scripts/install.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 9175
21e2be5f0b41
child 9214
bd28e56047d7
--- a/scripts/install.py	Tue Jul 05 16:34:43 2022 +0200
+++ b/scripts/install.py	Thu Jul 07 11:23:56 2022 +0200
@@ -46,7 +46,7 @@
 cfg = {}
 progLanguages = ["Python", "Ruby", "QSS"]
 sourceDir = "eric"
-eric7SourceDir = os.path.join(sourceDir, "eric7")
+eric7SourceDir = ""
 configName = 'eric7config.py'
 defaultMacAppBundleName = "eric7.app"
 defaultMacAppBundlePath = "/Applications"
@@ -275,12 +275,12 @@
     @param src source file name (string)
     @param dst destination file name (string)
     """
-    if os.path.exists(os.path.join("eric", "eric7", "UI", "Info.py")):
-        # Installing from archive
-        from eric.eric7.UI.Info import Version
-    elif os.path.exists(os.path.join("eric7", "UI", "Info.py")):
+    if os.path.exists(os.path.join("eric", "src", "eric7", "UI", "Info.py")):
+        # Installing from installer archive
+        from eric.src.eric7.UI.Info import Version
+    elif os.path.exists(os.path.join("src", "eric7", "UI", "Info.py")):
         # Installing from source tree
-        from eric7.UI.Info import Version
+        from src.eric7.UI.Info import Version
     else:
         Version = "Unknown"
     
@@ -740,10 +740,9 @@
         
         # copy the various parts of eric
         copyTree(
-            eric7SourceDir, cfg['ericDir'],
+            eric7SourceDir,
+            cfg['ericDir'],
             ['*.py', '*.pyc', '*.pyo', '*.pyw'],
-            [os.path.join(sourceDir, "Examples"),
-             os.path.join(sourceDir, ".ropeproject")],
             excludePatterns=["eric7config.py*"])
         copyTree(
             os.path.join(eric7SourceDir, "Plugins"),
@@ -936,6 +935,8 @@
     """
     global distDir, sourceDir
     
+    dataSourceDir = os.path.join(eric7SourceDir, "data", "linux")
+    
     if distDir:
         dst = os.path.normpath(os.path.join(distDir, "usr/share/icons"))
         if not os.path.exists(dst):
@@ -962,10 +963,10 @@
             os.path.join(distDir, "usr/share/applications"))
         if not os.path.exists(dst):
             os.makedirs(dst)
-        copyDesktopFile(os.path.join(sourceDir, "linux", "eric7.desktop.in"),
+        copyDesktopFile(os.path.join(dataSourceDir, "eric7.desktop.in"),
                         os.path.join(dst, "eric7.desktop"))
         copyDesktopFile(
-            os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"),
+            os.path.join(dataSourceDir, "eric7_browser.desktop.in"),
             os.path.join(dst, "eric7_browser.desktop"))
         
         dst = os.path.normpath(
@@ -973,7 +974,7 @@
         if not os.path.exists(dst):
             os.makedirs(dst)
         copyAppStreamFile(
-            os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"),
+            os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
             os.path.join(dst, "eric7.appdata.xml"))
     elif os.getuid() == 0:
         shutilCopy(
@@ -983,15 +984,15 @@
             os.path.join(eric7SourceDir, "pixmaps", "eric48_icon.png"),
             "/usr/share/icons/hicolor/48x48/apps/eric.png")
         copyDesktopFile(
-            os.path.join(sourceDir, "linux", "eric7.desktop.in"),
+            os.path.join(dataSourceDir, "eric7.desktop.in"),
             "/usr/share/applications/eric7.desktop")
         if os.path.exists("/usr/share/metainfo"):
             copyAppStreamFile(
-                os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"),
+                os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
                 "/usr/share/metainfo/eric7.appdata.xml")
         elif os.path.exists("/usr/share/appdata"):
             copyAppStreamFile(
-                os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"),
+                os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
                 "/usr/share/appdata/eric7.appdata.xml")
         shutilCopy(
             os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
@@ -1000,7 +1001,7 @@
             os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
             "/usr/share/icons/hicolor/48x48/apps/ericWeb.png")
         copyDesktopFile(
-            os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"),
+            os.path.join(dataSourceDir, "eric7_browser.desktop.in"),
             "/usr/share/applications/eric7_browser.desktop")
     elif os.getuid() >= 1000:
         # it is assumed, that user ids start at 1000
@@ -1020,13 +1021,13 @@
             os.path.join(eric7SourceDir, "pixmaps", "eric48_icon.png"),
             os.path.join(localPath, "icons/hicolor/48x48/apps", "eric.png"))
         copyDesktopFile(
-            os.path.join(sourceDir, "linux", "eric7.desktop.in"),
+            os.path.join(dataSourceDir, "eric7.desktop.in"),
             os.path.join(localPath, "applications", "eric7.desktop"))
         copyAppStreamFile(
-            os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"),
+            os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
             os.path.join(localPath, "metainfo", "eric7.appdata.xml"))
         copyAppStreamFile(
-            os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"),
+            os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
             os.path.join(localPath, "appdata", "eric7.appdata.xml"))
         shutilCopy(
             os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
@@ -1035,7 +1036,7 @@
             os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
             os.path.join(localPath, "icons/hicolor/48x48/apps", "ericWeb.png"))
         copyDesktopFile(
-            os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"),
+            os.path.join(dataSourceDir, "eric7_browser.desktop.in"),
             os.path.join(localPath, "applications",
                          "eric7_browser.desktop"))
 
@@ -2045,17 +2046,21 @@
     if depChecks:
         doDependancyChecks()
     
+    if installFromSource:
+        sourceDir = os.path.abspath("..")
+    
+    eric7SourceDir = (
+        os.path.join(sourceDir, "eric7")
+        if os.path.exists(os.path.join(sourceDir, "eric7")) else
+        os.path.join(sourceDir, "src", "eric7")
+    )
+    
     # cleanup source if installing from source
     if installFromSource:
         print("Cleaning up source ...")
-        sourceDir = os.path.abspath("..")
-        eric7SourceDir = os.path.join(sourceDir, "eric7")
         cleanupSource(eric7SourceDir)
         print()
-    
-    if installFromSource:
-        sourceDir = os.path.abspath("..")
-        eric7SourceDir = os.path.join(sourceDir, "eric7")
+        
         configName = os.path.join(eric7SourceDir, "eric7config.py")
         if os.path.exists(os.path.join(sourceDir, ".hg")):
             # we are installing from source with repo

eric ide

mercurial