1. Robert Myers
  2. pip

Commits

Robert Myers  committed 6c8aad1

updating install lib with hacked setup.py file

  • Participants
  • Parent commits 7338f5e
  • Branches default

Comments (0)

Files changed (1)

File pip/commands/install_lib.py

View file
 from pip.index import PackageFinder
 from pip.exceptions import InstallationError
 
+SETUP_PY = """
+# Fake setup.py file created by pip
+from setuptools import setup
+setup(name='%s',
+      version='%s')
+"""
+
+class LibInstallRequirement(InstallRequirement):
+    
+    @property
+    def setup_py(self):
+        # check if we need to make a fake 'setup.py' file.
+        setup_file = os.path.join(self.source_dir, 'setup.py')
+        if os.path.isfile(setup_file):
+            return setup_file
+        s = open(setup_file, 'w')
+        s.write(SETUP_PY % (self.req.project_name, self.req.specs[0][1]))
+        s.close()
+        return setup_file
 
 class InstallLibCommand(Command):
     name = 'install_lib'
             help='Install all the packages listed in the given requirements file.  '
             'This option can be used multiple times.')
         self.parser.add_option(
+            '--src', '--source', '--source-dir', '--source-directory',
+            dest='src_dir',
+            metavar='DIR',
+            default=None,
+            help='Check out --editable packages into DIR (default %s)' % src_prefix)
+        self.parser.add_option(
             '-f', '--find-links',
             dest='find_links',
             action='append',
             metavar='URL',
             help='URL to look for packages at')
         self.parser.add_option(
+            '-i', '--index-url', '--pypi-url',
+            dest='index_url',
+            metavar='URL',
+            default='http://pypi.python.org/simple/',
+            help='Base URL of Python Package Index (default %default)')
+        self.parser.add_option(
+            '--extra-index-url',
+            dest='extra_index_urls',
+            metavar='URL',
+            action='append',
+            default=[],
+            help='Extra URLs of package indexes to use in addition to --index-url')
+        self.parser.add_option(
+            '--no-index',
+            dest='no_index',
+            action='store_true',
+            default=False,
+            help='Ignore package index (only looking at --find-links URLs instead)')
+        self.parser.add_option(
             '--mirrors',
             dest='mirrors',
             metavar='URL',
             action='append',
             default=[],
             help='Specific mirror URLs to query when --use-mirrors is used')
-
+        self.parser.add_option(
+            '-M', '--use-mirrors',
+            dest='use_mirrors',
+            action='store_true',
+            default=False,
+            help='Use the PyPI mirrors as a fallback in case the main index is down.')
         self.parser.add_option(
             '-b', '--build', '--build-dir', '--build-directory',
             dest='build_dir',
         self.parser.add_option(
             '--configure-command',
             dest='configure_command',
-            action='./configure --prefix=$VIRTUAL_ENV',
+            default='./configure --prefix=$VIRTUAL_ENV',
             help="Specify the configure command to be run.")
 
         self.parser.add_option(
             options.ignore_installed = True
         options.build_dir = os.path.abspath(options.build_dir)
         options.src_dir = os.path.abspath(options.src_dir)
-        install_options = options.install_options or []
+        install_options = []
         if options.use_user_site:
             install_options.append('--user')
-        global_options = options.global_options or []
+        global_options = []
         index_urls = [options.index_url] + options.extra_index_urls
         if options.no_index:
             logger.notify('Ignoring indexes: %s' % ','.join(index_urls))
             download_dir=options.download_dir,
             download_cache=options.download_cache,
             upgrade=options.upgrade,
-            ignore_installed=options.ignore_installed,
-            ignore_dependencies=options.ignore_dependencies)
+            ignore_installed=options.ignore_installed)
         for name in args:
             requirement_set.add_requirement(
-                InstallRequirement.from_line(name, None))
-        for name in options.editables:
-            requirement_set.add_requirement(
-                InstallRequirement.from_editable(name, default_vcs=options.default_vcs))
+                LibInstallRequirement.from_line(name, None))
+#        for name in options.editables:
+#            requirement_set.add_requirement(
+#                InstallRequirement.from_editable(name, default_vcs=options.default_vcs))
         for filename in options.requirements:
             for req in parse_requirements(filename, finder=finder, options=options):
                 requirement_set.add_requirement(req)