Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
news
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sartika Aritonang
news
Commits
091c6638
Commit
091c6638
authored
May 29, 2020
by
Sartika Aritonang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
3c7639cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
0 deletions
+92
-0
__init__.py
stbi/Lib/site-packages/pip/_internal/req/__init__.py
+92
-0
No files found.
stbi/Lib/site-packages/pip/_internal/req/__init__.py
0 → 100644
View file @
091c6638
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
from
__future__
import
absolute_import
import
logging
from
pip._internal.utils.logging
import
indent_log
from
pip._internal.utils.typing
import
MYPY_CHECK_RUNNING
from
.req_file
import
parse_requirements
from
.req_install
import
InstallRequirement
from
.req_set
import
RequirementSet
if
MYPY_CHECK_RUNNING
:
from
typing
import
Any
,
List
,
Sequence
__all__
=
[
"RequirementSet"
,
"InstallRequirement"
,
"parse_requirements"
,
"install_given_reqs"
,
]
logger
=
logging
.
getLogger
(
__name__
)
class
InstallationResult
(
object
):
def
__init__
(
self
,
name
):
# type: (str) -> None
self
.
name
=
name
def
__repr__
(
self
):
# type: () -> str
return
"InstallationResult(name={!r})"
.
format
(
self
.
name
)
def
install_given_reqs
(
to_install
,
# type: List[InstallRequirement]
install_options
,
# type: List[str]
global_options
=
(),
# type: Sequence[str]
*
args
,
# type: Any
**
kwargs
# type: Any
):
# type: (...) -> List[InstallationResult]
"""
Install everything in the given list.
(to be called after having downloaded and unpacked the packages)
"""
if
to_install
:
logger
.
info
(
'Installing collected packages:
%
s'
,
', '
.
join
([
req
.
name
for
req
in
to_install
]),
)
installed
=
[]
with
indent_log
():
for
requirement
in
to_install
:
if
requirement
.
should_reinstall
:
logger
.
info
(
'Attempting uninstall:
%
s'
,
requirement
.
name
)
with
indent_log
():
uninstalled_pathset
=
requirement
.
uninstall
(
auto_confirm
=
True
)
try
:
requirement
.
install
(
install_options
,
global_options
,
*
args
,
**
kwargs
)
except
Exception
:
should_rollback
=
(
requirement
.
should_reinstall
and
not
requirement
.
install_succeeded
)
# if install did not succeed, rollback previous uninstall
if
should_rollback
:
uninstalled_pathset
.
rollback
()
raise
else
:
should_commit
=
(
requirement
.
should_reinstall
and
requirement
.
install_succeeded
)
if
should_commit
:
uninstalled_pathset
.
commit
()
installed
.
append
(
InstallationResult
(
requirement
.
name
))
return
installed
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment