diff options
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 76 |
1 files changed, 45 insertions, 31 deletions
@@ -1,4 +1,7 @@ -# setup.py for coverage.py +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +# Distutils setup for coverage.py """Code coverage measurement for Python @@ -8,7 +11,7 @@ library to determine which lines are executable, and which have been executed. Coverage.py runs on CPython 2.6, 2.7, 3.3, 3.4 or 3.5, PyPy 2.4, and PyPy3 2.4. -Documentation is at `nedbatchelder.com <%s>`_. Code repository and issue +Documentation is on `Read the Docs <{docurl}>`_. Code repository and issue tracker are on `Bitbucket <http://bitbucket.org/ned/coveragepy>`_, with a mirrored repo on `GitHub <https://github.com/nedbat/coveragepy>`_. @@ -32,28 +35,28 @@ New in 3.2: Branch coverage! # This file is used unchanged under all versions of Python, 2.x and 3.x. -classifiers = """\ -Environment :: Console -Intended Audience :: Developers -License :: OSI Approved :: BSD License -Operating System :: OS Independent -Programming Language :: Python :: 2 -Programming Language :: Python :: 3 -Topic :: Software Development :: Quality Assurance -Topic :: Software Development :: Testing -""" - # Pull in the tools we need. import os, sys from setuptools import setup -from distutils.core import Extension # pylint: disable=no-name-in-module,import-error +from distutils.core import Extension # pylint: disable=no-name-in-module, import-error from distutils.command.build_ext import build_ext # pylint: disable=no-name-in-module, import-error from distutils import errors # pylint: disable=no-name-in-module # Get or massage our metadata. We exec coverage/version.py so we can avoid # importing the product code into setup.py. +classifiers = """\ +Environment :: Console +Intended Audience :: Developers +License :: OSI Approved :: Apache Software License +Operating System :: OS Independent +Programming Language :: Python :: 2 +Programming Language :: Python :: 3 +Topic :: Software Development :: Quality Assurance +Topic :: Software Development :: Testing +""" + doc = __doc__ # __doc__ will be overwritten by version.py. __version__ = __url__ = "" # Keep pylint happy. @@ -61,7 +64,7 @@ cov_ver_py = os.path.join(os.path.split(__file__)[0], "coverage/version.py") with open(cov_ver_py) as version_file: exec(compile(version_file.read(), cov_ver_py, 'exec')) -doclines = (doc % __url__).splitlines() +doclines = (doc.format(docurl=__url__)).splitlines() classifier_list = classifiers.splitlines() if 'a' in __version__: @@ -75,10 +78,10 @@ classifier_list.append("Development Status :: " + devstat) # Install a script as "coverage", and as "coverage[23]", and as # "coverage-2.7" (or whatever). scripts = [ - 'coverage = coverage:main', - 'coverage%d = coverage:main' % sys.version_info[:1], - 'coverage-%d.%d = coverage:main' % sys.version_info[:2], - ] + 'coverage = coverage.cmdline:main', + 'coverage%d = coverage.cmdline:main' % sys.version_info[:1], + 'coverage-%d.%d = coverage.cmdline:main' % sys.version_info[:2], +] # Create the keyword arguments for setup() @@ -88,13 +91,13 @@ setup_args = dict( packages = [ 'coverage', - ], + ], package_data = { 'coverage': [ 'htmlfiles/*.*', - ] - }, + ] + }, entry_points = {'console_scripts': scripts}, @@ -106,10 +109,10 @@ setup_args = dict( description = doclines[0], long_description = '\n'.join(doclines[2:]), keywords = 'code coverage testing', - license = 'BSD', + license = 'Apache 2.0', classifiers = classifier_list, url = __url__, - ) +) # A replacement for the build_ext command which raises a single exception # if the build fails, so we can fallback nicely. @@ -124,11 +127,13 @@ if sys.platform == 'win32': # find the compiler ext_errors += (IOError,) + class BuildFailed(Exception): """Raise this to indicate the C extension wouldn't build.""" def __init__(self): Exception.__init__(self) - self.cause = sys.exc_info()[1] # work around py 2/3 different syntax + self.cause = sys.exc_info()[1] # work around py 2/3 different syntax + class ve_build_ext(build_ext): """Build C extensions, but fail with a straightforward exception.""" @@ -150,7 +155,7 @@ class ve_build_ext(build_ext): raise BuildFailed() except ValueError as err: # this can happen on Windows 64 bit, see Python issue 7511 - if "'path'" in str(err): # works with both py 2/3 + if "'path'" in str(err): # works with both py 2/3 raise BuildFailed() raise @@ -170,19 +175,28 @@ if '__pypy__' in sys.builtin_module_names: if compile_extension: setup_args.update(dict( ext_modules = [ - Extension("coverage.tracer", sources=["coverage/tracer.c"]) - ], + Extension( + "coverage.tracer", + sources=[ + "coverage/ctracer/datastack.c", + "coverage/ctracer/filedisp.c", + "coverage/ctracer/module.c", + "coverage/ctracer/tracer.c", + ] + ) + ], cmdclass = { 'build_ext': ve_build_ext, - }, - )) + }, + )) # Py3.x-specific details. if sys.version_info >= (3, 0): setup_args.update(dict( use_2to3 = False, - )) + )) + def main(): """Actually invoke setup() with the arguments we built above.""" |