310 |
306 |
311 @param dname name of the directory to place the wrapper into |
307 @param dname name of the directory to place the wrapper into |
312 @param wfile basename (without extension) of the wrapper script |
308 @param wfile basename (without extension) of the wrapper script |
313 @return the names of the wrapper scripts |
309 @return the names of the wrapper scripts |
314 """ |
310 """ |
315 if sys.platform.startswith(("win", "cygwin")): |
311 wnames = ( |
316 wnames = (dname + "\\" + wfile + ".cmd", |
312 (dname + "\\" + wfile + ".cmd", dname + "\\" + wfile + ".bat") |
317 dname + "\\" + wfile + ".bat") |
313 if sys.platform.startswith(("win", "cygwin")) else |
318 else: |
314 (dname + "/" + wfile, ) |
319 wnames = (dname + "/" + wfile, ) |
315 ) |
320 |
316 |
321 return wnames |
317 return wnames |
322 |
318 |
323 |
319 |
324 def createPyWrapper(pydir, wfile, saveDir, isGuiScript=True): |
320 def createPyWrapper(pydir, wfile, saveDir, isGuiScript=True): |
558 os.path.join(getConfig('ericTranslationsDir'), 'eric6_*.qm')): |
554 os.path.join(getConfig('ericTranslationsDir'), 'eric6_*.qm')): |
559 if os.path.exists(name): |
555 if os.path.exists(name): |
560 os.remove(name) |
556 os.remove(name) |
561 |
557 |
562 # Cleanup API files |
558 # Cleanup API files |
563 try: |
559 with contextlib.suppress(AttributeError): |
564 apidir = getConfig('apidir') |
560 apidir = getConfig('apidir') |
565 for progLanguage in progLanguages: |
561 for progLanguage in progLanguages: |
566 for name in getConfig('apis'): |
562 for name in getConfig('apis'): |
567 apiname = os.path.join(apidir, progLanguage.lower(), name) |
563 apiname = os.path.join(apidir, progLanguage.lower(), name) |
568 if os.path.exists(apiname): |
564 if os.path.exists(apiname): |
569 os.remove(apiname) |
565 os.remove(apiname) |
570 for apiname in glob.glob( |
566 for apiname in glob.glob( |
571 os.path.join(apidir, progLanguage.lower(), "*.bas")): |
567 os.path.join(apidir, progLanguage.lower(), "*.bas")): |
572 if os.path.basename(apiname) != "eric6.bas": |
568 if os.path.basename(apiname) != "eric6.bas": |
573 os.remove(apiname) |
569 os.remove(apiname) |
574 except AttributeError: |
|
575 pass |
|
576 |
570 |
577 if sys.platform == "darwin": |
571 if sys.platform == "darwin": |
578 # delete the Mac app bundle |
572 # delete the Mac app bundle |
579 cleanUpMacAppBundle() |
573 cleanUpMacAppBundle() |
580 except OSError as msg: |
574 except OSError as msg: |
586 def cleanUpLinuxSpecifics(): |
580 def cleanUpLinuxSpecifics(): |
587 """ |
581 """ |
588 Clean up Linux specific files. |
582 Clean up Linux specific files. |
589 """ |
583 """ |
590 if os.getuid() == 0: |
584 if os.getuid() == 0: |
591 for name in ["/usr/share/pixmaps/eric.png", |
|
592 "/usr/share/pixmaps/ericWeb.png"]: |
|
593 if os.path.exists(name): |
|
594 os.remove(name) |
|
595 for name in [ |
585 for name in [ |
596 "/usr/share/applications/eric6.desktop", |
586 "/usr/share/applications/eric6.desktop", |
597 "/usr/share/appdata/eric6.appdata.xml", |
587 "/usr/share/appdata/eric6.appdata.xml", |
598 "/usr/share/metainfo/eric6.appdata.xml", |
588 "/usr/share/metainfo/eric6.appdata.xml", |
599 "/usr/share/applications/eric6_browser.desktop", |
589 "/usr/share/applications/eric6_browser.desktop", |
600 "/usr/share/pixmaps/eric.png", |
590 "/usr/share/pixmaps/eric.png", |
601 "/usr/share/pixmaps/ericWeb.png", |
591 "/usr/share/pixmaps/ericWeb.png", |
|
592 "/usr/share/icons/eric.png", |
|
593 "/usr/share/icons/ericWeb.png", |
602 # from Python2 era |
594 # from Python2 era |
603 "/usr/share/applications/eric6_webbrowser.desktop", |
595 "/usr/share/applications/eric6_webbrowser.desktop", |
604 ]: |
596 ]: |
605 if os.path.exists(name): |
597 if os.path.exists(name): |
606 os.remove(name) |
598 os.remove(name) |
607 elif os.getuid() >= 1000: |
599 elif os.getuid() >= 1000: |
608 # it is assumed that user ids start at 1000 |
600 # it is assumed that user ids start at 1000 |
609 for name in ["~/.local/share/pixmaps/eric.png", |
|
610 "~/.local/share/pixmaps/ericWeb.png"]: |
|
611 path = os.path.expanduser(name) |
|
612 if os.path.exists(path): |
|
613 os.remove(path) |
|
614 for name in [ |
601 for name in [ |
615 "~/.local/share/applications/eric6.desktop", |
602 "~/.local/share/applications/eric6.desktop", |
616 "~/.local/share/appdata/eric6.appdata.xml", |
603 "~/.local/share/appdata/eric6.appdata.xml", |
617 "~/.local/share/metainfo/eric6.appdata.xml", |
604 "~/.local/share/metainfo/eric6.appdata.xml", |
618 "~/.local/share/applications/eric6_browser.desktop", |
605 "~/.local/share/applications/eric6_browser.desktop", |
619 "~/.local/share/pixmaps/eric.png", |
606 "~/.local/share/pixmaps/eric.png", |
620 "~/.local/share/pixmaps/ericWeb.png", |
607 "~/.local/share/pixmaps/ericWeb.png", |
|
608 "~/.local/share/icons/eric.png", |
|
609 "~/.local/share/icons/ericWeb.png", |
621 # from Python2 era |
610 # from Python2 era |
622 "/usr/share/applications/eric6_webbrowser.desktop", |
611 "/usr/share/applications/eric6_webbrowser.desktop", |
623 ]: |
612 ]: |
624 path = os.path.expanduser(name) |
613 path = os.path.expanduser(name) |
625 if os.path.exists(path): |
614 if os.path.exists(path): |
939 Install Linux specific files. |
928 Install Linux specific files. |
940 """ |
929 """ |
941 global distDir, sourceDir |
930 global distDir, sourceDir |
942 |
931 |
943 if distDir: |
932 if distDir: |
944 dst = os.path.normpath(os.path.join(distDir, "usr/share/pixmaps")) |
933 dst = os.path.normpath(os.path.join(distDir, "usr/share/icons")) |
945 if not os.path.exists(dst): |
934 if not os.path.exists(dst): |
946 os.makedirs(dst) |
935 os.makedirs(dst) |
947 shutilCopy( |
936 shutilCopy( |
948 os.path.join(eric6SourceDir, "pixmaps", "eric_icon.png"), |
937 os.path.join(eric6SourceDir, "pixmaps", "eric_icon.png"), |
949 os.path.join(dst, "eric.png")) |
938 os.path.join(dst, "eric.png")) |
967 os.path.join(sourceDir, "linux", "eric6.appdata.xml.in"), |
956 os.path.join(sourceDir, "linux", "eric6.appdata.xml.in"), |
968 os.path.join(dst, "eric6.appdata.xml")) |
957 os.path.join(dst, "eric6.appdata.xml")) |
969 elif os.getuid() == 0: |
958 elif os.getuid() == 0: |
970 shutilCopy( |
959 shutilCopy( |
971 os.path.join(eric6SourceDir, "pixmaps", "eric_icon.png"), |
960 os.path.join(eric6SourceDir, "pixmaps", "eric_icon.png"), |
972 "/usr/share/pixmaps/eric.png") |
961 "/usr/share/icons/eric.png") |
973 copyDesktopFile( |
962 copyDesktopFile( |
974 os.path.join(sourceDir, "linux", "eric6.desktop.in"), |
963 os.path.join(sourceDir, "linux", "eric6.desktop.in"), |
975 "/usr/share/applications/eric6.desktop") |
964 "/usr/share/applications/eric6.desktop") |
976 if os.path.exists("/usr/share/metainfo"): |
965 if os.path.exists("/usr/share/metainfo"): |
977 copyAppStreamFile( |
966 copyAppStreamFile( |
981 copyAppStreamFile( |
970 copyAppStreamFile( |
982 os.path.join(sourceDir, "linux", "eric6.appdata.xml.in"), |
971 os.path.join(sourceDir, "linux", "eric6.appdata.xml.in"), |
983 "/usr/share/appdata/eric6.appdata.xml") |
972 "/usr/share/appdata/eric6.appdata.xml") |
984 shutilCopy( |
973 shutilCopy( |
985 os.path.join(eric6SourceDir, "pixmaps", "ericWeb48_icon.png"), |
974 os.path.join(eric6SourceDir, "pixmaps", "ericWeb48_icon.png"), |
986 "/usr/share/pixmaps/ericWeb.png") |
975 "/usr/share/icons/ericWeb.png") |
987 copyDesktopFile( |
976 copyDesktopFile( |
988 os.path.join(sourceDir, "linux", "eric6_browser.desktop.in"), |
977 os.path.join(sourceDir, "linux", "eric6_browser.desktop.in"), |
989 "/usr/share/applications/eric6_browser.desktop") |
978 "/usr/share/applications/eric6_browser.desktop") |
990 elif os.getuid() >= 1000: |
979 elif os.getuid() >= 1000: |
991 # it is assumed, that user ids start at 1000 |
980 # it is assumed, that user ids start at 1000 |
992 localPath = os.path.join(os.path.expanduser("~"), |
981 localPath = os.path.join(os.path.expanduser("~"), |
993 ".local", "share") |
982 ".local", "share") |
994 # create directories first |
983 # create directories first |
995 for directory in [os.path.join(localPath, name) |
984 for directory in [os.path.join(localPath, name) |
996 for name in ("pixmaps", "applications", |
985 for name in ("icons", "applications", |
997 "metainfo", "appdata")]: |
986 "metainfo", "appdata")]: |
998 if not os.path.isdir(directory): |
987 if not os.path.isdir(directory): |
999 os.makedirs(directory) |
988 os.makedirs(directory) |
1000 # now copy the files |
989 # now copy the files |
1001 shutilCopy( |
990 shutilCopy( |
1002 os.path.join(eric6SourceDir, "pixmaps", "eric_icon.png"), |
991 os.path.join(eric6SourceDir, "pixmaps", "eric_icon.png"), |
1003 os.path.join(localPath, "pixmaps", "eric.png")) |
992 os.path.join(localPath, "icons", "eric.png")) |
1004 copyDesktopFile( |
993 copyDesktopFile( |
1005 os.path.join(sourceDir, "linux", "eric6.desktop.in"), |
994 os.path.join(sourceDir, "linux", "eric6.desktop.in"), |
1006 os.path.join(localPath, "applications", "eric6.desktop")) |
995 os.path.join(localPath, "applications", "eric6.desktop")) |
1007 copyAppStreamFile( |
996 copyAppStreamFile( |
1008 os.path.join(sourceDir, "linux", "eric6.appdata.xml.in"), |
997 os.path.join(sourceDir, "linux", "eric6.appdata.xml.in"), |
1010 copyAppStreamFile( |
999 copyAppStreamFile( |
1011 os.path.join(sourceDir, "linux", "eric6.appdata.xml.in"), |
1000 os.path.join(sourceDir, "linux", "eric6.appdata.xml.in"), |
1012 os.path.join(localPath, "appdata", "eric6.appdata.xml")) |
1001 os.path.join(localPath, "appdata", "eric6.appdata.xml")) |
1013 shutilCopy( |
1002 shutilCopy( |
1014 os.path.join(eric6SourceDir, "pixmaps", "ericWeb48_icon.png"), |
1003 os.path.join(eric6SourceDir, "pixmaps", "ericWeb48_icon.png"), |
1015 os.path.join(localPath, "pixmaps", "ericWeb.png")) |
1004 os.path.join(localPath, "icons", "ericWeb.png")) |
1016 copyDesktopFile( |
1005 copyDesktopFile( |
1017 os.path.join(sourceDir, "linux", "eric6_browser.desktop.in"), |
1006 os.path.join(sourceDir, "linux", "eric6_browser.desktop.in"), |
1018 os.path.join(localPath, "applications", "eric6_browser.desktop")) |
1007 os.path.join(localPath, "applications", "eric6_browser.desktop")) |
1019 |
1008 |
1020 |
1009 |
1246 for apiName in sorted( |
1236 for apiName in sorted( |
1247 glob.glob(os.path.join(eric6SourceDir, "APIs", |
1237 glob.glob(os.path.join(eric6SourceDir, "APIs", |
1248 "MicroPython", "*.api"))): |
1238 "MicroPython", "*.api"))): |
1249 apis.append(os.path.basename(apiName)) |
1239 apis.append(os.path.basename(apiName)) |
1250 |
1240 |
1251 if sys.platform == "darwin": |
1241 macConfig = ( |
1252 macConfig = ( |
1242 (""" 'macAppBundlePath': r'{0}',\n""" |
1253 """ 'macAppBundlePath': r'{0}',\n""" |
1243 """ 'macAppBundleName': r'{1}',\n""").format(macAppBundlePath, |
1254 """ 'macAppBundleName': r'{1}',\n""" |
1244 macAppBundleName) |
1255 ).format(macAppBundlePath, macAppBundleName) |
1245 if sys.platform == "darwin" else |
1256 else: |
1246 "" |
1257 macConfig = "" |
1247 ) |
1258 config = ( |
1248 config = ( |
1259 """# -*- coding: utf-8 -*-\n""" |
1249 """# -*- coding: utf-8 -*-\n""" |
1260 """#\n""" |
1250 """#\n""" |
1261 """# This module contains the configuration of the individual eric""" |
1251 """# This module contains the configuration of the individual eric""" |
1262 """ installation\n""" |
1252 """ installation\n""" |
1343 installInfo["exe_edited"] = False |
1333 installInfo["exe_edited"] = False |
1344 installInfo["argv_edited"] = False |
1334 installInfo["argv_edited"] = False |
1345 installInfo["eric_edited"] = False |
1335 installInfo["eric_edited"] = False |
1346 |
1336 |
1347 |
1337 |
1348 def pipInstall(packageName, message): |
1338 def pipInstall(packageName, message, force=True): |
1349 """ |
1339 """ |
1350 Install the given package via pip. |
1340 Install the given package via pip. |
1351 |
1341 |
1352 @param packageName name of the package to be installed |
1342 @param packageName name of the package to be installed |
1353 @type str |
1343 @type str |
1354 @param message message to be shown to the user |
1344 @param message message to be shown to the user |
1355 @type str |
1345 @type str |
|
1346 @param force flag indicating to perform the installation |
|
1347 without asking the user |
|
1348 @type bool |
1356 @return flag indicating a successful installation |
1349 @return flag indicating a successful installation |
1357 @rtype bool |
1350 @rtype bool |
1358 """ |
1351 """ |
1359 global yes2All |
1352 global yes2All |
1360 |
1353 |
1361 ok = False |
1354 ok = False |
1362 if yes2All: |
1355 if yes2All or force: |
1363 answer = "y" |
1356 answer = "y" |
1364 else: |
1357 else: |
1365 print("{0}\n\nShall '{1}' be installed using pip? (Y/n)" |
1358 print("{0}\n\nShall '{1}' be installed using pip? (Y/n)" |
1366 .format(message, packageName), end=" ") |
1359 .format(message, packageName), end=" ") |
1367 answer = input() # secok |
1360 answer = input() # secok |
1537 (("PyQt5.QtWebEngineWidgets", ), sys.maxsize <= 2**32), |
1531 (("PyQt5.QtWebEngineWidgets", ), sys.maxsize <= 2**32), |
1538 ] |
1532 ] |
1539 optionalModulesList = { |
1533 optionalModulesList = { |
1540 # key is pip project name |
1534 # key is pip project name |
1541 # value is tuple of package name, pip install constraint |
1535 # value is tuple of package name, pip install constraint |
1542 "PyYAML": ("yaml", ""), |
1536 "docutils": ("docutils", ""), |
|
1537 "Markdown": ("markdown", ""), |
|
1538 "pyyaml": ("yaml", ""), |
1543 "toml": ("toml", ""), |
1539 "toml": ("toml", ""), |
|
1540 "chardet": ("chardet", ""), |
|
1541 "asttokens": ("asttokens", ""), |
|
1542 "EditorConfig": ("editorconfig", ""), |
|
1543 "Send2Trash": ("send2trash", ""), |
|
1544 "Pygments": ("pygments", ""), |
1544 } |
1545 } |
1545 # dict with tuples of package name and install constraint |
1546 # dict with tuples of package name and install constraint |
1546 if sys.platform != "darwin" and not ignorePyqt5Tools: |
1547 if sys.platform != "darwin" and not ignorePyqt5Tools: |
1547 optionalModulesList["qt5-applications"] = ("qt5_applications", |
1548 optionalModulesList["qt5-applications"] = ("qt5_applications", |
1548 "<5.15.2") |
1549 "<5.15.2") |
1565 altModulesOK = True |
1566 altModulesOK = True |
1566 for altModules, forcedOk in altModulesList: |
1567 for altModules, forcedOk in altModulesList: |
1567 modulesOK = False |
1568 modulesOK = False |
1568 for altModule in altModules: |
1569 for altModule in altModules: |
1569 name = altModule.split(".")[1] |
1570 name = altModule.split(".")[1] |
1570 try: |
1571 with contextlib.suppress(ImportError): |
1571 __import__(altModule) |
1572 __import__(altModule) |
1572 print("Found", name) |
1573 print("Found", name) |
1573 modulesOK = True |
1574 modulesOK = True |
1574 break |
1575 break |
1575 except ImportError: |
|
1576 pass |
|
1577 if not modulesOK and not forcedOk: |
1576 if not modulesOK and not forcedOk: |
1578 altModulesOK = False |
1577 altModulesOK = False |
1579 print('Sorry, please install {0}.' |
1578 print('Sorry, please install {0}.' |
1580 .format(" or ".join(altModules))) |
1579 .format(" or ".join(altModules))) |
1581 if not altModulesOK: |
1580 if not altModulesOK: |
1627 (major, minor, pat) = sipVersion.split('.') |
1626 (major, minor, pat) = sipVersion.split('.') |
1628 major = int(major) |
1627 major = int(major) |
1629 minor = int(minor) |
1628 minor = int(minor) |
1630 pat = int(pat) |
1629 pat = int(pat) |
1631 if ( |
1630 if ( |
1632 major < 4 or |
1631 major < 5 or |
1633 (major == 4 and minor < 14) or |
1632 (major == 5 and minor < 0) or |
1634 (major == 4 and minor == 14 and pat < 2) |
1633 (major == 5 and minor == 0 and pat < 0) |
1635 ): |
1634 ): |
1636 print('Sorry, you must have sip 4.14.2 or higher or' |
1635 print('Sorry, you must have sip 5.0.0 or higher or' |
1637 ' a recent snapshot release.') |
1636 ' a recent snapshot release.') |
1638 exit(3) |
1637 exit(3) |
1639 # check for blacklisted versions |
1638 # check for blacklisted versions |
1640 for vers in BlackLists["sip"] + PlatformBlackLists["sip"]: |
1639 for vers in BlackLists["sip"] + PlatformBlackLists["sip"]: |
1641 if vers == sipVersion: |
1640 if vers == sipVersion: |
1642 print( |
1641 print( |
1643 'Sorry, sip version {0} is not compatible with eric.' |
1642 'Sorry, sip version {0} is not compatible with eric.' |
1644 .format(vers)) |
1643 .format(vers)) |
1645 print('Please install another version.') |
1644 print('Please install another version.') |
1646 exit(3) |
1645 exit(3) |
1647 except (ImportError, AttributeError): |
|
1648 pass |
|
1649 |
1646 |
1650 # check version of PyQt |
1647 # check version of PyQt |
1651 from PyQt5.QtCore import PYQT_VERSION_STR |
1648 from PyQt5.QtCore import PYQT_VERSION_STR |
1652 pyqtVersion = PYQT_VERSION_STR |
1649 pyqtVersion = PYQT_VERSION_STR |
1653 print("PyQt Version:", pyqtVersion.strip()) |
1650 print("PyQt Version:", pyqtVersion.strip()) |
1702 ' eric.'.format(vers)) |
1699 ' eric.'.format(vers)) |
1703 print('Please install another version.') |
1700 print('Please install another version.') |
1704 exit(5) |
1701 exit(5) |
1705 |
1702 |
1706 # print version info for additional modules |
1703 # print version info for additional modules |
1707 try: |
1704 with contextlib.suppress(NameError, AttributeError): |
1708 print("PyQtChart:", QtChart.PYQT_CHART_VERSION_STR) |
1705 print("PyQtChart:", QtChart.PYQT_CHART_VERSION_STR) |
1709 except (NameError, AttributeError): |
1706 |
1710 pass |
1707 with contextlib.suppress(ImportError, AttributeError): |
1711 try: |
|
1712 from PyQt5 import QtWebEngine |
1708 from PyQt5 import QtWebEngine |
1713 print("PyQtWebEngine.", QtWebEngine.PYQT_WEBENGINE_VERSION_STR) |
1709 print("PyQtWebEngine.", QtWebEngine.PYQT_WEBENGINE_VERSION_STR) |
1714 except (ImportError, AttributeError): |
|
1715 pass |
|
1716 |
1710 |
1717 print("All dependencies ok.") |
1711 print("All dependencies ok.") |
1718 print() |
1712 print() |
1719 |
1713 |
1720 |
1714 |
1745 @param fileName name of the Python file containing the info (string) |
1739 @param fileName name of the Python file containing the info (string) |
1746 """ |
1740 """ |
1747 if not fileName: |
1741 if not fileName: |
1748 return |
1742 return |
1749 |
1743 |
1750 try: |
1744 with contextlib.suppress(OSError): |
1751 os.rename(fileName, fileName + ".orig") |
1745 os.rename(fileName, fileName + ".orig") |
1752 except OSError: |
|
1753 pass |
|
1754 try: |
1746 try: |
1755 hgOut = subprocess.check_output(["hg", "identify", "-i"]) # secok |
1747 hgOut = subprocess.check_output(["hg", "identify", "-i"]) # secok |
1756 hgOut = hgOut.decode() |
1748 hgOut = hgOut.decode() |
1757 except (OSError, subprocess.CalledProcessError): |
1749 except (OSError, subprocess.CalledProcessError): |
1758 hgOut = "" |
1750 hgOut = "" |
1809 @type str |
1801 @type str |
1810 """ |
1802 """ |
1811 from win32com.client import Dispatch |
1803 from win32com.client import Dispatch |
1812 from pywintypes import com_error |
1804 from pywintypes import com_error |
1813 |
1805 |
1814 try: |
1806 with contextlib.suppress(com_error): |
1815 shell = Dispatch('WScript.Shell') |
1807 shell = Dispatch('WScript.Shell') |
1816 shortcut = shell.CreateShortCut(linkPath) |
1808 shortcut = shell.CreateShortCut(linkPath) |
1817 shortcut.Targetpath = targetPath |
1809 shortcut.Targetpath = targetPath |
1818 shortcut.WorkingDirectory = os.path.dirname(targetPath) |
1810 shortcut.WorkingDirectory = os.path.dirname(targetPath) |
1819 shortcut.IconLocation = iconPath |
1811 shortcut.IconLocation = iconPath |
1820 shortcut.save() |
1812 shortcut.save() |
1821 except com_error: |
|
1822 # maybe restrictions prohibited link creation |
|
1823 pass |
|
1824 |
1813 |
1825 |
1814 |
1826 def windowsDesktopNames(): |
1815 def windowsDesktopNames(): |
1827 """ |
1816 """ |
1828 Function to generate the link names for the Windows Desktop. |
1817 Function to generate the link names for the Windows Desktop. |
1937 elif opt == "-c": |
1926 elif opt == "-c": |
1938 doCleanup = False |
1927 doCleanup = False |
1939 elif opt == "-z": |
1928 elif opt == "-z": |
1940 doCompile = False |
1929 doCompile = False |
1941 elif opt == "-f": |
1930 elif opt == "-f": |
1942 try: |
1931 with open(arg) as f: |
1943 exec(compile(open(arg).read(), arg, 'exec'), globals()) |
1932 try: |
1944 # secok |
1933 exec(compile(f.read(), arg, 'exec'), globals()) |
1945 if len(cfg) != configLength: |
1934 # secok |
1946 print("The configuration dictionary in '{0}' is incorrect." |
1935 if len(cfg) != configLength: |
1947 " Aborting".format(arg)) |
1936 print("The configuration dictionary in '{0}' is" |
1948 exit(6) |
1937 " incorrect. Aborting".format(arg)) |
1949 except Exception: |
1938 exit(6) |
1950 cfg = {} |
1939 except Exception: |
|
1940 cfg = {} |
1951 elif opt == "-m": |
1941 elif opt == "-m": |
1952 macAppBundleName = arg |
1942 macAppBundleName = arg |
1953 elif opt == "-n": |
1943 elif opt == "-n": |
1954 macAppBundlePath = arg |
1944 macAppBundlePath = arg |
1955 elif opt == "-p": |
1945 elif opt == "-p": |
1991 |
1981 |
1992 if len(cfg) == 0: |
1982 if len(cfg) == 0: |
1993 createInstallConfig() |
1983 createInstallConfig() |
1994 |
1984 |
1995 # get rid of development config file, if it exists |
1985 # get rid of development config file, if it exists |
1996 try: |
1986 with contextlib.suppress(OSError): |
1997 if installFromSource: |
1987 if installFromSource: |
1998 os.rename(configName, configName + ".orig") |
1988 os.rename(configName, configName + ".orig") |
1999 configNameC = configName + 'c' |
1989 configNameC = configName + 'c' |
2000 if os.path.exists(configNameC): |
1990 if os.path.exists(configNameC): |
2001 os.remove(configNameC) |
1991 os.remove(configNameC) |
2002 os.remove(configName) |
1992 os.remove(configName) |
2003 except OSError: |
|
2004 pass |
|
2005 |
1993 |
2006 # cleanup old installation |
1994 # cleanup old installation |
2007 print("Cleaning up old installation ...") |
1995 print("Cleaning up old installation ...") |
2008 try: |
1996 try: |
2009 if doCleanup: |
1997 if doCleanup: |
2059 with open(os.path.join(cfg["ericDir"], |
2047 with open(os.path.join(cfg["ericDir"], |
2060 installInfoName), "w") as installInfoFile: |
2048 installInfoName), "w") as installInfoFile: |
2061 json.dump(installInfo, installInfoFile, indent=2) |
2049 json.dump(installInfo, installInfoFile, indent=2) |
2062 |
2050 |
2063 # do some cleanup |
2051 # do some cleanup |
2064 try: |
2052 with contextlib.suppress(OSError): |
2065 if installFromSource: |
2053 if installFromSource: |
2066 os.remove(configName) |
2054 os.remove(configName) |
2067 configNameC = configName + 'c' |
2055 configNameC = configName + 'c' |
2068 if os.path.exists(configNameC): |
2056 if os.path.exists(configNameC): |
2069 os.remove(configNameC) |
2057 os.remove(configNameC) |
2070 os.rename(configName + ".orig", configName) |
2058 os.rename(configName + ".orig", configName) |
2071 except OSError: |
2059 with contextlib.suppress(OSError): |
2072 pass |
|
2073 try: |
|
2074 if installFromSource and infoName: |
2060 if installFromSource and infoName: |
2075 os.remove(infoName) |
2061 os.remove(infoName) |
2076 infoNameC = infoName + 'c' |
2062 infoNameC = infoName + 'c' |
2077 if os.path.exists(infoNameC): |
2063 if os.path.exists(infoNameC): |
2078 os.remove(infoNameC) |
2064 os.remove(infoNameC) |
2079 os.rename(infoName + ".orig", infoName) |
2065 os.rename(infoName + ".orig", infoName) |
2080 except OSError: |
|
2081 pass |
|
2082 |
2066 |
2083 print("\nInstallation complete.") |
2067 print("\nInstallation complete.") |
2084 print() |
2068 print() |
2085 |
2069 |
2086 exit(res) |
2070 exit(res) |