install.py

branch
maintenance
changeset 6319
df201b9fbad4
parent 6316
ee88310f0334
child 6322
cb7d2ab9c9f5
diff -r 44249d49d892 -r df201b9fbad4 install.py
--- a/install.py	Tue May 01 12:04:30 2018 +0200
+++ b/install.py	Sat Jun 02 12:44:41 2018 +0200
@@ -29,7 +29,6 @@
 import glob
 import shutil
 import fnmatch
-import distutils.sysconfig
 import codecs
 import subprocess
 import time
@@ -233,7 +232,13 @@
     simple assignment.
     """
     global platBinDir, modDir, pyModDir, apisDir, pyqtVariant, platBinDirOld
-
+    
+    try:
+        import distutils.sysconfig
+    except ImportError:
+        print("Please install the 'distutils' package first.")
+        exit(5)
+    
     if sys.platform.startswith("win"):
         platBinDir = sys.exec_prefix
         if platBinDir.endswith("\\"):
@@ -302,7 +307,7 @@
     @param dst destination file name (string)
     @param marker marker to be used (string)
     """
-    global cfg
+    global cfg, platBinDir
     
     if sys.version_info[0] == 2:
         f = codecs.open(src, "r", "utf-8")
@@ -311,7 +316,7 @@
     text = f.read()
     f.close()
     
-    text = text.replace("@BINDIR@", cfg['bindir'])
+    text = text.replace("@BINDIR@", platBinDir)
     text = text.replace("@MARKER@", marker)
     if marker:
         t_marker = " ({0})".format(PythonTextMarkers[marker])
@@ -1235,9 +1240,9 @@
     @rtype bool
     """
     ok = False
-    print(message, "\n")
-    answer = input("Shall '{0}' be installed using pip? (Y/n) "
-                   .format(packageName))
+    print("{0}\n\nShall '{1}' be installed using pip? (Y/n)"
+          .format(message, packageName), end=" ")
+    answer = input()
     if answer in ("", "Y", "y"):
         exitCode = subprocess.call(
             [sys.executable, "-m", "pip", "install", packageName])

eric ide

mercurial