Added --force (-f) option to force installation (including bytecode

compilation).
This commit is contained in:
Greg Ward 2000-09-13 01:02:25 +00:00
parent 1830b21186
commit 3a0310a328
5 changed files with 20 additions and 4 deletions

View 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

View 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):

View 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

View 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'),

View 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.