Extended the install script to improve cooperation with packagers.

Sun, 30 Nov 2014 11:55:32 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 30 Nov 2014 11:55:32 +0100
changeset 3948
6c3720179d6b
parent 3947
bee3a5d3f71c
child 3950
6819272cafd5

Extended the install script to improve cooperation with packagers.

install.py file | annotate | diff | comparison | revisions
uninstall.py file | annotate | diff | comparison | revisions
--- a/install.py	Sat Nov 29 16:31:36 2014 +0100
+++ b/install.py	Sun Nov 30 11:55:32 2014 +0100
@@ -625,8 +625,8 @@
     try:
         # Install the files
         # make the install directories
-        for key in list(cfg.keys()):
-            if not os.path.isdir(cfg[key]):
+        for key in cfg.keys():
+            if cfg[key] and not os.path.isdir(cfg[key]):
                 os.makedirs(cfg[key])
         
         # copy the eric6 config file
@@ -911,7 +911,7 @@
     """
     Create the installation config dictionary.
     """
-    global modDir, platBinDir, cfg, apisDir
+    global modDir, platBinDir, cfg, apisDir, installApis
         
     ericdir = os.path.join(modDir, "eric6")
     cfg = {
@@ -930,10 +930,13 @@
         'bindir': platBinDir,
         'mdir': modDir,
     }
-    if apisDir:
-        cfg['apidir'] = apisDir
+    if installApis:
+        if apisDir:
+            cfg['apidir'] = apisDir
+        else:
+            cfg['apidir'] = os.path.join(ericdir, "api")
     else:
-        cfg['apidir'] = os.path.join(ericdir, "api")
+        cfg['apidir'] = ""
 configLength = 15
     
 
@@ -944,15 +947,16 @@
     global cfg, sourceDir, macAppBundlePath
     
     apis = []
-    for progLanguage in progLanguages:
-        for apiName in glob.glob(
-                os.path.join(sourceDir, "APIs", progLanguage, "*.api")):
-            apis.append(os.path.basename(apiName))
-        if progLanguage == "Python":
-            # treat Python3 API files the same as Python API files
+    if installApis:
+        for progLanguage in progLanguages:
             for apiName in glob.glob(
-                    os.path.join(sourceDir, "APIs", "Python3", "*.api")):
+                    os.path.join(sourceDir, "APIs", progLanguage, "*.api")):
                 apis.append(os.path.basename(apiName))
+            if progLanguage == "Python":
+                # treat Python3 API files the same as Python API files
+                for apiName in glob.glob(
+                        os.path.join(sourceDir, "APIs", "Python3", "*.api")):
+                    apis.append(os.path.basename(apiName))
     
     fn = 'eric6config.py'
     config = (
--- a/uninstall.py	Sat Nov 29 16:31:36 2014 +0100
+++ b/uninstall.py	Sun Nov 30 11:55:32 2014 +0100
@@ -164,15 +164,16 @@
         
         # Cleanup API files
         apidir = getConfig('apidir')
-        for progLanguage in progLanguages:
-            for name in getConfig('apis'):
-                apiname = os.path.join(apidir, progLanguage.lower(), name)
-                if os.path.exists(apiname):
-                    os.remove(apiname)
-            for apiname in glob.glob(
-                    os.path.join(apidir, progLanguage.lower(), "*.bas")):
-                if os.path.basename(apiname) != "eric6.bas":
-                    os.remove(apiname)
+        if apidir:
+            for progLanguage in progLanguages:
+                for name in getConfig('apis'):
+                    apiname = os.path.join(apidir, progLanguage.lower(), name)
+                    if os.path.exists(apiname):
+                        os.remove(apiname)
+                for apiname in glob.glob(
+                        os.path.join(apidir, progLanguage.lower(), "*.bas")):
+                    if os.path.basename(apiname) != "eric6.bas":
+                        os.remove(apiname)
         
         if sys.platform == "darwin":
             # delete the Mac app bundle

eric ide

mercurial