Andy Mikhailenko avatar Andy Mikhailenko committed f5d627c

Fix #21 again: py26 did not install argparse; distribute would break pypy. Remove the outdated manifest file. Avoid importing argh.__version__ at all.

Comments (0)

Files changed (3)

 from .helpers import *
 from .decorators import *
-__version__ = '0.17.1'    # =  (keep in sync!)
+__version__ = '0.17.2'
 import os
-from setuptools import setup
+# Why distutils?
-# NOTE: keep in sync with argh.__version__ !
-# (importing `__version__` from `argh` would trigger a cascading import
-#  of `argparse`; but Python < 2.7 ships without argparse.)
-ARGH_VERSION = '0.17.1'    # = argh.__version__
+# We could bundle and call it as recommended:
+# However, `distribute` seems to break PyPy (at least 1.6 thru 1.9).
+# So we'll simply fall back to plain distutils.
+    from setuptools import setup
+    from distutils.core import setup
+# Importing `__version__` from `argh` would trigger a cascading import
+# of `argparse`. We need to avoid this as Python < 2.7 ships without argparse.
+__version__ = None
+with open('argh/') as f:
+    for line in f:
+        if line.startswith('__version__'):
+            exec(line)
+            break
+assert __version__, 'argh.__version__ must be imported correctly'
 readme = open(os.path.join(os.path.dirname(__file__), 'README')).read()
     # overview
     name             = 'argh',
     long_description = readme,
     # technical info
-    version  = ARGH_VERSION,
+    version  = __version__,
     packages = ['argh'],
-    requires = ['python (>= 2.5)', 'argparse (>=1.1)'],
     provides = ['argh'],
+    requires = ['python(>=2.5)', 'argparse(>=1.1)'],
+    install_requires = ['argparse>=1.1'],    # for Python 2.6 (no bundled argparse; setuptools is likely to exist)
     # copyright
     author   = 'Andrey Mikhaylenko',
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.