OpenQuizz
Une application de gestion des contenus pédagogiques
InstallRequirement Class Reference

Public Member Functions

def __init__ (self, req, comes_from, editable=False, link=None, markers=None, use_pep517=None, isolated=False, install_options=None, global_options=None, hash_options=None, constraint=False, extras=(), user_supplied=False)
 
def __str__ (self)
 
def __repr__ (self)
 
def format_debug (self)
 
def name (self)
 
def specifier (self)
 
def is_pinned (self)
 
def match_markers (self, extras_requested=None)
 
def has_hash_options (self)
 
def hashes (self, trust_internet=True)
 
def from_path (self)
 
def ensure_build_location (self, build_dir, autodelete, parallel_builds)
 
def warn_on_mismatching_name (self)
 
def check_if_exists (self, use_user_site)
 
def is_wheel (self)
 
def unpacked_source_directory (self)
 
def setup_py_path (self)
 
def pyproject_toml_path (self)
 
def load_pyproject_toml (self)
 
def prepare_metadata (self)
 
def metadata (self)
 
def get_dist (self)
 
def assert_source_matches_version (self)
 
def ensure_has_source_dir (self, parent_dir, autodelete=False, parallel_builds=False)
 
def update_editable (self)
 
def uninstall (self, auto_confirm=False, verbose=False)
 
def archive (self, build_dir)
 
def install (self, install_options, global_options=None, root=None, home=None, prefix=None, warn_script_location=True, use_user_site=False, pycompile=True # type:bool)
 

Data Fields

 req
 
 comes_from
 
 constraint
 
 editable
 
 legacy_install_reason
 
 source_dir
 
 link
 
 original_link
 
 original_link_is_in_wheel_cache
 
 local_file_path
 
 extras
 
 markers
 
 satisfied_by
 
 should_reinstall
 
 install_succeeded
 
 install_options
 
 global_options
 
 hash_options
 
 prepared
 
 user_supplied
 
 isolated
 
 build_env
 
 metadata_directory
 
 pyproject_requires
 
 requirements_to_check
 
 pep517_backend
 
 use_pep517
 
 needs_more_preparation
 

Detailed Description

Represents something that may be installed later on, may have information
about where to fetch the relevant requirement and also contains logic for
installing the said requirement.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  req,
  comes_from,
  editable = False,
  link = None,
  markers = None,
  use_pep517 = None,
  isolated = False,
  install_options = None,
  global_options = None,
  hash_options = None,
  constraint = False,
  extras = (),
  user_supplied = False 
)

Member Function Documentation

◆ __repr__()

def __repr__ (   self)

◆ __str__()

def __str__ (   self)

◆ archive()

def archive (   self,
  build_dir 
)
Saves archive to provided build_dir.

Used for saving downloaded VCS requirements as part of `pip download`.

◆ assert_source_matches_version()

def assert_source_matches_version (   self)

◆ check_if_exists()

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.should_reinstall appropriately.

◆ ensure_build_location()

def ensure_build_location (   self,
  build_dir,
  autodelete,
  parallel_builds 
)

◆ ensure_has_source_dir()

def ensure_has_source_dir (   self,
  parent_dir,
  autodelete = False,
  parallel_builds = False 
)
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

◆ format_debug()

def format_debug (   self)
An un-tested helper for getting state, for debugging.

◆ from_path()

def from_path (   self)
Format a nice indicator to show where this "comes from"

◆ get_dist()

def get_dist (   self)

◆ has_hash_options()

def has_hash_options (   self)
Return whether any known-good hashes are specified as options.

These activate --require-hashes mode; hashes specified as part of a
URL do not.

◆ hashes()

def hashes (   self,
  trust_internet = True 
)
Return a hash-comparer that considers my option- and URL-based
hashes to be known-good.

Hashes in URLs--ones embedded in the requirements file, not ones
downloaded from an index server--are almost peers with ones from
flags. They satisfy --require-hashes (whether it was implicitly or
explicitly activated) but do not activate it. md5 and sha224 are not
allowed in flags, which should nudge people toward good algos. We
always OR all hashes together, even ones from URLs.

:param trust_internet: Whether to trust URL-based (#md5=...) hashes
    downloaded from the internet, as by populate_link()

◆ install()

def install (   self,
  install_options,
  global_options = None,
  root = None,
  home = None,
  prefix = None,
  warn_script_location = True,
  use_user_site = False,
  pycompile = True  # type: bool 
)

◆ is_pinned()

def is_pinned (   self)
Return whether I am pinned to an exact version.

For example, some-package==1.2 is pinned; some-package>1.2 is not.

◆ is_wheel()

def is_wheel (   self)

◆ load_pyproject_toml()

def load_pyproject_toml (   self)
Load the pyproject.toml file.

After calling this routine, all of the attributes related to PEP 517
processing for this requirement have been set. In particular, the
use_pep517 attribute can be used to determine whether we should
follow the PEP 517 or legacy (setup.py) code path.

◆ match_markers()

def match_markers (   self,
  extras_requested = None 
)

◆ metadata()

def metadata (   self)

◆ name()

def name (   self)

◆ prepare_metadata()

def prepare_metadata (   self)
Ensure that project metadata is available.

Under PEP 517, call the backend hook to prepare the metadata.
Under legacy processing, call setup.py egg-info.

◆ pyproject_toml_path()

def pyproject_toml_path (   self)

◆ setup_py_path()

def setup_py_path (   self)

◆ specifier()

def specifier (   self)

◆ uninstall()

def uninstall (   self,
  auto_confirm = False,
  verbose = 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.

◆ unpacked_source_directory()

def unpacked_source_directory (   self)

◆ update_editable()

def update_editable (   self)

◆ warn_on_mismatching_name()

def warn_on_mismatching_name (   self)

Field Documentation

◆ build_env

build_env

◆ comes_from

comes_from

◆ constraint

constraint

◆ editable

editable

◆ extras

extras

◆ global_options

global_options

◆ hash_options

hash_options

◆ install_options

install_options

◆ install_succeeded

install_succeeded

◆ isolated

isolated

◆ legacy_install_reason

legacy_install_reason

◆ link

link

◆ local_file_path

local_file_path

◆ markers

markers

◆ metadata_directory

metadata_directory

◆ needs_more_preparation

needs_more_preparation

◆ original_link

original_link

◆ original_link_is_in_wheel_cache

original_link_is_in_wheel_cache

◆ pep517_backend

pep517_backend

◆ prepared

prepared

◆ pyproject_requires

pyproject_requires

◆ req

req

◆ requirements_to_check

requirements_to_check

◆ satisfied_by

satisfied_by

◆ should_reinstall

should_reinstall

◆ source_dir

source_dir

◆ use_pep517

use_pep517

◆ user_supplied

user_supplied

The documentation for this class was generated from the following file: