Commits

Ronny Pfannschmidt  committed c99dc7f

initial

  • Participants

Comments (0)

Files changed (5)

File custom-userbase

+# HG changeset patch
+# Parent 17250062114b72ef018755f2f307e3598139c54a
+use a cusom PYTHONUSERBASE for testing --user
+
+diff --git a/tests/test_pip.py b/tests/test_pip.py
+--- a/tests/test_pip.py
++++ b/tests/test_pip.py
+@@ -294,6 +294,9 @@ class TestPipEnvironment(TestFileEnviron
+         assert self.venv == TestPipEnvironment.venv # sanity check
+ 
+         self.site_packages = self.lib/'site-packages'
++        self.user_base = self.lib/'../user'
++        demand_dirs(self.user_base)
++        self.environ["PYTHONUSERBASE"] = self.user_base
+ 
+         # put the test-scratch virtualenv's bin dir first on the PATH
+         self.environ['PATH'] = Path.pathsep.join((self.bin_path, self.environ['PATH']))

File options-for-editable

+# HG changeset patch
+# Parent 7f57b700d9cc20af9182dad73a3951850aa5e823
+support install/global options for editables
+
+diff --git a/pip/req.py b/pip/req.py
+--- a/pip/req.py
++++ b/pip/req.py
+@@ -531,7 +531,7 @@ execfile(__file__)
+ 
+     def install(self, install_options, global_options=()):
+         if self.editable:
+-            self.install_editable()
++            self.install_editable(install_options, global_options)
+             return
+         temp_location = tempfile.mkdtemp('-record', 'pip-')
+         record_filename = os.path.join(temp_location, 'install-record.txt')
+@@ -603,15 +603,17 @@ execfile(__file__)
+                 rmtree(self._temp_build_dir)
+             self._temp_build_dir = None
+ 
+-    def install_editable(self):
++    def install_editable(self, install_options, global_options=()):
+         logger.notify('Running setup.py develop for %s' % self.name)
+         logger.indent += 2
+         try:
+             ## FIXME: should we do --install-headers here too?
+             call_subprocess(
+                 [sys.executable, '-c',
+-                 "import setuptools; __file__=%r; execfile(%r)" % (self.setup_py, self.setup_py),
+-                 'develop', '--no-deps'], cwd=self.source_dir, filter_stdout=self._filter_install,
++                 "import setuptools; __file__=%r; execfile(%r)" % (self.setup_py, self.setup_py)]
++                + list(global_options) + ['develop', '--no-deps'] + list(install_options),
++
++                cwd=self.source_dir, filter_stdout=self._filter_install,
+                 show_stdout=False)
+         finally:
+             logger.indent -= 2
+options-for-editable
+custom-userbase
+user-alias
+dec82745fec19c89edd75bf0cebc6f14794a030f:options-for-editable
+33dbadf465784fc612795d94fd4a88db53ed3961:custom-userbase
+ab6952246c6e1c0d315738281980a7efb771a54b:user-alias
+# HG changeset patch
+# Parent 17250062114b72ef018755f2f307e3598139c54a
+add a --user alias for --install-opt=--user
+
+diff --git a/pip/commands/install.py b/pip/commands/install.py
+--- a/pip/commands/install.py
++++ b/pip/commands/install.py
+@@ -130,6 +130,18 @@ class InstallCommand(Command):
+             help="Extra global options to be supplied to the setup.py"
+             "call before the install command")
+ 
++        def add_user_flag_callback(option, opt_str, value, parser):
++            if not hasattr(parser, 'install_options'):
++                parser.install_options = []
++            parser.install_options.append('--user')
++
++        self.parser.add_option(
++            '--user',
++            action='callback',
++            nargs=0,
++            callback=add_user_flag_callback,
++            help='Install to user-site')
++
+     def _build_package_finder(self, options, index_urls):
+         """
+         Create a package finder appropriate to this install command.