From 2df6b3604259e3a8a26a8f20c0d91a920f0f52c1 Mon Sep 17 00:00:00 2001 From: chfw Date: Sat, 4 May 2019 20:44:16 +0100 Subject: [PATCH 01/22] :sparkles: enable push for next 0.0.6 release. #84 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a737ed5..5912b00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,7 @@ stages: install: pip install moban>=0.0.4 script: - make + - make push jobs: include: From 78dc74af663f321191ff97f3056266811036fca2 Mon Sep 17 00:00:00 2001 From: chfw Date: Sat, 4 May 2019 20:55:58 +0100 Subject: [PATCH 02/22] :bug: fix master doc index. fix #77 --- templates/conf.py.jj2 | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/conf.py.jj2 b/templates/conf.py.jj2 index e2c8652..2d14ff9 100644 --- a/templates/conf.py.jj2 +++ b/templates/conf.py.jj2 @@ -8,6 +8,7 @@ DESCRIPTION = ( '' ) {% set project = name %} +{% set master = 'index' %} {% set copyright = '{0} {1}'.format(copyright_year, company) %} {% if sphinx_extensions %} {% set extensions = sphinx_extensions %} From 5a63de095fa659d5a4b4c423e1d3d1916c60f524 Mon Sep 17 00:00:00 2001 From: chfw Date: Sun, 5 May 2019 17:31:42 +0100 Subject: [PATCH 03/22] :sparkles: optimize the git commit --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7dd6f25..75876e9 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,5 @@ lint: flake8 . --exclude=.moban.d,docs --builtins=unicode,xrange,long push: git config user.email "travis@travis-ci.org" git config user.name "traviscibot" - git add . - git commit -m "Sync templates [skip ci]" + git commit -am "Sync templates [skip ci]" git push https://moremoban:${GITHUB_TOKEN}@github.com/moremoban/pypi-mobans HEAD:moban -f From 5219c14255c3c4350408ffea64af1ae6849f3e82 Mon Sep 17 00:00:00 2001 From: chfw Date: Sun, 5 May 2019 17:39:38 +0100 Subject: [PATCH 04/22] :sparkles: no change, no commit --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 75876e9..7e959f3 100644 --- a/Makefile +++ b/Makefile @@ -9,4 +9,7 @@ push: git config user.email "travis@travis-ci.org" git config user.name "traviscibot" git commit -am "Sync templates [skip ci]" - git push https://moremoban:${GITHUB_TOKEN}@github.com/moremoban/pypi-mobans HEAD:moban -f + if [ $? -eq 0 ] + then + git push https://moremoban:${GITHUB_TOKEN}@github.com/moremoban/pypi-mobans HEAD:moban -f + fi From c1e4c54ac6530bc23f7bb74e8f5a8866e8b8ea64 Mon Sep 17 00:00:00 2001 From: chfw Date: Tue, 21 May 2019 18:08:49 +0100 Subject: [PATCH 05/22] :green_heart: disable make push --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5912b00..a737ed5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,6 @@ stages: install: pip install moban>=0.0.4 script: - make - - make push jobs: include: From 8a2c04acae1a5fcbea6ef5179fbd45cc0e7512fa Mon Sep 17 00:00:00 2001 From: siddhpant <25429745+siddhpant@users.noreply.github.com> Date: Fri, 24 May 2019 22:12:13 +0530 Subject: [PATCH 06/22] :hammer: #86 syntax fix --- templates/Pipfile.jj2 | 44 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/templates/Pipfile.jj2 b/templates/Pipfile.jj2 index 04df116..e72a845 100644 --- a/templates/Pipfile.jj2 +++ b/templates/Pipfile.jj2 @@ -8,9 +8,23 @@ python_version= '3.6' [packages] {% for dependency in dependencies: %} - {% if ('=' in dependency) or ('>' in dependency) or ('<' in dependency) %} - {{dependency}} - {% else %} + {% if ('>' in dependency) %} + {%- with dep, ver = dependency.split('>') -%} + {{dep}} = '>{{ver}}' + {% endwith %} + {% elif ('<' in dependency) %} + {%- with dep, ver = dependency.split('<') -%} + {{dep}} = '<{{ver}}' + {% endwith %} + {% elif ('~' in dependency) %} + {%- with dep, ver = dependency.split('~') -%} + {{dep}} = '~{{ver}}' + {% endwith %} + {% elif ('=' in dependency) %} + {%- with dep, ver = dependency.split('=', 1) -%} + {{dep}} = '={{ver}}' + {% endwith %} + {%- else -%} {{dependency}} = "*" {% endif %} {% endfor %} @@ -23,10 +37,24 @@ coverage = "*" flake8 = "*" {% if dev_dependencies is defined %} {% for dependency in dev_dependencies: %} - {% if ('=' in dependency) or ('>' in dependency) or ('<' in dependency) %} - {{dependency}} - {% else %} + {% if ('>' in dependency) %} + {%- with dep, ver = dependency.split('>') -%} + {{dep}} = '>{{ver}}' + {% endwith %} + {% elif ('<' in dependency) %} + {%- with dep, ver = dependency.split('<') -%} + {{dep}} = '<{{ver}}' + {% endwith %} + {% elif ('~' in dependency) %} + {%- with dep, ver = dependency.split('~') -%} + {{dep}} = '~{{ver}}' + {% endwith %} + {% elif ('=' in dependency) %} + {%- with dep, ver = dependency.split('=', 1) -%} + {{dep}} = '={{ver}}' + {% endwith %} + {%- else -%} {{dependency}} = "*" - {% endif %} - {% endfor %} + {% endif %} + {%- endfor %} {% endif %} From 1cfc1d12155b7e412db51ba7db8db6833dfa9070 Mon Sep 17 00:00:00 2001 From: siddhpant <25429745+siddhpant@users.noreply.github.com> Date: Fri, 24 May 2019 22:13:21 +0530 Subject: [PATCH 07/22] :sparkles: Test for Pipfile --- tests/test_pipfile.py | 69 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tests/test_pipfile.py diff --git a/tests/test_pipfile.py b/tests/test_pipfile.py new file mode 100644 index 0000000..5cd70c9 --- /dev/null +++ b/tests/test_pipfile.py @@ -0,0 +1,69 @@ +import textwrap + +from test_utils import get_rendered_file + + +def test_pipfile(): + context = { + 'dependencies': [ + 'dependency', + 'dependency=1.0', + 'dependency==1.0', + 'dependency>1.0', + 'dependency>=1.0', + 'dependency<1.0', + 'dependency<=1.0', + 'dependency~1.0', + 'dependency~=1.0' + ], + 'dev_dependencies': [ + 'dev_dependency', + 'dev_dependency=1.0', + 'dev_dependency==1.0', + 'dev_dependency>1.0', + 'dev_dependency>=1.0', + 'dev_dependency<1.0', + 'dev_dependency<=1.0', + 'dev_dependency~1.0', + 'dev_dependency~=1.0' + ] + } + filename = 'Pipfile.jj2' + rendered = get_rendered_file(filename, context) + expected_pipfile = textwrap.dedent("""\ + [[source]] + url = 'https://pypi.python.org/simple' + verify_ssl = true + name = 'pypi' + + [requires] + python_version= '3.6' + + [packages] + dependency = "*" + dependency = '=1.0' + dependency = '==1.0' + dependency = '>1.0' + dependency = '>=1.0' + dependency = '<1.0' + dependency = '<=1.0' + dependency = '~1.0' + dependency = '~=1.0' + + [dev-packages] + nose = "*" + mock = "*" + codecov = "*" + coverage = "*" + flake8 = "*" + dev_dependency = "*" + dev_dependency = '=1.0' + dev_dependency = '==1.0' + dev_dependency = '>1.0' + dev_dependency = '>=1.0' + dev_dependency = '<1.0' + dev_dependency = '<=1.0' + dev_dependency = '~1.0' + dev_dependency = '~=1.0' + """) + assert expected_pipfile == rendered From 5d4dd0c782619fbd16862800799b734f092a1378 Mon Sep 17 00:00:00 2001 From: siddhpant <25429745+siddhpant@users.noreply.github.com> Date: Sat, 25 May 2019 09:41:32 +0530 Subject: [PATCH 08/22] :books: Update changelog to 0.0.6 --- CHANGELOG.rst | 13 +++++++++++++ changelog.yml | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a11fe54..2cf6ec4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,19 @@ Change log ================================================================================ +0.0.6 - 25-05-2019 +-------------------------------------------------------------------------------- + +Updated +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +#. #87: updated the pipfile syntax + +Added +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +#. #87: Added tests for pipfile generation + 0.0.5 - 04-05-2019 -------------------------------------------------------------------------------- diff --git a/changelog.yml b/changelog.yml index 8dcaa20..e6cf0d4 100644 --- a/changelog.yml +++ b/changelog.yml @@ -1,6 +1,15 @@ name: "pypi-mobans" organisation: moremoban releases: +- changes: + - action: Updated + details: + - "#87: updated the pipfile syntax" + - action: Added + details: + - "#87: Added tests for pipfile generation" + date: 25-05-2019 + version: 0.0.6 - changes: - action: Updated details: From ce13c052f29d0d9da829a881dbf2bfed022df506 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Tue, 9 Jul 2019 06:44:53 +0700 Subject: [PATCH 09/22] :ambulance: use Python 3.6 for moban job Avoids https://github.com/moremoban/moban/issues/283 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a737ed5..5e8ddaf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ stages: .moban: &moban <<: *disable_global - python: 2.7 + python: 3.6 stage: moban install: pip install moban>=0.0.4 script: From bc6adab50cee179384f19e4ae9c50d152d34c1c0 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Tue, 9 Jul 2019 08:05:31 +0700 Subject: [PATCH 10/22] :ambulance: fix allowing test jobs to fail Avoids https://github.com/moremoban/moban/issues/283 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5e8ddaf..4a8a46f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,7 @@ jobs: - *moban - *lint allow_failures: - - test + - stage: test stage: test From 78b672f8ccd2e52d7789be8c83e0d64797098e32 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Tue, 9 Jul 2019 07:02:23 +0700 Subject: [PATCH 11/22] :arrow_up: sync make.bat.jj2 Incorporates https://github.com/sphinx-doc/sphinx/commit/0dbdae31 --- templates/docs/make.bat.jj2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/docs/make.bat.jj2 b/templates/docs/make.bat.jj2 index 2dc5004..c244e1e 100644 --- a/templates/docs/make.bat.jj2 +++ b/templates/docs/make.bat.jj2 @@ -25,11 +25,11 @@ if errorlevel 9009 ( exit /b 1 ) -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% goto end :help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% :end popd From e157e88c507377554f9aca1619c6cd124563bb18 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Tue, 9 Jul 2019 06:56:59 +0700 Subject: [PATCH 12/22] :green_heart: check for changes found by moban Re-instates check dropped in b8b61f8c6. Use --ignore-blank-lines because sphinx templates have trailing lines that are not wanted here, and 92b799ae7 and others removed the custom handling of these, and moban doesnt yet have post-processors to handle this. git diff --ignore-blank-lines --exit-code still emits an exit code even if there was no applicable changes, even with git v2.22.0 on Travis' bionic image. Workaround with a shell loop. --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 7e959f3..c19c6eb 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ all: upstreaming upstreaming: moban -m mobanfile + git diff + git diff --ignore-blank-lines | while read line; do if [ "$line" ]; then exit 1; fi; done lint: flake8 . --exclude=.moban.d,docs --builtins=unicode,xrange,long From 9df26827578d25131a2c08e1876437b3f5de1a2c Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Mon, 8 Jul 2019 16:40:29 +0700 Subject: [PATCH 13/22] :sparkles: dependency environment markers This is a setuptools hack to support environment markers with almost any setuptools version. Context and history at https://github.com/pypa/packaging/issues/72 Previous editions authored by myself. https://github.com/html5lib/html5lib-python/commit/43aeaefe https://github.com/tox-dev/tox-travis/commit/44a35c02 Closes https://github.com/moremoban/pypi-mobans/issues/89 --- templates/setup.py.jj2 | 82 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 3 deletions(-) diff --git a/templates/setup.py.jj2 b/templates/setup.py.jj2 index f0df6ed..3bd6606 100644 --- a/templates/setup.py.jj2 +++ b/templates/setup.py.jj2 @@ -7,6 +7,22 @@ {% set min_python_version = min_python_version|default('2.6') %} {% set min_python_version = min_python_version.split('.', 2) %} +{# marker_dependencies is implemented as a defaultdict(list) + See https://gsnedders.github.io/python-marker-test/results.html + for acceptable markers ("without parser" columns) #} +{% set marker_dependencies = {} %} +{% for dependency in dependencies: %} + {% if ';' in dependency %} + {% set dependency, marker = dependency.split(';') %} + {% set dependency, marker = dependency.strip(), marker.strip() %} + {% set marker = marker.replace('"', "'") %} + {% if marker in marker_dependencies %} + {% set _ = marker_dependencies[marker].append(dependency) %} + {% else %} + {% set _ = marker_dependencies.__setitem__(marker, [dependency]) %} + {% endif %} + {% endif %} +{% endfor %} {% block header %} # Template by pypi-mobans {% endblock %} @@ -16,13 +32,24 @@ import os import platform import sys from shutil import rmtree + {% if external_module_library %} from distutils.core import setup, Extension {% else %} - from setuptools import Command, find_packages, setup - {%endif%} +{% if marker_dependencies and setup_use_markers and setup_use_markers_fix %} +from setuptools import __version__ as setuptools_version +from pkg_resources import parse_version + +import pkg_resources + +try: + import _markerlib.markers +except ImportError: + _markerlib = None +{% endif %} + {%block compat_block%} PY2 = sys.version_info[0] == 2 PY26 = PY2 and sys.version_info[1] < 7 @@ -188,7 +215,7 @@ SETUP_COMMANDS = {} {% endblock %} {% for dependency in dependencies: %} - {% if ';' in dependency: %} + {% if not setup_use_markers and ';' in dependency: %} {{handle_complex_dependency(dependency)}} {% endif %} {% endfor %} @@ -212,6 +239,11 @@ EXTRAS_REQUIRE = { "{{key}}": {{value}}, {% endfor %} {% endfor %} + {% if setup_use_markers %} + {% for marker, dependencies in marker_dependencies.items(): %} + ":{{marker}}": ["{{dependencies | list|join('", "')}}"], + {% endfor %} + {% endif %} } {% else: %} EXTRAS_REQUIRE = {} @@ -330,6 +362,50 @@ def filter_out_test_code(file_handle): else: yield line +{% if marker_dependencies and setup_use_markers and setup_use_markers_fix %} + +# _markerlib.default_environment() obtains its data from _VARS +# and wraps it in another dict, but _markerlib_evaluate writes +# to the dict while it is iterating the keys, causing an error +# on Python 3 only. +# Replace _markerlib.default_environment to return a custom dict +# that has all the necessary markers, and ignores any writes. + +class Python3MarkerDict(dict): + + def __setitem__(self, key, value): + pass + + def pop(self, i=-1): + return self[i] + + +if _markerlib and sys.version_info[0] == 3: + env = _markerlib.markers._VARS + for key in list(env.keys()): + new_key = key.replace(".", "_") + if new_key != key: + env[new_key] = env[key] + + _markerlib.markers._VARS = Python3MarkerDict(env) + + def default_environment(): + return _markerlib.markers._VARS + + _markerlib.default_environment = default_environment + +# Avoid the very buggy pkg_resources.parser, which does not consistently +# recognise the markers needed by this setup.py +# See https://github.com/pypa/packaging/issues/72 for details +# Change this to setuptools 20.10.0 to support all markers. +if pkg_resources: + if parse_version(setuptools_version) < parse_version("18.5"): + MarkerEvaluation = pkg_resources.MarkerEvaluation + + del pkg_resources.parser + pkg_resources.evaluate_marker = MarkerEvaluation._markerlib_evaluate + MarkerEvaluation.evaluate_marker = MarkerEvaluation._markerlib_evaluate +{% endif %} if __name__ == "__main__": setup( From 3652990beb7e50075fca78d9eb89317240a1bb17 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Fri, 12 Jul 2019 09:22:55 +0700 Subject: [PATCH 14/22] :construction: .gitattributes merge strategies Use union for changelog yaml, and use binary for generaged CHANGELOG.rst. --- .gitattributes | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d020d1f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# Include changes from both sides +changelog.yml merge=union +# Include regenerated files as-is using binary merge driver +CHANGELOG.rst merge=binary From 3bf25b226c3f5c154c3f211e813f3afe0cc262e9 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Fri, 12 Jul 2019 18:29:21 +0700 Subject: [PATCH 15/22] :art: reformat changelog.yml to pass yamllint --- changelog.yml | 106 +++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/changelog.yml b/changelog.yml index e6cf0d4..245fcc9 100644 --- a/changelog.yml +++ b/changelog.yml @@ -1,55 +1,55 @@ -name: "pypi-mobans" +name: pypi-mobans organisation: moremoban releases: -- changes: - - action: Updated - details: - - "#87: updated the pipfile syntax" - - action: Added - details: - - "#87: Added tests for pipfile generation" - date: 25-05-2019 - version: 0.0.6 -- changes: - - action: Updated - details: - - "#75: separate flake8 linting in separate travis job" - - "#72: project and copyright are no longer filled." - - "black style on setup.py, include python 3.7, 3.8 , update gitignore" - date: 04-05-2019 - version: 0.0.5 -- changes: - - action: Updated - details: - - "travis-ci: uses xenial dist. dropped python 3.4, 3.7-dev and added 3.7, pypy2 and pypy3" - - "added min_requirements.txt where minimum requirements are computed" - - "#71: include tests folder as test_suite if 'tests' folder exists" - - "#16: package data / MANIFEST.in.jj2 is not easy to customise" - - "#14: Mandatory CHANGELOG.rst become optional" - date: 18-02-2019 - version: 0.0.4 -- changes: - - action: First release - details: - - "bug fix on `PR#60`" - date: 18-01-2019 - version: 0.0.3 -- changes: - - action: Added - details: - - "`PR#60`: codec and locale hacks added" - - "`PR#61`: add python classifiers" - - action: Updated - details: - - "`PR#63`: updated Pipfile implementation" - - Synchronize with sphinx doc file at release date - date: 18-01-2019 - version: 0.0.2 -- changes: - - action: First release - details: - - versioning is applied - - Pipfile included - date: 05-11-2018 - version: 0.0.1 - + - changes: + - action: Updated + details: + - "#87: updated the pipfile syntax" + - action: Added + details: + - "#87: Added tests for pipfile generation" + date: 25-05-2019 + version: 0.0.6 + - changes: + - action: Updated + details: + - "#75: separate flake8 linting in separate travis job" + - "#72: project and copyright are no longer filled." + - black style on setup.py, include python 3.7, 3.8 , update gitignore + date: 04-05-2019 + version: 0.0.5 + - changes: + - action: Updated + details: + - "travis-ci: uses xenial dist. dropped python 3.4, 3.7-dev and added + 3.7, pypy2 and pypy3" + - added min_requirements.txt where minimum requirements are computed + - "#71: include tests folder as test_suite if 'tests' folder exists" + - "#16: package data / MANIFEST.in.jj2 is not easy to customise" + - "#14: Mandatory CHANGELOG.rst become optional" + date: 18-02-2019 + version: 0.0.4 + - changes: + - action: First release + details: + - "bug fix on `PR#60`" + date: 18-01-2019 + version: 0.0.3 + - changes: + - action: Added + details: + - "`PR#60`: codec and locale hacks added" + - "`PR#61`: add python classifiers" + - action: Updated + details: + - "`PR#63`: updated Pipfile implementation" + - Synchronize with sphinx doc file at release date + date: 18-01-2019 + version: 0.0.2 + - changes: + - action: First release + details: + - versioning is applied + - Pipfile included + date: 05-11-2018 + version: 0.0.1 From 63d3e889e5e7f2a77e909002cb10e9243a0e61f7 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Mon, 8 Jul 2019 16:34:15 +0700 Subject: [PATCH 16/22] :hammer: improve min_requirements template Discard extra requirements when a dependency contains multiple constraints with a comma. Refactor also to simplify and improve style. Closes https://github.com/moremoban/pypi-mobans/issues/88 --- templates/min_requirements.txt.jj2 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/templates/min_requirements.txt.jj2 b/templates/min_requirements.txt.jj2 index 773961b..35e112e 100644 --- a/templates/min_requirements.txt.jj2 +++ b/templates/min_requirements.txt.jj2 @@ -1,7 +1,14 @@ {% for dependency in dependencies: %} -{% if ';' in dependency: %} -{{dependency.split(';')[0].replace('>=', '==').replace('>', '==') + ';' + dependency.split(';')[1]}} -{% else: %} -{{dependency.replace('>=', '==').replace('>', '==')}} -{% endif %} +{% if ';' in dependency %} +{% set dependency, marker = dependency.split(';') %} +{% else %} +{% set marker = None %} +{% endif %} +{% set dependency = dependency.split(',')[0] %} +{% set dependency = dependency.replace('>=', '==').replace('>', '==') %} +{% if marker %} +{{dependency + ';' + marker }} +{% else: %} +{{dependency}} +{% endif %} {% endfor %} From 9a193dba6c1a37758deb793003c5dc4e6a78112e Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sun, 14 Jul 2019 11:07:05 +0700 Subject: [PATCH 17/22] :ambulance: fix travis global disable install Fixes https://github.com/moremoban/pypi-mobans/issues/101 --- templates/travis.yml.jj2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/travis.yml.jj2 b/templates/travis.yml.jj2 index 3344ccf..7a14e0c 100644 --- a/templates/travis.yml.jj2 +++ b/templates/travis.yml.jj2 @@ -32,7 +32,7 @@ stages: .disable_global: &disable_global before_install: false - install: true + install: false before_script: false after_success: false after_failure: false From 93bbbd5057ff5fde6772279802961a13cb235d0a Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sun, 14 Jul 2019 11:10:57 +0700 Subject: [PATCH 18/22] :art: allow overriding travis test command Closes https://github.com/moremoban/pypi-mobans/issues/31 --- templates/travis.yml.jj2 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/templates/travis.yml.jj2 b/templates/travis.yml.jj2 index 7a14e0c..e92c865 100644 --- a/templates/travis.yml.jj2 +++ b/templates/travis.yml.jj2 @@ -3,7 +3,6 @@ {% else %} {% set lint = 'flake8' %} {% endif %} - sudo: false dist: xenial language: python @@ -50,8 +49,6 @@ jobs: stage: test -script: make test - before_install: {% block custom_install %} {% endblock%} @@ -62,6 +59,6 @@ before_install: - test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt ; - pip install -r tests/requirements.txt script: - - make test + - {{ test_command | default('make test') }} after_success: codecov From 1a76e21c74f13b53528984144ef515e1194d8c91 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sat, 13 Jul 2019 20:52:11 +0700 Subject: [PATCH 19/22] :art: Use travis template Closes https://github.com/moremoban/pypi-mobans/issues/96 --- .moban.dt/local-travis.yml.jj2 | 24 +++++++++++ .travis.yml | 43 +++++++++++++------ Makefile | 11 +++-- config/data.yml | 3 ++ mobanfile | 1 + templates/travis.yml.jj2 | 76 ++++++++++++++++++++++++++++++---- test_requirements.txt | 1 - tests/requirements.txt | 3 ++ 8 files changed, 139 insertions(+), 23 deletions(-) create mode 100644 .moban.dt/local-travis.yml.jj2 delete mode 100644 test_requirements.txt diff --git a/.moban.dt/local-travis.yml.jj2 b/.moban.dt/local-travis.yml.jj2 new file mode 100644 index 0000000..17e2140 --- /dev/null +++ b/.moban.dt/local-travis.yml.jj2 @@ -0,0 +1,24 @@ +{% extends 'travis.yml.jj2' %} + +{% block custom_python_versions %} +python: + - 3.7 + - 2.7 +{% endblock %} + +{% block extra_jobs %} + allow_failures: + - stage: test +{% endblock %} + +{% block before_script %} +before_script: + - find templates/ -type f -name '*.jj2' -exec echo '{}' \; |{% raw %} + sed -e "s/templates\//{%include \"/" -e "s/$/\" %}/" > test.file +{% endraw %} +{% endblock %} + +{% block script %} + - moban -c config/data.yml -t test.file -td templates . + - {{ test_command }} +{% endblock %} diff --git a/.travis.yml b/.travis.yml index 4a8a46f..63568c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,38 +1,45 @@ sudo: false +dist: xenial language: python -python: - - 2.7 - - 3.6 notifications: email: false -install: - - pip install -r test_requirements.txt -r tests/requirements.txt +python: + - 3.7 + - 2.7 + stages: - test - - moban - lint + - moban .disable_global: &disable_global + addons: false + cache: false + env: {} + python: false before_install: false - install: true + install: false before_script: false + script: false after_success: false after_failure: false + before_deploy: false + deploy: false .lint: &lint <<: *disable_global + git: + submodules: false python: 3.6 stage: lint - install: pip install flake8 - script: flake8 + script: make install_test lint .moban: &moban <<: *disable_global python: 3.6 stage: moban install: pip install moban>=0.0.4 - script: - - make + script: make upstreaming git-diff-check jobs: include: @@ -43,7 +50,19 @@ jobs: stage: test +before_install: + - if [[ -f min_requirements.txt && "$MINREQ" -eq 1 ]]; then + mv min_requirements.txt requirements.txt ; + fi + - test ! -f rnd_requirements.txt || + pip install --no-deps -r rnd_requirements.txt + - test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt ; + - pip install -r tests/requirements.txt +before_script: + - find templates/ -type f -name '*.jj2' -exec echo '{}' \; | + sed -e "s/templates\//{%include \"/" -e "s/$/\" %}/" > test.file script: - - find templates/ -type f -name '*.jj2' -exec echo '{}' \;|sed -e "s/templates\//{%include \"/" -e "s/$/\" %}/" > test.file - moban -c config/data.yml -t test.file -td templates . - pytest +after_success: + codecov diff --git a/Makefile b/Makefile index c19c6eb..34e3234 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,16 @@ -all: upstreaming - upstreaming: moban -m mobanfile + +git-diff-check: git diff git diff --ignore-blank-lines | while read line; do if [ "$line" ]; then exit 1; fi; done -lint: flake8 . --exclude=.moban.d,docs --builtins=unicode,xrange,long +install_test: + pip install -r tests/requirements.txt + +lint: + flake8 . --exclude=.moban.d,docs --builtins=unicode,xrange,long + yamllint . push: git config user.email "travis@travis-ci.org" diff --git a/config/data.yml b/config/data.yml index 4f4b0a3..32248d7 100644 --- a/config/data.yml +++ b/config/data.yml @@ -16,3 +16,6 @@ rsrcdir: docs/source rbuilddir: docs/_build version: 0.1.1rc3 mastertocmaxdepth: 3 +lint_command: make install_test lint +moban_command: make upstreaming git-diff-check +test_command: pytest diff --git a/mobanfile b/mobanfile index decc755..feb9b47 100644 --- a/mobanfile +++ b/mobanfile @@ -8,6 +8,7 @@ configuration: - sphinx:sphinx/templates/quickstart targets: - .gitignore: gitignore.jj2 + - .travis.yml: local-travis.yml.jj2 - LICENSE: NEW_BSD_LICENSE.jj2 - README.rst: local-README.rst.jj2 - output: CHANGELOG.rst diff --git a/templates/travis.yml.jj2 b/templates/travis.yml.jj2 index e92c865..6d28505 100644 --- a/templates/travis.yml.jj2 +++ b/templates/travis.yml.jj2 @@ -1,10 +1,15 @@ -{% if lint_command %} -{% set lint = lint_command%} -{% else %} -{% set lint = 'flake8' %} +{% if not lint_command and lint_command != False %} +{% set lint_command = 'flake8' %} +{% endif %} +{% if not moban_command and moban_command != False %} +{% if mobanfile %} +{% set moban_command = 'moban -m ' + mobanfile %} +{% else %} +{% set moban_command = 'moban' %} +{% endif %} {% endif %} sudo: false -dist: xenial +dist: {{ travis_dist | default('xenial') }} language: python notifications: email: false @@ -25,40 +30,97 @@ python: {%block extra_matrix%} {%endblock%} +{% block stages %} stages: - test +{% if lint_command != False %} - lint +{% endif %} +{% if moban_command != False %} + - moban +{% endif %} +{% endblock %} .disable_global: &disable_global + addons: false + cache: false + env: {} + python: false before_install: false install: false before_script: false + script: false after_success: false after_failure: false + before_deploy: false + deploy: false +{% if lint_command != False %} .lint: &lint <<: *disable_global + git: + submodules: false python: 3.6 stage: lint +{% if lint_command == 'flake8' %} install: pip install flake8 - script: {{ lint }} +{% endif %} + script: {{ lint_command }} + +{% endif %} +{% if moban_command != False %} +.moban: &moban + <<: *disable_global + python: 3.6 + stage: moban + install: pip install moban>=0.0.4 +{% if moban_command.startswith('moban') and 'exit-code' not in moban_command %} + script: + - {{ moban_command }} +{% if moban_allow_trailing_whitespace %} + - git diff + - git diff --ignore-blank-lines | + while read line; do if [ "$line" ]; then exit 1; fi; done +{% else %} + - git diff --exit-code +{% endif %} +{% else %} + script: {{ moban_command }} +{% endif %} +{% endif %} +{% block extra_dot_blocks %} +{% endblock %} +{% block jobs %} jobs: include: + - *moban - *lint +{% block extra_jobs %} +{% endblock %} +{% endblock %} stage: test +{% block before_install %} before_install: {% block custom_install %} {% endblock%} - if [[ -f min_requirements.txt && "$MINREQ" -eq 1 ]]; then mv min_requirements.txt requirements.txt ; fi - - test ! -f rnd_requirements.txt || pip install --no-deps -r rnd_requirements.txt + - test ! -f rnd_requirements.txt || + pip install --no-deps -r rnd_requirements.txt - test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt ; - pip install -r tests/requirements.txt +{% endblock %} +{% block before_script %} +{% endblock %} script: +{% block script %} - {{ test_command | default('make test') }} +{% endblock %} +{% block end %} after_success: codecov +{% endblock %} diff --git a/test_requirements.txt b/test_requirements.txt deleted file mode 100644 index 9ddf86d..0000000 --- a/test_requirements.txt +++ /dev/null @@ -1 +0,0 @@ -moban>=0.0.4 diff --git a/tests/requirements.txt b/tests/requirements.txt index 67b7158..13d3714 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,2 +1,5 @@ +codecov +moban>=0.0.4 pytest~=3.6.1 flake8 +yamllint From d4c4c7c64c83935793252768f709eae6671ead27 Mon Sep 17 00:00:00 2001 From: chfw Date: Sun, 14 Jul 2019 08:48:18 +0100 Subject: [PATCH 20/22] :bug: temporary fix for #105 --- templates/lint.script.jj2 | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/lint.script.jj2 b/templates/lint.script.jj2 index 7197858..6a96fc2 100644 --- a/templates/lint.script.jj2 +++ b/templates/lint.script.jj2 @@ -1 +1,2 @@ +pip install flake8 flake8 . --exclude=.moban.d,docs {%block flake8_options%}--builtins=unicode,xrange,long{%endblock%} From fd2c0f12d0454f27770da71cd76e16ac88ac7e8b Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sun, 14 Jul 2019 12:18:57 +0700 Subject: [PATCH 21/22] :books: prepare changelog for 0.0.7 --- CHANGELOG.rst | 25 +++++++++++++++++++++++++ changelog.yml | 21 +++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2cf6ec4..157d9ec 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,31 @@ Change log ================================================================================ +0.0.7 - tba +-------------------------------------------------------------------------------- + +Updated +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +#. sync templates/docs/make.bat.jj2 to include changes from + https://github.com/sphinx-doc/sphinx/commit/0dbdae31 +#. #100: Fixed travis.yml.jj2 to not emit yamllint errors +#. #101: Fixed travis.yml.jj2 .disable_global to reset `install:` +#. #31: Added test_command to override travis.yml.jj2 use of Makefile +#. #96: Expanded travis.yml.jj2 and use in in the pypi-mobans repo +#. #88: Enhanced min_requirements.txt.jj2 support for dependencies with multiple + constraints such as `>1,<3` +#. #93: Added CI to ensure pypi-mobans is in sync with upstream +#. #99: Formated changelog.yml according to yamllint default rules + +Added +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +#. #89: setup.py.jj2 support for dependencies using all PEP 508 environment + markers; enable setup_use_markers to activate, and enable + setup_use_markers_fix to use with setuptools pre v22 +#. #98: Added .gitattributes to reduce conflicts on changelog.yml + 0.0.6 - 25-05-2019 -------------------------------------------------------------------------------- diff --git a/changelog.yml b/changelog.yml index 245fcc9..2535f19 100644 --- a/changelog.yml +++ b/changelog.yml @@ -1,6 +1,27 @@ name: pypi-mobans organisation: moremoban releases: + - changes: + - action: Updated + details: + - sync templates/docs/make.bat.jj2 to include changes from + https://github.com/sphinx-doc/sphinx/commit/0dbdae31 + - "#100: Fixed travis.yml.jj2 to not emit yamllint errors" + - "#101: Fixed travis.yml.jj2 .disable_global to reset `install:`" + - "#31: Added test_command to override travis.yml.jj2 use of Makefile" + - "#96: Expanded travis.yml.jj2 and use in in the pypi-mobans repo" + - "#88: Enhanced min_requirements.txt.jj2 support for dependencies + with multiple constraints such as `>1,<3`" + - "#93: Added CI to ensure pypi-mobans is in sync with upstream" + - "#99: Formated changelog.yml according to yamllint default rules" + - action: Added + details: + - "#89: setup.py.jj2 support for dependencies using all PEP 508 + environment markers; enable setup_use_markers to activate, and + enable setup_use_markers_fix to use with setuptools pre v22" + - "#98: Added .gitattributes to reduce conflicts on changelog.yml" + date: tba + version: 0.0.7 - changes: - action: Updated details: From 73baef98cbc2475bdbe020260d87016baadea8dd Mon Sep 17 00:00:00 2001 From: chfw Date: Sun, 14 Jul 2019 15:46:12 +0100 Subject: [PATCH 22/22] :books: update release date --- CHANGELOG.rst | 2 +- changelog.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 157d9ec..1d10d32 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ Change log ================================================================================ -0.0.7 - tba +0.0.7 - 14.07.2019 -------------------------------------------------------------------------------- Updated diff --git a/changelog.yml b/changelog.yml index 2535f19..67ddbfb 100644 --- a/changelog.yml +++ b/changelog.yml @@ -20,7 +20,7 @@ releases: environment markers; enable setup_use_markers to activate, and enable setup_use_markers_fix to use with setuptools pre v22" - "#98: Added .gitattributes to reduce conflicts on changelog.yml" - date: tba + date: 14.07.2019 version: 0.0.7 - changes: - action: Updated