diff --git a/diskimage_builder/elements/pypi/element-deps b/diskimage_builder/elements/pypi/element-deps new file mode 100644 index 00000000..f9eb801e --- /dev/null +++ b/diskimage_builder/elements/pypi/element-deps @@ -0,0 +1 @@ +dib-python diff --git a/diskimage_builder/elements/pypi/pre-install.d/00-configure-pypi-mirror b/diskimage_builder/elements/pypi/pre-install.d/04-configure-pypi-mirror similarity index 90% rename from diskimage_builder/elements/pypi/pre-install.d/00-configure-pypi-mirror rename to diskimage_builder/elements/pypi/pre-install.d/04-configure-pypi-mirror index fc177a8f..9ad74c45 100755 --- a/diskimage_builder/elements/pypi/pre-install.d/00-configure-pypi-mirror +++ b/diskimage_builder/elements/pypi/pre-install.d/04-configure-pypi-mirror @@ -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 # 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 +try: + from urllib.parse import urlparse +except ImportError: + from urlparse import urlparse + def main(): home = os.path.expanduser("~") @@ -49,6 +54,7 @@ def main(): output.write('[global]\n') output.write('log = %s/pip.log\n' % (home,)) output.write('index-url = %s\n' % (indices[0],)) + output.write('trusted-host = %s\n' % (urlparse(indices[0]).hostname,)) if retries is not None: output.write('retries = %s\n' % retries) for index in indices[1:]: @@ -56,6 +62,7 @@ def main(): 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):