Beispiel #1
0
 def run(self, options, args):
     if not options.build_dir:
         options.build_dir = build_prefix
     if not options.src_dir:
         options.src_dir = src_prefix
     if options.download_dir:
         options.no_install = True
         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 []
     index_urls = [options.index_url] + options.extra_index_urls
     if options.no_index:
         logger.notify('Ignoring indexes: %s' % ','.join(index_urls))
         index_urls = []
     finder = PackageFinder(
         find_links=options.find_links,
         index_urls=index_urls)
     requirement_set = RequirementSet(
         build_dir=options.build_dir,
         src_dir=options.src_dir,
         download_dir=options.download_dir,
         download_cache=options.download_cache,
         upgrade=options.upgrade,
         ignore_installed=options.ignore_installed,
         ignore_dependencies=options.ignore_dependencies)
     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))
     for filename in options.requirements:
         for req in parse_requirements(filename, finder=finder, options=options):
             requirement_set.add_requirement(req)
     if not options.no_download:
         requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
     else:
         requirement_set.locate_files()
     if not options.no_install and not self.bundle:
         requirement_set.install(install_options)
         installed = ' '.join([req.name for req in
                               requirement_set.successfully_installed])
         if installed:
             logger.notify('Successfully installed %s' % installed)
     elif not self.bundle:
         downloaded = ' '.join([req.name for req in
                                requirement_set.successfully_downloaded])
         if downloaded:
             logger.notify('Successfully downloaded %s' % downloaded)
     elif self.bundle:
         requirement_set.create_bundle(self.bundle_filename)
         logger.notify('Created bundle in %s' % self.bundle_filename)
     # Clean up
     if not options.no_install:
         requirement_set.cleanup_files(bundle=self.bundle)
     return requirement_set
Beispiel #2
0
    def run(self, options, args):
        if options.download_dir:
            options.no_install = True
            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 []
        if options.use_user_site:
            if virtualenv_no_global():
                raise InstallationError("Can not perform a '--user' install. User site-packages are not visible in this virtualenv.")
            install_options.append('--user')
        if options.target_dir:
            options.ignore_installed = True
            temp_target_dir = tempfile.mkdtemp()
            options.target_dir = os.path.abspath(options.target_dir)
            if os.path.exists(options.target_dir) and not os.path.isdir(options.target_dir):
                raise CommandError("Target path exists but is not a directory, will not continue.")
            install_options.append('--home=' + temp_target_dir)
        global_options = options.global_options or []
        index_urls = [options.index_url] + options.extra_index_urls
        if options.no_index:
            logger.notify('Ignoring indexes: %s' % ','.join(index_urls))
            index_urls = []

        finder = self._build_package_finder(options, index_urls)

        requirement_set = RequirementSet(
            build_dir=options.build_dir,
            src_dir=options.src_dir,
            download_dir=options.download_dir,
            download_cache=options.download_cache,
            upgrade=options.upgrade,
            as_egg=options.as_egg,
            ignore_installed=options.ignore_installed,
            ignore_dependencies=options.ignore_dependencies,
            force_reinstall=options.force_reinstall,
            use_user_site=options.use_user_site)
        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))
        for filename in options.requirements:
            for req in parse_requirements(filename, finder=finder, options=options):
                requirement_set.add_requirement(req)
        if not requirement_set.has_requirements:
            opts = {'name': self.name}
            if options.find_links:
                msg = ('You must give at least one requirement to %(name)s '
                       '(maybe you meant "pip %(name)s %(links)s"?)' %
                       dict(opts, links=' '.join(options.find_links)))
            else:
                msg = ('You must give at least one requirement '
                       'to %(name)s (see "pip help %(name)s")' % opts)
            logger.warn(msg)
            return

        if (options.use_user_site and
            sys.version_info < (2, 6)):
            raise InstallationError('--user is only supported in Python version 2.6 and newer')

        import setuptools
        if (options.use_user_site and
            requirement_set.has_editables and
            not getattr(setuptools, '_distribute', False)):

            raise InstallationError('--user --editable not supported with setuptools, use distribute')

        if not options.no_download:
            requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
        else:
            requirement_set.locate_files()

        if not options.no_install and not self.bundle:
            requirement_set.install(install_options, global_options)
            installed = ' '.join([req.name for req in
                                  requirement_set.successfully_installed])
            if installed:
                logger.notify('Successfully installed %s' % installed)
        elif not self.bundle:
            downloaded = ' '.join([req.name for req in
                                   requirement_set.successfully_downloaded])
            if downloaded:
                logger.notify('Successfully downloaded %s' % downloaded)
        elif self.bundle:
            requirement_set.create_bundle(self.bundle_filename)
            logger.notify('Created bundle in %s' % self.bundle_filename)
        # Clean up
        if not options.no_install or options.download_dir:
            requirement_set.cleanup_files(bundle=self.bundle)
        if options.target_dir:
            if not os.path.exists(options.target_dir):
                os.makedirs(options.target_dir)
            lib_dir = home_lib(temp_target_dir)
            for item in os.listdir(lib_dir):
                shutil.move(
                    os.path.join(lib_dir, item),
                    os.path.join(options.target_dir, item)
                    )
            shutil.rmtree(temp_target_dir)
        return requirement_set
