Brad Bishop | 2d39a06 | 2019-10-28 08:33:36 -0400 | [diff] [blame] | 1 | From f820f3ff7ad8818475b6e107e63aa9a54252d2a9 Mon Sep 17 00:00:00 2001 |
| 2 | From: Jonathan Ringer <jonringer117@gmail.com> |
| 3 | Date: Thu, 17 Oct 2019 16:54:16 -0700 |
| 4 | Subject: [PATCH] Fix packaging for setuptools>=41.4 |
| 5 | |
| 6 | --- |
| 7 | astor/VERSION | 1 + |
| 8 | astor/__init__.py | 5 ++++- |
| 9 | setup.cfg | 3 ++- |
| 10 | setup.py | 16 +--------------- |
| 11 | 4 files changed, 8 insertions(+), 17 deletions(-) |
| 12 | create mode 100644 astor/VERSION |
| 13 | |
| 14 | diff --git a/astor/VERSION b/astor/VERSION |
| 15 | new file mode 100644 |
| 16 | index 0000000..a3df0a6 |
| 17 | --- /dev/null |
| 18 | +++ b/astor/VERSION |
| 19 | @@ -0,0 +1 @@ |
| 20 | +0.8.0 |
| 21 | diff --git a/astor/__init__.py b/astor/__init__.py |
| 22 | index 3b02983..8dfcdb1 100644 |
| 23 | --- a/astor/__init__.py |
| 24 | +++ b/astor/__init__.py |
| 25 | @@ -9,6 +9,7 @@ |
| 26 | |
| 27 | """ |
| 28 | |
| 29 | +import os |
| 30 | import warnings |
| 31 | |
| 32 | from .code_gen import SourceGenerator, to_source # NOQA |
| 33 | @@ -19,7 +20,9 @@ |
| 34 | from .op_util import symbol_data # NOQA |
| 35 | from .tree_walk import TreeWalk # NOQA |
| 36 | |
| 37 | -__version__ = '0.8.0' |
| 38 | +ROOT = os.path.dirname(__file__) |
| 39 | +with open(os.path.join(ROOT, 'VERSION')) as version_file: |
| 40 | + __version__ = version_file.read().strip |
| 41 | |
| 42 | parse_file = code_to_ast.parse_file |
| 43 | |
| 44 | diff --git a/setup.cfg b/setup.cfg |
| 45 | index 1baf6fc..a43634f 100644 |
| 46 | --- a/setup.cfg |
| 47 | +++ b/setup.cfg |
| 48 | @@ -2,6 +2,7 @@ |
| 49 | name = astor |
| 50 | description = Read/rewrite/write Python ASTs |
| 51 | long_description = file:README.rst |
| 52 | +version = file: astor/VERSION |
| 53 | author = Patrick Maupin |
| 54 | author_email = pmaupin@gmail.com |
| 55 | platforms = Independent |
| 56 | @@ -40,7 +41,7 @@ test_suite = nose.collector |
| 57 | [options.packages.find] |
| 58 | exclude = tests |
| 59 | |
| 60 | -[wheel] |
| 61 | +[bdist_wheel] |
| 62 | universal = 1 |
| 63 | |
| 64 | [build-system] |
| 65 | diff --git a/setup.py b/setup.py |
| 66 | index 4a111b5..6068493 100644 |
| 67 | --- a/setup.py |
| 68 | +++ b/setup.py |
| 69 | @@ -1,17 +1,3 @@ |
| 70 | -import os |
| 71 | -import sys |
| 72 | - |
| 73 | from setuptools import setup |
| 74 | -from setuptools.config import read_configuration |
| 75 | - |
| 76 | -from setuputils import find_version |
| 77 | - |
| 78 | - |
| 79 | -def here(*paths): |
| 80 | - return os.path.join(os.path.dirname(__file__), *paths) |
| 81 | - |
| 82 | -config = read_configuration(here('setup.cfg')) |
| 83 | -config['metadata']['version'] = find_version(here('astor', '__init__.py')) |
| 84 | -config['options'].update(config['metadata']) |
| 85 | |
| 86 | -setup(**config['options']) |
| 87 | +setup() |