Mercurial > cpython-lru_cache-weakref
comparison Mac/Tools/IDE/PythonIDE.py @ 32736:c3a096bfbd6b legacy-trunk
Whitespace normalization, via reindent.py.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Sun, 18 Jul 2004 06:16:08 +0000 |
| parents | 0729d1db5118 |
| children |
comparison
equal
deleted
inserted
replaced
| 32735:2bc66f1df7cc | 32736:c3a096bfbd6b |
|---|---|
| 1 # copyright 1996-2001 Just van Rossum, Letterror. just@letterror.com | 1 # copyright 1996-2001 Just van Rossum, Letterror. just@letterror.com |
| 2 | 2 |
| 3 # keep this (__main__) as clean as possible, since we are using | 3 # keep this (__main__) as clean as possible, since we are using |
| 4 # it like the "normal" interpreter. | 4 # it like the "normal" interpreter. |
| 5 | 5 |
| 6 __version__ = '1.0.2' | 6 __version__ = '1.0.2' |
| 7 import sys | 7 import sys |
| 8 import os | 8 import os |
| 9 | 9 |
| 10 def init(): | 10 def init(): |
| 11 import MacOS | 11 import MacOS |
| 12 if hasattr(MacOS, 'EnableAppswitch'): | 12 if hasattr(MacOS, 'EnableAppswitch'): |
| 13 MacOS.EnableAppswitch(-1) | 13 MacOS.EnableAppswitch(-1) |
| 14 | 14 |
| 15 try: | 15 try: |
| 16 import autoGIL | 16 import autoGIL |
| 17 except ImportError: | 17 except ImportError: |
| 18 pass | 18 pass |
| 19 else: | 19 else: |
| 20 autoGIL.installAutoGIL() | 20 autoGIL.installAutoGIL() |
| 21 | 21 |
| 22 from Carbon import Qd, QuickDraw | 22 from Carbon import Qd, QuickDraw |
| 23 Qd.SetCursor(Qd.GetCursor(QuickDraw.watchCursor).data) | 23 Qd.SetCursor(Qd.GetCursor(QuickDraw.watchCursor).data) |
| 24 | 24 |
| 25 import macresource | 25 import macresource |
| 26 import sys, os | 26 import sys, os |
| 27 macresource.need('DITL', 468, "PythonIDE.rsrc") | 27 macresource.need('DITL', 468, "PythonIDE.rsrc") |
| 28 widgetrespathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE", "Widgets.rsrc"] | 28 widgetrespathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE", "Widgets.rsrc"] |
| 29 widgetresfile = os.path.join(*widgetrespathsegs) | 29 widgetresfile = os.path.join(*widgetrespathsegs) |
| 30 if not os.path.exists(widgetresfile): | 30 if not os.path.exists(widgetresfile): |
| 31 widgetrespathsegs = [os.pardir, "Tools", "IDE", "Widgets.rsrc"] | 31 widgetrespathsegs = [os.pardir, "Tools", "IDE", "Widgets.rsrc"] |
| 32 widgetresfile = os.path.join(*widgetrespathsegs) | 32 widgetresfile = os.path.join(*widgetrespathsegs) |
| 33 refno = macresource.need('CURS', 468, widgetresfile) | 33 refno = macresource.need('CURS', 468, widgetresfile) |
| 34 if os.environ.has_key('PYTHONIDEPATH'): | 34 if os.environ.has_key('PYTHONIDEPATH'): |
| 35 # For development set this environment variable | 35 # For development set this environment variable |
| 36 ide_path = os.environ['PYTHONIDEPATH'] | 36 ide_path = os.environ['PYTHONIDEPATH'] |
| 37 elif refno: | 37 elif refno: |
| 38 # We're not a fullblown application | 38 # We're not a fullblown application |
| 39 idepathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE"] | 39 idepathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE"] |
| 40 ide_path = os.path.join(*idepathsegs) | 40 ide_path = os.path.join(*idepathsegs) |
| 41 if not os.path.exists(ide_path): | 41 if not os.path.exists(ide_path): |
| 42 idepathsegs = [os.pardir, "Tools", "IDE"] | 42 idepathsegs = [os.pardir, "Tools", "IDE"] |
| 43 for p in sys.path: | 43 for p in sys.path: |
| 44 ide_path = os.path.join(*([p]+idepathsegs)) | 44 ide_path = os.path.join(*([p]+idepathsegs)) |
| 45 if os.path.exists(ide_path): | 45 if os.path.exists(ide_path): |
| 46 break | 46 break |
| 47 | 47 |
| 48 else: | 48 else: |
| 49 # We are a fully frozen application | 49 # We are a fully frozen application |
| 50 ide_path = sys.argv[0] | 50 ide_path = sys.argv[0] |
| 51 if ide_path not in sys.path: | 51 if ide_path not in sys.path: |
| 52 sys.path.insert(1, ide_path) | 52 sys.path.insert(1, ide_path) |
| 53 | 53 |
| 54 | 54 |
| 55 init() | 55 init() |
| 56 del init | 56 del init |
| 57 | 57 |