Beispiel #3
0
    def run(self, options, args):
        if not options.build_dir:
            options.build_dir = build_prefix
        if not options.src_dir:
            options.src_dir = src_prefix
        if options.download_dir:
            options.no_install = True
            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 []
        if options.use_user_site:
            install_options.append('--user')
        global_options = options.global_options or []
        index_urls = [options.index_url] + options.extra_index_urls
        if options.no_index:
            logger.notify('Ignoring indexes: %s' % ','.join(index_urls))
            index_urls = []

        finder = self._build_package_finder(options, index_urls)

        requirement_set = RequirementSet(
            build_dir=options.build_dir,
            src_dir=options.src_dir,
            download_dir=options.download_dir,
            download_cache=options.download_cache,
            upgrade=options.upgrade,
            ignore_installed=options.ignore_installed,
            ignore_dependencies=options.ignore_dependencies)
        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))
        for filename in options.requirements:
            for req in parse_requirements(filename,
                                          finder=finder,
                                          options=options):
                requirement_set.add_requirement(req)

        if not requirement_set.has_requirements:
            if options.find_links:
                raise InstallationError(
                    'You must give at least one '
                    'requirement to %s (maybe you meant "pip install %s"?)' %
                    (self.name, " ".join(options.find_links)))
            raise InstallationError('You must give at least one requirement '
                                    'to %(name)s (see "pip help %(name)s")' %
                                    dict(name=self.name))

        if (options.use_user_site and sys.version_info < (2, 6)):
            raise InstallationError(
                '--user is only supported in Python version 2.6 and newer')

        import setuptools
        if (options.use_user_site and requirement_set.has_editables
                and not getattr(setuptools, '_distribute', False)):

            raise InstallationError(
                '--user --editable not supported with setuptools, use distribute'
            )

        if not options.no_download:
            requirement_set.prepare_files(finder,
                                          force_root_egg_info=self.bundle,
                                          bundle=self.bundle)
        else:
            requirement_set.locate_files()

        if not options.no_install and not self.bundle:
            requirement_set.install(install_options, global_options)
            installed = ' '.join(
                [req.name for req in requirement_set.successfully_installed])
            if installed:
                logger.notify('Successfully installed %s' % installed)
        elif not self.bundle:
            downloaded = ' '.join(
                [req.name for req in requirement_set.successfully_downloaded])
            if downloaded:
                logger.notify('Successfully downloaded %s' % downloaded)
        elif self.bundle:
            requirement_set.create_bundle(self.bundle_filename)
            logger.notify('Created bundle in %s' % self.bundle_filename)
        # Clean up
        if not options.no_install:
            requirement_set.cleanup_files(bundle=self.bundle)
        return requirement_set
