From a060b8ff738c08b837c89d87eae8a6bba54cf357 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Sat, 25 Jul 2015 10:44:18 +0200 Subject: [PATCH 1/3] use setuptools_scm to determine the version --- .gitignore | 5 +++++ _pytest/__init__.py | 2 -- setup.py | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) delete mode 100644 _pytest/__init__.py diff --git a/.gitignore b/.gitignore index 2b7c267b0..cd6a7fc9e 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,11 @@ include/ *.orig *~ +.eggs/ + +# this file is managed by setuptools_scm +_pytest/__init__.py + doc/*/_build build/ dist/ diff --git a/_pytest/__init__.py b/_pytest/__init__.py deleted file mode 100644 index 5b3715e54..000000000 --- a/_pytest/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# -__version__ = '2.8.0.dev4' diff --git a/setup.py b/setup.py index 218c14da8..69b6f5e5c 100644 --- a/setup.py +++ b/setup.py @@ -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, From 5098e5fc47d0d7531a7501d0e8e72ea4c629de79 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Sun, 26 Jul 2015 14:04:52 +0200 Subject: [PATCH 2/3] fix version import --- pytest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.py b/pytest.py index 8549ba781..161c44822 100644 --- a/pytest.py +++ b/pytest.py @@ -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 From 235f9da432310c7084af08c2fddefd9a3a0bf223 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Mon, 27 Jul 2015 11:33:27 +0200 Subject: [PATCH 3/3] special-case _pytest.__init__ in genscript to avoid a python3 bug --- _pytest/genscript.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/_pytest/genscript.py b/_pytest/genscript.py index d6f452370..fbaef4c2d 100755 --- a/_pytest/genscript.py +++ b/_pytest/genscript.py @@ -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)