From 75341292f945d70fc4241dd1d587ca7082720a58 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sun, 24 Nov 2019 11:27:47 -0500 Subject: [PATCH] Stop installing pydistutils.cfg Support for easy_install codepaths is increasingly broken, and now putting allow-hosts in this file breaks most recent pip. Just stop installing the file - people should be using pip anyway. Change-Id: I0a6b2432f81d80fbcbb336403fe555003880fa9f --- diskimage_builder/elements/pypi/README.rst | 7 ++----- .../pypi/post-install.d/00-unconfigure-pypi-mirror | 7 ------- .../elements/pypi/pre-install.d/04-configure-pypi-mirror | 5 ----- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/diskimage_builder/elements/pypi/README.rst b/diskimage_builder/elements/pypi/README.rst index 47c258b6..08d502e8 100644 --- a/diskimage_builder/elements/pypi/README.rst +++ b/diskimage_builder/elements/pypi/README.rst @@ -8,8 +8,7 @@ Inject a PyPI mirror 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 -file:///tmp/pypi. The element temporarily overwrites /root/.pip.conf -and .pydistutils.cfg to use it. +file:///tmp/pypi. The element temporarily overwrites /root/.pip.conf to use it. 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 @@ -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/ 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 -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 +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. You can also set the number of retries that occur on failure by setting the diff --git a/diskimage_builder/elements/pypi/post-install.d/00-unconfigure-pypi-mirror b/diskimage_builder/elements/pypi/post-install.d/00-unconfigure-pypi-mirror index c32c3662..45775966 100755 --- a/diskimage_builder/elements/pypi/post-install.d/00-unconfigure-pypi-mirror +++ b/diskimage_builder/elements/pypi/post-install.d/00-unconfigure-pypi-mirror @@ -11,10 +11,3 @@ if [ -e ~/.pip/pip.conf.orig ]; then else rm ~/.pip/pip.conf fi - - -if [ -e ~/.pydistutils.cfg.orig ]; then - mv ~/.pydistutils.cfg{.orig,} -else - rm ~/.pydistutils.cfg -fi diff --git a/diskimage_builder/elements/pypi/pre-install.d/04-configure-pypi-mirror b/diskimage_builder/elements/pypi/pre-install.d/04-configure-pypi-mirror index 335f3d58..164686e3 100755 --- a/diskimage_builder/elements/pypi/pre-install.d/04-configure-pypi-mirror +++ b/diskimage_builder/elements/pypi/pre-install.d/04-configure-pypi-mirror @@ -41,7 +41,6 @@ def main(): indices = ['file:///tmp/pypi'] print('WARNING: You are using the pypi element but no pypi mirror is ' 'defined via the PYPI_MIRROR_URL env variable') - easy_index = indices[-1] use_pypi_python_org = True if os.environ.get('DIB_OFFLINE'): use_pypi_python_org = False @@ -61,10 +60,6 @@ def main(): output.write('extra-index-url =\n') for index in indices[1:]: 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):