#!/usr/bin/env python3
"""
-Create rpm packages of pyi2ncommon for autotest (py3.6) and i2n system (py 3.3).
+Create rpm packages of pyi2ncommon for various python versions.
-Calls setup.py with different args. Add %check section to .spec file
+Per default try building for autotest (py3.6) and i2n system (py 3.3). Can
+deviate from this by calling `./make_dist.py 3.4` (for example). All python
+versions used must be installed on local machine.
-Accidentally stumbled of this: it appears that setting install-lib to
-/usr/lib/pythonVERSION/site-packages is translated by setup.py to installation
-requirement python(abi) = VERSION
+Calls setup.py with different args. Adds %check section to .spec file
+
+This script relies on one feature I accidentally stumbled over: it appears that
+setting install-lib to /usr/lib/pythonVERSION/site-packages is translated by
+setup.py to installation requirement python(abi) = VERSION
.. codeauthor:: Intra2net AG <info@intra2net.com>
"""
"""Create rpm that will install pyi2ncommon for given python version."""
print('Creating RPM for python version {}'.format(py_version))
+ # test that python version is installed
+ try:
+ result = call(['python{}'.format(py_version), '--version'])
+ except Exception:
+ result = 1
+ if result != 0:
+ raise RuntimeError('Python version {} not installed, '
+ 'run {} VERSION'.format(py_version, sys.argv[0]))
+
# define options for where to install library;
# It appears this is automatically translated into requirement
# python(abi) = version !
see module doc for more info
"""
- for filename in (create_rpm('3.3'), create_rpm('3.6'), create_spec()):
+ if len(sys.argv) > 1:
+ versions = sys.argv[1:]
+ else:
+ versions = ['3.3', '3.6']
+ files_created = []
+ for version in versions:
+ files_created.append(create_rpm(version))
+ files_created.append(create_spec())
+
+ for filename in files_created:
print('Created {}'.format(filename))
return 0