]> granicus.if.org Git - python/commitdiff
Stop ignoring RPMs in distutils' upload command (#2945).
authorÉric Araujo <merwok@netwok.org>
Sun, 15 Jan 2012 01:48:55 +0000 (02:48 +0100)
committerÉric Araujo <merwok@netwok.org>
Sun, 15 Jan 2012 01:48:55 +0000 (02:48 +0100)
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 :)

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

index 678e1188966f603d9a7504f29bdbf471395ec447..357eaa575e6cacf9486a1127633fea6cbe200180 100644 (file)
@@ -365,16 +365,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))
 
     def _dist_path(self, path):
         return os.path.join(self.dist_dir, os.path.basename(path))
index 804fb1355f28eeedf86e1babf9ac1e49a07a2bff..ab7a1bf24e7e565db1b4cede18b5e38a36d1ad01 100644 (file)
@@ -78,6 +78,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
@@ -117,6 +121,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 24f3f4599c4e1021a93c6c4a77b33dacc6daa7f8..bad11aebacf80d4ce30487ea8dcbc71df4d17ae2 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -765,6 +765,7 @@ Vlad Riscutia
 Juan M. Bello Rivas
 Davide Rizzo
 Anthony Roach
+Carl Robben
 Mark Roberts
 Jim Robinson
 Andy Robinson
index fe28751a2db84ddfa5234f301a1ad755c68494c3..271c5b7423ba568ac481287f7b2faa23834ab5fd 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -97,6 +97,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #2945: Make the distutils upload command aware of bdist_rpm products.
+
 - Issue #13642: Unquote before b64encoding user:password during Basic
   Authentication. Patch contributed by Joonas Kuorilehto.