Beispiel #4
0
    def run(self, options, args):

        if (options.no_install or options.no_download or options.build_dir
                or options.no_clean):
            logger.deprecated(
                '1.7', 'DEPRECATION: --no-install, --no-download, --build, '
                'and --no-clean are deprecated.  See https://github.com/pypa/pip/issues/906.'
            )

        if options.download_dir:
            options.no_install = True
            options.ignore_installed = True

        # If we have --no-install or --no-download and no --build we use the
        # legacy static build dir
        if (options.build_dir is None
                and (options.no_install or options.no_download)):
            options.build_dir = build_prefix

        if options.build_dir:
            options.build_dir = os.path.abspath(options.build_dir)

        options.src_dir = os.path.abspath(options.src_dir)
        install_options = options.install_options or []
        if options.use_user_site:
            if virtualenv_no_global():
                raise InstallationError(
                    "Can not perform a '--user' install. User site-packages are not visible in this virtualenv."
                )
            install_options.append('--user')

        temp_target_dir = None
        if options.target_dir:
            options.ignore_installed = True
            temp_target_dir = tempfile.mkdtemp()
            options.target_dir = os.path.abspath(options.target_dir)
            if os.path.exists(options.target_dir) and not os.path.isdir(
                    options.target_dir):
                raise CommandError(
                    "Target path exists but is not a directory, will not continue."
                )
            install_options.append('--home=' + temp_target_dir)

        global_options = options.global_options or []
        index_urls = [options.index_url] + options.extra_index_urls
        if options.no_index:
            logger.notify('Ignoring indexes: %s' % ','.join(index_urls))
            index_urls = []

        if options.use_mirrors:
            logger.deprecated(
                "1.7", "--use-mirrors has been deprecated and will be removed"
                " in the future. Explicit uses of --index-url and/or "
                "--extra-index-url is suggested.")

        if options.mirrors:
            logger.deprecated(
                "1.7", "--mirrors has been deprecated and will be removed in "
                " the future. Explicit uses of --index-url and/or "
                "--extra-index-url is suggested.")
            index_urls += options.mirrors

        session = self._build_session(options)

        finder = self._build_package_finder(options, index_urls, session)

        build_delete = (not (options.no_clean or options.build_dir))
        with BuildDirectory(options.build_dir,
                            delete=build_delete) as build_dir:
            requirement_set = RequirementSet(
                build_dir=build_dir,
                src_dir=options.src_dir,
                download_dir=options.download_dir,
                download_cache=options.download_cache,
                upgrade=options.upgrade,
                as_egg=options.as_egg,
                ignore_installed=options.ignore_installed,
                ignore_dependencies=options.ignore_dependencies,
                force_reinstall=options.force_reinstall,
                use_user_site=options.use_user_site,
                target_dir=temp_target_dir,
                session=session,
                pycompile=options.compile,
            )
            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))
            for filename in options.requirements:
                for req in parse_requirements(filename,
                                              finder=finder,
                                              options=options,
                                              session=session):
                    requirement_set.add_requirement(req)
            if not requirement_set.has_requirements:
                opts = {'name': self.name}
                if options.find_links:
                    msg = (
                        'You must give at least one requirement to %(name)s '
                        '(maybe you meant "pip %(name)s %(links)s"?)' %
                        dict(opts, links=' '.join(options.find_links)))
                else:
                    msg = ('You must give at least one requirement '
                           'to %(name)s (see "pip help %(name)s")' % opts)
                logger.warn(msg)
                return

            try:
                if not options.no_download:
                    requirement_set.prepare_files(
                        finder,
                        force_root_egg_info=self.bundle,
                        bundle=self.bundle)
                else:
                    requirement_set.locate_files()

                if not options.no_install and not self.bundle:
                    requirement_set.install(install_options,
                                            global_options,
                                            root=options.root_path)
                    installed = ' '.join([
                        req.name
                        for req in requirement_set.successfully_installed
                    ])
                    if installed:
                        logger.notify('Successfully installed %s' % installed)
                elif not self.bundle:
                    downloaded = ' '.join([
                        req.name
                        for req in requirement_set.successfully_downloaded
                    ])
                    if downloaded:
                        logger.notify('Successfully downloaded %s' %
                                      downloaded)
                elif self.bundle:
                    requirement_set.create_bundle(self.bundle_filename)
                    logger.notify('Created bundle in %s' %
                                  self.bundle_filename)
            except PreviousBuildDirError:
                options.no_clean = True
                raise
            finally:
                # Clean up
                if (not options.no_clean) and ((not options.no_install)
                                               or options.download_dir):
                    requirement_set.cleanup_files(bundle=self.bundle)

        if options.target_dir:
            if not os.path.exists(options.target_dir):
                os.makedirs(options.target_dir)
            lib_dir = distutils_scheme('', home=temp_target_dir)['purelib']
            for item in os.listdir(lib_dir):
                shutil.move(os.path.join(lib_dir, item),
                            os.path.join(options.target_dir, item))
            shutil.rmtree(temp_target_dir)
        return requirement_set
