From 392a70d3b55399a58d914daad6ffe5b047e0679e Mon Sep 17 00:00:00 2001
From: Nikki Heald <nicky@notnowlewis.com>
Date: Wed, 15 Jul 2015 09:27:21 +0100
Subject: [PATCH] Update build tools and fix link paths

The tarball builds were using the wheelhouse paths
for find_links, that should have been using the
pip download cache path.

The pre-build upgrade now upgrades distribute, pbr,
and setuptools to handle the ;environment_factor
style requirements.

Change-Id: I68d3e090779d9b73613e3aab7fe9c7ee9513e45d
---
 pypi_mirror/cmd/run_mirror.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/pypi_mirror/cmd/run_mirror.py b/pypi_mirror/cmd/run_mirror.py
index fc62cf3..fd41bd4 100644
--- a/pypi_mirror/cmd/run_mirror.py
+++ b/pypi_mirror/cmd/run_mirror.py
@@ -257,7 +257,11 @@ class Mirror(object):
                 self.run_command(
                     venv_format % dict(
                         extra_search_dir=pip_cache_dir, venv_dir=venv))
-                for requirement in ['"pip>=6.0"', "wheel", "virtualenv"]:
+                build_tools = [
+                    "pip", "wheel", "virtualenv", "setuptools", "pbr",
+                    "distribute"]
+
+                for requirement in build_tools:
                     for extra_args in ("", "--no-use-wheel"):
                         self.run_command(
                             upgrade_format % dict(
@@ -265,14 +269,14 @@ class Mirror(object):
                                 download_cache=pip_cache_dir,
                                 build_dir=build, find_links=wheelhouse,
                                 requirement=requirement))
-                for requirement in [
-                        '"pip>=6.0"', "setuptools", "distribute",
-                        "virtualenv"]:
+
+                for requirement in build_tools:
                     self.run_command(
                         wheel_format % dict(
                             pip=pip, download_cache=pip_cache_dir,
                             find_links=wheelhouse, wheel_dir=wheelhouse,
                             requirement=requirement))
+
                 if os.path.exists(build):
                     shutil.rmtree(build)
                 new_reqs = self.process_http_requirements(reqlist,
@@ -290,7 +294,7 @@ class Mirror(object):
                     pip_format % dict(
                         pip=pip, extra_args="",
                         download_cache=pip_cache_dir, build_dir=build,
-                        find_links=wheelhouse, requirements_file=reqfn))
+                        find_links=pip_cache_dir, requirements_file=reqfn))
                 if "\nSuccessfully installed " not in out:
                     sys.stderr.write("Installing pip requires for %s:%s "
                                      "failed.\n%s\n" %
@@ -329,7 +333,7 @@ class Mirror(object):
                     pip_format % dict(
                         pip=pip, extra_args="--no-install",
                         download_cache=pip_cache_dir, build_dir=build,
-                        find_links=wheelhouse, requirements_file=reqs))
+                        find_links=pip_cache_dir, requirements_file=reqs))
                 if "\nSuccessfully downloaded " not in out:
                     sys.stderr.write("Downloading pip requires for "
                                      "%s:%s failed.\n%s\n" %