Erik Bray avatar Erik Bray committed 488cc8a

First stab at a fix. The hack that allows it to work is that it allows the easy_install command to take a '-' argument which simply means 'don't run', so that arguments can be passed to the easy_install command from the comannd line without running it.

Comments (0)

Files changed (3)

setuptools/command/easy_install.py

                     )
                 else:
                     self.all_site_dirs.append(normalize_path(d))
-        if not self.editable: self.check_site_dir()
+        if not self.editable and self.args != ['-']:
+            self.check_site_dir()
         self.index_url = self.index_url or "http://pypi.python.org/simple"
         self.shadow_path = self.all_site_dirs[:]
         for path_item in self.install_dir, normalize_path(self.script_dir):
                             'install_scripts', 'install_data',])
 
     def run(self):
+        if self.args == ['-']:
+            # A single dash as an argument means 'do nothing' and is just a way
+            # to pass arguments to the easy_install command without running it
+            return
+
         if self.verbose != self.distribution.verbose:
             log.set_verbosity(self.verbose)
         try:
         )
         try:
             args.append(dist_dir)
+            ei_opts = self.distribution.get_option_dict('easy_install').copy()
+            keep = (
+                'find_links', 'site_dirs', 'index_url', 'optimize',
+                'site_dirs', 'allow_hosts'
+            )
+            for key in ei_opts.keys():
+                if key not in keep:
+                    del ei_opts[key]
+            if ei_opts:
+                args.append('easy_install')
+                for key, val in ei_opts.iteritems():
+                    args.append('--%s=%s' % (key.replace('_', '-'), val[1]))
+                args.append('-')
+
             self.run_setup(setup_script, setup_base, args)
             all_eggs = Environment([dist_dir])
             eggs = []

setuptools/dist.py

             cmd.package_index.to_scan = []
         except AttributeError:
             from setuptools.command.easy_install import easy_install
-            dist = self.__class__({'script_args':['easy_install']})
+            dist = self.__class__()
             dist.parse_config_files()
+            dist.parse_command_line()
             opts = dist.get_option_dict('easy_install')
             keep = (
                 'find_links', 'site_dirs', 'index_url', 'optimize',

setuptools/package_index.py

 
 
 
-# this line is a kludge to keep the trailing blank lines for pje's editor
+# this line is a kludge to keep the trailing blank lines for pje's editor
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.