Mercurial > cpython-lru_cache-weakref
comparison Mac/scripts/ConfigurePython.py @ 3122:2caa3e283568 legacy-trunk
Load toolbox modules "by hand" using imp, so this script should now
work in a virgin distribution.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Sun, 24 Sep 1995 21:06:50 +0000 |
| parents | 7a67dbcb6d83 |
| children | 61ca19a3000f |
comparison
equal
deleted
inserted
replaced
| 3121:c10f55b46a11 | 3122:2caa3e283568 |
|---|---|
| 8 # If you compare it to MkPluginAliases.as it also serves | 8 # If you compare it to MkPluginAliases.as it also serves |
| 9 # as a comparison between python and AppleScript:-) | 9 # as a comparison between python and AppleScript:-) |
| 10 # | 10 # |
| 11 # Jack Jansen, CWI, August 1995 | 11 # Jack Jansen, CWI, August 1995 |
| 12 | 12 |
| 13 import os | |
| 14 import macfs | |
| 15 import sys | 13 import sys |
| 16 | 14 |
| 15 def help(): | |
| 16 print""" | |
| 17 Try the following: | |
| 18 1. Remove any old "Python Preferences" files from the system folder. | |
| 19 2. Remove any old "PythonCore" files from the system folder. | |
| 20 3. Make sure this script, PythonPPC and PythonCore are all located in the | |
| 21 python home folder (where the Lib and PlugIns folders are) | |
| 22 4. Run this script again, by dropping it on PythonPPC. | |
| 23 | |
| 24 If this fails try removing starting afresh from the distribution archive. | |
| 25 """ | |
| 26 sys.exit(1) | |
| 27 | |
| 28 try: | |
| 29 import os | |
| 30 except ImportError: | |
| 31 print """ | |
| 32 I cannot import the 'os' module, so something is wrong with sys.path | |
| 33 """ | |
| 34 help() | |
| 35 | |
| 17 try: | 36 try: |
| 18 import Res | 37 import Res |
| 19 except ImportError: | 38 except ImportError: |
| 20 print """ | 39 # |
| 21 Res module not found, which probably means that you are trying | 40 # Check that we are actually in the main python directory |
| 22 to execute this script with a dynamically-linked python. This will | 41 # |
| 23 not work, since the whole point of the script is to create aliases | 42 try: |
| 24 for dynamically-linked python to use. Do one of the following: | 43 os.chdir(':PlugIns') |
| 25 - Run this script using a non-dynamic python | 44 except IOError: |
| 26 - Use MkPluginAliases.as (an AppleScript) | 45 print """ |
| 27 - Create the aliases by hand (see the source for a list).""" | 46 I cannot find the 'PlugIns' folder, so I am obviously not run from the Python |
| 28 sys.exit(1) | 47 home folder. |
| 48 """ | |
| 49 help() | |
| 50 import imp | |
| 51 cwd = os.getcwd() | |
| 52 tblibname = os.path.join(cwd, "toolboxmodules.slb") | |
| 53 if not os.exists(tblibname): | |
| 54 print """ | |
| 55 I cannot find the 'toolboxmodules.slb' file in the PlugIns directory. | |
| 56 Start afresh from a clean distribution. | |
| 57 """ | |
| 58 sys.exit(1) | |
| 59 try: | |
| 60 for wtd in ["Ctl", "Dlg", "Evt", "Qd", "Res", "Win"]: | |
| 61 imp.load_dynamic_module(wtd, tblibname, None) | |
| 62 except ImportError: | |
| 63 print """ | |
| 64 I cannot load the toolbox modules by hand. Are you sure you are | |
| 65 using a PowerPC mac? | |
| 66 """ | |
| 67 sys.exit(1) | |
| 68 | |
| 29 | 69 |
| 70 import macfs | |
| 30 import EasyDialogs | 71 import EasyDialogs |
| 31 import macostools | 72 import macostools |
| 32 | 73 |
| 33 goals = [ | 74 goals = [ |
| 34 ("mactcp.slb", "mactcpmodules.slb"), | 75 ("mactcp.slb", "mactcpmodules.slb"), |
