]> granicus.if.org Git - python/commitdiff
Stop ignoring RPMs in distutils' upload command (#2945).
authorÉric Araujo <merwok@netwok.org>
Sun, 26 Feb 2012 00:16:47 +0000 (01:16 +0100)
committerÉric Araujo <merwok@netwok.org>
Sun, 26 Feb 2012 00:16:47 +0000 (01:16 +0100)
Bug reported by Hartmut Goebel and patch contributed by Carl Robben.
Untested backport of the fix committed and tested for 3.2.

Lib/distutils/command/bdist_rpm.py
Lib/distutils/tests/test_bdist_rpm.py
Misc/ACKS
Misc/NEWS

index 0bba36355740b3fa686b7b4d144ec14f3c1a1cf4..595824367e336769b109e1546baf481a92e55186 100644 (file)
@@ -379,16 +379,28 @@ class bdist_rpm (Command):
         self.spawn(rpm_cmd)
 
         if not self.dry_run:
+            if self.distribution.has_ext_modules():
+                pyversion = get_python_version()
+            else:
+                pyversion = 'any'
+
             if not self.binary_only:
                 srpm = os.path.join(rpm_dir['SRPMS'], source_rpm)
                 assert(os.path.exists(srpm))
                 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:
                 for rpm in binary_rpms:
                     rpm = os.path.join(rpm_dir['RPMS'], rpm)
                     if os.path.exists(rpm):
                         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()
 
     def _dist_path(self, path):
index 25a5763a72d753095d87a1797fb3ad5c36e92f7b..37d89155c7e51bb64e5983c8e5ac83b5e2068061 100644 (file)
@@ -79,6 +79,10 @@ class BuildRpmTestCase(support.TempdirManager,
         dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
         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):
 
         # XXX I am unable yet to make this test work without
@@ -118,6 +122,11 @@ class BuildRpmTestCase(support.TempdirManager,
 
         dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
         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'))
 
 def test_suite():
index 624b6164becfd550a27c62d01b9f63b485b37085..c7c3979c507b2d8934dff698b362d9a4e26722f1 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -709,6 +709,7 @@ Vlad Riscutia
 Juan M. Bello Rivas
 Davide Rizzo
 Anthony Roach
+Carl Robben
 Mark Roberts
 Jim Robinson
 Andy Robinson
index 96cfd2dda5fcb0be01332be64dfa519823603ce8..7be7777dda70b5770818a04309f194c73aba68ae 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -98,6 +98,8 @@ Core and Builtins
 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
   scripts found in the Tools directory.