[Distutils] [issue92] [PATCH] Added download directory option
Eddy Pronk
setuptools at bugs.python.org
Fri Nov 6 22:59:14 CET 2009
New submission from Eddy Pronk <epronk at muftor.com>:
I added the option --download-directory to keep the downloaded archives so I can
install them on another machine.
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index af4e349..c58cf91 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -60,6 +60,8 @@ class easy_install(Command):
"no longer needed; don't use this"),
("build-directory=", "b",
"download/extract/build in DIR; keep the results"),
+ ("download-directory=", "z",
+ "download in DIR; keep the results"),
('optimize=', 'O',
"also compile with optimization: -O1 for \"python -O\", "
"-O2 for \"python -OO\", and -O0 to disable [default: -O0]"),
@@ -86,6 +88,7 @@ class easy_install(Command):
self.index_url = None
self.find_links = None
self.build_directory = None
+ self.download_directory = None
self.args = None
self.optimize = self.record = None
self.upgrade = self.always_copy = self.multi_version = None
@@ -208,7 +211,7 @@ class easy_install(Command):
log.set_verbosity(self.verbose)
try:
for spec in self.args:
- self.easy_install(spec, not self.no_deps)
+ self.easy_install(spec, deps=not self.no_deps)
if self.record:
outputs = self.outputs
if self.root: # strip any package prefix
@@ -410,15 +413,20 @@ Please make the appropriate changes for your system and
try again.
def easy_install(self, spec, deps=False):
tmpdir = tempfile.mkdtemp(prefix="easy_install-")
+ if self.download_directory:
+ download_directory = self.download_directory
+ else:
+ download_directory = tmpdir
+
download = None
if not self.editable: self.install_site_py()
try:
if not isinstance(spec,Requirement):
if URL_SCHEME(spec):
- # It's a url, download it to tmpdir and process
+ # It's a url, download it to download_directory and process
self.not_editable(spec)
- download = self.package_index.download(spec, tmpdir)
+ download = self.package_index.download(spec,
download_directory)
return self.install_item(None, download, tmpdir, deps, True)
elif os.path.exists(spec):
@@ -430,7 +438,7 @@ Please make the appropriate changes for your system and try
again.
self.check_editable(spec)
dist = self.package_index.fetch_distribution(
- spec, tmpdir, self.upgrade, self.editable, not self.always_copy,
+ spec, download_directory, self.upgrade, self.editable, not
self.always_copy,
self.local_index
)
if dist is None:
--
1.5.6.5
----------
messages: 458
nosy: epronk
priority: feature
status: unread
title: [PATCH] Added download directory option
_______________________________________________
Setuptools tracker <setuptools at bugs.python.org>
<http://bugs.python.org/setuptools/issue92>
_______________________________________________
More information about the Distutils-SIG
mailing list