diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2022-07-13 12:49:01 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2022-07-13 12:49:01 +0900 |
commit | 7e49c80df47208a56b72e98221d3b4cf868bc585 (patch) | |
tree | 753bcd68593783109c74b4d6884161b08ad7742b | |
parent | d600dc128c783ad542eb7ba4e61ac437079ce98e (diff) | |
download | python3-Cheetah-7e49c80df47208a56b72e98221d3b4cf868bc585.tar.gz python3-Cheetah-7e49c80df47208a56b72e98221d3b4cf868bc585.tar.bz2 python3-Cheetah-7e49c80df47208a56b72e98221d3b4cf868bc585.zip |
Imported Upstream version 3.2.7b1upstream/3.2.7b1
33 files changed, 371 insertions, 141 deletions
diff --git a/.travis.yml b/.travis.yml index 71dcc86..6b34bfc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,20 +18,57 @@ matrix: include: - python: "2.7" env: TOXENV=py27 - - python: "3.4" - env: TOXENV=py34 + - python: "2.7" + arch: arm64-graviton2 + group: edge + virt: lxd + env: TOXENV=py27 + - python: "3.5" + env: TOXENV=py34 TOXPYTHON=/home/travis/virtualenv/python3.4.8/bin/python3.4 + - python: "3.5" + arch: arm64-graviton2 + group: edge + virt: lxd + env: TOXENV=py34 TOXPYTHON=/home/travis/virtualenv/python3.4.10/bin/python3.4 - python: "3.5" env: TOXENV=py35 + - python: "3.5" + arch: arm64-graviton2 + group: edge + virt: lxd + env: TOXENV=py35 + - python: "3.6" + env: TOXENV=py36 - python: "3.6" + arch: arm64-graviton2 + group: edge + virt: lxd env: TOXENV=py36 - python: "3.7" env: TOXENV=py37 + - python: "3.7" + arch: arm64-graviton2 + group: edge + virt: lxd + env: TOXENV=py37 + - python: "3.8" + env: TOXENV=py38 - python: "3.8" + arch: arm64-graviton2 + group: edge + virt: lxd env: TOXENV=py38 + - python: "3.9" + env: TOXENV=py39 + - python: "3.9" + arch: arm64-graviton2 + group: edge + virt: lxd + env: TOXENV=py39 - python: "2.7" env: TOXENV=py27-flake8 - - python: "3.8" - env: TOXENV=py38-flake8 + - python: "3.9" + env: TOXENV=py39-flake8 - os: osx # No version of Python is available via virtualenv on OS X workers, see https://github.com/travis-ci/travis-ci/issues/2312 language: generic @@ -48,6 +85,9 @@ matrix: - os: osx language: generic env: TOXENV=py38 + - os: osx + language: generic + env: TOXENV=py39 - python: "pypy2.7-6.0" env: TOXENV=pypy @@ -55,16 +95,27 @@ matrix: before_install: - | - if [ "$TRAVIS_OS_NAME" == 'osx' -a "$TOXENV" != "py27" ]; then + if [ "$TRAVIS_OS_NAME" = 'osx' -a "$TOXENV" != "py27" ]; then curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh bash Miniconda3-latest-MacOSX-x86_64.sh -b -p "$HOME/miniconda3" REQUIRED_PYTHON_VERSION=$(python -c "import os; toxenv = os.environ['TOXENV']; print('.'.join(list(toxenv[2:])))") ~/miniconda3/bin/conda create -y -n "$TOXENV" python="$REQUIRED_PYTHON_VERSION" . ~/miniconda3/bin/activate "$TOXENV" fi + - | + if [ "$TRAVIS_OS_NAME" = 'linux' -a "$TOXENV" = "py34" ]; then + # Manually install Python 3.4 to run tox under Python 3.5 and tests with Python 3.4 + if [ "$TRAVIS_CPU_ARCH" = 'arm64' ]; then + _UBUNTU_PYTHON_ARCH=aarch64 + else + _UBUNTU_PYTHON_ARCH=x86_64 + fi + curl -sSf --retry 5 -o python-3.4.tar.bz2 https://storage.googleapis.com/travis-ci-language-archives/python/binaries/ubuntu/16.04/$_UBUNTU_PYTHON_ARCH/python-3.4.tar.bz2 + sudo tar xjf python-3.4.tar.bz2 --directory / + fi install: - - travis_retry pip install --upgrade "pip<19.2" "setuptools<44" tox ppu + - travis_retry pip install --upgrade "pip<19.2" "setuptools<44" "tox>=3.15" ppu script: - tox diff --git a/ANNOUNCE.rst b/ANNOUNCE.rst index 3803111..409ecee 100644 --- a/ANNOUNCE.rst +++ b/ANNOUNCE.rst @@ -1,18 +1,31 @@ Hello! -I'm pleased to announce version 3.2.6, a bugfix release -of branch 3.2 of CheetahTemplate3. +I'm pleased to announce version 3.2.7b1, the 1st beta +for minor feature release 3.2.7 of branch 3.2 of CheetahTemplate3. What's new in CheetahTemplate3 ============================== -The contributors for this release are Jonathan Ross Rogers (reported) -and Dale Sedivec (provided a pull request). +The contributors for this release are: +N Protokowicz, Enzo Conty, Andrea Mennucci, Saiprasad Kale, odidev. +Many thanks! + +Minor features: + + - Load from JSON file to searchlist (similar to loading from pickle). Bug fixes: - - Fixed use of uninitialized variable in _namemapper. + - Fix ``filetype`` for Python 2 in ``Template``. + +Build, CI: + + - Build wheels for ``aarch64`` at Travis; publish them at PyPI. + +Tests: + + - ``tox.ini``: Limit ``VIRTUALENV_PIP`` version for Python 3.4. What is CheetahTemplate3 @@ -34,7 +47,7 @@ Development: https://github.com/CheetahTemplate3 Download: -https://pypi.org/project/Cheetah3/3.2.6 +https://pypi.org/project/Cheetah3/3.2.7b1 News and changes: https://cheetahtemplate.org/news.html diff --git a/Cheetah/CheetahWrapper.py b/Cheetah/CheetahWrapper.py index 4a95bb2..a466477 100755 --- a/Cheetah/CheetahWrapper.py +++ b/Cheetah/CheetahWrapper.py @@ -7,6 +7,7 @@ import pprint import re import shutil import sys +import json try: import cPickle as pickle except ImportError: # PY3 @@ -177,6 +178,8 @@ class CheetahWrapper(object): help='Pass the environment into the search list') pao("--pickle", action="store", dest="pickle", default="", help='Unpickle FILE and pass it through in the search list') + pao("--json", action="store", dest="json", default="", + help='Read from JSON FILE and pass it through in the search list') pao("--flat", action="store_true", dest="flat", default=False, help='Do not build destination subdirectories') pao("--nobackup", action="store_true", dest="nobackup", default=False, @@ -250,6 +253,11 @@ Files are %s""", args, pprint.pformat(vars(opts)), files) unpickled = pickle.load(f) f.close() self.searchList.insert(0, unpickled) + if opts.json: + f = open(opts.json, 'r') + unjsoned = json.load(f) + f.close() + self.searchList.insert(0, unjsoned) ################################################## # COMMAND METHODS diff --git a/Cheetah/Template.py b/Cheetah/Template.py index a9bb08f..3ff156e 100644 --- a/Cheetah/Template.py +++ b/Cheetah/Template.py @@ -54,7 +54,7 @@ except ImportError: pass if PY2: - filetype = io.IOBase + filetype = file # noqa: F821 undefined name def createMethod(func, cls): return types.MethodType(func, None, cls) diff --git a/Cheetah/TemplateCmdLineIface.py b/Cheetah/TemplateCmdLineIface.py index 0fd4a41..e14559a 100644 --- a/Cheetah/TemplateCmdLineIface.py +++ b/Cheetah/TemplateCmdLineIface.py @@ -7,6 +7,7 @@ try: from cPickle import load except ImportError: from pickle import load +from json import load as jsonload from Cheetah.Version import Version @@ -35,7 +36,7 @@ class CmdLineIface: def _processCmdLineArgs(self): try: self._opts, self._args = getopt.getopt( - self._cmdLineArgs, 'h', ['help', 'env', 'pickle='] + self._cmdLineArgs, 'h', ['help', 'env', 'pickle=', 'json='] ) except getopt.GetoptError as v: @@ -63,6 +64,19 @@ class CmdLineIface: unpickled = load(f) f.close() self._template.searchList().insert(0, unpickled) + if o == '--json': + if a == '-': + if hasattr(sys.stdin, 'buffer'): + stdin = sys.stdin.buffer # Read binary data from stdin + else: + stdin = sys.stdin + unjsoned = jsonload(stdin) + self._template.searchList().insert(0, unjsoned) + else: + f = open(a, 'r') + unjsoned = jsonload(f) + f.close() + self._template.searchList().insert(0, unjsoned) def usage(self): return """Cheetah %(Version)s template module command-line interface diff --git a/Cheetah/Tests/CheetahWrapper.py b/Cheetah/Tests/CheetahWrapper.py index c3f75f3..a98eb14 100755 --- a/Cheetah/Tests/CheetahWrapper.py +++ b/Cheetah/Tests/CheetahWrapper.py @@ -19,6 +19,9 @@ import shutil import sys import tempfile import unittest +import pickle +import json + from optparse import OptionParser from Cheetah.CheetahWrapper import CheetahWrapper # Used by NoBackup. @@ -95,7 +98,8 @@ class CFBase(unittest.TestCase): if DELETE: shutil.rmtree(self.scratchDir, True) # Ignore errors. if os.path.exists(self.scratchDir): - warn("Warning: unable to delete scratch directory %s") + warn("Warning: unable to delete scratch directory %s" + % self.scratchDir) else: warn("Warning: not deleting scratch directory %s" % self.scratchDir) @@ -549,6 +553,92 @@ class NoBackup(CFBase): self.checkNoBackup("a.txt" + BACKUP_SUFFIX) +class FileDataFill(CFBase): + """Populate searchlist variables from pickled or JSON data""" + srcFiles = ('pickle.tmpl', 'json.tmpl') + + def setUp(self): + """Create the top-level directories and .tmpl + files. + """ + self.cmd = self.locate_cheetah('cheetah') + cwd = os.getcwd() + if not os.environ.get('PYTHONPATH'): + os.environ['PYTHONPATH'] = cwd + else: + pythonPath = os.environ['PYTHONPATH'] + if (pythonPath != cwd) and \ + not pythonPath.endswith(':%s' % cwd): + os.environ['PYTHONPATH'] = '%s:%s' % (pythonPath, cwd) + # Step 1: Create the scratch directory and chdir into it. + self.scratchDir = scratchDir = tempfile.mkdtemp() + self.origCwd = os.getcwd() + os.chdir(scratchDir) + if self.srcDir: + os.mkdir(self.srcDir) + # Step 2: Create the .tmpl files, each in its proper directory. + for fil in self.srcFiles: + with open(fil, 'w') as f: + f.write("foo $bar\n") + # Step 3: Export a variable to a pickle and json file + self.pickle_file = tempfile.NamedTemporaryFile(mode='wb', delete=False) + pickle.dump({'bar': 'baz'}, self.pickle_file) + self.pickle_file.close() + self.json_file = tempfile.NamedTemporaryFile(mode='w', delete=False) + json.dump({'bar': 'baz'}, self.json_file) + self.json_file.close() + + def tearDown(self): + os.chdir(self.origCwd) + if DELETE: + shutil.rmtree(self.scratchDir, True) # Ignore errors. + if os.path.exists(self.scratchDir): + warn("Warning: unable to delete scratch directory %s" + % self.scratchDir) + else: + warn("Warning: not deleting scratch directory %s" + % self.scratchDir) + + def checkCompile(self, path): + # Raw string to prevent "\n" from being converted to a newline. + # expected = R"write('Hello, world!\n')" + expected = "foo" # might output a u'' string + errmsg = """\ +destination file %(path)s doesn't contain expected substring: +%(expected)r""" + self._checkDestFileHelper(path, expected, True, errmsg) + + def checkFill(self, path): + expected = "foo baz\n" + errmsg = """\ +destination file %(path)s contains wrong result. +Expected %(expected)r +Found %(result)r""" + self._checkDestFileHelper(path, expected, False, errmsg) + + def testCompile(self): + self.go('cheetah compile json.tmpl') + self.go('cheetah compile pickle.tmpl') + self.checkCompile('json.py') + self.checkCompile('pickle.py') + + def testFill(self): + self.go('cheetah fill --json {jsonfile} json.tmpl' + .format(jsonfile=self.json_file.name)) + self.go('cheetah fill --pickle {picklefile} pickle.tmpl' + .format(picklefile=self.pickle_file.name)) + self.checkFill('json.html') + self.checkFill('pickle.html') + + def testText(self): + self.go('cheetah fill --json {jsonfile} --oext txt json.tmpl' + .format(jsonfile=self.json_file.name)) + self.go('cheetah fill --pickle {picklefile} --oext txt pickle.tmpl' + .format(picklefile=self.pickle_file.name)) + self.checkFill('json.txt') + self.checkFill('pickle.txt') + + def listTests(cheetahWrapperFile): """cheetahWrapperFile, string, path of this script. diff --git a/Cheetah/Tests/ImportHooks.py b/Cheetah/Tests/ImportHooks.py index d7b5f5d..bc0239c 100644 --- a/Cheetah/Tests/ImportHooks.py +++ b/Cheetah/Tests/ImportHooks.py @@ -87,7 +87,9 @@ class ImportHooksTest(unittest.TestCase): return raise self.fail("All builtin modules are imported") - if not PY2: + # _bootlocale was removed in Python 3.10: + # https://bugs.python.org/issue42208 + if not PY2 and sys.version_info < (3, 10): def test_import_bootlocale(self): if '_bootlocale' in sys.modules: del sys.modules['_bootlocale'] diff --git a/Cheetah/Tests/Template.py b/Cheetah/Tests/Template.py index f53e81f..575f223 100644 --- a/Cheetah/Tests/Template.py +++ b/Cheetah/Tests/Template.py @@ -160,6 +160,24 @@ class ClassMethods_compile(TemplateTest): assert klass._CHEETAH_isInCompilationCache +class OpenFileTest(TemplateTest): + def setUp(self): + self.template_file = \ + tempfile.NamedTemporaryFile(mode='w', delete=False) + self.template_file.write("<h1>Test open file</h1>") + self.template_file.close() + + def tearDown(self): + os.remove(self.template_file.name) + + def test_compileFile(self): + tmpl_file = open(self.template_file.name) + try: + Template.compile(file=tmpl_file) + finally: + tmpl_file.close() + + class ClassMethods_subclass(TemplateTest): def test_basicUsage(self): diff --git a/Cheetah/Tests/TemplateCmdLineIface.py b/Cheetah/Tests/TemplateCmdLineIface.py index d07367f..b941ffe 100644 --- a/Cheetah/Tests/TemplateCmdLineIface.py +++ b/Cheetah/Tests/TemplateCmdLineIface.py @@ -1,5 +1,5 @@ try: - from io import BytesIO, TextIOWrapper + from io import BytesIO, TextIOWrapper, StringIO except ImportError: try: from cStringIO import StringIO as BytesIO @@ -10,6 +10,7 @@ from tempfile import NamedTemporaryFile import os import pickle +import json import sys import unittest @@ -49,6 +50,7 @@ class TestEnv(unittest.TestCase): class TestPickleStdin(unittest.TestCase): + def setUp(self): pickle_bytes = pickle.dumps({'foo': 'test foo'}) if hasattr(sys.stdin, 'buffer'): @@ -69,6 +71,7 @@ class TestPickleStdin(unittest.TestCase): class TestPickleFile(unittest.TestCase): + def setUp(self): self.pickle_file = pickle_file = \ NamedTemporaryFile(mode='wb', delete=False) @@ -85,3 +88,43 @@ class TestPickleFile(unittest.TestCase): cmdLineArgs=['--pickle', self.pickle_file.name]) cmdline._processCmdLineArgs() assert str(t) == 'test foo' + + +class TestJsonStdin(unittest.TestCase): + + def setUp(self): + json_string = json.dumps({'foo': 'test foo'}) + if hasattr(sys.stdin, 'buffer'): + sys.stdin = TextIOWrapper(StringIO(json_string)) + else: + sys.stdin = BytesIO(json_string.encode('utf-8')) + + def tearDown(self): + sys.stdin = sys.__stdin__ + + def test_json_stdin(self): + klass = Template.compile(source='$foo') + t = klass() + cmdline = CmdLineIface(t, scriptName='test', + cmdLineArgs=['--json=-']) + cmdline._processCmdLineArgs() + assert (True) + + +class TestJsonFile(unittest.TestCase): + + def setUp(self): + self.json_file = NamedTemporaryFile(mode='w', delete=False) + json.dump({'foo': 'test foo'}, self.json_file) + self.json_file.close() + + def tearDown(self): + os.remove(self.json_file.name) + + def test_json_file(self): + klass = Template.compile(source='$foo') + t = klass() + cmdline = CmdLineIface(t, scriptName='test', + cmdLineArgs=['--json', self.json_file.name]) + cmdline._processCmdLineArgs() + assert str(t) == 'test foo' diff --git a/Cheetah/Version.py b/Cheetah/Version.py index b1d433f..6802c06 100755 --- a/Cheetah/Version.py +++ b/Cheetah/Version.py @@ -1,7 +1,7 @@ #!/usr/bin/env python -Version = '3.2.6' -VersionTuple = (3, 2, 6, 'final', 0) +Version = '3.2.7b1' +VersionTuple = (3, 2, 7, 'beta', 1) MinCompatibleVersion = '3.0.0a1' MinCompatibleVersionTuple = (3, 0, 0, 'alpha', 1) @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2017-2019, Oleg Broytman and contributors. +Copyright (c) 2017-2021, Oleg Broytman and contributors. Copyright (c) 2009-2012, R. Tyler Croy and contributors. Copyright (c) 2001-2008, The Cheetah Development Team: Tavis Rudd, Mike Orr, Chuck Esterbrook, Ian Bicking. @@ -1,5 +1,5 @@ -Cheetah Template 3.2.6 -====================== +Cheetah Template 3.2.7b1 +======================== Cheetah3 is a free and open source template engine and code generation tool. diff --git a/SetupConfig.py b/SetupConfig.py index 11e68a9..d3a75d1 100644 --- a/SetupConfig.py +++ b/SetupConfig.py @@ -56,6 +56,7 @@ classifiers = [line.strip() for line in '''\ Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 Topic :: Internet :: WWW/HTTP Topic :: Internet :: WWW/HTTP :: Dynamic Content Topic :: Internet :: WWW/HTTP :: Site Management diff --git a/appveyor.yml b/appveyor.yml index cf50838..5da5e53 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,14 +25,16 @@ environment: PYTHON_VERSION: "2.7" PYTHON_ARCH: "64" PYTHON_HOME: "C:\\Python27-x64" - - TOXENV: "py34-w32" - PYTHON_VERSION: "3.4" + - TOXENV: "py34" + PYTHON_VERSION: "3.5" PYTHON_ARCH: "32" - PYTHON_HOME: "C:\\Python34" - - TOXENV: "py34-w32" - PYTHON_VERSION: "3.4" + PYTHON_HOME: "C:\\Python35" + PYTHON34_HOME: "C:\\Python34" + - TOXENV: "py34" + PYTHON_VERSION: "3.5" PYTHON_ARCH: "64" - PYTHON_HOME: "C:\\Python34-x64" + PYTHON_HOME: "C:\\Python35-x64" + PYTHON34_HOME: "C:\\Python34-x64" - TOXENV: "py35" PYTHON_VERSION: "3.5" PYTHON_ARCH: "32" @@ -65,43 +67,56 @@ environment: PYTHON_VERSION: "3.8" PYTHON_ARCH: "64" PYTHON_HOME: "C:\\Python38-x64" + - TOXENV: "py39" + PYTHON_VERSION: "3.9" + PYTHON_ARCH: "32" + PYTHON_HOME: "C:\\Python39" + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + - TOXENV: "py39" + PYTHON_VERSION: "3.9" + PYTHON_ARCH: "64" + PYTHON_HOME: "C:\\Python39-x64" + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - TOXENV: "pypy" PYTHON_VERSION: "2.7" PYTHON_ARCH: "32" - PYTHON_HOME: "C:\\tools\\pypy\\pypy" + PYTHON_HOME: "C:\\ProgramData\\chocolatey\\lib\\python.pypy\\tools\\pypy2.7-v7.3.1-win32" install: # Ensure we use the right python version - "SET PATH=%PYTHON_HOME%;%PYTHON_HOME%\\Scripts;%PATH%" - - "SET TOXPYTHON=%PYTHON_HOME%\\python.exe" - - if "%TOXENV%" == "pypy" devscripts\\CI\\appveyor_install_pypy.cmd - - "python --version" - - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" - - if "%TOXENV%" == "pypy" SET TOXPYTHON=pypy.exe - - if "%TOXENV%" == "pypy" pypy --version - - "python -m pip install --upgrade \"pip<19.2\" \"setuptools<44\"" - - "pip install --upgrade \"tox<3.1\" ppu" - - "pip --version" + - "SET PYTHON=%PYTHON_HOME%\\python.exe" + - "SET TOXPYTHON=%PYTHON%" + - if "%TOXENV%" == "py34" SET TOXPYTHON=%PYTHON34_HOME%\python.exe + - if "%TOXENV%" == "pypy" devscripts\CI\appveyor_install_pypy.cmd + - if "%TOXENV%" == "pypy" SET PYTHON=%PYTHON_HOME%\pypy.exe + - if "%TOXENV%" == "pypy" SET TOXPYTHON=%PYTHON% + - "%PYTHON% --version" + - "%PYTHON% -c \"import struct; print(struct.calcsize('P') * 8)\"" + - "%PYTHON% -m ensurepip" + - "%PYTHON% -m pip install --upgrade \"pip<19.2\" \"setuptools<44\"" + - "%PYTHON% -m pip install --upgrade \"tox>=3.15\" ppu" + - "%PYTHON% -m pip --version" # No build step - _namemapper extension will be built under tox build: false test_script: - - "%CMD_IN_ENV% tox" + - "%CMD_IN_ENV% %PYTHON% -m tox" after_test: - - remove-old-files.py -o 180 %LOCALAPPDATA%\\pip\\Cache + - remove-old-files.py -o 180 %LOCALAPPDATA%\pip\Cache deploy_script: # If tests are successful and we've tested a tag, deploy binary wheel # TWINE_USERNAME / TWINE_PASSWORD / TWINE_REPOSITORY_URL # must be set in AppVeyor settings. - if "%APPVEYOR_REPO_TAG%" == "true" ( - if "%PYTHON_VERSION%" == "3.4" ( - pip install --upgrade "readme-renderer<25.0" "twine<2.0" "wheel==0.31.1" + if "%TOXENV%" == "py34" ( + %TOXPYTHON% -m pip install --upgrade "readme-renderer<25.0" "twine<2.0" "wheel==0.31.1" ) else ( - pip install --upgrade twine "wheel==0.34.1" + %TOXPYTHON% -m pip install --upgrade twine "wheel==0.34.1" ) && - %CMD_IN_ENV% python setup.py bdist_wheel && - twine upload --skip-existing dist\\*.whl + %CMD_IN_ENV% %TOXPYTHON% setup.py bdist_wheel && + twine upload --skip-existing dist\*.whl ) diff --git a/devscripts/CI/pip-19.1.1.tar.gz b/devscripts/CI/pip-19.1.1.tar.gz Binary files differdeleted file mode 100644 index 1348ea5..0000000 --- a/devscripts/CI/pip-19.1.1.tar.gz +++ /dev/null diff --git a/devscripts/CI/pip-install.py b/devscripts/CI/pip-install.py new file mode 100755 index 0000000..1b0bd30 --- /dev/null +++ b/devscripts/CI/pip-install.py @@ -0,0 +1,7 @@ +#! /usr/bin/env python + +import subprocess +import sys + +subprocess.check_call([sys.executable, '-m', 'ensurepip']) +subprocess.check_call([sys.executable, '-m', 'pip', 'install'] + sys.argv[1:]) diff --git a/devscripts/CI/setuptools-43.0.0.zip b/devscripts/CI/setuptools-43.0.0.zip Binary files differdeleted file mode 100644 index 15d756d..0000000 --- a/devscripts/CI/setuptools-43.0.0.zip +++ /dev/null diff --git a/devscripts/CI/tox-install.cmd b/devscripts/CI/tox-install.cmd deleted file mode 100644 index e5aeb33..0000000 --- a/devscripts/CI/tox-install.cmd +++ /dev/null @@ -1,26 +0,0 @@ -REM Downgrade pip/pkg_resources/setuptools to work around a bug in tox
-REM that upgrades packages too eagerly and installs incompatible versions.
-
-REM Cleanup
-del /q /s .tox\py34-w32\lib\site-packages\pip
-del /q /s .tox\py34-w32\lib\site-packages\pkg_resources
-del /q /s .tox\py34-w32\lib\site-packages\setuptools
-
-REM Install pkg_resources/setuptools
-python -m zipfile -e devscripts\CI\setuptools-43.0.0.zip .
-cd setuptools-43.0.0
-python bootstrap.py
-python setup.py install
-cd ..
-python -c "import setuptools; print(setuptools.__version__)"
-
-REM Install pip
-python -m tarfile -e devscripts\CI\pip-19.1.1.tar.gz
-cd pip-19.1.1.
-python bootstrap.py
-python setup.py install
-cd ..
-pip --version
-
-REM Use fixed pip to install dependencies
-pip install %*
diff --git a/devscripts/CI/travisci-release b/devscripts/CI/travisci-release index ce1ad8e..cef5f4d 100755 --- a/devscripts/CI/travisci-release +++ b/devscripts/CI/travisci-release @@ -34,7 +34,7 @@ if [ "$TRAVIS_OS_NAME" == 'linux' ]; then pip install -U "auditwheel==3.1.0" fi && - for f in dist/Cheetah3-*-cp$v-*-linux_x86_64.whl; do + for f in dist/Cheetah3-*-cp$v-*-linux*.whl; do if [ "$py" == 2.7 ]; then python3.6 -m auditwheel repair -w dist/ "$f" else diff --git a/devscripts/RELEASE-CHECKLIST b/devscripts/RELEASE-CHECKLIST index a3fa7fd..7b4cc87 100644 --- a/devscripts/RELEASE-CHECKLIST +++ b/devscripts/RELEASE-CHECKLIST @@ -17,12 +17,15 @@ branch and creates the new tag at the head of the release branch. Push the branch and the tag to start test/build. -3. Run devscripts/release. This generates and uploads new archives to PyPI. +3. Run devscripts/push-all in the development repository to push all + branches and tags to the public repositories. + +4. Run devscripts/release. This generates and uploads new archives to PyPI. -4. Generate new docs using devscripts/build-all-docs. Upload docs using +5. Generate new docs using devscripts/build-all-docs. Upload docs using devscripts/publish-docs. -5. Run devscripts/postrelease. The script checks out master and null-merge +6. Run devscripts/postrelease. The script checks out master and null-merge maint. The script restores ANNOUNCE.rst from the previous commit (HEAD~). It calls editor; update next version, remove the list of contributors and the list of changes, edit download URL in ANNOUNCE.rst. @@ -31,9 +34,6 @@ edit "Development Status" in trove classifiers; edit dev_tag or download URL. Commit. Verify. Fast-forward next to master. -6. Run devscripts/push-all in the development repository to push all - branches and tags to the public repositories. - 7. Send announcement to the Cheetah mailing list. For a stable release send announcements to python and python-announce mailing lists. diff --git a/devscripts/postrelease b/devscripts/postrelease index cf1cfcb..c60c856 100755 --- a/devscripts/postrelease +++ b/devscripts/postrelease @@ -2,7 +2,7 @@ tag="`python setup.py --version`" && -. `dirname $0`/split.sh && +. `dirname $0`/split_tag.sh && split_tag $tag if [ $micro -eq 0 -a $state = final ] && @@ -19,4 +19,4 @@ fi && git checkout $tag~ ANNOUNCE.rst && `git var GIT_EDITOR` ANNOUNCE.rst docs/news.rst Cheetah/Version.py README.rst setup.cfg SetupConfig.py && -exec git commit --message="Prepare for the next release" ANNOUNCE.rst docs/news.rst Cheetah/Version.py README.rst setup.cfg SetupConfig.py +exec git commit --message="Build: Prepare for the next release" --message="[skip ci]" ANNOUNCE.rst docs/news.rst Cheetah/Version.py README.rst setup.cfg SetupConfig.py diff --git a/devscripts/prerelease b/devscripts/prerelease index 981e6aa..92c116e 100755 --- a/devscripts/prerelease +++ b/devscripts/prerelease @@ -7,7 +7,7 @@ else tag="$1" fi -. `dirname $0`/split.sh && +. `dirname $0`/split_tag.sh && split_tag $tag if [ $micro -eq 0 -o $state != final ]; then diff --git a/devscripts/prerelease-tag b/devscripts/prerelease-tag index 0c59a42..99513b1 100755 --- a/devscripts/prerelease-tag +++ b/devscripts/prerelease-tag @@ -7,7 +7,7 @@ else tag="$1" fi -. `dirname $0`/split.sh && +. `dirname $0`/split_tag.sh && split_tag $tag if [ $micro -eq 0 -o $state != final ]; then diff --git a/devscripts/release b/devscripts/release index e771d13..561d37f 100755 --- a/devscripts/release +++ b/devscripts/release @@ -10,7 +10,7 @@ devscripts/build-docs && if [ ! -d build ]; then mkdir build; fi && python setup.py sdist && -for py in 2.7 3.4 3.5 3.6 3.7 3.8; do +for py in 2.7 3.4 3.5 3.6 3.7 3.8 3.9; do find build -name '*.py[co]' -delete && python$py setup.py build_ext && python$py setup.py build --executable '/usr/bin/env python' && diff --git a/devscripts/requirements/requirements_tox.txt b/devscripts/requirements/requirements_tox.txt index 8c9b6ed..8b5960b 100644 --- a/devscripts/requirements/requirements_tox.txt +++ b/devscripts/requirements/requirements_tox.txt @@ -1 +1 @@ -tox >= 2.0, < 3.1 +tox >= 3.15 diff --git a/devscripts/setup b/devscripts/setup index d40081c..271f497 100755 --- a/devscripts/setup +++ b/devscripts/setup @@ -3,7 +3,7 @@ umask 022 # -rwxr-xr-x cd "`dirname \"$0\"`"/.. && -for py_ver in 2.7 3.4 3.5 3.6 3.7 3.8; do +for py_ver in 2.7 3.4 3.5 3.6 3.7 3.8 3.9; do python$py_ver -m pip install --install-option=-O2 --upgrade . done && diff --git a/devscripts/split.sh b/devscripts/split_tag.sh index ce5c3c5..d0024f0 100644 --- a/devscripts/split.sh +++ b/devscripts/split_tag.sh @@ -1,6 +1,6 @@ split_tag() { branch=$2 - set -- `echo $1 | sed -e 's/\./ /g' -e 's/a/ alpha /' -e 's/b/ beta /' -e 's/rc/ rc /' -e 's/\([0-9]\)c/\1 rc /'` + set -- `echo $1 | sed -e 's/\./ /g' -e 's/a/ alpha /' -e 's/b/ beta /' -e 's/rc/ rc /' -e 's/\([0-9]\)c/\1 rc /' -e 's/post\([0-9]\+\)/ post \1/'` major=$1 minor=$2 micro=$3 diff --git a/devscripts/test-cheetah.cmd b/devscripts/test-cheetah.cmd index 7473fc1..900bdb8 100644 --- a/devscripts/test-cheetah.cmd +++ b/devscripts/test-cheetah.cmd @@ -3,7 +3,7 @@ SetLocal EnableDelayedExpansion
set SavePATH=%PATH%
-for %%V in (27 34 35 36 37 38) do (
+for %%V in (27 34 35 36 37 38 39) do (
for %%s in (32 64) do (
set PATH=C:\Python%%V-%%s;C:\Python%%V-%%s\Scripts;!SavePATH!
set TOXPYTHON=C:\Python%%V-%%s\python.exe
diff --git a/docs/authors.rst b/docs/authors.rst index 8c8021f..944cedc 100644 --- a/docs/authors.rst +++ b/docs/authors.rst @@ -33,4 +33,10 @@ Contributions have been made by: * Pierre-Yves <pyu at riseup.net> * Dan Vinakovsky <dvinak at gmail.com> * Yegor Yefremov <yegorslists at googlemail.com> +* Andrew J. Hesford <ajh at sideband.org> +* Victor Stinner <vstinner at python.org> +* N Protokowicz <nicklivewire at gmail.com> +* Enzo Conty <contact at enzoconty.dev> +* Andrea Mennucci <mennucc1@debian.org> +* odidev <odidev at puresoftware.com> * Oleg Broytman <phd@phdru.name> diff --git a/docs/developers.rst b/docs/developers.rst index 7cf96e8..7f7d328 100644 --- a/docs/developers.rst +++ b/docs/developers.rst @@ -29,7 +29,7 @@ and then they can be organized into particular releases as is necessary. In addition to the bug tracker, Cheetah uses Travis CI for automating builds and test runs (see: `Cheetah at Travis -<https://travis-ci.org/CheetahTemplate3/cheetah3>`_). +<https://travis-ci.com/github/CheetahTemplate3/cheetah3>`_). Prior to the tarballing of a release, **all** tests must be passing before the **next** branch is merged down to the Git **master** branch where the release diff --git a/docs/news.rst b/docs/news.rst index fa8e78b..0705216 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -1,9 +1,40 @@ News ==== -Development (master) +3.2.7b1 (2021-07-25) -------------------- +Minor features: + + - Load from JSON file to searchlist (similar to loading from pickle). + +Bug fixes: + + - Fix ``filetype`` for Python 2 in ``Template``. + +Build, CI: + + - Build wheels for ``aarch64`` at Travis; publish them at PyPI. + +Tests: + + - ``tox.ini``: Limit ``VIRTUALENV_PIP`` version for Python 3.4. + +3.2.6.post1 (2021-02-22) +------------------------ + +Tests: + + - Add Python 3.9 to ``tox.ini``. + + - Refactor ``tox.ini``. + +CI: + + - Run tests with Python 3.9 at Travis and AppVeyor. + + - Run tests for Python 3.4 with ``tox`` under Python 3.5. + 3.2.6 (2020-10-01) ------------------ diff --git a/docs/users_guide/errorHandling.rst b/docs/users_guide/errorHandling.rst index caf8d51..0d59b4e 100644 --- a/docs/users_guide/errorHandling.rst +++ b/docs/users_guide/errorHandling.rst @@ -130,7 +130,7 @@ should either be a string specifying which of the classes in can also be used to change the errorCatcher part way through a template. -{Cheetah.ErrorCatchers.ListErrors} will produce the same ouput as +{Cheetah.ErrorCatchers.ListErrors} will produce the same output as {Echo} while maintaining a list of the errors that can be retrieved later. To retrieve the list, use the {Template} class' {'errorCatcher'} method to retrieve the errorCatcher and then call @@ -1,11 +1,6 @@ -# Tox (http://tox.testrun.org/) is a tool for running tests -# in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. - [tox] -minversion = 2.0 -envlist = py27,py3{4,5,6,7,8},py{27,38}-flake8,pypy +minversion = 3.15 +envlist = py27,py3{4,5,6,7,8,9},pypy,py{27,38,39}-flake8 [testenv] basepython = @@ -15,68 +10,30 @@ basepython = py36: {env:TOXPYTHON:python3.6} py37: {env:TOXPYTHON:python3.7} py38: {env:TOXPYTHON:python3.8} + py39: {env:TOXPYTHON:python3.9} pypy: {env:TOXPYTHON:pypy} commands = {envpython} --version {envpython} -c "import struct; print(struct.calcsize('P') * 8)" deps = + pip < 19.2 setuptools < 44 Markdown >= 2.0.1, < 3.2 pygments +install_command = {envpython} {toxinidir}{/}devscripts{/}CI{/}pip-install.py {opts} {packages} passenv = CI TRAVIS TRAVIS_* APPVEYOR DISTUTILS_USE_SDK MSSdk INCLUDE LIB WINDIR setenv = LC_CTYPE = en_US.UTF-8 + VIRTUALENV_PIP = 19.1.1 -[tests] +[testenv:{py27,py34,py35,py36,py37,py38,py39,pypy}] commands = {[testenv]commands} {envpython} {envsitepackagesdir}/Cheetah/Tests/Test.py -[testenv:py27] -commands = - {[tests]commands} - -[testenv:py34] -commands = - {[tests]commands} - -[testenv:py34-w32] -platform=win32 -whitelist_externals=tox-install.cmd -install_command=devscripts\\CI\\tox-install.cmd {opts} {packages} -commands = - {[tests]commands} - -[testenv:py35] -commands = - {[tests]commands} - -[testenv:py36] -commands = - {[tests]commands} - -[testenv:py37] -commands = - {[tests]commands} - -[testenv:py38] -commands = - {[tests]commands} - -[testenv:py27-flake8] +[testenv:{py27,py34,py35,py36,py37,py38,py39}-flake8] deps = flake8 commands = {[testenv]commands} flake8 . - -[testenv:py38-flake8] -deps = - flake8 -commands = - {[testenv]commands} - flake8 . - -[testenv:pypy] -commands = - {[tests]commands} |