Skip to content

Commit 2912e07

Browse files
committed
Version in setup.py reading __version__.py directly
1 parent d137a21 commit 2912e07

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

pact/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from .matchers import EachLike, SomethingLike, Term
44
from .pact import Pact
55
from .provider import Provider
6-
6+
from .__version__ import __version__
77

88
__all__ = ('Consumer', 'EachLike', 'Pact', 'Provider', 'SomethingLike', 'Term')
9-
__version__ = '0.6.0'

pact/__version__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.6.0'

setup.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@
1111
from setuptools.command.develop import develop
1212
from setuptools.command.install import install
1313

14-
import pact
15-
1614

1715
IS_64 = sys.maxsize > 2 ** 32
1816
PACT_STANDALONE_VERSION = '1.0.0'
1917

2018

19+
here = os.path.abspath(os.path.dirname(__file__))
20+
21+
about = {}
22+
with open(os.path.join(here, "pact", "__version__.py")) as f:
23+
exec(f.read(), about)
24+
25+
2126
class PactPythonDevelopCommand(develop):
2227
"""
2328
Custom develop mode installer for pact-python.
@@ -107,7 +112,7 @@ def read(filename):
107112
cmdclass={'develop': PactPythonDevelopCommand,
108113
'install': PactPythonInstallCommand},
109114
name='pact-python',
110-
version=pact.__version__,
115+
version=about['__version__'],
111116
description=('Tools for creating and verifying consumer driven contracts'
112117
' using the Pact framework.'),
113118
long_description=read('README.md'),

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ deps=
66
py27-test: subprocess32
77
commands=
88
test: nosetests
9+
install: python -c "import pact"

0 commit comments

Comments
 (0)