summaryrefslogtreecommitdiff
path: root/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/req/__init__.py
diff options
context:
space:
mode:
authorShubham Saini <shubham6405@gmail.com>2018-12-11 10:01:23 +0000
committerShubham Saini <shubham6405@gmail.com>2018-12-11 10:01:23 +0000
commit68df54d6629ec019142eb149dd037774f2d11e7c (patch)
tree345bc22d46b4e01a4ba8303b94278952a4ed2b9e /venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/req/__init__.py
First commit
Diffstat (limited to 'venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/req/__init__.py')
-rw-r--r--venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/req/__init__.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/req/__init__.py b/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/req/__init__.py
new file mode 100644
index 0000000..07ae607
--- /dev/null
+++ b/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/req/__init__.py
@@ -0,0 +1,69 @@
1from __future__ import absolute_import
2
3import logging
4
5from .req_install import InstallRequirement
6from .req_set import RequirementSet
7from .req_file import parse_requirements
8from pip._internal.utils.logging import indent_log
9
10
11__all__ = [
12 "RequirementSet", "InstallRequirement",
13 "parse_requirements", "install_given_reqs",
14]
15
16logger = logging.getLogger(__name__)
17
18
19def install_given_reqs(to_install, install_options, global_options=(),
20 *args, **kwargs):
21 """
22 Install everything in the given list.
23
24 (to be called after having downloaded and unpacked the packages)
25 """
26
27 if to_install:
28 logger.info(
29 'Installing collected packages: %s',
30 ', '.join([req.name for req in to_install]),
31 )
32
33 with indent_log():
34 for requirement in to_install:
35 if requirement.conflicts_with:
36 logger.info(
37 'Found existing installation: %s',
38 requirement.conflicts_with,
39 )
40 with indent_log():
41 uninstalled_pathset = requirement.uninstall(
42 auto_confirm=True
43 )
44 try:
45 requirement.install(
46 install_options,
47 global_options,
48 *args,
49 **kwargs
50 )
51 except:
52 should_rollback = (
53 requirement.conflicts_with and
54 not requirement.install_succeeded
55 )
56 # if install did not succeed, rollback previous uninstall
57 if should_rollback:
58 uninstalled_pathset.rollback()
59 raise
60 else:
61 should_commit = (
62 requirement.conflicts_with and
63 requirement.install_succeeded
64 )
65 if should_commit:
66 uninstalled_pathset.commit()
67 requirement.remove_temporary_source()
68
69 return to_install