当前位置: 首页>>代码示例>>Python>>正文


Python wheel.name方法代码示例

本文整理汇总了Python中pip._internal.wheel.name方法的典型用法代码示例。如果您正苦于以下问题:Python wheel.name方法的具体用法?Python wheel.name怎么用?Python wheel.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pip._internal.wheel的用法示例。


在下文中一共展示了wheel.name方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: populate_link

# 需要导入模块: from pip._internal import wheel [as 别名]
# 或者: from pip._internal.wheel import name [as 别名]
def populate_link(self, finder, upgrade, require_hashes):
        """Ensure that if a link can be found for this, that it is found.

        Note that self.link may still be None - if Upgrade is False and the
        requirement is already installed.

        If require_hashes is True, don't use the wheel cache, because cached
        wheels, always built locally, have different hashes than the files
        downloaded from the index server and thus throw false hash mismatches.
        Furthermore, cached wheels at present have undeterministic contents due
        to file modification times.
        """
        if self.link is None:
            self.link = finder.find_requirement(self, upgrade)
        if self._wheel_cache is not None and not require_hashes:
            old_link = self.link
            self.link = self._wheel_cache.get(self.link, self.name)
            if old_link != self.link:
                logger.debug('Using cached wheel link: %s', self.link) 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:21,代码来源:req_install.py

示例2: uninstall

# 需要导入模块: from pip._internal import wheel [as 别名]
# 或者: from pip._internal.wheel import name [as 别名]
def uninstall(self, auto_confirm=False, verbose=False,
                  use_user_site=False):
        """
        Uninstall the distribution currently satisfying this requirement.

        Prompts before removing or modifying files unless
        ``auto_confirm`` is True.

        Refuses to delete or modify files outside of ``sys.prefix`` -
        thus uninstallation within a virtual environment can only
        modify that virtual environment, even if the virtualenv is
        linked to global site-packages.

        """
        if not self.check_if_exists(use_user_site):
            logger.warning("Skipping %s as it is not installed.", self.name)
            return
        dist = self.satisfied_by or self.conflicts_with

        uninstalled_pathset = UninstallPathSet.from_dist(dist)
        uninstalled_pathset.remove(auto_confirm, verbose)
        return uninstalled_pathset 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:24,代码来源:req_install.py

示例3: populate_link

# 需要导入模块: from pip._internal import wheel [as 别名]
# 或者: from pip._internal.wheel import name [as 别名]
def populate_link(self, finder, upgrade, require_hashes):
        """Ensure that if a link can be found for this, that it is found.

        Note that self.link may still be None - if Upgrade is False and the
        requirement is already installed.

        If require_hashes is True, don't use the wheel cache, because cached
        wheels, always built locally, have different hashes than the files
        downloaded from the index server and thus throw false hash mismatches.
        Furthermore, cached wheels at present have undeterministic contents due
        to file modification times.
        """
        if self.link is None:
            self.link = finder.find_requirement(self, upgrade)
        if self._wheel_cache is not None and not require_hashes:
            old_link = self.link
            self.link = self._wheel_cache.get(self.link, self.name)
            if old_link != self.link:
                logger.debug('Using cached wheel link: %s', self.link)

    # Things that are valid for all kinds of requirements? 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:23,代码来源:req_install.py

示例4: from_editable

# 需要导入模块: from pip._internal import wheel [as 别名]
# 或者: from pip._internal.wheel import name [as 别名]
def from_editable(cls, editable_req, comes_from=None, isolated=False,
                      options=None, wheel_cache=None, constraint=False):
        from pip._internal.index import Link

        name, url, extras_override = parse_editable(editable_req)
        if url.startswith('file:'):
            source_dir = url_to_path(url)
        else:
            source_dir = None

        if name is not None:
            try:
                req = Requirement(name)
            except InvalidRequirement:
                raise InstallationError("Invalid requirement: '%s'" % name)
        else:
            req = None
        return cls(
            req, comes_from, source_dir=source_dir,
            editable=True,
            link=Link(url),
            constraint=constraint,
            isolated=isolated,
            options=options if options else {},
            wheel_cache=wheel_cache,
            extras=extras_override or (),
        ) 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:29,代码来源:req_install.py

示例5: build_location

# 需要导入模块: from pip._internal import wheel [as 别名]
# 或者: from pip._internal.wheel import name [as 别名]
def build_location(self, build_dir):
        assert build_dir is not None
        if self._temp_build_dir.path is not None:
            return self._temp_build_dir.path
        if self.req is None:
            # for requirement via a path to a directory: the name of the
            # package is not available yet so we create a temp directory
            # Once run_egg_info will have run, we'll be able
            # to fix it via _correct_build_location
            # Some systems have /tmp as a symlink which confuses custom
            # builds (such as numpy). Thus, we ensure that the real path
            # is returned.
            self._temp_build_dir.create()
            self._ideal_build_dir = build_dir

            return self._temp_build_dir.path
        if self.editable:
            name = self.name.lower()
        else:
            name = self.name
        # FIXME: Is there a better place to create the build_dir? (hg and bzr
        # need this)
        if not os.path.exists(build_dir):
            logger.debug('Creating directory %s', build_dir)
            _make_build_dir(build_dir)
        return os.path.join(build_dir, name) 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:28,代码来源:req_install.py

示例6: _correct_build_location

