ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> distutils-sig
distutils-sig
[Distutils] [issue92] [PATCH] Added download directory option
by Eddy Pronk other posts by this author
Nov 6 2009 2:08PM messages near this date
[Distutils] [issue93] SandboxViolation when opening os.devnull | [Distutils] People want CPAN :-)
New submission from Eddy Pronk <epronk@[...].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@[...].org> 
<http://bugs.python.org/setuptools/issue92> 
_______________________________________________
_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@[...].org
http://mail.python.org/mailman/listinfo/distutils-sig

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved