Just van Rossum | dc3c617 | 2001-06-19 21:37:33 +0000 | [diff] [blame] | 1 | # copyright 1996-2001 Just van Rossum, Letterror. just@letterror.com |
Just van Rossum | 40f9b7b | 1999-01-30 22:39:17 +0000 | [diff] [blame] | 2 | |
Tim Peters | 182b5ac | 2004-07-18 06:16:08 +0000 | [diff] [blame^] | 3 | # keep this (__main__) as clean as possible, since we are using |
Just van Rossum | 40f9b7b | 1999-01-30 22:39:17 +0000 | [diff] [blame] | 4 | # it like the "normal" interpreter. |
| 5 | |
Jack Jansen | 4f90137 | 2004-07-15 21:30:41 +0000 | [diff] [blame] | 6 | __version__ = '1.0.2' |
Jack Jansen | 815d2bf | 2002-01-21 23:00:52 +0000 | [diff] [blame] | 7 | import sys |
| 8 | import os |
Just van Rossum | 40f9b7b | 1999-01-30 22:39:17 +0000 | [diff] [blame] | 9 | |
| 10 | def init(): |
Tim Peters | 182b5ac | 2004-07-18 06:16:08 +0000 | [diff] [blame^] | 11 | import MacOS |
| 12 | if hasattr(MacOS, 'EnableAppswitch'): |
| 13 | MacOS.EnableAppswitch(-1) |
| 14 | |
| 15 | try: |
| 16 | import autoGIL |
| 17 | except ImportError: |
| 18 | pass |
| 19 | else: |
| 20 | autoGIL.installAutoGIL() |
| 21 | |
| 22 | from Carbon import Qd, QuickDraw |
| 23 | Qd.SetCursor(Qd.GetCursor(QuickDraw.watchCursor).data) |
| 24 | |
| 25 | import macresource |
| 26 | import sys, os |
| 27 | macresource.need('DITL', 468, "PythonIDE.rsrc") |
| 28 | widgetrespathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE", "Widgets.rsrc"] |
| 29 | widgetresfile = os.path.join(*widgetrespathsegs) |
| 30 | if not os.path.exists(widgetresfile): |
| 31 | widgetrespathsegs = [os.pardir, "Tools", "IDE", "Widgets.rsrc"] |
| 32 | widgetresfile = os.path.join(*widgetrespathsegs) |
| 33 | refno = macresource.need('CURS', 468, widgetresfile) |
| 34 | if os.environ.has_key('PYTHONIDEPATH'): |
| 35 | # For development set this environment variable |
| 36 | ide_path = os.environ['PYTHONIDEPATH'] |
| 37 | elif refno: |
| 38 | # We're not a fullblown application |
| 39 | idepathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE"] |
| 40 | ide_path = os.path.join(*idepathsegs) |
| 41 | if not os.path.exists(ide_path): |
| 42 | idepathsegs = [os.pardir, "Tools", "IDE"] |
| 43 | for p in sys.path: |
| 44 | ide_path = os.path.join(*([p]+idepathsegs)) |
| 45 | if os.path.exists(ide_path): |
| 46 | break |
| 47 | |
| 48 | else: |
| 49 | # We are a fully frozen application |
| 50 | ide_path = sys.argv[0] |
| 51 | if ide_path not in sys.path: |
| 52 | sys.path.insert(1, ide_path) |
Just van Rossum | 40f9b7b | 1999-01-30 22:39:17 +0000 | [diff] [blame] | 53 | |
| 54 | |
| 55 | init() |
| 56 | del init |
| 57 | |
Just van Rossum | d797e7b | 2003-05-02 23:40:29 +0000 | [diff] [blame] | 58 | import PythonIDEMain as _PythonIDEMain |
| 59 | _PythonIDEMain.PythonIDE() |