Commits

Roger Haase committed 2d20593

fix 395 - with pip 1.5+ quickinstall.py fails with CalledProcessError trying to download Flask-Themes

Comments (0)

Files changed (1)

 needs: virtualenv, pip
 """
 
-PIP15 = False  # dirty hack to support pip >= 1.5 incompatibilities
 
 import MoinMoin  # validate python version
 import argparse
 or the virtual environment must be deactivated before rerunning quickinstall.py
 """)
 
-from make import Commands, WINDOWS_OS, M
+from make import Commands, WINDOWS_OS, M, ACTIVATE
 
 
 WIN_INFO = 'm.bat, activate.bat, and deactivate.bat are created by quickinstall.py'
 
     def __call__(self):
         self.do_venv()
+        self.do_helpers()
         self.do_install()
         self.do_catalog()
-        self.do_helpers()
 
         sys.stdout.write("""
 Pip cache location is at {0}
     def do_venv(self):
         virtualenv.create_environment(self.dir_venv)
 
+    def pip15_plus(self):
+        """Return true if pip version is >= 1.5"""
+        command = ACTIVATE + 'pip --version'
+        pip_txt = subprocess.check_output(command, shell=True)
+        # expecting pip_txt similar to "pip 1.4.1 from /bitbucket/moin-2.0..."
+        pip_txt = pip_txt.split()
+        if pip_txt[0] == 'pip':
+            pip_version = [int(x) for x in pip_txt[1].split('.')]
+            return pip_version >= [1, 5]
+        else:
+            sys.exit("Error: 'pip --version' produced unexpected results.")
+
     def do_install(self):
         args = [
             os.path.join(self.dir_venv_bin, 'pip'),
             '--editable',
             self.dir_source,
         ]
-        if PIP15:
+        if self.pip15_plus():
             args += [
                 '--process-dependency-links',
                 '--allow-external', 'flatland',