]> granicus.if.org Git - python/commitdiff
Added --force (-f) option to force installation (including bytecode
authorGreg Ward <gward@python.net>
Wed, 13 Sep 2000 01:02:25 +0000 (01:02 +0000)
committerGreg Ward <gward@python.net>
Wed, 13 Sep 2000 01:02:25 +0000 (01:02 +0000)
compilation).

Lib/distutils/command/install.py
Lib/distutils/command/install_data.py
Lib/distutils/command/install_headers.py
Lib/distutils/command/install_lib.py
Lib/distutils/command/install_scripts.py

index 2cb7871fdf9a079d7a27a702d19fbb306e5ee5b0..2332770c6b9baec8731aa6e5ebe68ebde847864e 100644 (file)
@@ -85,8 +85,9 @@ class install (Command):
         ('install-data=', None,
          "installation directory for data files"),
 
-        # For lazy debuggers who just want to test the install
-        # commands without rerunning "build" all the time
+        # Miscellaneous control options
+        ('force', 'f',
+         "force installation (overwrite any existing files)"),
         ('skip-build', None,
          "skip rebuilding everything (for testing/debugging)"),
 
@@ -146,6 +147,7 @@ class install (Command):
         self.extra_path = None
         self.install_path_file = 0
 
+        self.force = 0
         self.skip_build = 0
 
         # These are only here as a conduit from the 'build' command to the
index 9193f9192437a979ddadafa24b028ec11390051f..6cfc7d41f3476f3304f0e0beb18c01f3226a4c36 100644 (file)
@@ -22,18 +22,21 @@ class install_data (Command):
          "(default: installation base dir)"),
         ('root=', None,
          "install everything relative to this alternate root directory"),
+        ('force', 'f', "force installation (overwrite existing files)"),
         ]
 
     def initialize_options (self):
         self.install_dir = None
         self.outfiles = []
         self.root = None
+        self.force = 0
         self.data_files = self.distribution.data_files
 
     def finalize_options (self):
         self.set_undefined_options('install',
                                   ('install_data', 'install_dir'),
                                   ('root', 'root'),
+                                   ('force', 'force'),
                                  )
 
     def run (self):
index 2e6ce8690b7292a1f97df4221c94fe7f2929e872..5c06d574d61f80331aa06abc943908a73794f2b1 100644 (file)
@@ -17,16 +17,21 @@ class install_headers (Command):
 
     user_options = [('install-dir=', 'd',
                      "directory to install header files to"),
+                    ('force', 'f',
+                     "force installation (overwrite existing files)"),
                    ]
 
 
     def initialize_options (self):
         self.install_dir = None
+        self.force = 0
         self.outfiles = []
 
     def finalize_options (self):
         self.set_undefined_options('install',
-                                   ('install_headers', 'install_dir'))
+                                   ('install_headers', 'install_dir'),
+                                   ('force', 'force'))
+                                   
 
     def run (self):
         headers = self.distribution.headers
index 879a7d00e2153ec6308671f4395e672de63997c1..2d19e5b96a300757e7a1b0538a0b2af71242631c 100644 (file)
@@ -13,6 +13,7 @@ class install_lib (Command):
     user_options = [
         ('install-dir=', 'd', "directory to install to"),
         ('build-dir=','b', "build directory (where to install from)"),
+        ('force', 'f', "force installation (overwrite existing files)"),
         ('compile', 'c', "compile .py to .pyc"),
         ('optimize', 'o', "compile .py to .pyo (optimized)"),
         ('skip-build', None, "skip the build steps"),
@@ -23,6 +24,7 @@ class install_lib (Command):
         # let the 'install' command dictate our installation directory
         self.install_dir = None
         self.build_dir = None
+        self.force = 0
         self.compile = 1
         self.optimize = 1
         self.skip_build = None
@@ -35,6 +37,7 @@ class install_lib (Command):
         self.set_undefined_options ('install',
                                     ('build_lib', 'build_dir'),
                                     ('install_lib', 'install_dir'),
+                                    ('force', 'force'),
                                     ('compile_py', 'compile'),
                                     ('optimize_py', 'optimize'),
                                     ('skip_build', 'skip_build'),
index 3eb3963c95847eb6aa913814aa47fae5420ee721..d506f90f5110e8525cef23bf478b6ca547f89a77 100644 (file)
@@ -18,11 +18,13 @@ class install_scripts (Command):
     user_options = [
         ('install-dir=', 'd', "directory to install scripts to"),
         ('build-dir=','b', "build directory (where to install from)"),
+        ('force', 'f', "force installation (overwrite existing files)"),
         ('skip-build', None, "skip the build steps"),
     ]
 
     def initialize_options (self):
         self.install_dir = None
+        self.force = 0
         self.build_dir = None
         self.skip_build = None
 
@@ -30,13 +32,14 @@ class install_scripts (Command):
         self.set_undefined_options('build', ('build_scripts', 'build_dir'))
         self.set_undefined_options ('install',
                                     ('install_scripts', 'install_dir'),
+                                    ('force', 'force'),
                                     ('skip_build', 'skip_build'),
                                    )
 
     def run (self):
         if not self.skip_build:
             self.run_command('build_scripts')
-        self.outfiles = self.copy_tree (self.build_dir, self.install_dir)
+        self.outfiles = self.copy_tree(self.build_dir, self.install_dir)
         if os.name == 'posix':
             # Set the executable bits (owner, group, and world) on
             # all the scripts we just installed.