Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 73cec21

Browse files
committed
Stop ignoring RPMs in distutils' upload command (#2945).
Bug reported by Hartmut Goebel and patch contributed by Carl Robben. Carl tested the fix and we have a buildbot with rpm installed, so I’m committing even though I could not run this test (but I do understand the changed code :)
1 parent 9c7b919 commit 73cec21

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

Lib/distutils/command/bdist_rpm.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,16 +365,28 @@ def run(self):
365365
self.spawn(rpm_cmd)
366366

367367
if not self.dry_run:
368+
if self.distribution.has_ext_modules():
369+
pyversion = get_python_version()
370+
else:
371+
pyversion = 'any'
372+
368373
if not self.binary_only:
369374
srpm = os.path.join(rpm_dir['SRPMS'], source_rpm)
370375
assert(os.path.exists(srpm))
371376
self.move_file(srpm, self.dist_dir)
377+
filename = os.path.join(self.dist_dir, source_rpm)
378+
self.distribution.dist_files.append(
379+
('bdist_rpm', pyversion, filename))
372380

373381
if not self.source_only:
374382
for rpm in binary_rpms:
375383
rpm = os.path.join(rpm_dir['RPMS'], rpm)
376384
if os.path.exists(rpm):
377385
self.move_file(rpm, self.dist_dir)
386+
filename = os.path.join(self.dist_dir,
387+
os.path.basename(rpm))
388+
self.distribution.dist_files.append(
389+
('bdist_rpm', pyversion, filename))
378390

379391
def _dist_path(self, path):
380392
return os.path.join(self.dist_dir, os.path.basename(path))

Lib/distutils/tests/test_bdist_rpm.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ def test_quiet(self):
7878
dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
7979
self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)
8080

81+
# bug #2945: upload ignores bdist_rpm files
82+
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)
83+
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'), dist.dist_files)
84+
8185
def test_no_optimize_flag(self):
8286

8387
# XXX I am unable yet to make this test work without
@@ -117,6 +121,11 @@ def test_no_optimize_flag(self):
117121

118122
dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
119123
self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)
124+
125+
# bug #2945: upload ignores bdist_rpm files
126+
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)
127+
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'), dist.dist_files)
128+
120129
os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm'))
121130

122131
def test_suite():

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ Vlad Riscutia
765765
Juan M. Bello Rivas
766766
Davide Rizzo
767767
Anthony Roach
768+
Carl Robben
768769
Mark Roberts
769770
Jim Robinson
770771
Andy Robinson

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ Core and Builtins
9797
Library
9898
-------
9999

100+
- Issue #2945: Make the distutils upload command aware of bdist_rpm products.
101+
100102
- Issue #13642: Unquote before b64encoding user:password during Basic
101103
Authentication. Patch contributed by Joonas Kuorilehto.
102104

0 commit comments

Comments
 (0)