Beispiel #5
0
    def run(self, options, args):
        if not options.build_dir:
            options.build_dir = build_prefix
        if not options.src_dir:
            options.src_dir = src_prefix
        if options.download_dir:
            options.no_install = True
            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 []
        if options.use_user_site:
            install_options.append('--user')
        global_options = options.global_options or []
        index_urls = [options.index_url] + options.extra_index_urls
        if options.no_index:
            logger.notify('Ignoring indexes: %s' % ','.join(index_urls))
            index_urls = []

        finder = self._build_package_finder(options, index_urls)

        requirement_set = RequirementSet(
            build_dir=options.build_dir,
            src_dir=options.src_dir,
            download_dir=options.download_dir,
            download_cache=options.download_cache,
            upgrade=options.upgrade,
            ignore_installed=options.ignore_installed,
            ignore_dependencies=options.ignore_dependencies)
        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))
        for filename in options.requirements:
            for req in parse_requirements(filename, finder=finder, options=options):
                requirement_set.add_requirement(req)

        if not requirement_set.has_requirements:
            if options.find_links:
                raise InstallationError('You must give at least one '
                    'requirement to %s (maybe you meant "pip install %s"?)'
                    % (self.name, " ".join(options.find_links)))
            raise InstallationError('You must give at least one requirement '
                'to %(name)s (see "pip help %(name)s")' % dict(name=self.name))

        if (options.use_user_site and
            sys.version_info < (2, 6)):
            raise InstallationError('--user is only supported in Python version 2.6 and newer')

        import setuptools
        if (options.use_user_site and
            requirement_set.has_editables and
            not getattr(setuptools, '_distribute', False)):

            raise InstallationError('--user --editable not supported with setuptools, use distribute')

        if not options.no_download:
            requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
        else:
            requirement_set.locate_files()

        if not options.no_install and not self.bundle:
            requirement_set.install(install_options, global_options)
            installed = ' '.join([req.name for req in
                                  requirement_set.successfully_installed])
            if installed:
                logger.notify('Successfully installed %s' % installed)
        elif not self.bundle:
            downloaded = ' '.join([req.name for req in
                                   requirement_set.successfully_downloaded])
            if downloaded:
                logger.notify('Successfully downloaded %s' % downloaded)
        elif self.bundle:
            requirement_set.create_bundle(self.bundle_filename)
            logger.notify('Created bundle in %s' % self.bundle_filename)
        # Clean up
        if not options.no_install:
            requirement_set.cleanup_files(bundle=self.bundle)
        return requirement_set
Beispiel #6
0
 def run(self, options, args):
     if not options.build_dir:
         options.build_dir = build_prefix
     if not options.src_dir:
         options.src_dir = src_prefix
     if options.download_dir:
         options.no_install = True
         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 []
     index_urls = [options.index_url] + options.extra_index_urls
     if options.no_index:
         logger.notify('Ignoring indexes: %s' % ','.join(index_urls))
         index_urls = []
     finder = PackageFinder(find_links=options.find_links,
                            index_urls=index_urls)
     requirement_set = RequirementSet(
         build_dir=options.build_dir,
         src_dir=options.src_dir,
         download_dir=options.download_dir,
         download_cache=options.download_cache,
         upgrade=options.upgrade,
         ignore_installed=options.ignore_installed,
         ignore_dependencies=options.ignore_dependencies)
     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))
     for filename in options.requirements:
         for req in parse_requirements(filename,
                                       finder=finder,
                                       options=options):
             requirement_set.add_requirement(req)
     if not options.no_download:
         requirement_set.prepare_files(finder,
                                       force_root_egg_info=self.bundle,
                                       bundle=self.bundle)
     else:
         requirement_set.locate_files()
     if not options.no_install and not self.bundle:
         requirement_set.install(install_options)
         installed = ' '.join(
             [req.name for req in requirement_set.successfully_installed])
         if installed:
             logger.notify('Successfully installed %s' % installed)
     elif not self.bundle:
         downloaded = ' '.join(
             [req.name for req in requirement_set.successfully_downloaded])
         if downloaded:
             logger.notify('Successfully downloaded %s' % downloaded)
     elif self.bundle:
         requirement_set.create_bundle(self.bundle_filename)
         logger.notify('Created bundle in %s' % self.bundle_filename)
     # Clean up
     if not options.no_install:
         requirement_set.cleanup_files(bundle=self.bundle)
     return requirement_set
