Skip to content

Commit 54af685

Browse files
authored
Merge pull request #2380 from thisch/bdist-rpm
Reduce size of setuptools' bdist_rpm._make_spec_file
2 parents a60ba76 + 9a7710b commit 54af685

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

changelog.d/2380.change.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
There are some setuptools specific changes in the
2+
`setuptools.command.bdist_rpm` module that are no longer needed, because
3+
they are part of the `bdist_rpm` module in distutils in Python
4+
3.5.0. Therefore, code was removed from `setuptools.command.bdist_rpm`.

setuptools/command/bdist_rpm.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ class bdist_rpm(orig.bdist_rpm):
88
1. Run egg_info to ensure the name and version are properly calculated.
99
2. Always run 'install' using --single-version-externally-managed to
1010
disable eggs in RPM distributions.
11-
3. Replace dash with underscore in the version numbers for better RPM
12-
compatibility.
1311
"""
1412

1513
def run(self):
@@ -19,25 +17,15 @@ def run(self):
1917
orig.bdist_rpm.run(self)
2018

2119
def _make_spec_file(self):
22-
version = self.distribution.get_version()
23-
rpmversion = version.replace('-', '_')
2420
spec = orig.bdist_rpm._make_spec_file(self)
25-
line23 = '%define version ' + version
26-
line24 = '%define version ' + rpmversion
2721
spec = [
2822
line.replace(
29-
"Source0: %{name}-%{version}.tar",
30-
"Source0: %{name}-%{unmangled_version}.tar"
31-
).replace(
3223
"setup.py install ",
3324
"setup.py install --single-version-externally-managed "
3425
).replace(
3526
"%setup",
3627
"%setup -n %{name}-%{unmangled_version}"
37-
).replace(line23, line24)
28+
)
3829
for line in spec
3930
]
40-
insert_loc = spec.index(line24) + 1
41-
unmangled_version = "%define unmangled_version " + version
42-
spec.insert(insert_loc, unmangled_version)
4331
return spec

0 commit comments

Comments
 (0)