--no-clean for 'pip wheel'

This commit is contained in:
Marcus Smith 2013-05-24 17:11:15 -07:00
parent 41fed83353
commit 6fd5e0eb7a
4 changed files with 25 additions and 8 deletions

View File

@ -119,6 +119,12 @@ global_options = make_option(
help="Extra global options to be supplied to the setup.py "
"call before the install command.")
no_clean = make_option(
'--no-clean',
action='store_true',
default=False,
help="Don't clean up build directories.")
##########
# groups #

View File

@ -145,11 +145,7 @@ class InstallCommand(Command):
default=False,
help="Include pre-release and development versions. By default, pip only finds stable versions.")
cmd_opts.add_option(
'--no-clean',
action='store_true',
default=False,
help="Don't delete build directories after installs or errors.")
cmd_opts.add_option(cmdoptions.no_clean)
index_opts = cmdoptions.make_option_group(cmdoptions.index_group, self.parser)

View File

@ -69,6 +69,8 @@ class WheelCommand(Command):
help="Extra global options to be supplied to the setup.py "
"call before the 'bdist_wheel' command.")
cmd_opts.add_option(cmdoptions.no_clean)
index_opts = cmdoptions.make_option_group(cmdoptions.index_group, self.parser)
self.parser.insert_option_group(0, index_opts)
@ -139,5 +141,6 @@ class WheelCommand(Command):
)
wb.build()
finally:
requirement_set.cleanup_files()
if not options.no_clean:
requirement_set.cleanup_files()

View File

@ -20,15 +20,27 @@ def test_cleanup_after_install():
assert not exists(src), "unexpected src/ dir exists: %s" % src
env.assert_no_temp()
def test_no_clean_option_blocks_cleaning():
def test_no_clean_option_blocks_cleaning_after_install():
"""
Test --no-clean option blocks cleaning.
Test --no-clean option blocks cleaning after install
"""
env = reset_env()
result = run_pip('install', '--no-clean', '--no-index', '--find-links=%s' % find_links, 'simple')
build = env.venv_path/'build'/'simple'
assert exists(build), "build/simple should still exist %s" % str(result)
def test_no_clean_option_blocks_cleaning_after_wheel():
"""
Test --no-clean option blocks cleaning after wheel build
"""
env = reset_env(use_distribute=True)
run_pip('install', 'wheel')
result = run_pip('wheel', '--no-clean', '--no-index', '--find-links=%s' % find_links, 'simple')
build = env.venv_path/'build'/'simple'
assert exists(build), "build/simple should still exist %s" % str(result)
def test_cleanup_after_install_editable_from_hg():
"""
Test clean up after cloning from Mercurial.