Beispiel #7
0
    def run(self, options, args):

        if (
                            options.no_install or
                            options.no_download or
                        (options.build_dir != build_prefix) or
                    options.no_clean
        ):
            logger.deprecated('1.7', 'DEPRECATION: --no-install, --no-download, --build, '
                                     'and --no-clean are deprecated.  See https://github.com/pypa/pip/issues/906.')

        if options.download_dir:
            options.no_install = True
            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 []
        if options.use_user_site:
            if virtualenv_no_global():
                raise InstallationError(
                    "Can not perform a '--user' install. User site-packages are not visible in this virtualenv.")
            install_options.append('--user')

        temp_target_dir = None
        if options.target_dir:
            options.ignore_installed = True
            temp_target_dir = tempfile.mkdtemp()
            options.target_dir = os.path.abspath(options.target_dir)
            if os.path.exists(options.target_dir) and not os.path.isdir(options.target_dir):
                raise CommandError("Target path exists but is not a directory, will not continue.")
            install_options.append('--home=' + temp_target_dir)

        global_options = options.global_options or []
        index_urls = [options.index_url] + options.extra_index_urls
        if options.no_index:
            logger.notify('Ignoring indexes: %s' % ','.join(index_urls))
            index_urls = []

        if options.use_mirrors:
            logger.deprecated("1.7",
                              "--use-mirrors has been deprecated and will be removed"
                              " in the future. Explicit uses of --index-url and/or "
                              "--extra-index-url is suggested.")

        if options.mirrors:
            logger.deprecated("1.7",
                              "--mirrors has been deprecated and will be removed in "
                              " the future. Explicit uses of --index-url and/or "
                              "--extra-index-url is suggested.")
            index_urls += options.mirrors

        session = self._build_session(options)

        finder = self._build_package_finder(options, index_urls, session)

        requirement_set = RequirementSet(
            build_dir=options.build_dir,
            src_dir=options.src_dir,
            download_dir=options.download_dir,
            download_cache=options.download_cache,
            upgrade=options.upgrade,
            as_egg=options.as_egg,
            ignore_installed=options.ignore_installed,
            ignore_dependencies=options.ignore_dependencies,
            force_reinstall=options.force_reinstall,
            use_user_site=options.use_user_site,
            target_dir=temp_target_dir,
            session=session,
            pycompile=options.compile,
        )
        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))
        for filename in options.requirements:
            for req in parse_requirements(filename, finder=finder, options=options, session=session):
                requirement_set.add_requirement(req)
        if not requirement_set.has_requirements:
            opts = {'name': self.name}
            if options.find_links:
                msg = ('You must give at least one requirement to %(name)s '
                       '(maybe you meant "pip %(name)s %(links)s"?)' %
                       dict(opts, links=' '.join(options.find_links)))
            else:
                msg = ('You must give at least one requirement '
                       'to %(name)s (see "pip help %(name)s")' % opts)
            logger.warn(msg)
            return

        try:
            if not options.no_download:
                requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
            else:
                requirement_set.locate_files()

            if not options.no_install and not self.bundle:
                requirement_set.install(install_options, global_options, root=options.root_path)
                installed = ' '.join([req.name for req in
                                      requirement_set.successfully_installed])
                if installed:
                    logger.notify('Successfully installed %s' % installed)
            elif not self.bundle:
                downloaded = ' '.join([req.name for req in
                                       requirement_set.successfully_downloaded])
                if downloaded:
                    logger.notify('Successfully downloaded %s' % downloaded)
            elif self.bundle:
                requirement_set.create_bundle(self.bundle_filename)
                logger.notify('Created bundle in %s' % self.bundle_filename)
        except PreviousBuildDirError:
            options.no_clean = True
            raise
        finally:
            # Clean up
            if (not options.no_clean) and ((not options.no_install) or options.download_dir):
                requirement_set.cleanup_files(bundle=self.bundle)

        if options.target_dir:
            if not os.path.exists(options.target_dir):
                os.makedirs(options.target_dir)
            lib_dir = distutils_scheme('', home=temp_target_dir)['purelib']
            for item in os.listdir(lib_dir):
                shutil.move(
                    os.path.join(lib_dir, item),
                    os.path.join(options.target_dir, item)
                )
            shutil.rmtree(temp_target_dir)
        return requirement_set
