Stop ignoring RPMs in distutils' upload command (#2945).

Bug reported by Hartmut Goebel and patch contributed by Carl Robben.
Untested backport of the fix committed and tested for 3.2.
This commit is contained in:
Éric Araujo 2012-02-26 01:16:47 +01:00
parent c3cc2acb09
commit d673b62bac
4 changed files with 24 additions and 0 deletions

View File

@ -379,16 +379,28 @@ def run (self):
self.spawn(rpm_cmd) self.spawn(rpm_cmd)
if not self.dry_run: if not self.dry_run:
if self.distribution.has_ext_modules():
pyversion = get_python_version()
else:
pyversion = 'any'
if not self.binary_only: if not self.binary_only:
srpm = os.path.join(rpm_dir['SRPMS'], source_rpm) srpm = os.path.join(rpm_dir['SRPMS'], source_rpm)
assert(os.path.exists(srpm)) assert(os.path.exists(srpm))
self.move_file(srpm, self.dist_dir) self.move_file(srpm, self.dist_dir)
filename = os.path.join(self.dist_dir, source_rpm)
self.distribution.dist_files.append(
('bdist_rpm', pyversion, filename))
if not self.source_only: if not self.source_only:
for rpm in binary_rpms: for rpm in binary_rpms:
rpm = os.path.join(rpm_dir['RPMS'], rpm) rpm = os.path.join(rpm_dir['RPMS'], rpm)
if os.path.exists(rpm): if os.path.exists(rpm):
self.move_file(rpm, self.dist_dir) self.move_file(rpm, self.dist_dir)
filename = os.path.join(self.dist_dir,
os.path.basename(rpm))
self.distribution.dist_files.append(
('bdist_rpm', pyversion, filename))
# run() # run()
def _dist_path(self, path): def _dist_path(self, path):

View File

@ -79,6 +79,10 @@ def test_quiet(self):
dist_created = os.listdir(os.path.join(pkg_dir, 'dist')) dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created) self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)
# bug #2945: upload ignores bdist_rpm files
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'), dist.dist_files)
def test_no_optimize_flag(self): def test_no_optimize_flag(self):
# XXX I am unable yet to make this test work without # XXX I am unable yet to make this test work without
@ -118,6 +122,11 @@ def test_no_optimize_flag(self):
dist_created = os.listdir(os.path.join(pkg_dir, 'dist')) dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created) self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)
# bug #2945: upload ignores bdist_rpm files
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'), dist.dist_files)
os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm')) os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm'))
def test_suite(): def test_suite():

View File

@ -709,6 +709,7 @@ Vlad Riscutia
Juan M. Bello Rivas Juan M. Bello Rivas
Davide Rizzo Davide Rizzo
Anthony Roach Anthony Roach
Carl Robben
Mark Roberts Mark Roberts
Jim Robinson Jim Robinson
Andy Robinson Andy Robinson

View File

@ -98,6 +98,8 @@ Core and Builtins
Library Library
------- -------
- Issue #2945: Make the distutils upload command aware of bdist_rpm products.
- Issue #13447: Add a test file to host regression tests for bugs in the - Issue #13447: Add a test file to host regression tests for bugs in the
scripts found in the Tools directory. scripts found in the Tools directory.