mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Merge pull request #1598 from Ivoz/rmbootstrap
Remove bootstrap function, simplify __main__
This commit is contained in:
commit
26c056efd2
1 changed files with 5 additions and 21 deletions
|
@ -167,14 +167,14 @@ def parseopts(args):
|
||||||
return cmd_name, cmd_args
|
return cmd_name, cmd_args
|
||||||
|
|
||||||
|
|
||||||
def main(initial_args=None):
|
def main(args=None):
|
||||||
if initial_args is None:
|
if args is None:
|
||||||
initial_args = sys.argv[1:]
|
args = sys.argv[1:]
|
||||||
|
|
||||||
autocomplete()
|
autocomplete()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd_name, cmd_args = parseopts(initial_args)
|
cmd_name, cmd_args = parseopts(args)
|
||||||
except PipError as exc:
|
except PipError as exc:
|
||||||
sys.stderr.write("ERROR: %s" % exc)
|
sys.stderr.write("ERROR: %s" % exc)
|
||||||
sys.stderr.write(os.linesep)
|
sys.stderr.write(os.linesep)
|
||||||
|
@ -184,23 +184,9 @@ def main(initial_args=None):
|
||||||
return command.main(cmd_args)
|
return command.main(cmd_args)
|
||||||
|
|
||||||
|
|
||||||
def bootstrap():
|
|
||||||
"""
|
|
||||||
Bootstrapping function to be called from install-pip.py script.
|
|
||||||
"""
|
|
||||||
pkgs = ['pip']
|
|
||||||
try:
|
|
||||||
import setuptools
|
|
||||||
# Dumb hack
|
|
||||||
setuptools
|
|
||||||
except ImportError:
|
|
||||||
pkgs.append('setuptools')
|
|
||||||
return main(['install', '--upgrade'] + pkgs + sys.argv[1:])
|
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
## Writing freeze files
|
## Writing freeze files
|
||||||
|
|
||||||
|
|
||||||
class FrozenRequirement(object):
|
class FrozenRequirement(object):
|
||||||
|
|
||||||
def __init__(self, name, req, editable, comments=()):
|
def __init__(self, name, req, editable, comments=()):
|
||||||
|
@ -260,6 +246,4 @@ class FrozenRequirement(object):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
exit = main()
|
sys.exit(main())
|
||||||
if exit:
|
|
||||||
sys.exit(exit)
|
|
||||||
|
|
Loading…
Reference in a new issue