setting install-lib to /usr/lib/pythonVERSION/site-packages is translated by
setup.py to installation requirement python(abi) = VERSION
+TODO: allow modification of release string from cmd line args (e.g. "testing")
+
.. codeauthor:: Intra2net AG <info@intra2net.com>
"""
from tempfile import mkstemp
from configparser import ConfigParser
from glob import iglob
+import time
INSTALL_DIR_PATTERN = '/usr/lib/python{}/site-packages'
py_version.startswith('3.3') or py_version.startswith('3.4')
# create rpm
+ start_time = time.time()
run_setup('bdist_rpm', install_options=install_options,
need_zip35=need_zip35)
# find rpm and rename it
- newest_name = None
+ newest_names = []
newest_time = 0
for filename in iglob(join(DIST_DIR, 'pyi2ncommon-*.noarch.rpm')):
filetime = os.stat(filename).st_mtime
if filetime > newest_time:
newest_time = filetime
- newest_name = filename
+ newest_names = [filename, ]
+ elif filetime == newest_time:
+ newest_names.append(filename)
- if newest_name is None:
+ if not newest_names:
raise RuntimeError('No pyi2ncommon rpm file found in {}'
.format(DIST_DIR))
+ elif newest_time < start_time:
+ raise RuntimeError('Newest pyi2ncommon rpm file in {} is too old'
+ .format(DIST_DIR))
+ elif len(newest_names) > 1:
+ raise RuntimeError('Multiple newest pyi2ncommon rpm files: {}'
+ .format(newest_names))
+ newest_name = newest_names[0]
mod_name = newest_name[:-11] + '.py' + py_version.replace('.', '') + \
newest_name[-11:]
os.rename(newest_name, mod_name)