Sfoglia il codice sorgente

Always prune shebangs (because of upgrades)

Valentin Niess 5 anni fa
parent
commit
5cf28eef19
1 ha cambiato i file con 9 aggiunte e 9 eliminazioni
  1. 9 9
      python_appimage/data/sitecustomize.py

+ 9 - 9
python_appimage/data/sitecustomize.py

@@ -43,9 +43,6 @@ def patch_pip_install():
     args = sys.argv[1:]
     if 'install' in args:
         for exe in os.listdir(sys.prefix + '/bin'):
-            if exe in _bin_at_start:
-                continue
-
             path = os.path.join(sys.prefix, 'bin', exe)
 
             if (not os.path.isfile(path)) or (not os.access(path, os.X_OK)) or \
@@ -53,12 +50,6 @@ def patch_pip_install():
                exe.endswith('.pyc') or exe.endswith('.pyo'):
                 continue
 
-            usr_dir = os.path.join(sys.prefix, '../../usr/bin')
-            usr_exe = os.path.join(usr_dir, exe)
-            if not os.path.exists(usr_exe):
-                relpath = os.path.relpath(path, usr_dir)
-                os.symlink(relpath, usr_exe)
-
             try:
                 with open(path, 'r') as f:
                     header = f.read(2)
@@ -93,6 +84,15 @@ def patch_pip_install():
             except IOError:
                 continue
 
+            if exe in _bin_at_start:
+                continue
+
+            usr_dir = os.path.join(sys.prefix, '../../usr/bin')
+            usr_exe = os.path.join(usr_dir, exe)
+            if not os.path.exists(usr_exe):
+                relpath = os.path.relpath(path, usr_dir)
+                os.symlink(relpath, usr_exe)
+
     elif 'uninstall' in args:
         usr_dir = os.path.join(sys.prefix, '../../usr/bin')
         for exe in os.listdir(usr_dir):