1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

clean up temporary source code

This commit is contained in:
Qiangning Hong 2012-02-01 14:25:06 +08:00
parent 84a3f4ce69
commit fa773cdec6
3 changed files with 8 additions and 3 deletions

View file

@ -246,7 +246,7 @@ class InstallCommand(Command):
requirement_set.create_bundle(self.bundle_filename)
logger.notify('Created bundle in %s' % self.bundle_filename)
# Clean up
if not options.no_install:
if not options.no_install or options.download_dir:
requirement_set.cleanup_files(bundle=self.bundle)
return requirement_set

View file

@ -1047,6 +1047,8 @@ class RequirementSet(object):
self.add_requirement(subreq)
if req_to_install.name not in self.requirements:
self.requirements[req_to_install.name] = req_to_install
if self.is_download:
self.reqs_to_cleanup.append(req_to_install)
else:
self.reqs_to_cleanup.append(req_to_install)
@ -1104,7 +1106,10 @@ class RequirementSet(object):
else:
if self.download_cache:
self.download_cache = os.path.expanduser(self.download_cache)
return unpack_http_url(link, location, self.download_cache, self.download_dir)
retval = unpack_http_url(link, location, self.download_cache, self.download_dir)
if only_download:
_write_delete_marker_message(os.path.join(location, PIP_DELETE_MARKER_FILENAME))
return retval
def install(self, install_options, global_options=()):
"""Install everything in this set (after having downloaded and unpacked the packages)"""

View file

@ -36,6 +36,6 @@ def test_download_should_download_dependencies():
env = reset_env()
result = run_pip('install', 'Paste[openid]==1.7.5.1', '-d', '.', expect_error=True)
assert Path('scratch')/ 'Paste-1.7.5.1.tar.gz' in result.files_created
openid_tarball_prefix = str(Path('scratch')/ 'openid-')
openid_tarball_prefix = str(Path('scratch')/ 'python-openid-')
assert any(path.startswith(openid_tarball_prefix) for path in result.files_created)
assert env.site_packages/ 'openid' not in result.files_created