Mercurial > repos > guerler > hhblits
comparison lib/python3.8/site-packages/setuptools/command/bdist_rpm.py @ 0:9e54283cc701 draft
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
author | guerler |
---|---|
date | Mon, 27 Jul 2020 03:47:31 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:9e54283cc701 |
---|---|
1 import distutils.command.bdist_rpm as orig | |
2 | |
3 | |
4 class bdist_rpm(orig.bdist_rpm): | |
5 """ | |
6 Override the default bdist_rpm behavior to do the following: | |
7 | |
8 1. Run egg_info to ensure the name and version are properly calculated. | |
9 2. Always run 'install' using --single-version-externally-managed to | |
10 disable eggs in RPM distributions. | |
11 3. Replace dash with underscore in the version numbers for better RPM | |
12 compatibility. | |
13 """ | |
14 | |
15 def run(self): | |
16 # ensure distro name is up-to-date | |
17 self.run_command('egg_info') | |
18 | |
19 orig.bdist_rpm.run(self) | |
20 | |
21 def _make_spec_file(self): | |
22 version = self.distribution.get_version() | |
23 rpmversion = version.replace('-', '_') | |
24 spec = orig.bdist_rpm._make_spec_file(self) | |
25 line23 = '%define version ' + version | |
26 line24 = '%define version ' + rpmversion | |
27 spec = [ | |
28 line.replace( | |
29 "Source0: %{name}-%{version}.tar", | |
30 "Source0: %{name}-%{unmangled_version}.tar" | |
31 ).replace( | |
32 "setup.py install ", | |
33 "setup.py install --single-version-externally-managed " | |
34 ).replace( | |
35 "%setup", | |
36 "%setup -n %{name}-%{unmangled_version}" | |
37 ).replace(line23, line24) | |
38 for line in spec | |
39 ] | |
40 insert_loc = spec.index(line24) + 1 | |
41 unmangled_version = "%define unmangled_version " + version | |
42 spec.insert(insert_loc, unmangled_version) | |
43 return spec |