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
dad97e54
Commit
dad97e54
authored
May 29, 2020
by
Sartika Aritonang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
1a676ac0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
main.py
stbi/Lib/site-packages/pip/_internal/cli/main.py
+75
-0
No files found.
stbi/Lib/site-packages/pip/_internal/cli/main.py
0 → 100644
View file @
dad97e54
"""Primary application entrypoint.
"""
from
__future__
import
absolute_import
import
locale
import
logging
import
os
import
sys
from
pip._internal.cli.autocompletion
import
autocomplete
from
pip._internal.cli.main_parser
import
parse_command
from
pip._internal.commands
import
create_command
from
pip._internal.exceptions
import
PipError
from
pip._internal.utils
import
deprecation
from
pip._internal.utils.typing
import
MYPY_CHECK_RUNNING
if
MYPY_CHECK_RUNNING
:
from
typing
import
List
,
Optional
logger
=
logging
.
getLogger
(
__name__
)
# Do not import and use main() directly! Using it directly is actively
# discouraged by pip's maintainers. The name, location and behavior of
# this function is subject to change, so calling it directly is not
# portable across different pip versions.
# In addition, running pip in-process is unsupported and unsafe. This is
# elaborated in detail at
# https://pip.pypa.io/en/stable/user_guide/#using-pip-from-your-program.
# That document also provides suggestions that should work for nearly
# all users that are considering importing and using main() directly.
# However, we know that certain users will still want to invoke pip
# in-process. If you understand and accept the implications of using pip
# in an unsupported manner, the best approach is to use runpy to avoid
# depending on the exact location of this entry point.
# The following example shows how to use runpy to invoke pip in that
# case:
#
# sys.argv = ["pip", your, args, here]
# runpy.run_module("pip", run_name="__main__")
#
# Note that this will exit the process after running, unlike a direct
# call to main. As it is not safe to do any processing after calling
# main, this should not be an issue in practice.
def
main
(
args
=
None
):
# type: (Optional[List[str]]) -> int
if
args
is
None
:
args
=
sys
.
argv
[
1
:]
# Configure our deprecation warnings to be sent through loggers
deprecation
.
install_warning_logger
()
autocomplete
()
try
:
cmd_name
,
cmd_args
=
parse_command
(
args
)
except
PipError
as
exc
:
sys
.
stderr
.
write
(
"ERROR: {}"
.
format
(
exc
))
sys
.
stderr
.
write
(
os
.
linesep
)
sys
.
exit
(
1
)
# Needed for locale.getpreferredencoding(False) to work
# in pip._internal.utils.encoding.auto_decode
try
:
locale
.
setlocale
(
locale
.
LC_ALL
,
''
)
except
locale
.
Error
as
e
:
# setlocale can apparently crash if locale are uninitialized
logger
.
debug
(
"Ignoring error
%
s when setting locale"
,
e
)
command
=
create_command
(
cmd_name
,
isolated
=
(
"--isolated"
in
cmd_args
))
return
command
.
main
(
cmd_args
)
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