--- a/install.py Sun Apr 13 15:45:57 2014 +0200 +++ b/install.py Tue Apr 15 22:41:08 2014 +0200 @@ -42,11 +42,12 @@ doCleanup = True doCompile = True cfg = {} -progLanguages = ["Python", "Ruby"] +progLanguages = ["Python", "Ruby", "QSS"] sourceDir = "eric" configName = 'eric5config.py' defaultMacAppBundleName = "eric5.app" macAppBundleName = "eric5.app" +macAppBundlePath = "/Applications" macPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format( sys.exec_prefix) @@ -103,8 +104,8 @@ @param rcode the return code passed back to the calling process. """ - global progName, modDir, distDir, apisDir, macAppBundleName - global macPythonExe + global progName, modDir, distDir, apisDir + global macAppBundleName, macAppBundlePath, macPythonExe print() print("Usage:") @@ -136,6 +137,9 @@ if sys.platform == "darwin": print(" -m name name of the Mac app bundle") print(" (default: {0})".format(macAppBundleName)) + print(" -n path path of the directory the Mac app bundle will") + print(" be created in") + print(" (default: {0}".format(macAppBundlePath)) print(" -p python name of the python executable") print(" (default: {0})".format(macPythonExe)) print(" -x don't perform dependency checks (use on your own" @@ -322,7 +326,7 @@ fname = os.path.join(pdir, "__init__.py") if not os.path.exists(fname): if not os.path.exists(pdir): - os.mkdir(pdir, 0o755) + os.mkdir(pdir, 0o755) f = open(fname, "w") f.write( '''# -*- coding: utf-8 -*- @@ -340,7 +344,7 @@ """ Uninstall the old eric files. """ - global macAppBundleName, platBinDir + global macAppBundleName, macAppBundlePath, platBinDir try: from eric5config import getConfig @@ -433,8 +437,17 @@ # delete the Mac app bundle if os.path.exists("/Developer/Applications/Eric5"): shutil.rmtree("/Developer/Applications/Eric5") + try: + macAppBundlePath = getConfig("macAppBundlePath") + macAppBundleName = getConfig("macAppBundleName") + except AttributeError: + macAppBundlePath = "/Applications" + macAppBundleName = "eric5.app" if os.path.exists("/Applications/" + macAppBundleName): shutil.rmtree("/Applications/" + macAppBundleName) + bundlePath = os.path.join(macAppBundlePath, macAppBundleName) + if os.path.exists(bundlePath): + shutil.rmtree(bundlePath) except (IOError, OSError) as msg: sys.stderr.write( @@ -670,15 +683,19 @@ @param pydir the name of the directory where the Python script will eventually be installed (string) """ - global cfg, sourceDir, macAppBundleName, macPythonExe + global cfg, sourceDir, macAppBundleName, macPythonExe, macAppBundlePath - dirs = {"contents": "/Applications/{0}/Contents/".format(macAppBundleName), - "exe": "/Applications/{0}/Contents/MacOS".format(macAppBundleName), - "icns": "/Applications/{0}/Contents/Resources".format( - macAppBundleName)} + dirs = { + "contents": "{0}/{1}/Contents/".format( + macAppBundlePath, macAppBundleName), + "exe": "{0}/{1}/Contents/MacOS".format( + macAppBundlePath, macAppBundleName), + "icns": "{0}/{1}/Contents/Resources".format( + macAppBundlePath, macAppBundleName) + } os.makedirs(dirs["contents"]) - os.mkdir(dirs["exe"]) - os.mkdir(dirs["icns"]) + os.makedirs(dirs["exe"]) + os.makedirs(dirs["icns"]) if macAppBundleName == defaultMacAppBundleName: starter = os.path.join(dirs["exe"], "eric") @@ -771,7 +788,7 @@ """ Create a config file with the respective config entries. """ - global cfg, sourceDir + global cfg, sourceDir, macAppBundlePath apis = [] for progLanguage in progLanguages: @@ -809,6 +826,8 @@ """ 'mdir': r'{13}',\n""" """ 'apidir': r'{14}',\n""" """ 'apis': {15},\n""" + """ 'macAppBundlePath': r'{16}',\n""" + """ 'macAppBundleName': r'{17}',\n""" """}}\n""" """\n""" """def getConfig(name):\n""" @@ -823,7 +842,8 @@ """ pass\n""" """\n""" """ raise AttributeError('"{{0}}" is not a valid configuration""" - """ value'.format(name))\n""").format( + """ value'.format(name))\n""" + ).format( cfg['ericDir'], cfg['ericPixDir'], cfg['ericIconDir'], cfg['ericDTDDir'], cfg['ericCSSDir'], cfg['ericStylesDir'], cfg['ericDocDir'], @@ -831,7 +851,9 @@ cfg['ericTemplatesDir'], cfg['ericCodeTemplatesDir'], cfg['ericOthersDir'], cfg['bindir'], cfg['mdir'], - cfg['apidir'], apis) + cfg['apidir'], apis, + macAppBundlePath, macAppBundleName, + ) copyToFile(fn, config) @@ -1081,7 +1103,8 @@ # Parse the command line. global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir - global sourceDir, configName, macAppBundleName, macPythonExe + global sourceDir, configName + global macAppBundlePath, macAppBundleName, macPythonExe if sys.version_info < (2, 6, 0) or sys.version_info > (3, 9, 9): print('Sorry, eric5 requires at least Python 2.6 or ' @@ -1137,6 +1160,8 @@ cfg = {} elif opt == "-m": macAppBundleName = arg + elif opt == "-n": + macAppBundlePath = arg elif opt == "-p": macPythonExe = arg