526 shutil.copy(os.path.join(sourceDir, "icons", "default", "eric.png"), |
526 shutil.copy(os.path.join(sourceDir, "icons", "default", "eric.png"), |
527 "/usr/share/pixmaps") |
527 "/usr/share/pixmaps") |
528 shutil.copy(os.path.join(sourceDir, "eric5.desktop"), |
528 shutil.copy(os.path.join(sourceDir, "eric5.desktop"), |
529 "/usr/share/applications") |
529 "/usr/share/applications") |
530 |
530 |
|
531 # Create a Mac application bundle |
531 if sys.platform == "darwin": |
532 if sys.platform == "darwin": |
532 createMacAppBundle() |
533 createMacAppBundle(cfg['ericDir']) |
533 |
534 |
534 |
535 |
535 def createMacAppBundle(): |
536 def createMacAppBundle(pydir): |
536 """ |
537 """ |
537 Create a Mac application bundle. |
538 Create a Mac application bundle. |
|
539 |
|
540 @param pydir the name of the directory where the Python script will eventually |
|
541 be installed (string) |
538 """ |
542 """ |
539 global cfg, sourceDir |
543 global cfg, sourceDir |
540 |
544 |
541 dirs = {"contents": "/Developer/Applications/Eric5/eric5.app/Contents/", |
545 dirs = {"contents": "/Developer/Applications/Eric5/eric5.app/Contents/", |
542 "exe": "/Developer/Applications/Eric5/eric5.app/Contents/MacOS", |
546 "exe": "/Developer/Applications/Eric5/eric5.app/Contents/MacOS", |
543 "icns": "/Developer/Applications/Eric5/eric5.app/Contents/Resources"} |
547 "icns": "/Developer/Applications/Eric5/eric5.app/Contents/Resources"} |
544 os.makedirs(dirs["contents"]) |
548 os.makedirs(dirs["contents"]) |
545 os.mkdir(dirs["exe"]) |
549 os.mkdir(dirs["exe"]) |
546 os.mkdir(dirs["icns"]) |
550 os.mkdir(dirs["icns"]) |
547 shutil.copy(os.path.join(cfg['bindir'], "eric5"), dirs["exe"]) |
551 |
|
552 wname = os.path.join(dirs["exe"], "eric5") |
|
553 path = os.getenv("PATH", "") |
|
554 if path: |
|
555 pybin = os.path.join(sys.exec_prefix, "bin") |
|
556 pathlist = path.split(os.pathsep) |
|
557 if pybin not in pathlist: |
|
558 pathlist.insert(0, pybin) |
|
559 path = os.pathsep.join(pathlist) |
|
560 wrapper = \ |
|
561 '''#!/bin/sh |
|
562 |
|
563 PATH={0} |
|
564 exec "{1}/bin/pythonw3" "{2}/{3}.py" "$@" |
|
565 '''.format(path, sys.exec_prefix, pydir, "eric5") |
|
566 else: |
|
567 wrapper = \ |
|
568 '''#!/bin/sh |
|
569 |
|
570 exec "{0}/bin/pythonw3" "{1}/{2}.py" "$@" |
|
571 '''.format(sys.exec_prefix, pydir, "eric5") |
|
572 copyToFile(wname, wrapper) |
|
573 os.chmod(wname, 0o755) |
|
574 |
548 shutil.copy(os.path.join(sourceDir, "pixmaps", "eric_2.icns"), |
575 shutil.copy(os.path.join(sourceDir, "pixmaps", "eric_2.icns"), |
549 os.path.join(dirs["icns"], "eric.icns")) |
576 os.path.join(dirs["icns"], "eric.icns")) |
550 f = open(os.path.join(dirs["contents"], "Info.plist"), "w", encoding="utf-8") |
577 |
551 f.write(\ |
578 copyToFile(os.path.join(dirs["contents"], "Info.plist"), |
552 '''<?xml version="1.0" encoding="UTF-8"?> |
579 '''<?xml version="1.0" encoding="UTF-8"?> |
553 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" |
580 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" |
554 "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
581 "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
555 <plist version="1.0"> |
582 <plist version="1.0"> |
556 <dict> |
583 <dict> |