diff --git a/MANIFEST.in b/MANIFEST.in index b12a6fe..81e72d5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ include README.rst AUTHORS LICENSE CHANGES include setuputils.py +include astor/VERSION recursive-include tests *.py diff --git a/astor/VERSION b/astor/VERSION new file mode 100644 index 0000000..39e898a --- /dev/null +++ b/astor/VERSION @@ -0,0 +1 @@ +0.7.1 diff --git a/astor/__init__.py b/astor/__init__.py index 3d30a94..adeb36e 100644 --- a/astor/__init__.py +++ b/astor/__init__.py @@ -9,6 +9,7 @@ Copyright 2013 (c) Berker Peksag """ +import os import warnings from .code_gen import to_source # NOQA @@ -19,7 +20,9 @@ from .op_util import get_op_symbol, get_op_precedence # NOQA from .op_util import symbol_data # NOQA from .tree_walk import TreeWalk # NOQA -__version__ = '0.7.1' +ROOT = os.path.dirname(__file__) +with open(os.path.join(ROOT, 'VERSION')) as version_file: + __version__ = version_file.read().strip() parse_file = code_to_ast.parse_file diff --git a/setup.cfg b/setup.cfg index d61ea5c..213a359 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,6 +2,7 @@ name = astor description = Read/rewrite/write Python ASTs long_description = file:README.rst +version = file: astor/VERSION author = Patrick Maupin email = pmaupin@gmail.com platforms = Independent @@ -39,7 +40,7 @@ python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* [options.packages.find] exclude = tests -[wheel] +[bdist_wheel] universal = 1 [build-system] diff --git a/setup.py b/setup.py index 4a111b5..6068493 100644 --- a/setup.py +++ b/setup.py @@ -1,17 +1,3 @@ -import os -import sys - from setuptools import setup -from setuptools.config import read_configuration - -from setuputils import find_version - - -def here(*paths): - return os.path.join(os.path.dirname(__file__), *paths) - -config = read_configuration(here('setup.cfg')) -config['metadata']['version'] = find_version(here('astor', '__init__.py')) -config['options'].update(config['metadata']) -setup(**config['options']) +setup()