summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2014-03-17 12:42:14 +0100
committerAnthon van der Neut <anthon@mnt.org>2014-03-17 12:42:14 +0100
commitb54bc003810027481e8125be28af7af0781dadcc (patch)
treeb5c2e1b106eb272401eacd341f3d9277557b7dc3
parent677f099cdbbf5d4e313640bf47358fe77ffcf880 (diff)
downloadruamel.std.argparse-b54bc003810027481e8125be28af7af0781dadcc.tar.gz
include version stuff so it can be upgraded
-rw-r--r--__init__.py8
-rw-r--r--setup.py24
2 files changed, 21 insertions, 11 deletions
diff --git a/__init__.py b/__init__.py
index eef0950..8bc424f 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1,6 +1,7 @@
# coding: utf-8
+# < from ruamel.util.new import _convert_version
def _convert_version(tup):
"""create a PEP 386 pseudo-format conformant string from tuple tup"""
ret_val = str(tup[0]) # first is always digit
@@ -18,7 +19,9 @@ def _convert_version(tup):
ret_val += '.post' if first_letter == 'p' else '.dev'
return ret_val
-version_info = (0, 2, "alpha", 1)
+
+# <
+version_info = (0, 2, "alpha", 2)
__version__ = _convert_version(version_info)
del _convert_version
@@ -202,7 +205,8 @@ def create_argument_parser(self, *args, **keywords):
sp.add_argument(*arg, **o['kw'])
#print ' opt:', x, method.options
if hasattr(method, "global_only_option"):
- arg, kw = method.global_only_option
+ arg = method.global_only_option['args']
+ kw = method.global_only_option['kw']
argument_parser.add_argument(*arg, **kw)
for x in dir(self):
if x.startswith('_'):
diff --git a/setup.py b/setup.py
index 8f83608..e36bc9f 100644
--- a/setup.py
+++ b/setup.py
@@ -15,15 +15,22 @@ exclude_files = [
'setup.py',
]
+if __name__ == '__main__':
+ # put here so setup.py can be imported more easily
+ from setuptools import setup, find_packages, Extension
+ from setuptools.command import install_lib
+
+# < from ruamel.util.new.setupinc import get_version, _check_convert_version
def get_version():
v_i = 'version_info = '
for line in open('__init__.py'):
if not line.startswith(v_i):
continue
s_e = line[len(v_i):].strip()[1:-1].split(', ')
- els = [x.strip()[1:-1] if x[0] in '\'"' else int(x) for x in s_e]
- return els
+ elems = [x.strip()[1:-1] if x[0] in '\'"' else int(x) for x in s_e]
+ break
+ return elems
def _check_convert_version(tup):
@@ -56,15 +63,11 @@ def _check_convert_version(tup):
raise ValueError('First letter of "' + x + '" not recognised')
return ret_val
+
+# < from ruamel.util.new.setupinc import version_info, version_str
version_info = get_version()
version_str = _check_convert_version(version_info)
-
-if __name__ == '__main__':
- # put here so setup.py can be imported more easily
- from setuptools import setup, find_packages, Extension
- from setuptools.command import install_lib
-
-
+# < from ruamel.util.new.setupinc import MyInstallLib
class MyInstallLib(install_lib.install_lib):
"create __init__.py on the fly"
def run(self):
@@ -106,6 +109,9 @@ class MyInstallLib(install_lib.install_lib):
return alt_files
+# <
+
+
def main():
install_requires = [
]