251 elif sys.platform == "darwin": |
251 elif sys.platform == "darwin": |
252 pyexec = "{0}/bin/pythonw3".format(sys.exec_prefix) |
252 pyexec = "{0}/bin/pythonw3".format(sys.exec_prefix) |
253 if not os.path.exists(pyexec): |
253 if not os.path.exists(pyexec): |
254 pyexec = "{0}/bin/python3".format(sys.exec_prefix) |
254 pyexec = "{0}/bin/python3".format(sys.exec_prefix) |
255 wname = wfile |
255 wname = wfile |
256 wrapper = ( |
256 wrapper = ('''#!/bin/sh\n''' |
257 '''#!/bin/sh |
257 '''\n''' |
258 |
258 '''exec "{0}" "{1}/{2}.py" "$@"\n''' |
259 exec "{0}" "{1}/{2}.py" "$@" |
259 .format(pyexec, pydir, wfile)) |
260 '''.format(pyexec, pydir, wfile)) |
|
261 |
260 |
262 # *nix systems |
261 # *nix systems |
263 else: |
262 else: |
264 wname = wfile |
263 wname = wfile |
265 wrapper = ( |
264 wrapper = ('''#!/bin/sh\n''' |
266 '''#!/bin/sh |
265 '''\n''' |
267 |
266 '''exec "{0}" "{1}/{2}.py" "$@"\n''' |
268 exec "{0}" "{1}/{2}.py" "$@" |
267 .format(sys.executable, pydir, wfile)) |
269 '''.format(sys.executable, pydir, wfile)) |
|
270 |
268 |
271 copyToFile(wname, wrapper) |
269 copyToFile(wname, wrapper) |
272 os.chmod(wname, 0o755) |
270 os.chmod(wname, 0o755) |
273 |
271 |
274 return wname |
272 return wname |
513 shutilCopy(configName + 'c', modDir) |
511 shutilCopy(configName + 'c', modDir) |
514 |
512 |
515 # copy the various parts of eric5 |
513 # copy the various parts of eric5 |
516 copyTree( |
514 copyTree( |
517 sourceDir, cfg['ericDir'], |
515 sourceDir, cfg['ericDir'], |
518 ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
516 ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
519 ['{1}{0}Examples'.format(os.sep, sourceDir)], |
517 ['{1}{0}Examples'.format(os.sep, sourceDir)], |
520 excludePatterns=["eric5config.py*"]) |
518 excludePatterns=["eric5config.py*"]) |
521 copyTree( |
519 copyTree( |
522 sourceDir, cfg['ericDir'], ['*.rb'], |
520 sourceDir, cfg['ericDir'], ['*.rb'], |
523 ['{1}{0}Examples'.format(os.sep, sourceDir)]) |
521 ['{1}{0}Examples'.format(os.sep, sourceDir)]) |
694 pybin = os.path.join(sys.exec_prefix, "bin") |
692 pybin = os.path.join(sys.exec_prefix, "bin") |
695 pathlist = path.split(os.pathsep) |
693 pathlist = path.split(os.pathsep) |
696 if pybin not in pathlist: |
694 if pybin not in pathlist: |
697 pathlist.insert(0, pybin) |
695 pathlist.insert(0, pybin) |
698 path = os.pathsep.join(pathlist) |
696 path = os.pathsep.join(pathlist) |
699 wrapper = ( |
697 wrapper = ('''#!/bin/sh\n''' |
700 '''#!/bin/sh |
698 '''\n''' |
701 |
699 '''PATH={0}\n''' |
702 PATH={0} |
700 '''exec "{1}" "{2}/{3}.py" "$@"\n''' |
703 exec "{1}" "{2}/{3}.py" "$@" |
701 .format(path, starter, pydir, "eric5")) |
704 '''.format(path, starter, pydir, "eric5")) |
|
705 else: |
702 else: |
706 wrapper = ( |
703 wrapper = ('''#!/bin/sh\n''' |
707 '''#!/bin/sh |
704 '''\n''' |
708 |
705 '''exec "{0}" "{1}/{2}.py" "$@"\n''' |
709 exec "{0}" "{1}/{2}.py" "$@" |
706 .format(starter, pydir, "eric5")) |
710 '''.format(starter, pydir, "eric5")) |
|
711 copyToFile(wname, wrapper) |
707 copyToFile(wname, wrapper) |
712 os.chmod(wname, 0o755) |
708 os.chmod(wname, 0o755) |
713 |
709 |
714 shutilCopy(os.path.join(sourceDir, "pixmaps", "eric_2.icns"), |
710 shutilCopy(os.path.join(sourceDir, "pixmaps", "eric_2.icns"), |
715 os.path.join(dirs["icns"], "eric.icns")) |
711 os.path.join(dirs["icns"], "eric.icns")) |
716 |
712 |
717 copyToFile( |
713 copyToFile( |
718 os.path.join(dirs["contents"], "Info.plist"), |
714 os.path.join(dirs["contents"], "Info.plist"), |
719 '''<?xml version="1.0" encoding="UTF-8"?> |
715 '''<?xml version="1.0" encoding="UTF-8"?>\n''' |
720 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" |
716 '''<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"\n''' |
721 "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
717 ''' "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n''' |
722 <plist version="1.0"> |
718 '''<plist version="1.0">\n''' |
723 <dict> |
719 '''<dict>\n''' |
724 <key>CFBundleExecutable</key> |
720 ''' <key>CFBundleExecutable</key>\n''' |
725 <string>eric5</string> |
721 ''' <string>eric5</string>\n''' |
726 <key>CFBundleIconFile</key> |
722 ''' <key>CFBundleIconFile</key>\n''' |
727 <string>eric.icns</string> |
723 ''' <string>eric.icns</string>\n''' |
728 <key>CFBundleInfoDictionaryVersion</key> |
724 ''' <key>CFBundleInfoDictionaryVersion</key>\n''' |
729 <string>1.0</string> |
725 ''' <string>1.0</string>\n''' |
730 <key>CFBundleName</key> |
726 ''' <key>CFBundleName</key>\n''' |
731 <string>{0}</string> |
727 ''' <string>{0}</string>\n''' |
732 <key>CFBundleDisplayName</key> |
728 ''' <key>CFBundleDisplayName</key>\n''' |
733 <string>{0}</string> |
729 ''' <string>{0}</string>\n''' |
734 <key>CFBundlePackageType</key> |
730 ''' <key>CFBundlePackageType</key>\n''' |
735 <string>APPL</string> |
731 ''' <string>APPL</string>\n''' |
736 <key>CFBundleSignature</key> |
732 ''' <key>CFBundleSignature</key>\n''' |
737 <string>????</string> |
733 ''' <string>????</string>\n''' |
738 <key>CFBundleVersion</key> |
734 ''' <key>CFBundleVersion</key>\n''' |
739 <string>1.0</string> |
735 ''' <string>1.0</string>\n''' |
740 </dict> |
736 '''</dict>\n''' |
741 </plist>\n'''.format(macAppBundleName.replace(".app", ""))) |
737 '''</plist>\n'''.format(macAppBundleName.replace(".app", ""))) |
742 |
738 |
743 |
739 |
744 def createInstallConfig(): |
740 def createInstallConfig(): |
745 """ |
741 """ |
746 Create the installation config dictionary. |
742 Create the installation config dictionary. |
787 for apiName in glob.glob( |
783 for apiName in glob.glob( |
788 os.path.join(sourceDir, "APIs", "Python3", "*.api")): |
784 os.path.join(sourceDir, "APIs", "Python3", "*.api")): |
789 apis.append(os.path.basename(apiName)) |
785 apis.append(os.path.basename(apiName)) |
790 |
786 |
791 fn = 'eric5config.py' |
787 fn = 'eric5config.py' |
792 config = \ |
788 config = ( |
793 """# -*- coding: utf-8 -*- |
789 """# -*- coding: utf-8 -*-\n""" |
794 # |
790 """#\n""" |
795 # This module contains the configuration of the individual eric5 installation |
791 """# This module contains the configuration of the individual eric5""" |
796 # |
792 """ installation\n""" |
797 |
793 """#\n""" |
798 _pkg_config = {{ |
794 """\n""" |
799 'ericDir': r'{0}', |
795 """_pkg_config = {{\n""" |
800 'ericPixDir': r'{1}', |
796 """ 'ericDir': r'{0}',\n""" |
801 'ericIconDir': r'{2}', |
797 """ 'ericPixDir': r'{1}',\n""" |
802 'ericDTDDir': r'{3}', |
798 """ 'ericIconDir': r'{2}',\n""" |
803 'ericCSSDir': r'{4}', |
799 """ 'ericDTDDir': r'{3}',\n""" |
804 'ericStylesDir': r'{5}', |
800 """ 'ericCSSDir': r'{4}',\n""" |
805 'ericDocDir': r'{6}', |
801 """ 'ericStylesDir': r'{5}',\n""" |
806 'ericExamplesDir': r'{7}', |
802 """ 'ericDocDir': r'{6}',\n""" |
807 'ericTranslationsDir': r'{8}', |
803 """ 'ericExamplesDir': r'{7}',\n""" |
808 'ericTemplatesDir': r'{9}', |
804 """ 'ericTranslationsDir': r'{8}',\n""" |
809 'ericCodeTemplatesDir': r'{10}', |
805 """ 'ericTemplatesDir': r'{9}',\n""" |
810 'ericOthersDir': r'{11}', |
806 """ 'ericCodeTemplatesDir': r'{10}',\n""" |
811 'bindir': r'{12}', |
807 """ 'ericOthersDir': r'{11}',\n""" |
812 'mdir': r'{13}', |
808 """ 'bindir': r'{12}',\n""" |
813 'apidir': r'{14}', |
809 """ 'mdir': r'{13}',\n""" |
814 'apis': {15}, |
810 """ 'apidir': r'{14}',\n""" |
815 }} |
811 """ 'apis': {15},\n""" |
816 |
812 """}}\n""" |
817 def getConfig(name): |
813 """\n""" |
818 ''' |
814 """def getConfig(name):\n""" |
819 Module function to get a configuration value. |
815 """ '''\n""" |
820 |
816 """ Module function to get a configuration value.\n""" |
821 @param name the name of the configuration value (string). |
817 """\n""" |
822 ''' |
818 """ @param name name of the configuration value (string)\n""" |
823 try: |
819 """ '''\n""" |
824 return _pkg_config[name] |
820 """ try:\n""" |
825 except KeyError: |
821 """ return _pkg_config[name]\n""" |
826 pass |
822 """ except KeyError:\n""" |
827 |
823 """ pass\n""" |
828 raise AttributeError('"{{0}}" is not a valid configuration value'.format( |
824 """\n""" |
829 name))\n""".format( |
825 """ raise AttributeError('"{{0}}" is not a valid configuration""" |
830 cfg['ericDir'], cfg['ericPixDir'], cfg['ericIconDir'], |
826 """ value'.format(name))\n""").format( |
831 cfg['ericDTDDir'], cfg['ericCSSDir'], |
827 cfg['ericDir'], cfg['ericPixDir'], cfg['ericIconDir'], |
832 cfg['ericStylesDir'], cfg['ericDocDir'], |
828 cfg['ericDTDDir'], cfg['ericCSSDir'], |
833 cfg['ericExamplesDir'], cfg['ericTranslationsDir'], |
829 cfg['ericStylesDir'], cfg['ericDocDir'], |
834 cfg['ericTemplatesDir'], |
830 cfg['ericExamplesDir'], cfg['ericTranslationsDir'], |
835 cfg['ericCodeTemplatesDir'], cfg['ericOthersDir'], |
831 cfg['ericTemplatesDir'], |
836 cfg['bindir'], cfg['mdir'], |
832 cfg['ericCodeTemplatesDir'], cfg['ericOthersDir'], |
837 cfg['apidir'], apis) |
833 cfg['bindir'], cfg['mdir'], |
|
834 cfg['apidir'], apis) |
838 copyToFile(fn, config) |
835 copyToFile(fn, config) |
839 |
836 |
840 |
837 |
841 def doDependancyChecks(): |
838 def doDependancyChecks(): |
842 """ |
839 """ |
939 (maj, min, pat) = pyqtVersion.split('.') |
936 (maj, min, pat) = pyqtVersion.split('.') |
940 maj = int(maj) |
937 maj = int(maj) |
941 min = int(min) |
938 min = int(min) |
942 pat = int(pat) |
939 pat = int(pat) |
943 if maj < 4 or (maj == 4 and min < 8): |
940 if maj < 4 or (maj == 4 and min < 8): |
944 print('Sorry, you must have PyQt 4.8.0 or higher or' \ |
941 print('Sorry, you must have PyQt 4.8.0 or higher or' |
945 ' a recent snapshot release.') |
942 ' a recent snapshot release.') |
946 exit(4) |
943 exit(4) |
947 # check for blacklisted versions |
944 # check for blacklisted versions |
948 for vers in BlackLists["PyQt4"] + PlatformBlackLists["PyQt4"]: |
945 for vers in BlackLists["PyQt4"] + PlatformBlackLists["PyQt4"]: |
949 if vers == pyqtVersion: |
946 if vers == pyqtVersion: |
950 print('Sorry, PyQt4 version {0} is not compatible with eric5.'\ |
947 print('Sorry, PyQt4 version {0} is not compatible with eric5.' |
951 .format(vers)) |
948 .format(vers)) |
952 print('Please install another version.') |
949 print('Please install another version.') |
953 exit(4) |
950 exit(4) |
954 print("PyQt Version: ", pyqtVersion) |
951 print("PyQt Version: ", pyqtVersion) |
955 |
952 |