Added --force (-f) option to force installation (including bytecode
compilation).
This commit is contained in:
parent
1830b21186
commit
3a0310a328
|
@ -85,8 +85,9 @@ class install (Command):
|
||||||
('install-data=', None,
|
('install-data=', None,
|
||||||
"installation directory for data files"),
|
"installation directory for data files"),
|
||||||
|
|
||||||
# For lazy debuggers who just want to test the install
|
# Miscellaneous control options
|
||||||
# commands without rerunning "build" all the time
|
('force', 'f',
|
||||||
|
"force installation (overwrite any existing files)"),
|
||||||
('skip-build', None,
|
('skip-build', None,
|
||||||
"skip rebuilding everything (for testing/debugging)"),
|
"skip rebuilding everything (for testing/debugging)"),
|
||||||
|
|
||||||
|
@ -146,6 +147,7 @@ class install (Command):
|
||||||
self.extra_path = None
|
self.extra_path = None
|
||||||
self.install_path_file = 0
|
self.install_path_file = 0
|
||||||
|
|
||||||
|
self.force = 0
|
||||||
self.skip_build = 0
|
self.skip_build = 0
|
||||||
|
|
||||||
# These are only here as a conduit from the 'build' command to the
|
# These are only here as a conduit from the 'build' command to the
|
||||||
|
|
|
@ -22,18 +22,21 @@ class install_data (Command):
|
||||||
"(default: installation base dir)"),
|
"(default: installation base dir)"),
|
||||||
('root=', None,
|
('root=', None,
|
||||||
"install everything relative to this alternate root directory"),
|
"install everything relative to this alternate root directory"),
|
||||||
|
('force', 'f', "force installation (overwrite existing files)"),
|
||||||
]
|
]
|
||||||
|
|
||||||
def initialize_options (self):
|
def initialize_options (self):
|
||||||
self.install_dir = None
|
self.install_dir = None
|
||||||
self.outfiles = []
|
self.outfiles = []
|
||||||
self.root = None
|
self.root = None
|
||||||
|
self.force = 0
|
||||||
self.data_files = self.distribution.data_files
|
self.data_files = self.distribution.data_files
|
||||||
|
|
||||||
def finalize_options (self):
|
def finalize_options (self):
|
||||||
self.set_undefined_options('install',
|
self.set_undefined_options('install',
|
||||||
('install_data', 'install_dir'),
|
('install_data', 'install_dir'),
|
||||||
('root', 'root'),
|
('root', 'root'),
|
||||||
|
('force', 'force'),
|
||||||
)
|
)
|
||||||
|
|
||||||
def run (self):
|
def run (self):
|
||||||
|
|
|
@ -17,16 +17,21 @@ class install_headers (Command):
|
||||||
|
|
||||||
user_options = [('install-dir=', 'd',
|
user_options = [('install-dir=', 'd',
|
||||||
"directory to install header files to"),
|
"directory to install header files to"),
|
||||||
|
('force', 'f',
|
||||||
|
"force installation (overwrite existing files)"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def initialize_options (self):
|
def initialize_options (self):
|
||||||
self.install_dir = None
|
self.install_dir = None
|
||||||
|
self.force = 0
|
||||||
self.outfiles = []
|
self.outfiles = []
|
||||||
|
|
||||||
def finalize_options (self):
|
def finalize_options (self):
|
||||||
self.set_undefined_options('install',
|
self.set_undefined_options('install',
|
||||||
('install_headers', 'install_dir'))
|
('install_headers', 'install_dir'),
|
||||||
|
('force', 'force'))
|
||||||
|
|
||||||
|
|
||||||
def run (self):
|
def run (self):
|
||||||
headers = self.distribution.headers
|
headers = self.distribution.headers
|
||||||
|
|
|
@ -13,6 +13,7 @@ class install_lib (Command):
|
||||||
user_options = [
|
user_options = [
|
||||||
('install-dir=', 'd', "directory to install to"),
|
('install-dir=', 'd', "directory to install to"),
|
||||||
('build-dir=','b', "build directory (where to install from)"),
|
('build-dir=','b', "build directory (where to install from)"),
|
||||||
|
('force', 'f', "force installation (overwrite existing files)"),
|
||||||
('compile', 'c', "compile .py to .pyc"),
|
('compile', 'c', "compile .py to .pyc"),
|
||||||
('optimize', 'o', "compile .py to .pyo (optimized)"),
|
('optimize', 'o', "compile .py to .pyo (optimized)"),
|
||||||
('skip-build', None, "skip the build steps"),
|
('skip-build', None, "skip the build steps"),
|
||||||
|
@ -23,6 +24,7 @@ class install_lib (Command):
|
||||||
# let the 'install' command dictate our installation directory
|
# let the 'install' command dictate our installation directory
|
||||||
self.install_dir = None
|
self.install_dir = None
|
||||||
self.build_dir = None
|
self.build_dir = None
|
||||||
|
self.force = 0
|
||||||
self.compile = 1
|
self.compile = 1
|
||||||
self.optimize = 1
|
self.optimize = 1
|
||||||
self.skip_build = None
|
self.skip_build = None
|
||||||
|
@ -35,6 +37,7 @@ class install_lib (Command):
|
||||||
self.set_undefined_options ('install',
|
self.set_undefined_options ('install',
|
||||||
('build_lib', 'build_dir'),
|
('build_lib', 'build_dir'),
|
||||||
('install_lib', 'install_dir'),
|
('install_lib', 'install_dir'),
|
||||||
|
('force', 'force'),
|
||||||
('compile_py', 'compile'),
|
('compile_py', 'compile'),
|
||||||
('optimize_py', 'optimize'),
|
('optimize_py', 'optimize'),
|
||||||
('skip_build', 'skip_build'),
|
('skip_build', 'skip_build'),
|
||||||
|
|
|
@ -18,11 +18,13 @@ class install_scripts (Command):
|
||||||
user_options = [
|
user_options = [
|
||||||
('install-dir=', 'd', "directory to install scripts to"),
|
('install-dir=', 'd', "directory to install scripts to"),
|
||||||
('build-dir=','b', "build directory (where to install from)"),
|
('build-dir=','b', "build directory (where to install from)"),
|
||||||
|
('force', 'f', "force installation (overwrite existing files)"),
|
||||||
('skip-build', None, "skip the build steps"),
|
('skip-build', None, "skip the build steps"),
|
||||||
]
|
]
|
||||||
|
|
||||||
def initialize_options (self):
|
def initialize_options (self):
|
||||||
self.install_dir = None
|
self.install_dir = None
|
||||||
|
self.force = 0
|
||||||
self.build_dir = None
|
self.build_dir = None
|
||||||
self.skip_build = 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('build', ('build_scripts', 'build_dir'))
|
||||||
self.set_undefined_options ('install',
|
self.set_undefined_options ('install',
|
||||||
('install_scripts', 'install_dir'),
|
('install_scripts', 'install_dir'),
|
||||||
|
('force', 'force'),
|
||||||
('skip_build', 'skip_build'),
|
('skip_build', 'skip_build'),
|
||||||
)
|
)
|
||||||
|
|
||||||
def run (self):
|
def run (self):
|
||||||
if not self.skip_build:
|
if not self.skip_build:
|
||||||
self.run_command('build_scripts')
|
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':
|
if os.name == 'posix':
|
||||||
# Set the executable bits (owner, group, and world) on
|
# Set the executable bits (owner, group, and world) on
|
||||||
# all the scripts we just installed.
|
# all the scripts we just installed.
|
||||||
|
|
Loading…
Reference in New Issue