# 需要导入模块: from pip._internal import wheel [as 别名]
# 或者: from pip._internal.wheel import name [as 别名]
def _correct_build_location(self):
        """Move self._temp_build_dir to self._ideal_build_dir/self.req.name

        For some requirements (e.g. a path to a directory), the name of the
        package is not available until we run egg_info, so the build_location
        will return a temporary directory and store the _ideal_build_dir.

        This is only called by self.egg_info_path to fix the temporary build
        directory.
        """
        if self.source_dir is not None:
            return
        assert self.req is not None
        assert self._temp_build_dir.path
        assert self._ideal_build_dir.path
        old_location = self._temp_build_dir.path
        self._temp_build_dir.path = None

        new_location = self.build_location(self._ideal_build_dir)
        if os.path.exists(new_location):
            raise InstallationError(
                'A package already exists in %s; please remove it to continue'
                % display_path(new_location))
        logger.debug(
            'Moving package %s from %s to new location %s',
            self, display_path(old_location), display_path(new_location),
        )
        shutil.move(old_location, new_location)
        self._temp_build_dir.path = new_location
        self._ideal_build_dir = None
        self.source_dir = os.path.normpath(os.path.abspath(new_location))
        self._egg_info_path = None 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:34,代码来源:req_install.py

示例7: name

# 需要导入模块: from pip._internal import wheel [as 别名]
# 或者: from pip._internal.wheel import name [as 别名]
def name(self):
        if self.req is None:
            return None
        return native_str(pkg_resources.safe_name(self.req.name)) 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:6,代码来源:req_install.py

示例8: installed_version

# 需要导入模块: from pip._internal import wheel [as 别名]
# 或者: from pip._internal.wheel import name [as 别名]
def installed_version(self):
        return get_installed_version(self.name) 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:4,代码来源:req_install.py

示例9: _clean_zip_name

# 需要导入模块: from pip._internal import wheel [as 别名]
# 或者: from pip._internal.wheel import name [as 别名]
def _clean_zip_name(self, name, prefix):
        assert name.startswith(prefix + os.path.sep), (
            "name %r doesn't start with prefix %r" % (name, prefix)
        )
        name = name[len(prefix) + 1:]
        name = name.replace(os.path.sep, '/')
        return name 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:9,代码来源:req_install.py

示例10: ensure_has_source_dir

# 需要导入模块: from pip._internal import wheel [as 别名]
# 或者: from pip._internal.wheel import name [as 别名]
def ensure_has_source_dir(self, parent_dir):
        """Ensure that a source_dir is set.

        This will create a temporary build dir if the name of the requirement
        isn't known yet.

        :param parent_dir: The ideal pip parent_dir for the source_dir.
            Generally src_dir for editables and build_dir for sdists.
        :return: self.source_dir
        """
        if self.source_dir is None:
            self.source_dir = self.build_location(parent_dir)
        return self.source_dir 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:15,代码来源:req_install.py

示例11: install_editable

# 需要导入模块: from pip._internal import wheel [as 别名]
# 或者: from pip._internal.wheel import name [as 别名]
def install_editable(self, install_options,
                         global_options=(), prefix=None):
        logger.info('Running setup.py develop for %s', self.name)

        if self.isolated:
            global_options = list(global_options) + ["--no-user-cfg"]

        if prefix:
            prefix_param = ['--prefix={}'.format(prefix)]
            install_options = list(install_options) + prefix_param

        with indent_log():
            # FIXME: should we do --install-headers here too?
            with self.build_env:
                call_subprocess(
                    [
                        sys.executable,
                        '-c',
                        SETUPTOOLS_SHIM % self.setup_py
                    ] +
                    list(global_options) +
                    ['develop', '--no-deps'] +
                    list(install_options),

                    cwd=self.setup_py_dir,
                    show_stdout=False,
                )

        self.install_succeeded = True 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:31,代码来源:req_install.py

示例12: check_if_exists

# 需要导入模块: from pip._internal import wheel [as 别名]
# 或者: from pip._internal.wheel import name [as 别名]
def check_if_exists(self, use_user_site):
        """Find an installed distribution that satisfies or conflicts
        with this requirement, and set self.satisfied_by or
        self.conflicts_with appropriately.
        """
        if self.req is None:
            return False
        try:
            # get_distribution() will resolve the entire list of requirements
            # anyway, and we've already determined that we need the requirement
            # in question, so strip the marker so that we don't try to
            # evaluate it.
            no_marker = Requirement(str(self.req))
            no_marker.marker = None
            self.satisfied_by = pkg_resources.get_distribution(str(no_marker))
            if self.editable and self.satisfied_by:
                self.conflicts_with = self.satisfied_by
                # when installing editables, nothing pre-existing should ever
                # satisfy
                self.satisfied_by = None
                return True
        except pkg_resources.DistributionNotFound:
            return False
        except pkg_resources.VersionConflict:
            existing_dist = pkg_resources.get_distribution(
                self.req.name
            )
            if use_user_site:
                if dist_in_usersite(existing_dist):
                    self.conflicts_with = existing_dist
                elif (running_under_virtualenv() and
                        dist_in_site_packages(existing_dist)):
                    raise InstallationError(
                        "Will not install to the user site because it will "
                        "lack sys.path precedence to %s in %s" %
                        (existing_dist.project_name, existing_dist.location)
                    )
            else:
                self.conflicts_with = existing_dist
        return True 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:42,代码来源:req_install.py

示例13: move_wheel_files

# 需要导入模块: from pip._internal import wheel [as 别名]
# 或者: from pip._internal.wheel import name [as 别名]
def move_wheel_files(self, wheeldir, root=None, home=None, prefix=None,
                         warn_script_location=True, use_user_site=False,
                         pycompile=True):
        move_wheel_files(
            self.name, self.req, wheeldir,
            user=use_user_site,
            home=home,
            root=root,
            prefix=prefix,
            pycompile=pycompile,
            isolated=self.isolated,
            warn_script_location=warn_script_location,
        ) 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:15,代码来源:req_install.py


注:本文中的pip._internal.wheel.name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。