Drop support for Python 3.6 (#1004)
* Drop support for Python 3.6 * Remove unused time parsing function * Use Python 3.7 datetime function for writing stats data conversion * Test against Python 3.10 on macOS and Windows
This commit is contained in:
committed by
GitHub
parent
045a595537
commit
011291f225
@@ -209,9 +209,9 @@ def main(sysArgs=None):
|
||||
# Check Packages and Versions
|
||||
errorData = []
|
||||
errorCode = 0
|
||||
if sys.hexversion < 0x030600f0:
|
||||
if sys.hexversion < 0x030700f0:
|
||||
errorData.append(
|
||||
"At least Python 3.6 is required, found %s" % CONFIG.verPyString
|
||||
"At least Python 3.7 is required, found %s" % CONFIG.verPyString
|
||||
)
|
||||
errorCode |= 0x04
|
||||
if CONFIG.verQtValue < 50300:
|
||||
|
||||
@@ -241,19 +241,6 @@ def formatTime(tS):
|
||||
return "ERROR"
|
||||
|
||||
|
||||
def parseTimeStamp(theStamp, default, allowNone=False):
|
||||
"""Parses a text representation of a timestamp and converts it into
|
||||
a float. Note that negative timestamps cause an OSError on Windows.
|
||||
See https://bugs.python.org/issue29097
|
||||
"""
|
||||
if str(theStamp).lower() == "none" and allowNone:
|
||||
return None
|
||||
try:
|
||||
return datetime.strptime(theStamp, nwConst.FMT_TSTAMP).timestamp()
|
||||
except Exception:
|
||||
return default
|
||||
|
||||
|
||||
# =============================================================================================== #
|
||||
# String Functions
|
||||
# =============================================================================================== #
|
||||
|
||||
@@ -330,7 +330,7 @@ class ToOdt(Tokenizer):
|
||||
|
||||
# Meta Data
|
||||
xMeta = etree.SubElement(self._xMeta, _mkTag("meta", "creation-date"))
|
||||
xMeta.text = datetime.now().strftime(r"%Y-%m-%dT%H:%M:%S")
|
||||
xMeta.text = datetime.now().isoformat(sep="T", timespec="seconds")
|
||||
|
||||
xMeta = etree.SubElement(self._xMeta, _mkTag("meta", "generator"))
|
||||
xMeta.text = f"novelWriter/{novelwriter.__version__}"
|
||||
|
||||
@@ -457,12 +457,8 @@ class GuiWritingStats(QDialog):
|
||||
if len(inData) < 6:
|
||||
continue
|
||||
|
||||
dStart = datetime.strptime(
|
||||
"%s %s" % (inData[0], inData[1]), nwConst.FMT_TSTAMP
|
||||
)
|
||||
dEnd = datetime.strptime(
|
||||
"%s %s" % (inData[2], inData[3]), nwConst.FMT_TSTAMP
|
||||
)
|
||||
dStart = datetime.fromisoformat(" ".join(inData[0:2]))
|
||||
dEnd = datetime.fromisoformat(" ".join(inData[2:4]))
|
||||
|
||||
sIdle = 0
|
||||
if len(inData) > 6:
|
||||
|
||||
Reference in New Issue
Block a user