Skip to content

Commit

Permalink
py-astor: Update to 0.8.0 and add patch for setuptools fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cjones051073 committed Oct 20, 2019
1 parent c4c68a5 commit ce3d63e
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 4 deletions.
11 changes: 7 additions & 4 deletions python/py-astor/Portfile
Expand Up @@ -4,7 +4,7 @@ PortSystem 1.0
PortGroup python 1.0

name py-astor
version 0.7.1
version 0.8.0
platforms darwin
license BSD
maintainers {emcrisostomo @emcrisostomo} openmaintainer
Expand All @@ -17,9 +17,9 @@ homepage https://github.com/berkerpeksag/astor
master_sites pypi:a/astor
distname astor-${version}

checksums rmd160 c00e731d5db77b91acf9a550171f69b17e440734 \
sha256 95c30d87a6c2cf89aa628b87398466840f0ad8652f88eb173125a6df8533fb8d \
size 30633
checksums rmd160 bb50b95579121050544b216e5d25f5061fb7790d \
sha256 37a6eed8b371f1228db08234ed7f6cfdc7817a3ed3824797e20cbb11dc2a7862 \
size 35005

python.versions 27 35 36 37

Expand All @@ -31,3 +31,6 @@ if {${name} ne ${subport}} {
} else {
livecheck.type pypi
}

# https://github.com/berkerpeksag/astor/issues/162
patchfiles-append setuptools-fix.patch
74 changes: 74 additions & 0 deletions python/py-astor/files/setuptools-fix.patch
@@ -0,0 +1,74 @@
diff --git a/astor/VERSION b/astor/VERSION
new file mode 100644
index 0000000..a3df0a6
--- /dev/null
+++ astor/VERSION
@@ -0,0 +1 @@
+0.8.0
diff --git a/astor/__init__.py b/astor/__init__.py
index 3b02983..8dfcdb1 100644
--- astor/__init__.py.orig
+++ astor/__init__.py
@@ -9,6 +9,7 @@

"""

+import os
import warnings

from .code_gen import SourceGenerator, to_source # NOQA
@@ -19,7 +20,9 @@
from .op_util import symbol_data # NOQA
from .tree_walk import TreeWalk # NOQA

-__version__ = '0.8.0'
+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 1baf6fc..a43634f 100644
--- setup.cfg.orig
+++ 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
author_email = pmaupin@gmail.com
platforms = Independent
@@ -40,7 +41,7 @@ test_suite = nose.collector
[options.packages.find]
exclude = tests

-[wheel]
+[bdist_wheel]
universal = 1

[build-system]
diff --git a/setup.py b/setup.py
index 4a111b5..6068493 100644
--- setup.py.orig
+++ 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()

0 comments on commit ce3d63e

Please sign in to comment.