Merge "Move pypi to dib-python"

This commit is contained in:
Zuul 2019-06-18 06:49:36 +00:00 committed by Gerrit Code Review
commit 4afcba1fea
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1 @@
dib-python

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/local/bin/dib-python
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,11 @@ from __future__ import print_function
import os.path import os.path
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
def main(): def main():
home = os.path.expanduser("~") home = os.path.expanduser("~")
@ -49,6 +54,7 @@ def main():
output.write('[global]\n') output.write('[global]\n')
output.write('log = %s/pip.log\n' % (home,)) output.write('log = %s/pip.log\n' % (home,))
output.write('index-url = %s\n' % (indices[0],)) output.write('index-url = %s\n' % (indices[0],))
output.write('trusted-host = %s\n' % (urlparse(indices[0]).hostname,))
if retries is not None: if retries is not None:
output.write('retries = %s\n' % retries) output.write('retries = %s\n' % retries)
for index in indices[1:]: for index in indices[1:]:
@ -56,6 +62,7 @@ def main():
with open(home + '/.pydistutils.cfg', 'wt') as output: with open(home + '/.pydistutils.cfg', 'wt') as output:
output.write('[easy_install]\n') output.write('[easy_install]\n')
output.write('index_url = %s\n' % (easy_index,)) output.write('index_url = %s\n' % (easy_index,))
output.write('allow_hosts = %s\n' % (urlparse(easy_index).netloc,))
def backup_configs(home): def backup_configs(home):