diff options
author | Jason Madden <jamadden@gmail.com> | 2020-01-20 08:01:01 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-20 08:01:01 -0600 |
commit | 086085b3724e97c1c21fe67be9cdd6f31e179856 (patch) | |
tree | b9236bccafd6101452b65ad542303320bb716454 | |
parent | dc0de85e6c0b2dc8014839551397969faba9e261 (diff) | |
parent | 19f779725f062928c121e0383231a8a22d01a8c5 (diff) | |
download | zope-i18nmessageid-086085b3724e97c1c21fe67be9cdd6f31e179856.tar.gz |
Merge pull request #19 from zopefoundation/deprecated-setuptools-features
Drop the use of the deprecated setuptools Features
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | appveyor.yml | 4 | ||||
-rw-r--r-- | setup.py | 63 | ||||
-rw-r--r-- | tox.ini | 11 |
4 files changed, 37 insertions, 43 deletions
diff --git a/.travis.yml b/.travis.yml index 08ccae0..c8eb5b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,7 +65,7 @@ before_install: install: - pip install -U pip setuptools - - pip install -U coveralls coverage zope.testrunner + - pip install -U coveralls - pip install -U -e ".[test]" script: diff --git a/appveyor.yml b/appveyor.yml index d643125..fd5033a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -26,14 +26,14 @@ install: } - ps: if (-not (Test-Path $env:PYTHON)) { throw "No $env:PYTHON" } - echo "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 > "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat" - - pip install -e . + - pip install -e .[test] build_script: - pip install wheel - python -W ignore setup.py -q bdist_wheel test_script: - - python setup.py test -q + - zope-testrunner --test-path=src artifacts: - path: 'dist\*.whl' @@ -18,44 +18,44 @@ ############################################################################## """Setup for zope.i18nmessageid package """ +from __future__ import print_function import os import sys -from setuptools import setup, find_packages, Extension, Feature from distutils.command.build_ext import build_ext from distutils.errors import CCompilerError from distutils.errors import DistutilsExecError from distutils.errors import DistutilsPlatformError import platform +from setuptools import setup, find_packages, Extension + py_impl = getattr(platform, 'python_implementation', lambda: None) is_pypy = py_impl() == 'PyPy' is_jython = 'java' in sys.platform codeoptimization_c = os.path.join('src', 'zope', 'i18nmessageid', "_zope_i18nmessageid_message.c") -codeoptimization = Feature( - "Optional code optimizations", - standard=True, - ext_modules=[Extension( +codeoptimization = [ + Extension( "zope.i18nmessageid._zope_i18nmessageid_message", [os.path.normcase(codeoptimization_c)] - )]) - -extra = { - 'extras_require': { - 'testing': ['nose', 'coverage'], - 'docs': ['Sphinx'], - }, -} + ), +] +ext_modules = [] if not is_pypy and not is_jython: # Jython cannot build the C optimizations, while on PyPy they are # anti-optimizations (the C extension compatibility layer is known-slow, # and defeats JIT opportunities). - extra['features'] = {'codeoptimization': codeoptimization} + ext_modules = codeoptimization + +tests_require = [ + 'zope.testrunner', + 'coverage', +] def read(*rnames): with open(os.path.join(os.path.dirname(__file__), *rnames)) as stream: @@ -69,34 +69,27 @@ class optional_build_ext(build_ext): def run(self): try: build_ext.run(self) - - except DistutilsPlatformError: - # The sys.exc_info()[1] is to preserve compatibility with both - # Python 2.5 and 3.x, which is needed in setup.py. - self._unavailable(sys.exc_info()[1]) + except DistutilsPlatformError as e: + self._unavailable(e) def build_extension(self, ext): try: build_ext.build_extension(self, ext) - - except (CCompilerError, DistutilsExecError): - # The sys.exc_info()[1] is to preserve compatibility with both - # Python 2.5 and 3.x, which is needed in setup.py. - self._unavailable(sys.exc_info()[1]) + except (CCompilerError, DistutilsExecError) as e: + self._unavailable(e) def _unavailable(self, e): - # Write directly to stderr to preserve compatibility with both - # Python 2.5 and 3.x, which is needed in setup.py. - sys.stderr.write('*' * 80 + '\n') - sys.stderr.write("""WARNING: + print('*' * 80, file=sys.stderr) + print("""WARNING: An optional code optimization (C extension) could not be compiled. Optimizations for this package will not be available! - """) - sys.stderr.write(str(e) + '\n') - sys.stderr.write('*' * 80 + '\n') + """, file=sys.stderr) + print(str(e), file=sys.stderr) + print('*' * 80, file=sys.stderr) + setup( @@ -141,5 +134,11 @@ setup( test_suite='zope.i18nmessageid.tests.test_suite', zip_safe=False, cmdclass={'build_ext': optional_build_ext}, - **extra + ext_modules=ext_modules, + tests_require=tests_require, + extras_require={ + 'testing': tests_require, + 'test': tests_require, + 'docs': ['Sphinx'], + }, ) @@ -3,9 +3,7 @@ envlist = py27,py35,py36,py37,py38,pypy,pypy3,coverage,docs [testenv] -deps = - .[test] - zope.testrunner +extras = test commands = zope-testrunner --test-path=src [] @@ -15,11 +13,8 @@ usedevelop = true basepython = python2.7 commands = - nosetests --with-xunit --with-xcoverage -deps = - nose - coverage - nosexcover + coverage run -m zope.testrunner --test-path=src [] + coverage report --fail-under=100 [testenv:docs] basepython = |