install.py

branch
6_0_x
changeset 4375
12817b378138
parent 4308
3f9ea1a38560
child 4381
bde46f229e2c
equal deleted inserted replaced
4373:54d6d7c772ea 4375:12817b378138
845 Create a Mac application bundle. 845 Create a Mac application bundle.
846 846
847 @param pydir the name of the directory where the Python script will 847 @param pydir the name of the directory where the Python script will
848 eventually be installed (string) 848 eventually be installed (string)
849 """ 849 """
850 global cfg, sourceDir, macAppBundleName, macPythonExe, macAppBundlePath 850 global cfg, sourceDir, macAppBundleName, macPythonExe, macAppBundlePath, \
851 pyqtVariant
851 852
852 dirs = { 853 dirs = {
853 "contents": "{0}/{1}/Contents/".format( 854 "contents": "{0}/{1}/Contents/".format(
854 macAppBundlePath, macAppBundleName), 855 macAppBundlePath, macAppBundleName),
855 "exe": "{0}/{1}/Contents/MacOS".format( 856 "exe": "{0}/{1}/Contents/MacOS".format(
866 os.symlink(macPythonExe, starter) 867 os.symlink(macPythonExe, starter)
867 else: 868 else:
868 starter = "python{0}".format(sys.version_info.major) 869 starter = "python{0}".format(sys.version_info.major)
869 870
870 wname = os.path.join(dirs["exe"], "eric6") 871 wname = os.path.join(dirs["exe"], "eric6")
872
873 # determine entry for DYLD_FRAMEWORK_PATH
874 dyldLine = ""
875 try:
876 if pyqtVariant == "PyQt4":
877 from PyQt4.QtCore import QLibraryInfo
878 else:
879 from PyQt5.QtCore import QLibraryInfo
880 qtLibraryDir = QLibraryInfo.location(QLibraryInfo.LibrariesPath)
881 except ImportError:
882 qtLibraryDir = ""
883 if qtLibraryDir:
884 dyldLine = "DYLD_FRAMEWORK_PATH={0}\n".format(qtLibraryDir)
885
886 # determine entry for PATH
887 pathLine = ""
871 path = os.getenv("PATH", "") 888 path = os.getenv("PATH", "")
872 if path: 889 if path:
873 pybin = os.path.join(sys.exec_prefix, "bin") 890 pybin = os.path.join(sys.exec_prefix, "bin")
874 pathlist = path.split(os.pathsep) 891 pathlist = path.split(os.pathsep)
875 if pybin not in pathlist: 892 if pybin not in pathlist:
876 pathlist.insert(0, pybin) 893 pathLine = "PATH={0}{1}{2}\n".format(pybin, os.pathsep, path)
877 path = os.pathsep.join(pathlist) 894 else:
878 wrapper = ('''#!/bin/sh\n''' 895 pathLine = "PATH={0}\n".format(path)
879 '''\n''' 896 wrapper = ('''#!/bin/sh\n'''
880 '''PATH={0}\n''' 897 '''\n'''
881 '''exec "{1}" "{2}/{3}.py" "$@"\n''' 898 '''{0}'''
882 .format(path, starter, pydir, "eric6")) 899 '''{1}'''
883 else: 900 '''exec "{2}" "{3}/{4}.py" "$@"\n'''
884 wrapper = ('''#!/bin/sh\n''' 901 .format(pathLine, dyldLine, starter, pydir, "eric6"))
885 '''\n'''
886 '''exec "{0}" "{1}/{2}.py" "$@"\n'''
887 .format(starter, pydir, "eric6"))
888 copyToFile(wname, wrapper) 902 copyToFile(wname, wrapper)
889 os.chmod(wname, 0o755) 903 os.chmod(wname, 0o755)
890 904
891 shutilCopy(os.path.join(sourceDir, "pixmaps", "eric_2.icns"), 905 shutilCopy(os.path.join(sourceDir, "pixmaps", "eric_2.icns"),
892 os.path.join(dirs["icns"], "eric.icns")) 906 os.path.join(dirs["icns"], "eric.icns"))

eric ide

mercurial