From 679764d42fc111313d518f99136755064e7585e6 Mon Sep 17 00:00:00 2001 From: Dmytro Litvinov Date: Fri, 14 Feb 2020 08:53:20 +0200 Subject: [PATCH 1/2] Fix pinning version of Django for library --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 5037f1d..fdf0cc3 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ version = __import__('moderation').__version__ tests_require = [ - 'django>=1.11,<=2.2.9', + 'django>=1.11,<2.3', 'django-webtest', 'webtest', 'mock', @@ -55,7 +55,7 @@ tests_require=tests_require, test_suite='runtests.runtests', install_requires=[ - 'django>=1.11,<=2.2.9', + 'django>=1.11,<2.3', 'django-model-utils', ], zip_safe=False, From 8b7843f853453783e959554d3c962f97ba4607df Mon Sep 17 00:00:00 2001 From: Dmytro Litvinov Date: Fri, 14 Feb 2020 22:00:56 +0200 Subject: [PATCH 2/2] Fix django-model-utils version for running tests in Travis CI; refactor setup.py --- setup.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index fdf0cc3..ab68895 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,7 @@ version = __import__('moderation').__version__ tests_require = [ + 'unittest2py3k', 'django>=1.11,<2.3', 'django-webtest', 'webtest', @@ -13,14 +14,17 @@ 'pillow', ] -# ipython>2 is only supported on Python 2.7+ -if sys.hexversion < 0x02070000: - tests_require = ['ipython>=0.10,<2'] + tests_require +install_requires = [ + 'django>=1.11,<2.3', + 'django-model-utils' +] -if sys.hexversion >= 0x03000000: - tests_require = ['unittest2py3k'] + tests_require -else: - tests_require = ['unittest2'] + tests_require +# override django-model-utils version in requirements file if DJANGO env is set +DJANGO_ENV = os.environ.get("DJANGO") +if DJANGO_ENV == 'Django>=1.11,<2.0': + install_requires = [ + "django-model-utils<4" if r == "django-model-utils" else r for r in install_requires + ] setup( name='django-moderation', @@ -54,9 +58,6 @@ include_package_data=True, tests_require=tests_require, test_suite='runtests.runtests', - install_requires=[ - 'django>=1.11,<2.3', - 'django-model-utils', - ], + install_requires=install_requires, zip_safe=False, )