def _build_session(self, options):
        session = PipSession(
            cache=normalize_path(os.path.join(options.cache_dir, "http")),
            retries=options.retries,
        )

        # Handle custom ca-bundles from the user
        if options.cert:
            session.verify = options.cert
        elif options.no_check_certificate:
            session.verify = False

        # Handle SSL client certificate
        if options.client_cert:
            session.cert = options.client_cert

        # Handle timeouts
        if options.timeout:
            session.timeout = options.timeout

        # Handle configured proxies
        if options.proxy:
            session.proxies = {
                "http": options.proxy,
                "https": options.proxy,
            }

        # Determine if we can prompt the user for authentication or not
        session.auth.prompting = not options.no_input

        return session
    def _build_session(self, options):
        session = PipSession(
            cache=normalize_path(os.path.join(options.cache_dir, "http")),
            retries=options.retries,
        )

        # Handle custom ca-bundles from the user
        if options.cert:
            session.verify = options.cert
        elif options.no_check_certificate:
            session.verify = False

        # Handle SSL client certificate
        if options.client_cert:
            session.cert = options.client_cert

        # Handle timeouts
        if options.timeout:
            session.timeout = options.timeout

        # Handle configured proxies
        if options.proxy:
            session.proxies = {
                "http": options.proxy,
                "https": options.proxy,
            }

        # Determine if we can prompt the user for authentication or not
        session.auth.prompting = not options.no_input

        return session
示例#3
0
文件: wheel.py 项目: fpytloun/pip
 def __init__(self, requirement_set, finder, wheel_dir, build_options=[],
              global_options=[]):
     self.requirement_set = requirement_set
     self.finder = finder
     self.wheel_dir = normalize_path(wheel_dir)
     self.build_options = build_options
     self.global_options = global_options
 def add_pth(self, pth_file, entry):
     pth_file = normalize_path(pth_file)
     if self._permitted(pth_file):
         if pth_file not in self.pth:
             self.pth[pth_file] = UninstallPthEntries(pth_file)
         self.pth[pth_file].add(entry)
     else:
         self._refuse.add(pth_file)
 def _can_uninstall(self):
     if not dist_is_local(self.dist):
         logger.notify(
             "Not uninstalling %s at %s, outside environment %s" %
             (self.dist.project_name, normalize_path(
                 self.dist.location), sys.prefix), )
         return False
     return True
 def add_pth(self, pth_file, entry):
     pth_file = normalize_path(pth_file)
     if self._permitted(pth_file):
         if pth_file not in self.pth:
             self.pth[pth_file] = UninstallPthEntries(pth_file)
         self.pth[pth_file].add(entry)
     else:
         self._refuse.add(pth_file)
 def _can_uninstall(self):
     if not dist_is_local(self.dist):
         logger.notify(
             "Not uninstalling %s at %s, outside environment %s"
             % (self.dist.project_name, normalize_path(self.dist.location), sys.prefix)
         )
         return False
     return True
示例#8
0
文件: wheel.py 项目: elisamerida/TFG
 def __init__(self,
              requirement_set,
              finder,
              wheel_dir,
              build_options=[],
              global_options=[]):
     self.requirement_set = requirement_set
     self.finder = finder
     self.wheel_dir = normalize_path(wheel_dir)
     self.build_options = build_options
     self.global_options = global_options
    def add(self, path):
        path = normalize_path(path)
        if not os.path.exists(path):
            return
        if self._permitted(path):
            self.paths.add(path)
        else:
            self._refuse.add(path)

        # __pycache__ files can show up after 'installed-files.txt' is created,
        # due to imports
        if os.path.splitext(path)[1] == '.py' and uses_pycache:
            self.add(imp.cache_from_source(path))
    def add(self, path):
        path = normalize_path(path)
        if not os.path.exists(path):
            return
        if self._permitted(path):
            self.paths.add(path)
        else:
            self._refuse.add(path)

        # __pycache__ files can show up after 'installed-files.txt' is created,
        # due to imports
        if os.path.splitext(path)[1] == ".py" and uses_pycache:
            self.add(imp.cache_from_source(path))
    def __init__(self,
                 build_dir,
                 src_dir,
                 download_dir,
                 upgrade=False,
                 ignore_installed=False,
                 as_egg=False,
                 target_dir=None,
                 ignore_dependencies=False,
                 force_reinstall=False,
                 use_user_site=False,
                 session=None,
                 pycompile=True,
                 wheel_download_dir=None):
        if session is None:
            raise TypeError(
                "RequirementSet() missing 1 required keyword argument: "
                "'session'")

        self.build_dir = build_dir
        self.src_dir = src_dir
        self.download_dir = download_dir
        self.upgrade = upgrade
        self.ignore_installed = ignore_installed
        self.force_reinstall = force_reinstall
        self.requirements = Requirements()
        # Mapping of alias: real_name
        self.requirement_aliases = {}
        self.unnamed_requirements = []
        self.ignore_dependencies = ignore_dependencies
        self.successfully_downloaded = []
        self.successfully_installed = []
        self.reqs_to_cleanup = []
        self.as_egg = as_egg
        self.use_user_site = use_user_site
        self.target_dir = target_dir  # set from --target option
        self.session = session
        self.pycompile = pycompile
        if wheel_download_dir:
            wheel_download_dir = normalize_path(wheel_download_dir)
        self.wheel_download_dir = wheel_download_dir
示例#12
0
文件: wheel.py 项目: fpytloun/pip
# -*- coding: utf-8 -*-
from __future__ import absolute_import

import os

from pip.basecommand import Command
from pip.index import PackageFinder
from pip.log import logger
from pip.exceptions import CommandError, PreviousBuildDirError
from pip.req import InstallRequirement, RequirementSet, parse_requirements
from pip.util import normalize_path
from pip.wheel import WheelBuilder
from pip import cmdoptions

DEFAULT_WHEEL_DIR = os.path.join(normalize_path(os.curdir), 'wheelhouse')


class WheelCommand(Command):
    """
    Build Wheel archives for your requirements and dependencies.

    Wheel is a built-package format, and offers the advantage of not
    recompiling your software during every install. For more details, see the
    wheel docs: http://wheel.readthedocs.org/en/latest.

    Requirements: setuptools>=0.8, and wheel.

    'pip wheel' uses the bdist_wheel setuptools extension from the wheel
    package to build individual wheels.

    """
示例#13
0
# -*- coding: utf-8 -*-
from __future__ import absolute_import

import os
import sys
from pip.basecommand import Command
from pip.index import PackageFinder
from pip.log import logger
from pip.exceptions import CommandError, PreviousBuildDirError
from pip.req import InstallRequirement, RequirementSet, parse_requirements
from pip.util import BuildDirectory, normalize_path
from pip.wheel import WheelBuilder
from pip import cmdoptions

DEFAULT_WHEEL_DIR = os.path.join(normalize_path(os.curdir), 'wheelhouse')

class WheelCommand(Command):
    """
    Build Wheel archives for your requirements and dependencies.

    Wheel is a built-package format, and offers the advantage of not recompiling your software during every install.
    For more details, see the wheel docs: http://wheel.readthedocs.org/en/latest.

    Requirements: setuptools>=0.8, and wheel.

    'pip wheel' uses the bdist_wheel setuptools extension from the wheel package to build individual wheels.

    """

    name = 'wheel'
    usage = """