Phillip J. Eby wrote:
At 06:31 PM 1/3/2008 -0600, Ian Bicking wrote:
Jeff Hammel and myself were going over a problem with -f seemingly being
ignored in easy_install, and it took us a while to realize that you have
to do something like "easy_install -f 'url1 url2 ...'", and you can't do
"easy_install -f url1 -f url2".

It's literally been years that I've been unaware of this, and confused
by the results.  I think easy_install should give an error if you
provide multiple -f's (or make it work if you do so).

easy_install inherits this issue from the distutils -- i.e., it uses distutils argument parsing, which doesn't support this. It's a bit of a hack that it supports positional arguments at all. :(

In some alternate universe in which I have the funding (and therefore time) to actually work on setuptools 0.7 and "nest", this and many other issues would certainly be fixable.

The attached patch gives a helpful error message if you give multiple -f options. I used sys.argv; I imagine there might be a more proper way to get the unparsed arguments, but I admit I didn't look too closely.

Obviously there are more correct solutions to this, but this addresses what I think is a substantial usability issue.

--
Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org
Index: setuptools/command/easy_install.py
===================================================================
--- setuptools/command/easy_install.py	(revision 59721)
+++ setuptools/command/easy_install.py	(working copy)
@@ -201,8 +201,26 @@
             raise DistutilsArgError(
                 "No urls, filenames, or requirements specified (see --help)")
 
+        self.check_for_multiple_find_links()
+
         self.outputs = []
 
+    def check_for_multiple_find_links(self):
+        find_links = []
+        links = []
+        args = sys.argv[1:]
+        for i in range(len(args)):
+            arg = args[i]
+            if arg.startswith('--find-links='):
+                find_links.append(arg)
+                links.append(arg[len('--find-links='):])
+            elif (arg == '--find-links' or arg == '-f') and args[i+1:]:
+                find_links.append('%s %s' % (arg, args[i+1]))
+                links.append(args[i+1])
+        if len(find_links) > 1:
+            raise DistutilsArgError(
+                'You cannot specify multiple --find-links options (%s).  Instead give one option with space-separated URLs, like --find-links "%s"' % (' '.join(find_links), ' '.join(links)))
+
     def run(self):
         if self.verbose<>self.distribution.verbose:
             log.set_verbosity(self.verbose)
_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to