Beispiel #1
0
def getDependencies(name, requirementSet=None, finder=None):
    """Get dependencies of a python project
    
    @param name: name of python project
    @param requirements: RequirementSet
    @param finder: PackageFinder
    """
    if requirementSet is None:
        requirementSet = RequirementSet(
            build_dir=os.path.abspath(build_prefix),
            src_dir=os.path.abspath(src_prefix),
            download_dir=None,
            download_cache=None,
            upgrade=False,
            ignore_installed=True,
            ignore_dependencies=False)
    if finder is None:
        finder = PackageFinder(find_links=[], 
                               index_urls=['http://pypi.python.org/simple'])

    # lead pip download all dependencies
    req = InstallRequirement.from_line(name, None)
    requirementSet.add_requirement(req)
    requirementSet.install_files(finder)
    
    # trace the dependencies relationships between projects
    dependencies = []
    traceDependencys(req, requirementSet, dependencies)
    return dependencies
Beispiel #2
0
def getDependencies(name, requirementSet=None, finder=None):
    """Get dependencies of a python project
    
    @param name: name of python project
    @param requirements: RequirementSet
    @param finder: PackageFinder
    """
    if requirementSet is None:
        requirementSet = RequirementSet(
            build_dir=os.path.abspath(build_prefix),
            src_dir=os.path.abspath(src_prefix),
            download_dir=None,
            download_cache=None,
            upgrade=False,
            ignore_installed=True,
            ignore_dependencies=False)
    if finder is None:
        finder = PackageFinder(find_links=[],
                               index_urls=['http://pypi.python.org/simple'])

    # lead pip download all dependencies
    req = InstallRequirement.from_line(name, None)
    requirementSet.add_requirement(req)
    requirementSet.install_files(finder)

    # trace the dependencies relationships between projects
    dependencies = []
    traceDependencys(req, requirementSet, dependencies)
    return dependencies
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
     else:
         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)
     requirement_set.install_files(finder,
                                   force_root_egg_info=self.bundle,
                                   bundle=self.bundle)
     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)
     return requirement_set
Beispiel #4
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
     else:
         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)
     requirement_set.install_files(finder, force_root_egg_info=self.bundle)
     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)
     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
        else:
            options.build_dir = os.path.abspath(options.build_dir)
            options.src_dir = os.path.abspath(options.src_dir)
        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)
        requirementSet = 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=False)

        requirements = []
        for name in args:
            requirements.append(InstallRequirement.from_line(name, None))
        for name in options.editables:
            requirements.append(
                InstallRequirement.from_editable(
                    name, default_vcs=options.default_vcs))
        for filename in options.requirements:
            for req in parse_requirements(filename,
                                          finder=finder,
                                          options=options):
                requirements.append(req)
        # add all requirements into requirements set
        for req in requirements:
            requirementSet.add_requirement(req)

        requirementSet.install_files(finder,
                                     force_root_egg_info=self.bundle,
                                     bundle=self.bundle)

        return requirements, requirementSet
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
     else:
         options.build_dir = os.path.abspath(options.build_dir)
         options.src_dir = os.path.abspath(options.src_dir)
     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)
     requirementSet = 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=False)
     
     requirements = []
     for name in args:
         requirements.append(
             InstallRequirement.from_line(name, None))
     for name in options.editables:
         requirements.append(
             InstallRequirement.from_editable(name, default_vcs=options.default_vcs))
     for filename in options.requirements:
         for req in parse_requirements(filename, finder=finder, options=options):
             requirements.append(req)
     # add all requirements into requirements set
     for req in requirements:
         requirementSet.add_requirement(req)
     
     requirementSet.install_files(finder, 
                                   force_root_egg_info=self.bundle, 
                                   bundle=self.bundle)
     
     return requirements, requirementSet