Beispiel #8
0
    def run(self, options, args):
        if options.download_dir:
            options.no_install = True
            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 []
        if options.use_user_site:
            if virtualenv_no_global():
                raise InstallationError(
                    "Can not perform a '--user' install. User site-packages are not visible in this virtualenv."
                )
            install_options.append('--user')
        if options.target_dir:
            options.ignore_installed = True
            temp_target_dir = tempfile.mkdtemp()
            options.target_dir = os.path.abspath(options.target_dir)
            if os.path.exists(options.target_dir) and not os.path.isdir(
                    options.target_dir):
                raise CommandError(
                    "Target path exists but is not a directory, will not continue."
                )
            install_options.append('--home=' + temp_target_dir)
        global_options = options.global_options or []
        index_urls = [options.index_url] + options.extra_index_urls
        if options.no_index:
            logger.notify('Ignoring indexes: %s' % ','.join(index_urls))
            index_urls = []

        finder = self._build_package_finder(options, index_urls)

        requirement_set = RequirementSet(
            build_dir=options.build_dir,
            src_dir=options.src_dir,
            download_dir=options.download_dir,
            download_cache=options.download_cache,
            upgrade=options.upgrade,
            as_egg=options.as_egg,
            ignore_installed=options.ignore_installed,
            ignore_dependencies=options.ignore_dependencies,
            force_reinstall=options.force_reinstall,
            use_user_site=options.use_user_site)
        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))
        for filename in options.requirements:
            for req in parse_requirements(filename,
                                          finder=finder,
                                          options=options):
                requirement_set.add_requirement(req)
        if not requirement_set.has_requirements:
            opts = {'name': self.name}
            if options.find_links:
                msg = ('You must give at least one requirement to %(name)s '
                       '(maybe you meant "pip %(name)s %(links)s"?)' %
                       dict(opts, links=' '.join(options.find_links)))
            else:
                msg = ('You must give at least one requirement '
                       'to %(name)s (see "pip help %(name)s")' % opts)
            logger.warn(msg)
            return

        if (options.use_user_site and sys.version_info < (2, 6)):
            raise InstallationError(
                '--user is only supported in Python version 2.6 and newer')

        import setuptools
        if (options.use_user_site and requirement_set.has_editables
                and not getattr(setuptools, '_distribute', False)):

            raise InstallationError(
                '--user --editable not supported with setuptools, use distribute'
            )

        if not options.no_download:
            requirement_set.prepare_files(finder,
                                          force_root_egg_info=self.bundle,
                                          bundle=self.bundle)
        else:
            requirement_set.locate_files()

        if not options.no_install and not self.bundle:
            requirement_set.install(install_options,
                                    global_options,
                                    root=options.root_path)
            installed = ' '.join(
                [req.name for req in requirement_set.successfully_installed])
            if installed:
                logger.notify('Successfully installed %s' % installed)
        elif not self.bundle:
            downloaded = ' '.join(
                [req.name for req in requirement_set.successfully_downloaded])
            if downloaded:
                logger.notify('Successfully downloaded %s' % downloaded)
        elif self.bundle:
            requirement_set.create_bundle(self.bundle_filename)
            logger.notify('Created bundle in %s' % self.bundle_filename)
        # Clean up
        if not options.no_install or options.download_dir:
            requirement_set.cleanup_files(bundle=self.bundle)
        if options.target_dir:
            if not os.path.exists(options.target_dir):
                os.makedirs(options.target_dir)
            lib_dir = home_lib(temp_target_dir)
            for item in os.listdir(lib_dir):
                shutil.move(os.path.join(lib_dir, item),
                            os.path.join(options.target_dir, item))
            shutil.rmtree(temp_target_dir)
        return requirement_set