[Python-checkins] distutils2: Minor cleanup

eric.araujo python-checkins at python.org
Mon Sep 19 15:12:39 CEST 2011


http://hg.python.org/distutils2/rev/6de141008f4e
changeset:   1160:6de141008f4e
user:        Éric Araujo <merwok at netwok.org>
date:        Mon Sep 19 03:05:11 2011 +0200
summary:
  Minor cleanup

- Rename an attribute and create it in initialize_options instead of
  finalize_options to match the other install_* classes
- Remove unnecessary method call in tests
- Fix typo/wording in help text

files:
  distutils2/command/install_distinfo.py            |  18 +++++-----
  distutils2/tests/test_command_install_distinfo.py |   5 --
  2 files changed, 9 insertions(+), 14 deletions(-)


diff --git a/distutils2/command/install_distinfo.py b/distutils2/command/install_distinfo.py
--- a/distutils2/command/install_distinfo.py
+++ b/distutils2/command/install_distinfo.py
@@ -32,7 +32,7 @@
         ('no-record', None,
          "do not generate a RECORD file"),
         ('no-resources', None,
-         "do not generate a RESSOURCES list installed file"),
+         "do not generate a RESOURCES file"),
     ]
 
     boolean_options = ['requested', 'no-record', 'no-resources']
@@ -45,6 +45,7 @@
         self.requested = None
         self.no_record = None
         self.no_resources = None
+        self.outfiles = []
 
     def finalize_options(self):
         self.set_undefined_options('install_dist',
@@ -54,7 +55,7 @@
                                    ('install_dir', 'distinfo_dir'))
 
         if self.installer is None:
-            # FIXME distutils or distutils2?
+            # FIXME distutils or packaging or distutils2?
             # + document default in the option help text above and in install
             self.installer = 'distutils'
         if self.requested is None:
@@ -69,7 +70,6 @@
         basename = metadata.get_fullname(filesafe=True) + ".dist-info"
 
         self.distinfo_dir = os.path.join(self.distinfo_dir, basename)
-        self.outputs = []
 
     def run(self):
         # FIXME dry-run should be used at a finer level, so that people get
@@ -89,20 +89,20 @@
             metadata_path = os.path.join(self.distinfo_dir, 'METADATA')
             logger.info('creating %s', metadata_path)
             self.distribution.metadata.write(metadata_path)
-            self.outputs.append(metadata_path)
+            self.outfiles.append(metadata_path)
 
             installer_path = os.path.join(self.distinfo_dir, 'INSTALLER')
             logger.info('creating %s', installer_path)
             f = open(installer_path, 'w')
             f.write(self.installer)
             f.close()
-            self.outputs.append(installer_path)
+            self.outfiles.append(installer_path)
 
             if self.requested:
                 requested_path = os.path.join(self.distinfo_dir, 'REQUESTED')
                 logger.info('creating %s', requested_path)
                 open(requested_path, 'wb').close()
-                self.outputs.append(requested_path)
+                self.outfiles.append(requested_path)
 
 
             if not self.no_resources:
@@ -119,7 +119,7 @@
                         writer.writerow(tuple)
 
                     f.close()
-                    self.outputs.append(resources_path)
+                    self.outfiles.append(resources_path)
 
             if not self.no_record:
                 record_path = os.path.join(self.distinfo_dir, 'RECORD')
@@ -146,7 +146,7 @@
 
                 # add the RECORD file itself
                 writer.writerow((record_path, '', ''))
-                self.outputs.append(record_path)
+                self.outfiles.append(record_path)
 
     def get_outputs(self):
-        return self.outputs
+        return self.outfiles
diff --git a/distutils2/tests/test_command_install_distinfo.py b/distutils2/tests/test_command_install_distinfo.py
--- a/distutils2/tests/test_command_install_distinfo.py
+++ b/distutils2/tests/test_command_install_distinfo.py
@@ -47,7 +47,6 @@
         cmd = install_distinfo(dist)
         dist.command_obj['install_distinfo'] = cmd
 
-        cmd.initialize_options()
         cmd.distinfo_dir = install_dir
         cmd.ensure_finalized()
         cmd.run()
@@ -83,7 +82,6 @@
         cmd = install_distinfo(dist)
         dist.command_obj['install_distinfo'] = cmd
 
-        cmd.initialize_options()
         cmd.distinfo_dir = install_dir
         cmd.installer = 'bacon-python'
         cmd.ensure_finalized()
@@ -107,7 +105,6 @@
         cmd = install_distinfo(dist)
         dist.command_obj['install_distinfo'] = cmd
 
-        cmd.initialize_options()
         cmd.distinfo_dir = install_dir
         cmd.requested = False
         cmd.ensure_finalized()
@@ -128,7 +125,6 @@
         cmd = install_distinfo(dist)
         dist.command_obj['install_distinfo'] = cmd
 
-        cmd.initialize_options()
         cmd.distinfo_dir = install_dir
         cmd.no_record = True
         cmd.ensure_finalized()
@@ -166,7 +162,6 @@
         cmd = install_distinfo(dist)
         dist.command_obj['install_distinfo'] = cmd
 
-        cmd.initialize_options()
         cmd.distinfo_dir = install_dir
         cmd.ensure_finalized()
         cmd.run()

-- 
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list