Merge pull request #879 from RonnyPfannschmidt/setuptools-scm

use setuptools_scm to determine the version
This commit is contained in:
Floris Bruynooghe 2015-08-15 00:56:16 +01:00
commit f22d14b105
5 changed files with 14 additions and 5 deletions

5
.gitignore vendored
View File

@ -17,6 +17,11 @@ include/
*.orig
*~
.eggs/
# this file is managed by setuptools_scm
_pytest/__init__.py
doc/*/_build
build/
dist/

View File

@ -1,2 +0,0 @@
#
__version__ = '2.8.0.dev4'

View File

@ -31,7 +31,12 @@ def pkg_to_mapping(name):
else: # package
for pyfile in toplevel.visit('*.py'):
pkg = pkgname(name, toplevel, pyfile)
name2src[pkg] = pyfile.read()
if pkg == '_pytest.__init__':
# remove the coding comment line to avoid python bug
lines = pyfile.read().splitlines(True)
name2src[pkg] = ''.join(lines[1:])
else:
name2src[pkg] = pyfile.read()
# with wheels py source code might be not be installed
# and the resulting genscript is useless, just bail out.
assert name2src, "no source code found for %r at %r" %(name, toplevel)

View File

@ -15,7 +15,7 @@ from _pytest.config import (
main, UsageError, _preloadplugins, cmdline,
hookspec, hookimpl
)
from _pytest import __version__
from _pytest import version as __version__
_preloadplugins() # to populate pytest.* namespace so help(pytest) works

View File

@ -63,7 +63,7 @@ def main():
name='pytest',
description='pytest: simple powerful testing with Python',
long_description=long_description,
version=get_version(),
use_scm_version={'write_to': '_pytest/__init__.py'},
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
@ -75,6 +75,7 @@ def main():
# the following should be enabled for release
install_requires=install_requires,
extras_require=extras_require,
setup_requires=['setuptools_scm'],
packages=['_pytest', '_pytest.assertion'],
py_modules=['pytest'],
zip_safe=False,