-from setuptools import setup
-# 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:
+# 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.
+with open('argh/__init__.py') as f:
+ if line.startswith('__version__'):
+assert __version__, 'argh.__version__ must be imported correctly'
readme = open(os.path.join(os.path.dirname(__file__), 'README')).read()
long_description = readme,
- version =
- requires = ['python (>= 2.5)', 'argparse (>=1.1)'],
+ requires = ['python(>=2.5)', 'argparse(>=1.1)'],
+ install_requires = ['argparse>=1.1'], # for Python 2.6 (no bundled argparse; setuptools is likely to exist)
author = 'Andrey Mikhaylenko',