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)

MANIFEST.in

-include _version.py
 from .helpers import *
 from .decorators import *
 
-__version__ = '0.17.1'    # = setup.py:ARGH_VERSION  (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 distribute_setup.py and call it as recommended:
+#   http://packages.python.org/distribute/using.html
+# However, `distribute` seems to break PyPy (at least 1.6 thru 1.9).
+# So we'll simply fall back to plain distutils.
+try:
+    from setuptools import setup
+except:
+    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/__init__.py') 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()
 
+
 setup(
     # 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 ProjectModifiedEvent.java.
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.