Merge "Stop installing pydistutils.cfg"

This commit is contained in:
Zuul 2019-11-26 02:12:41 +00:00 committed by Gerrit Code Review
commit 20e468c604
3 changed files with 2 additions and 17 deletions

View File

@ -8,8 +8,7 @@ Inject a PyPI mirror
Use a custom PyPI mirror to build images. The default is to bind mount one from Use a custom PyPI mirror to build images. The default is to bind mount one from
~/.cache/image-create/pypi/mirror into the build environment as mirror URL ~/.cache/image-create/pypi/mirror into the build environment as mirror URL
file:///tmp/pypi. The element temporarily overwrites /root/.pip.conf file:///tmp/pypi. The element temporarily overwrites /root/.pip.conf to use it.
and .pydistutils.cfg to use it.
When online, the official pypi.python.org pypi index is supplied as an When online, the official pypi.python.org pypi index is supplied as an
extra-url, so uncached dependencies will still be available. When offline, only extra-url, so uncached dependencies will still be available. When offline, only
@ -21,9 +20,7 @@ DIB\_NO\_PYPI\_PIP to any non-empty value.
To use an arbitrary mirror set DIB\_PYPI\_MIRROR\_URL=http[s]://somevalue/ To use an arbitrary mirror set DIB\_PYPI\_MIRROR\_URL=http[s]://somevalue/
Additional mirrors can be added by exporting DIB\_PYPI\_MIRROR\_URL\_1=... etc. Additional mirrors can be added by exporting DIB\_PYPI\_MIRROR\_URL\_1=... etc.
Only the one mirror can be used by easy-install, but since wheels need to be in NB: The sort order for these variables is a simple string sort - if you
the first mirror to be used, the last listed mirror is used as the pydistutils
index. NB: The sort order for these variables is a simple string sort - if you
have more than 9 additional mirrors, some care will be needed. have more than 9 additional mirrors, some care will be needed.
You can also set the number of retries that occur on failure by setting the You can also set the number of retries that occur on failure by setting the

View File

@ -11,10 +11,3 @@ if [ -e ~/.pip/pip.conf.orig ]; then
else else
rm ~/.pip/pip.conf rm ~/.pip/pip.conf
fi fi
if [ -e ~/.pydistutils.cfg.orig ]; then
mv ~/.pydistutils.cfg{.orig,}
else
rm ~/.pydistutils.cfg
fi

View File

@ -41,7 +41,6 @@ def main():
indices = ['file:///tmp/pypi'] indices = ['file:///tmp/pypi']
print('WARNING: You are using the pypi element but no pypi mirror is ' print('WARNING: You are using the pypi element but no pypi mirror is '
'defined via the PYPI_MIRROR_URL env variable') 'defined via the PYPI_MIRROR_URL env variable')
easy_index = indices[-1]
use_pypi_python_org = True use_pypi_python_org = True
if os.environ.get('DIB_OFFLINE'): if os.environ.get('DIB_OFFLINE'):
use_pypi_python_org = False use_pypi_python_org = False
@ -61,10 +60,6 @@ def main():
output.write('extra-index-url =\n') output.write('extra-index-url =\n')
for index in indices[1:]: for index in indices[1:]:
output.write(' %s\n' % (index,)) output.write(' %s\n' % (index,))
with open(home + '/.pydistutils.cfg', 'wt') as output:
output.write('[easy_install]\n')
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):