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
@@ -12,7 +12,7 @@ jobs:
|
|||||||
testLinux:
|
testLinux:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
|
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Python Setup
|
- name: Python Setup
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ jobs:
|
|||||||
- name: Python Setup
|
- name: Python Setup
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: 3.9
|
python-version: "3.10"
|
||||||
architecture: x64
|
architecture: x64
|
||||||
- name: Install Packages
|
- name: Install Packages
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ jobs:
|
|||||||
- name: Python Setup
|
- name: Python Setup
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: 3.9
|
python-version: "3.10"
|
||||||
architecture: x64
|
architecture: x64
|
||||||
- name: Checkout Source
|
- name: Checkout Source
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ The full credits are listed in
|
|||||||
|
|
||||||
## Implementation
|
## Implementation
|
||||||
|
|
||||||
The application is written in Python 3 (3.6+) using Qt5 and PyQt5 (5.3+). It is developed on Linux,
|
The application is written with Python 3 (3.7+) using Qt5 and PyQt5 (5.3+). It is developed on
|
||||||
but should in principle work fine on other operating systems as well as long as dependencies are
|
Linux, but should in principle work fine on other operating systems as well as long as dependencies
|
||||||
met. It is regularly tested on Debian and Ubuntu Linux, Windows, and macOS.
|
are met. It is regularly tested on Debian and Ubuntu Linux, Windows, and macOS.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ Windows
|
|||||||
-------
|
-------
|
||||||
|
|
||||||
First, make sure you have Python installed on your system. If you don't, you can download it from
|
First, make sure you have Python installed on your system. If you don't, you can download it from
|
||||||
`python.org`_. Python 3.6 or higher is required, but it is recommended that you install the latest
|
`python.org`_. Python 3.7 or higher is required, but it is recommended that you install the latest
|
||||||
version.
|
version.
|
||||||
|
|
||||||
Make sure you select the "Add Python to PATH" option during installation, otherwise the ``python``
|
Make sure you select the "Add Python to PATH" option during installation, otherwise the ``python``
|
||||||
|
|||||||
@@ -209,9 +209,9 @@ def main(sysArgs=None):
|
|||||||
# Check Packages and Versions
|
# Check Packages and Versions
|
||||||
errorData = []
|
errorData = []
|
||||||
errorCode = 0
|
errorCode = 0
|
||||||
if sys.hexversion < 0x030600f0:
|
if sys.hexversion < 0x030700f0:
|
||||||
errorData.append(
|
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
|
errorCode |= 0x04
|
||||||
if CONFIG.verQtValue < 50300:
|
if CONFIG.verQtValue < 50300:
|
||||||
|
|||||||
@@ -241,19 +241,6 @@ def formatTime(tS):
|
|||||||
return "ERROR"
|
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
|
# String Functions
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ class ToOdt(Tokenizer):
|
|||||||
|
|
||||||
# Meta Data
|
# Meta Data
|
||||||
xMeta = etree.SubElement(self._xMeta, _mkTag("meta", "creation-date"))
|
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 = etree.SubElement(self._xMeta, _mkTag("meta", "generator"))
|
||||||
xMeta.text = f"novelWriter/{novelwriter.__version__}"
|
xMeta.text = f"novelWriter/{novelwriter.__version__}"
|
||||||
|
|||||||
@@ -457,12 +457,8 @@ class GuiWritingStats(QDialog):
|
|||||||
if len(inData) < 6:
|
if len(inData) < 6:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
dStart = datetime.strptime(
|
dStart = datetime.fromisoformat(" ".join(inData[0:2]))
|
||||||
"%s %s" % (inData[0], inData[1]), nwConst.FMT_TSTAMP
|
dEnd = datetime.fromisoformat(" ".join(inData[2:4]))
|
||||||
)
|
|
||||||
dEnd = datetime.strptime(
|
|
||||||
"%s %s" % (inData[2], inData[3]), nwConst.FMT_TSTAMP
|
|
||||||
)
|
|
||||||
|
|
||||||
sIdle = 0
|
sIdle = 0
|
||||||
if len(inData) > 6:
|
if len(inData) > 6:
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ license_file = LICENSE.md
|
|||||||
license = GNU General Public License v3
|
license = GNU General Public License v3
|
||||||
classifiers =
|
classifiers =
|
||||||
Programming Language :: Python :: 3 :: Only
|
Programming Language :: Python :: 3 :: Only
|
||||||
Programming Language :: Python :: 3.6
|
|
||||||
Programming Language :: Python :: 3.7
|
Programming Language :: Python :: 3.7
|
||||||
Programming Language :: Python :: 3.8
|
Programming Language :: Python :: 3.8
|
||||||
Programming Language :: Python :: 3.9
|
Programming Language :: Python :: 3.9
|
||||||
@@ -29,7 +28,7 @@ project_urls =
|
|||||||
Source Code = https://github.com/vkbo/novelWriter
|
Source Code = https://github.com/vkbo/novelWriter
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
python_requires = >=3.6
|
python_requires = >=3.7
|
||||||
include_package_data = True
|
include_package_data = True
|
||||||
packages = find:
|
packages = find:
|
||||||
install_requires =
|
install_requires =
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ Source: novelwriter
|
|||||||
Maintainer: Veronica Berglyd Olsen <code@vkbo.net>
|
Maintainer: Veronica Berglyd Olsen <code@vkbo.net>
|
||||||
Section: text
|
Section: text
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Build-Depends: dh-python, python3-setuptools, python3-all, debhelper (>= 9), python3 (>=3.6), python3-pyqt5 (>= 5.3), python3-lxml (>= 4.0), python3-enchant (>= 2.0)
|
Build-Depends: dh-python, python3-setuptools, python3-all, debhelper (>= 9), python3 (>=3.7), python3-pyqt5 (>= 5.3), python3-lxml (>= 4.0), python3-enchant (>= 2.0)
|
||||||
Standards-Version: 4.5.1
|
Standards-Version: 4.5.1
|
||||||
Homepage: https://novelwriter.io
|
Homepage: https://novelwriter.io
|
||||||
X-Python3-Version: >= 3.6
|
X-Python3-Version: >= 3.7
|
||||||
|
|
||||||
Package: novelwriter
|
Package: novelwriter
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Depends: ${misc:Depends}, ${python3:Depends}, python3 (>=3.6), python3-pyqt5 (>= 5.3), python3-lxml (>= 4.0), python3-enchant (>= 2.0)
|
Depends: ${misc:Depends}, ${python3:Depends}, python3 (>=3.7), python3-pyqt5 (>= 5.3), python3-lxml (>= 4.0), python3-enchant (>= 2.0)
|
||||||
Description: A markdown-like text editor for planning and writing novels
|
Description: A markdown-like text editor for planning and writing novels
|
||||||
novelWriter is a plain text editor designed for writing novels assembled from
|
novelWriter is a plain text editor designed for writing novels assembled from
|
||||||
many smaller text documents. It uses a minimal formatting syntax inspired by
|
many smaller text documents. It uses a minimal formatting syntax inspired by
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ synchronisation tools. All text is saved as plain text files with a meta data he
|
|||||||
project structure is stored in a single project XML file, and other meta data is primarily saved as
|
project structure is stored in a single project XML file, and other meta data is primarily saved as
|
||||||
JSON files.
|
JSON files.
|
||||||
|
|
||||||
The application is written in Python 3 (3.6+) using Qt5 and PyQt5 (5.3+). It is developed on Linux,
|
The application is written with Python 3 (3.7+) using Qt5 and PyQt5 (5.3+). It is developed on
|
||||||
but should in principle work fine on other operating systems as well as long as dependencies are
|
Linux, but should in principle work fine on other operating systems as well as long as dependencies
|
||||||
met. It is regularly tested on Debian and Ubuntu Linux, Windows, and macOS.
|
are met. It is regularly tested on Debian and Ubuntu Linux, Windows, and macOS.
|
||||||
|
|
||||||
novelWriter is developed and maintained by [Veronica Berglyd Olsen](https://github.com/vkbo).
|
novelWriter is developed and maintained by [Veronica Berglyd Olsen](https://github.com/vkbo).
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ import os
|
|||||||
import time
|
import time
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from mock import causeOSError
|
from mock import causeOSError
|
||||||
from tools import writeFile
|
from tools import writeFile
|
||||||
|
|
||||||
@@ -33,9 +31,9 @@ from novelwriter.guimain import GuiMain
|
|||||||
from novelwriter.common import (
|
from novelwriter.common import (
|
||||||
checkString, checkInt, checkFloat, checkBool, checkHandle, isHandle,
|
checkString, checkInt, checkFloat, checkBool, checkHandle, isHandle,
|
||||||
isTitleTag, isItemClass, isItemType, isItemLayout, hexToInt, checkIntRange,
|
isTitleTag, isItemClass, isItemType, isItemLayout, hexToInt, checkIntRange,
|
||||||
checkIntTuple, formatInt, formatTimeStamp, formatTime, parseTimeStamp,
|
checkIntTuple, formatInt, formatTimeStamp, formatTime, splitVersionNumber,
|
||||||
splitVersionNumber, transferCase, fuzzyTime, numberToRoman, jsonEncode,
|
transferCase, fuzzyTime, numberToRoman, jsonEncode, readTextFile,
|
||||||
readTextFile, makeFileNameSafe, sha256sum, getGuiItem, NWConfigParser
|
makeFileNameSafe, sha256sum, getGuiItem, NWConfigParser
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -272,21 +270,6 @@ def testBaseCommon_FormatTime():
|
|||||||
# END Test testBaseCommon_FormatTime
|
# END Test testBaseCommon_FormatTime
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.base
|
|
||||||
def testBaseCommon_ParseTimeStamp():
|
|
||||||
"""Test the parseTimeStamp function.
|
|
||||||
"""
|
|
||||||
localEpoch = datetime(2000, 1, 1).timestamp()
|
|
||||||
assert parseTimeStamp(None, 0.0, allowNone=True) is None
|
|
||||||
assert parseTimeStamp("None", 0.0, allowNone=True) is None
|
|
||||||
assert parseTimeStamp("None", 0.0) == 0.0
|
|
||||||
assert parseTimeStamp("2000-01-01 00:00:00", 123.0) == localEpoch
|
|
||||||
assert parseTimeStamp("2000-13-01 00:00:00", 123.0) == 123.0
|
|
||||||
assert parseTimeStamp("2000-01-32 00:00:00", 123.0) == 123.0
|
|
||||||
|
|
||||||
# END Test testBaseCommon_ParseTimeStamp
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.base
|
@pytest.mark.base
|
||||||
def testBaseCommon_SplitVersionNumber():
|
def testBaseCommon_SplitVersionNumber():
|
||||||
"""Test the splitVersionNumber function.
|
"""Test the splitVersionNumber function.
|
||||||
|
|||||||
Reference in New Issue
Block a user