示例#1
0
def resolve_requirements(
    repository,
    lines,
    requires_python="",
    allow_prereleases=None,
    strategy="all",
    preferred_pins=None,
    tracked_names=None,
):
    requirements = []
    for line in lines:
        if line.startswith("-e "):
            requirements.append(parse_requirement(line[3:], True))
        else:
            requirements.append(parse_requirement(line))
    requires_python = PySpecSet(requires_python)
    if not preferred_pins:
        provider = BaseProvider(repository, requires_python, allow_prereleases)
    else:
        provider_class = (ReusePinProvider
                          if strategy == "reuse" else EagerUpdateProvider)
        provider = provider_class(
            preferred_pins,
            tracked_names or (),
            repository,
            requires_python,
            allow_prereleases,
        )
    ui = termui.UI()
    with ui.open_spinner("Resolving dependencies") as spin, ui.logging("lock"):
        reporter = SpinnerReporter(spin, requirements)
        resolver = Resolver(provider, reporter)
        mapping, *_ = resolve(resolver, requirements, requires_python)
        return mapping
示例#2
0
文件: core.py 项目: pi-dal/pdm
    def __init__(self) -> None:
        self.version = importlib_metadata.version(__name__.split(".")[0])

        self.project_class = Project
        self.repository_class = PyPIRepository
        self.resolver_class = Resolver
        self.synchronizer_class = Synchronizer

        self.ui = termui.UI()
        self.parser: Optional[PdmParser] = None
        self.subparsers: Optional[argparse._SubParsersAction] = None
示例#3
0
    def __init__(self) -> None:
        try:
            import importlib.metadata as importlib_metadata
        except ModuleNotFoundError:
            import importlib_metadata
        self.version = importlib_metadata.version(__name__.split(".")[0])

        self.project_class = Project
        self.repository_class = PyPIRepository
        self.resolver_class = Resolver
        self.synchronizer_class = Synchronizer

        self.ui = termui.UI()
        self.parser: PdmParser = None
        self.subparsers = None
示例#4
0
    def __init__(self) -> None:
        try:
            self.version = importlib_metadata.version(__name__.split(".")[0])
        except importlib_metadata.PackageNotFoundError:
            self.version = "UNKNOWN"

        self.project_class = Project
        self.repository_class = PyPIRepository
        self.resolver_class = Resolver
        self.synchronizer_class = Synchronizer
        self.install_manager_class = InstallManager

        self.ui = termui.UI()
        self.parser: Optional[argparse.ArgumentParser] = None
        self.subparsers: Optional[argparse._SubParsersAction] = None
示例#5
0
 def __init__(self) -> None:
     self.version = __version__
     self.ui = termui.UI()
     self.init_parser()
     self.load_plugins()