scripts/install.py

branch
eric7
changeset 9420
92810aebc909
parent 9402
f5d9aa5c62db
child 9425
b1707793e213
diff -r 175ec2fe27ca -r 92810aebc909 scripts/install.py
--- a/scripts/install.py	Tue Oct 18 17:02:51 2022 +0200
+++ b/scripts/install.py	Tue Oct 18 17:48:03 2022 +0200
@@ -23,8 +23,9 @@
 import shlex
 import shutil
 import subprocess  # secok
+import sys
+import sysconfig
 import time
-import sys
 
 # Define the globals.
 progName = None
@@ -32,7 +33,6 @@
 modDir = None
 pyModDir = None
 platBinDir = None
-platBinDirOld = None
 distDir = None
 apisDir = None
 installApis = True
@@ -194,28 +194,16 @@
     Module function to set the values of globals that need more than a
     simple assignment.
     """
-    global platBinDir, modDir, pyModDir, apisDir, platBinDirOld
-
-    import sysconfig
+    global platBinDir, modDir, pyModDir, apisDir
 
     if sys.platform.startswith(("win", "cygwin")):
-        platBinDir = sys.exec_prefix
-        if platBinDir.endswith("\\"):
-            platBinDir = platBinDir[:-1]
-        platBinDirOld = platBinDir
-        platBinDir = os.path.join(platBinDir, "Scripts")
-        if not os.path.exists(platBinDir):
-            platBinDir = platBinDirOld
+        platBinDir = sysconfig.get_path("scripts")
     else:
-        pyBinDir = os.path.normpath(os.path.dirname(sys.executable))
-        if os.access(pyBinDir, os.W_OK):
-            # install the eric scripts along the python executable
-            platBinDir = pyBinDir
-        else:
+        # install the eric scripts along the python executable
+        platBinDir = sysconfig.get_path("scripts")
+        if not os.access(platBinDir, os.W_OK):
             # install them in the user's bin directory
             platBinDir = os.path.expanduser("~/bin")
-        if platBinDir != "/usr/local/bin" and os.access("/usr/local/bin", os.W_OK):
-            platBinDirOld = "/usr/local/bin"
 
     modDir = sysconfig.get_path("platlib")
     pyModDir = modDir
@@ -491,7 +479,7 @@
     """
     Uninstall the old eric files.
     """
-    global platBinDir, platBinDirOld
+    global platBinDir
 
     try:
         from eric7config import getConfig
@@ -543,8 +531,6 @@
 
     try:
         dirs = [platBinDir, getConfig("bindir")]
-        if platBinDirOld:
-            dirs.append(platBinDirOld)
         for rem_wname in rem_wnames:
             for d in dirs:
                 for rwname in wrapperNames(d, rem_wname):
@@ -1939,9 +1925,9 @@
     with contextlib.suppress(OSError):
         os.rename(fileName, fileName + ".orig")
     localHg = (
-        os.path.join(sys.exec_prefix, "Scripts", "hg.exe")
+        os.path.join(sysconfig.get_path("scripts"), "hg.exe")
         if sys.platform.startswith(("win", "cygwin"))
-        else os.path.join(sys.exec_prefix, "bin", "hg")
+        else os.path.join(sysconfig.get_path("scripts"), "hg")
     )
     for hg in (localHg, "hg"):
         with contextlib.suppress(OSError, subprocess.CalledProcessError):

eric ide

mercurial