]> granicus.if.org Git - python/commitdiff
Use more standard name for one option of packaging’s install_distinfo
authorÉric Araujo <merwok@netwok.org>
Sun, 6 Nov 2011 10:52:30 +0000 (11:52 +0100)
committerÉric Araujo <merwok@netwok.org>
Sun, 6 Nov 2011 10:52:30 +0000 (11:52 +0100)
Lib/packaging/command/install_dist.py
Lib/packaging/command/install_distinfo.py
Lib/packaging/tests/test_command_install_distinfo.py

index ce7015eeb4654242767feefed04211b5af120798..c54da6f3dfa0a67cccbea8addbaa69f624ce20aa 100644 (file)
@@ -55,9 +55,7 @@ class install_dist(Command):
         ('install-data=', None,
          "installation directory for data files"),
 
-        # Byte-compilation options -- see install_lib.py for details, as
-        # these are duplicated from there (but only install_lib does
-        # anything with them).
+        # Byte-compilation options -- see install_lib for details
         ('compile', 'c', "compile .py to .pyc [default]"),
         ('no-compile', None, "don't compile .py files"),
         ('optimize=', 'O',
index 06ea4c1f806b7f64c13ba478ad8478d4a3c3a459..b49729f5afa779bba573901e9d9d287f9b85bddc 100644 (file)
@@ -16,8 +16,8 @@ class install_distinfo(Command):
     description = 'create a .dist-info directory for the distribution'
 
     user_options = [
-        ('distinfo-dir=', None,
-         "directory where the the .dist-info directory will be installed"),
+        ('install-dir=', None,
+         "directory where the the .dist-info directory will be created"),
         ('installer=', None,
          "the name of the installer"),
         ('requested', None,
@@ -35,7 +35,7 @@ class install_distinfo(Command):
     negative_opt = {'no-requested': 'requested'}
 
     def initialize_options(self):
-        self.distinfo_dir = None
+        self.install_dir = None
         self.installer = None
         self.requested = None
         self.no_record = None
@@ -46,8 +46,7 @@ class install_distinfo(Command):
         self.set_undefined_options('install_dist',
                                    'installer', 'requested', 'no_record')
 
-        self.set_undefined_options('install_lib',
-                                   ('install_dir', 'distinfo_dir'))
+        self.set_undefined_options('install_lib', 'install_dir')
 
         if self.installer is None:
             # FIXME distutils or packaging?
@@ -64,26 +63,26 @@ class install_distinfo(Command):
 
         basename = metadata.get_fullname(filesafe=True) + ".dist-info"
 
-        self.distinfo_dir = os.path.join(self.distinfo_dir, basename)
+        self.install_dir = os.path.join(self.install_dir, basename)
 
     def run(self):
-        target = self.distinfo_dir
+        target = self.install_dir
 
         if os.path.isdir(target) and not os.path.islink(target):
             if not self.dry_run:
                 rmtree(target)
         elif os.path.exists(target):
-            self.execute(os.unlink, (self.distinfo_dir,),
+            self.execute(os.unlink, (self.install_dir,),
                          "removing " + target)
 
         self.execute(os.makedirs, (target,), "creating " + target)
 
-        metadata_path = os.path.join(self.distinfo_dir, 'METADATA')
+        metadata_path = os.path.join(self.install_dir, 'METADATA')
         self.execute(self.distribution.metadata.write, (metadata_path,),
                      "creating " + metadata_path)
         self.outfiles.append(metadata_path)
 
-        installer_path = os.path.join(self.distinfo_dir, 'INSTALLER')
+        installer_path = os.path.join(self.install_dir, 'INSTALLER')
         logger.info('creating %s', installer_path)
         if not self.dry_run:
             with open(installer_path, 'w') as f:
@@ -91,7 +90,7 @@ class install_distinfo(Command):
         self.outfiles.append(installer_path)
 
         if self.requested:
-            requested_path = os.path.join(self.distinfo_dir, 'REQUESTED')
+            requested_path = os.path.join(self.install_dir, 'REQUESTED')
             logger.info('creating %s', requested_path)
             if not self.dry_run:
                 open(requested_path, 'wb').close()
@@ -100,7 +99,7 @@ class install_distinfo(Command):
         if not self.no_resources:
             install_data = self.get_finalized_command('install_data')
             if install_data.get_resources_out() != []:
-                resources_path = os.path.join(self.distinfo_dir,
+                resources_path = os.path.join(self.install_dir,
                                               'RESOURCES')
                 logger.info('creating %s', resources_path)
                 if not self.dry_run:
@@ -114,7 +113,7 @@ class install_distinfo(Command):
                 self.outfiles.append(resources_path)
 
         if not self.no_record:
-            record_path = os.path.join(self.distinfo_dir, 'RECORD')
+            record_path = os.path.join(self.install_dir, 'RECORD')
             logger.info('creating %s', record_path)
             if not self.dry_run:
                 with open(record_path, 'w', encoding='utf-8') as f:
index 6783d87e00f3f5ea0f9f6cbc60c9b63f3d229b9c..33153e7fe3ad50df28808bd86ca4dbe87ebb50b9 100644 (file)
@@ -49,7 +49,7 @@ class InstallDistinfoTestCase(support.TempdirManager,
         cmd = install_distinfo(dist)
         dist.command_obj['install_distinfo'] = cmd
 
-        cmd.distinfo_dir = install_dir
+        cmd.install_dir = install_dir
         cmd.ensure_finalized()
         cmd.run()
 
@@ -76,7 +76,7 @@ class InstallDistinfoTestCase(support.TempdirManager,
         cmd = install_distinfo(dist)
         dist.command_obj['install_distinfo'] = cmd
 
-        cmd.distinfo_dir = install_dir
+        cmd.install_dir = install_dir
         cmd.installer = 'bacon-python'
         cmd.ensure_finalized()
         cmd.run()
@@ -96,7 +96,7 @@ class InstallDistinfoTestCase(support.TempdirManager,
         cmd = install_distinfo(dist)
         dist.command_obj['install_distinfo'] = cmd
 
-        cmd.distinfo_dir = install_dir
+        cmd.install_dir = install_dir
         cmd.requested = False
         cmd.ensure_finalized()
         cmd.run()
@@ -116,7 +116,7 @@ class InstallDistinfoTestCase(support.TempdirManager,
         cmd = install_distinfo(dist)
         dist.command_obj['install_distinfo'] = cmd
 
-        cmd.distinfo_dir = install_dir
+        cmd.install_dir = install_dir
         cmd.no_record = True
         cmd.ensure_finalized()
         cmd.run()
@@ -214,7 +214,7 @@ class InstallDistinfoTestCase(support.TempdirManager,
         cmd = install_distinfo(dist)
         dist.command_obj['install_distinfo'] = cmd
 
-        cmd.distinfo_dir = install_dir
+        cmd.install_dir = install_dir
         cmd.ensure_finalized()
         cmd.run()