install.py

changeset 3036
30c81c9e88b8
parent 3034
7ce719013078
child 3060
5883ce99ee12
child 3160
209a07d7e401
equal deleted inserted replaced
3035:36e9f388958b 3036:30c81c9e88b8
223 wrapper = \ 223 wrapper = \
224 '''@echo off\n''' \ 224 '''@echo off\n''' \
225 '''start "" "{2}\\pythonw.exe"''' \ 225 '''start "" "{2}\\pythonw.exe"''' \
226 ''' "{0}\\{1}.pyw"''' \ 226 ''' "{0}\\{1}.pyw"''' \
227 ''' %1 %2 %3 %4 %5 %6 %7 %8 %9\n'''.format( 227 ''' %1 %2 %3 %4 %5 %6 %7 %8 %9\n'''.format(
228 pydir, wfile, sys.exec_prefix) 228 pydir, wfile, sys.exec_prefix)
229 else: 229 else:
230 wrapper = \ 230 wrapper = \
231 '''@"{0}\\python" "{1}\\{2}.py"''' \ 231 '''@"{0}\\python" "{1}\\{2}.py"''' \
232 ''' %1 %2 %3 %4 %5 %6 %7 %8 %9\n'''.format( 232 ''' %1 %2 %3 %4 %5 %6 %7 %8 %9\n'''.format(
233 sys.exec_prefix, pydir, wfile) 233 sys.exec_prefix, pydir, wfile)
236 elif sys.platform == "darwin": 236 elif sys.platform == "darwin":
237 pyexec = "{0}/bin/pythonw3".format(sys.exec_prefix) 237 pyexec = "{0}/bin/pythonw3".format(sys.exec_prefix)
238 if not os.path.exists(pyexec): 238 if not os.path.exists(pyexec):
239 pyexec = "{0}/bin/python3".format(sys.exec_prefix) 239 pyexec = "{0}/bin/python3".format(sys.exec_prefix)
240 wname = wfile 240 wname = wfile
241 wrapper = ( 241 wrapper = ('''#!/bin/sh\n'''
242 '''#!/bin/sh 242 '''\n'''
243 243 '''exec "{0}" "{1}/{2}.py" "$@"\n'''
244 exec "{0}" "{1}/{2}.py" "$@" 244 .format(pyexec, pydir, wfile))
245 '''.format(pyexec, pydir, wfile))
246 245
247 # *nix systems 246 # *nix systems
248 else: 247 else:
249 wname = wfile 248 wname = wfile
250 wrapper = ( 249 wrapper = ('''#!/bin/sh\n'''
251 '''#!/bin/sh 250 '''\n'''
252 251 '''exec "{0}" "{1}/{2}.py" "$@"\n'''
253 exec "{0}" "{1}/{2}.py" "$@" 252 .format(sys.executable, pydir, wfile))
254 '''.format(sys.executable, pydir, wfile))
255 253
256 copyToFile(wname, wrapper) 254 copyToFile(wname, wrapper)
257 os.chmod(wname, 0o755) 255 os.chmod(wname, 0o755)
258 256
259 return wname 257 return wname
498 shutilCopy(configName + 'c', modDir) 496 shutilCopy(configName + 'c', modDir)
499 497
500 # copy the various parts of eric5 498 # copy the various parts of eric5
501 copyTree( 499 copyTree(
502 sourceDir, cfg['ericDir'], 500 sourceDir, cfg['ericDir'],
503 ['*.py', '*.pyc', '*.pyo', '*.pyw'], 501 ['*.py', '*.pyc', '*.pyo', '*.pyw'],
504 ['{1}{0}Examples'.format(os.sep, sourceDir)], 502 ['{1}{0}Examples'.format(os.sep, sourceDir)],
505 excludePatterns=["eric5config.py*"]) 503 excludePatterns=["eric5config.py*"])
506 copyTree( 504 copyTree(
507 sourceDir, cfg['ericDir'], ['*.rb'], 505 sourceDir, cfg['ericDir'], ['*.rb'],
508 ['{1}{0}Examples'.format(os.sep, sourceDir)]) 506 ['{1}{0}Examples'.format(os.sep, sourceDir)])
679 pybin = os.path.join(sys.exec_prefix, "bin") 677 pybin = os.path.join(sys.exec_prefix, "bin")
680 pathlist = path.split(os.pathsep) 678 pathlist = path.split(os.pathsep)
681 if pybin not in pathlist: 679 if pybin not in pathlist:
682 pathlist.insert(0, pybin) 680 pathlist.insert(0, pybin)
683 path = os.pathsep.join(pathlist) 681 path = os.pathsep.join(pathlist)
684 wrapper = ( 682 wrapper = ('''#!/bin/sh\n'''
685 '''#!/bin/sh 683 '''\n'''
686 684 '''PATH={0}\n'''
687 PATH={0} 685 '''exec "{1}" "{2}/{3}.py" "$@"\n'''
688 exec "{1}" "{2}/{3}.py" "$@" 686 .format(path, starter, pydir, "eric5"))
689 '''.format(path, starter, pydir, "eric5"))
690 else: 687 else:
691 wrapper = ( 688 wrapper = ('''#!/bin/sh\n'''
692 '''#!/bin/sh 689 '''\n'''
693 690 '''exec "{0}" "{1}/{2}.py" "$@"\n'''
694 exec "{0}" "{1}/{2}.py" "$@" 691 .format(starter, pydir, "eric5"))
695 '''.format(starter, pydir, "eric5"))
696 copyToFile(wname, wrapper) 692 copyToFile(wname, wrapper)
697 os.chmod(wname, 0o755) 693 os.chmod(wname, 0o755)
698 694
699 shutilCopy(os.path.join(sourceDir, "pixmaps", "eric_2.icns"), 695 shutilCopy(os.path.join(sourceDir, "pixmaps", "eric_2.icns"),
700 os.path.join(dirs["icns"], "eric.icns")) 696 os.path.join(dirs["icns"], "eric.icns"))
701 697
702 copyToFile( 698 copyToFile(
703 os.path.join(dirs["contents"], "Info.plist"), 699 os.path.join(dirs["contents"], "Info.plist"),
704 '''<?xml version="1.0" encoding="UTF-8"?> 700 '''<?xml version="1.0" encoding="UTF-8"?>\n'''
705 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 701 '''<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"\n'''
706 "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 702 ''' "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n'''
707 <plist version="1.0"> 703 '''<plist version="1.0">\n'''
708 <dict> 704 '''<dict>\n'''
709 <key>CFBundleExecutable</key> 705 ''' <key>CFBundleExecutable</key>\n'''
710 <string>eric5</string> 706 ''' <string>eric5</string>\n'''
711 <key>CFBundleIconFile</key> 707 ''' <key>CFBundleIconFile</key>\n'''
712 <string>eric.icns</string> 708 ''' <string>eric.icns</string>\n'''
713 <key>CFBundleInfoDictionaryVersion</key> 709 ''' <key>CFBundleInfoDictionaryVersion</key>\n'''
714 <string>1.0</string> 710 ''' <string>1.0</string>\n'''
715 <key>CFBundleName</key> 711 ''' <key>CFBundleName</key>\n'''
716 <string>{0}</string> 712 ''' <string>{0}</string>\n'''
717 <key>CFBundleDisplayName</key> 713 ''' <key>CFBundleDisplayName</key>\n'''
718 <string>{0}</string> 714 ''' <string>{0}</string>\n'''
719 <key>CFBundlePackageType</key> 715 ''' <key>CFBundlePackageType</key>\n'''
720 <string>APPL</string> 716 ''' <string>APPL</string>\n'''
721 <key>CFBundleSignature</key> 717 ''' <key>CFBundleSignature</key>\n'''
722 <string>????</string> 718 ''' <string>????</string>\n'''
723 <key>CFBundleVersion</key> 719 ''' <key>CFBundleVersion</key>\n'''
724 <string>1.0</string> 720 ''' <string>1.0</string>\n'''
725 </dict> 721 '''</dict>\n'''
726 </plist>\n'''.format(macAppBundleName.replace(".app", ""))) 722 '''</plist>\n'''.format(macAppBundleName.replace(".app", "")))
727 723
728 724
729 def createInstallConfig(): 725 def createInstallConfig():
730 """ 726 """
731 Create the installation config dictionary. 727 Create the installation config dictionary.
772 for apiName in glob.glob( 768 for apiName in glob.glob(
773 os.path.join(sourceDir, "APIs", "Python3", "*.api")): 769 os.path.join(sourceDir, "APIs", "Python3", "*.api")):
774 apis.append(os.path.basename(apiName)) 770 apis.append(os.path.basename(apiName))
775 771
776 fn = 'eric5config.py' 772 fn = 'eric5config.py'
777 config = \ 773 config = (
778 """# -*- coding: utf-8 -*- 774 """# -*- coding: utf-8 -*-\n"""
779 # 775 """#\n"""
780 # This module contains the configuration of the individual eric5 installation 776 """# This module contains the configuration of the individual eric5"""
781 # 777 """ installation\n"""
782 778 """#\n"""
783 _pkg_config = {{ 779 """\n"""
784 'ericDir': r'{0}', 780 """_pkg_config = {{\n"""
785 'ericPixDir': r'{1}', 781 """ 'ericDir': r'{0}',\n"""
786 'ericIconDir': r'{2}', 782 """ 'ericPixDir': r'{1}',\n"""
787 'ericDTDDir': r'{3}', 783 """ 'ericIconDir': r'{2}',\n"""
788 'ericCSSDir': r'{4}', 784 """ 'ericDTDDir': r'{3}',\n"""
789 'ericStylesDir': r'{5}', 785 """ 'ericCSSDir': r'{4}',\n"""
790 'ericDocDir': r'{6}', 786 """ 'ericStylesDir': r'{5}',\n"""
791 'ericExamplesDir': r'{7}', 787 """ 'ericDocDir': r'{6}',\n"""
792 'ericTranslationsDir': r'{8}', 788 """ 'ericExamplesDir': r'{7}',\n"""
793 'ericTemplatesDir': r'{9}', 789 """ 'ericTranslationsDir': r'{8}',\n"""
794 'ericCodeTemplatesDir': r'{10}', 790 """ 'ericTemplatesDir': r'{9}',\n"""
795 'ericOthersDir': r'{11}', 791 """ 'ericCodeTemplatesDir': r'{10}',\n"""
796 'bindir': r'{12}', 792 """ 'ericOthersDir': r'{11}',\n"""
797 'mdir': r'{13}', 793 """ 'bindir': r'{12}',\n"""
798 'apidir': r'{14}', 794 """ 'mdir': r'{13}',\n"""
799 'apis': {15}, 795 """ 'apidir': r'{14}',\n"""
800 }} 796 """ 'apis': {15},\n"""
801 797 """}}\n"""
802 def getConfig(name): 798 """\n"""
803 ''' 799 """def getConfig(name):\n"""
804 Module function to get a configuration value. 800 """ '''\n"""
805 801 """ Module function to get a configuration value.\n"""
806 @param name the name of the configuration value (string). 802 """\n"""
807 ''' 803 """ @param name name of the configuration value (string)\n"""
808 try: 804 """ '''\n"""
809 return _pkg_config[name] 805 """ try:\n"""
810 except KeyError: 806 """ return _pkg_config[name]\n"""
811 pass 807 """ except KeyError:\n"""
812 808 """ pass\n"""
813 raise AttributeError('"{{0}}" is not a valid configuration value'.format( 809 """\n"""
814 name))\n""".format( 810 """ raise AttributeError('"{{0}}" is not a valid configuration"""
815 cfg['ericDir'], cfg['ericPixDir'], cfg['ericIconDir'], 811 """ value'.format(name))\n""").format(
816 cfg['ericDTDDir'], cfg['ericCSSDir'], 812 cfg['ericDir'], cfg['ericPixDir'], cfg['ericIconDir'],
817 cfg['ericStylesDir'], cfg['ericDocDir'], 813 cfg['ericDTDDir'], cfg['ericCSSDir'],
818 cfg['ericExamplesDir'], cfg['ericTranslationsDir'], 814 cfg['ericStylesDir'], cfg['ericDocDir'],
819 cfg['ericTemplatesDir'], 815 cfg['ericExamplesDir'], cfg['ericTranslationsDir'],
820 cfg['ericCodeTemplatesDir'], cfg['ericOthersDir'], 816 cfg['ericTemplatesDir'],
821 cfg['bindir'], cfg['mdir'], 817 cfg['ericCodeTemplatesDir'], cfg['ericOthersDir'],
822 cfg['apidir'], apis) 818 cfg['bindir'], cfg['mdir'],
819 cfg['apidir'], apis)
823 copyToFile(fn, config) 820 copyToFile(fn, config)
824 821
825 822
826 def doDependancyChecks(): 823 def doDependancyChecks():
827 """ 824 """
1215 try: 1212 try:
1216 main(sys.argv) 1213 main(sys.argv)
1217 except SystemExit: 1214 except SystemExit:
1218 raise 1215 raise
1219 except: 1216 except:
1220 print(""" 1217 print("""An internal error occured. Please report all the output"""
1221 An internal error occured. Please report all the output of the program, 1218 """ of the program,\nincluding the following traceback, to"""
1222 including the following traceback, to eric5-bugs@eric-ide.python-projects.org. 1219 """ eric5-bugs@eric-ide.python-projects.org.\n""")
1223 """)
1224 raise 1220 raise

eric ide

mercurial