Kaydet (Commit) 74ead8ff authored tarafından Gregory P. Smith's avatar Gregory P. Smith

Added --skip-build option, so lazy debuggers/testers (mainly me) don't

have to wade through all the 'build' output when testing installation.
üst f8f2b98b
...@@ -77,6 +77,11 @@ class install (Command): ...@@ -77,6 +77,11 @@ 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
# commands without rerunning "build" all the time
('skip-build', None,
"skip rebuilding everything (for testing/debugging)"),
# Where to install documentation (eventually!) # Where to install documentation (eventually!)
#('doc-format=', None, "format of documentation to generate"), #('doc-format=', None, "format of documentation to generate"),
#('install-man=', None, "directory for Unix man pages"), #('install-man=', None, "directory for Unix man pages"),
...@@ -129,6 +134,8 @@ class install (Command): ...@@ -129,6 +134,8 @@ class install (Command):
self.extra_path = None self.extra_path = None
self.install_path_file = 0 self.install_path_file = 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
# 'install_*' commands that do the real work. ('build_base' isn't # 'install_*' commands that do the real work. ('build_base' isn't
# actually used anywhere, but it might be useful in future.) They # actually used anywhere, but it might be useful in future.) They
...@@ -270,7 +277,10 @@ class install (Command): ...@@ -270,7 +277,10 @@ class install (Command):
from distutils.fancy_getopt import longopt_xlate from distutils.fancy_getopt import longopt_xlate
print msg + ":" print msg + ":"
for opt in self.user_options: for opt in self.user_options:
opt_name = string.translate (opt[0][0:-1], longopt_xlate) opt_name = opt[0]
if opt_name[-1] == "=":
opt_name = opt_name[0:-1]
opt_name = string.translate (opt_name, longopt_xlate)
val = getattr (self, opt_name) val = getattr (self, opt_name)
print " %s: %s" % (opt_name, val) print " %s: %s" % (opt_name, val)
...@@ -409,7 +419,8 @@ class install (Command): ...@@ -409,7 +419,8 @@ class install (Command):
def run (self): def run (self):
# Obviously have to build before we can install # Obviously have to build before we can install
self.run_peer ('build') if not self.skip_build:
self.run_peer ('build')
# Run all sub-commands: currently this just means install all # Run all sub-commands: currently this just means install all
# Python modules using 'install_lib'. # Python modules using 'install_lib'.
......
...@@ -15,6 +15,7 @@ class install_lib (Command): ...@@ -15,6 +15,7 @@ class install_lib (Command):
('build-dir=','b', "build directory (where to install from)"), ('build-dir=','b', "build directory (where to install from)"),
('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"),
] ]
...@@ -24,6 +25,7 @@ class install_lib (Command): ...@@ -24,6 +25,7 @@ class install_lib (Command):
self.build_dir = None self.build_dir = None
self.compile = 1 self.compile = 1
self.optimize = 1 self.optimize = 1
self.skip_build = None
def finalize_options (self): def finalize_options (self):
...@@ -34,16 +36,19 @@ class install_lib (Command): ...@@ -34,16 +36,19 @@ class install_lib (Command):
('build_lib', 'build_dir'), ('build_lib', 'build_dir'),
('install_lib', 'install_dir'), ('install_lib', 'install_dir'),
('compile_py', 'compile'), ('compile_py', 'compile'),
('optimize_py', 'optimize')) ('optimize_py', 'optimize'),
('skip_build', 'skip_build'),
)
def run (self): def run (self):
# Make sure we have built everything we need first # Make sure we have built everything we need first
if self.distribution.has_pure_modules(): if not self.skip_build:
self.run_peer ('build_py') if self.distribution.has_pure_modules():
if self.distribution.has_ext_modules(): self.run_peer ('build_py')
self.run_peer ('build_ext') if self.distribution.has_ext_modules():
self.run_peer ('build_ext')
# Install everything: simply dump the entire contents of the build # Install everything: simply dump the entire contents of the build
# directory to the installation directory (that's the beauty of # directory to the installation directory (that's the beauty of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment