40 distDir = None |
40 distDir = None |
41 apisDir = None |
41 apisDir = None |
42 doCleanup = True |
42 doCleanup = True |
43 doCompile = True |
43 doCompile = True |
44 cfg = {} |
44 cfg = {} |
45 progLanguages = ["Python", "Ruby"] |
45 progLanguages = ["Python", "Ruby", "QSS"] |
46 sourceDir = "eric" |
46 sourceDir = "eric" |
47 configName = 'eric5config.py' |
47 configName = 'eric5config.py' |
48 defaultMacAppBundleName = "eric5.app" |
48 defaultMacAppBundleName = "eric5.app" |
49 macAppBundleName = "eric5.app" |
49 macAppBundleName = "eric5.app" |
|
50 macAppBundlePath = "/Applications" |
50 macPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format( |
51 macPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format( |
51 sys.exec_prefix) |
52 sys.exec_prefix) |
52 |
53 |
53 # Define blacklisted versions of the prerequisites |
54 # Define blacklisted versions of the prerequisites |
54 BlackLists = { |
55 BlackLists = { |
101 """ |
102 """ |
102 Display a usage message and exit. |
103 Display a usage message and exit. |
103 |
104 |
104 @param rcode the return code passed back to the calling process. |
105 @param rcode the return code passed back to the calling process. |
105 """ |
106 """ |
106 global progName, modDir, distDir, apisDir, macAppBundleName |
107 global progName, modDir, distDir, apisDir |
107 global macPythonExe |
108 global macAppBundleName, macAppBundlePath, macPythonExe |
108 |
109 |
109 print() |
110 print() |
110 print("Usage:") |
111 print("Usage:") |
111 if sys.platform == "darwin": |
112 if sys.platform == "darwin": |
112 print(" {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" |
113 print(" {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" |
134 print(" -i dir temporary install prefix") |
135 print(" -i dir temporary install prefix") |
135 print(" (default: {0})".format(distDir)) |
136 print(" (default: {0})".format(distDir)) |
136 if sys.platform == "darwin": |
137 if sys.platform == "darwin": |
137 print(" -m name name of the Mac app bundle") |
138 print(" -m name name of the Mac app bundle") |
138 print(" (default: {0})".format(macAppBundleName)) |
139 print(" (default: {0})".format(macAppBundleName)) |
|
140 print(" -n path path of the directory the Mac app bundle will") |
|
141 print(" be created in") |
|
142 print(" (default: {0}".format(macAppBundlePath)) |
139 print(" -p python name of the python executable") |
143 print(" -p python name of the python executable") |
140 print(" (default: {0})".format(macPythonExe)) |
144 print(" (default: {0})".format(macPythonExe)) |
141 print(" -x don't perform dependency checks (use on your own" |
145 print(" -x don't perform dependency checks (use on your own" |
142 " risk)") |
146 " risk)") |
143 print(" -c don't cleanup old installation first") |
147 print(" -c don't cleanup old installation first") |
320 |
324 |
321 pdir = os.path.join(cfg['mdir'], "eric5plugins") |
325 pdir = os.path.join(cfg['mdir'], "eric5plugins") |
322 fname = os.path.join(pdir, "__init__.py") |
326 fname = os.path.join(pdir, "__init__.py") |
323 if not os.path.exists(fname): |
327 if not os.path.exists(fname): |
324 if not os.path.exists(pdir): |
328 if not os.path.exists(pdir): |
325 os.mkdir(pdir, 0o755) |
329 os.mkdir(pdir, 0o755) |
326 f = open(fname, "w") |
330 f = open(fname, "w") |
327 f.write( |
331 f.write( |
328 '''# -*- coding: utf-8 -*- |
332 '''# -*- coding: utf-8 -*- |
329 |
333 |
330 """ |
334 """ |
431 |
435 |
432 if sys.platform == "darwin": |
436 if sys.platform == "darwin": |
433 # delete the Mac app bundle |
437 # delete the Mac app bundle |
434 if os.path.exists("/Developer/Applications/Eric5"): |
438 if os.path.exists("/Developer/Applications/Eric5"): |
435 shutil.rmtree("/Developer/Applications/Eric5") |
439 shutil.rmtree("/Developer/Applications/Eric5") |
|
440 try: |
|
441 macAppBundlePath = getConfig("macAppBundlePath") |
|
442 macAppBundleName = getConfig("macAppBundleName") |
|
443 except AttributeError: |
|
444 macAppBundlePath = "/Applications" |
|
445 macAppBundleName = "eric5.app" |
436 if os.path.exists("/Applications/" + macAppBundleName): |
446 if os.path.exists("/Applications/" + macAppBundleName): |
437 shutil.rmtree("/Applications/" + macAppBundleName) |
447 shutil.rmtree("/Applications/" + macAppBundleName) |
|
448 bundlePath = os.path.join(macAppBundlePath, macAppBundleName) |
|
449 if os.path.exists(bundlePath): |
|
450 shutil.rmtree(bundlePath) |
438 |
451 |
439 except (IOError, OSError) as msg: |
452 except (IOError, OSError) as msg: |
440 sys.stderr.write( |
453 sys.stderr.write( |
441 'Error: {0}\nTry install with admin rights.\n'.format(msg)) |
454 'Error: {0}\nTry install with admin rights.\n'.format(msg)) |
442 exit(7) |
455 exit(7) |
668 Create a Mac application bundle. |
681 Create a Mac application bundle. |
669 |
682 |
670 @param pydir the name of the directory where the Python script will |
683 @param pydir the name of the directory where the Python script will |
671 eventually be installed (string) |
684 eventually be installed (string) |
672 """ |
685 """ |
673 global cfg, sourceDir, macAppBundleName, macPythonExe |
686 global cfg, sourceDir, macAppBundleName, macPythonExe, macAppBundlePath |
674 |
687 |
675 dirs = {"contents": "/Applications/{0}/Contents/".format(macAppBundleName), |
688 dirs = { |
676 "exe": "/Applications/{0}/Contents/MacOS".format(macAppBundleName), |
689 "contents": "{0}/{1}/Contents/".format( |
677 "icns": "/Applications/{0}/Contents/Resources".format( |
690 macAppBundlePath, macAppBundleName), |
678 macAppBundleName)} |
691 "exe": "{0}/{1}/Contents/MacOS".format( |
|
692 macAppBundlePath, macAppBundleName), |
|
693 "icns": "{0}/{1}/Contents/Resources".format( |
|
694 macAppBundlePath, macAppBundleName) |
|
695 } |
679 os.makedirs(dirs["contents"]) |
696 os.makedirs(dirs["contents"]) |
680 os.mkdir(dirs["exe"]) |
697 os.makedirs(dirs["exe"]) |
681 os.mkdir(dirs["icns"]) |
698 os.makedirs(dirs["icns"]) |
682 |
699 |
683 if macAppBundleName == defaultMacAppBundleName: |
700 if macAppBundleName == defaultMacAppBundleName: |
684 starter = os.path.join(dirs["exe"], "eric") |
701 starter = os.path.join(dirs["exe"], "eric") |
685 os.symlink(macPythonExe, starter) |
702 os.symlink(macPythonExe, starter) |
686 else: |
703 else: |
769 |
786 |
770 def createConfig(): |
787 def createConfig(): |
771 """ |
788 """ |
772 Create a config file with the respective config entries. |
789 Create a config file with the respective config entries. |
773 """ |
790 """ |
774 global cfg, sourceDir |
791 global cfg, sourceDir, macAppBundlePath |
775 |
792 |
776 apis = [] |
793 apis = [] |
777 for progLanguage in progLanguages: |
794 for progLanguage in progLanguages: |
778 for apiName in glob.glob( |
795 for apiName in glob.glob( |
779 os.path.join(sourceDir, "APIs", progLanguage, "*.api")): |
796 os.path.join(sourceDir, "APIs", progLanguage, "*.api")): |
807 """ 'ericOthersDir': r'{11}',\n""" |
824 """ 'ericOthersDir': r'{11}',\n""" |
808 """ 'bindir': r'{12}',\n""" |
825 """ 'bindir': r'{12}',\n""" |
809 """ 'mdir': r'{13}',\n""" |
826 """ 'mdir': r'{13}',\n""" |
810 """ 'apidir': r'{14}',\n""" |
827 """ 'apidir': r'{14}',\n""" |
811 """ 'apis': {15},\n""" |
828 """ 'apis': {15},\n""" |
|
829 """ 'macAppBundlePath': r'{16}',\n""" |
|
830 """ 'macAppBundleName': r'{17}',\n""" |
812 """}}\n""" |
831 """}}\n""" |
813 """\n""" |
832 """\n""" |
814 """def getConfig(name):\n""" |
833 """def getConfig(name):\n""" |
815 """ '''\n""" |
834 """ '''\n""" |
816 """ Module function to get a configuration value.\n""" |
835 """ Module function to get a configuration value.\n""" |
821 """ return _pkg_config[name]\n""" |
840 """ return _pkg_config[name]\n""" |
822 """ except KeyError:\n""" |
841 """ except KeyError:\n""" |
823 """ pass\n""" |
842 """ pass\n""" |
824 """\n""" |
843 """\n""" |
825 """ raise AttributeError('"{{0}}" is not a valid configuration""" |
844 """ raise AttributeError('"{{0}}" is not a valid configuration""" |
826 """ value'.format(name))\n""").format( |
845 """ value'.format(name))\n""" |
|
846 ).format( |
827 cfg['ericDir'], cfg['ericPixDir'], cfg['ericIconDir'], |
847 cfg['ericDir'], cfg['ericPixDir'], cfg['ericIconDir'], |
828 cfg['ericDTDDir'], cfg['ericCSSDir'], |
848 cfg['ericDTDDir'], cfg['ericCSSDir'], |
829 cfg['ericStylesDir'], cfg['ericDocDir'], |
849 cfg['ericStylesDir'], cfg['ericDocDir'], |
830 cfg['ericExamplesDir'], cfg['ericTranslationsDir'], |
850 cfg['ericExamplesDir'], cfg['ericTranslationsDir'], |
831 cfg['ericTemplatesDir'], |
851 cfg['ericTemplatesDir'], |
832 cfg['ericCodeTemplatesDir'], cfg['ericOthersDir'], |
852 cfg['ericCodeTemplatesDir'], cfg['ericOthersDir'], |
833 cfg['bindir'], cfg['mdir'], |
853 cfg['bindir'], cfg['mdir'], |
834 cfg['apidir'], apis) |
854 cfg['apidir'], apis, |
|
855 macAppBundlePath, macAppBundleName, |
|
856 ) |
835 copyToFile(fn, config) |
857 copyToFile(fn, config) |
836 |
858 |
837 |
859 |
838 def doDependancyChecks(): |
860 def doDependancyChecks(): |
839 """ |
861 """ |
1079 """ |
1101 """ |
1080 import getopt |
1102 import getopt |
1081 |
1103 |
1082 # Parse the command line. |
1104 # Parse the command line. |
1083 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir |
1105 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir |
1084 global sourceDir, configName, macAppBundleName, macPythonExe |
1106 global sourceDir, configName |
|
1107 global macAppBundlePath, macAppBundleName, macPythonExe |
1085 |
1108 |
1086 if sys.version_info < (2, 6, 0) or sys.version_info > (3, 9, 9): |
1109 if sys.version_info < (2, 6, 0) or sys.version_info > (3, 9, 9): |
1087 print('Sorry, eric5 requires at least Python 2.6 or ' |
1110 print('Sorry, eric5 requires at least Python 2.6 or ' |
1088 'Python 3 for running.') |
1111 'Python 3 for running.') |
1089 exit(5) |
1112 exit(5) |