comparison Mac/scripts/ConfigurePython.py @ 4058:21b28dcfa865 legacy-trunk

Adapted for cfm68k, new names and split off of qt.
author Jack Jansen <jack.jansen@cwi.nl>
date Tue, 20 Aug 1996 16:35:30 +0000
parents 60bb743b8a5c
children 687899c563e3
comparison
equal deleted inserted replaced
4057:818599e39123 4058:21b28dcfa865
1 # This python script creates Finder aliases for all the 1 # This python script creates Finder aliases for all the
2 # dynamically-loaded modules that "live in" in a single 2 # dynamically-loaded modules that "live in" in a single
3 # shared library. 3 # shared library.
4 # It needs a fully functional non-dynamic python to work 4 # It needs a fully functional non-dynamic python to work
5 # (since it creates aliases to stuff it needs itself), 5 # but you can run it in a shared python as long as you can point
6 # you should probably drag it onto your non-dynamic python. 6 # it to toolboxmodules.slb
7 #
8 # If you compare it to MkPluginAliases.as it also serves
9 # as a comparison between python and AppleScript:-)
10 # 7 #
11 # Jack Jansen, CWI, August 1995 8 # Jack Jansen, CWI, August 1995
12 9
13 import sys 10 import sys
14 11
15 def help(): 12 def help():
16 print""" 13 print"""
17 Try the following: 14 Try the following:
18 1. Remove any old "Python Preferences" files from the system folder. 15 1. Remove any old "Python Preferences" files from the system folder.
19 2. Remove any old "PythonCore" files from the system folder. 16 2. Remove any old "PythonCore" or "PythonCoreCFM68K" files from the system folder.
20 3. Make sure this script, PythonPPC and PythonCore are all located in the 17 3. Make sure this script, your interpreter and your PythonCore are all located in the
21 python home folder (where the Lib and PlugIns folders are) 18 same folder.
22 4. Run this script again, by dropping it on PythonPPC. 19 4. Run this script again, by dropping it on your interpreter.
23 20
24 If this fails try removing starting afresh from the distribution archive. 21 If this fails try removing starting afresh from the distribution archive.
25 """ 22 """
26 sys.exit(1) 23 sys.exit(1)
27 24
34 help() 31 help()
35 32
36 try: 33 try:
37 import Res 34 import Res
38 except ImportError: 35 except ImportError:
36 import macfs
39 # 37 #
40 # Check that we are actually in the main python directory 38 # Check that we are actually in the main python directory
41 # 39 #
42 try: 40 fss, ok = macfs.StandardGetFile('Where are the toolbox modules?', 'shlb')
43 os.chdir(':PlugIns') 41 tblibname = fss.as_pathname()
44 except IOError:
45 print """
46 I cannot find the 'PlugIns' folder, so I am obviously not run from the Python
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.path.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: 42 try:
60 for wtd in ["Ctl", "Dlg", "Evt", "Qd", "Res", "Win"]: 43 for wtd in ["Ctl", "Dlg", "Evt", "Qd", "Res", "Win"]:
61 imp.load_dynamic(wtd, tblibname) 44 imp.load_dynamic(wtd, tblibname)
62 except ImportError: 45 except ImportError:
63 print """ 46 print """
69 52
70 import macfs 53 import macfs
71 import EasyDialogs 54 import EasyDialogs
72 import macostools 55 import macostools
73 56
74 goals = [ 57 ppc_goals = [
75 ("AE.slb", "toolboxmodules.slb"), 58 ("AE.ppc.slb", "toolboxmodules.ppc.slb"),
76 ("Cm.slb", "toolboxmodules.slb"), 59 ("Ctl.ppc.slb", "toolboxmodules.ppc.slb"),
77 ("Ctl.slb", "toolboxmodules.slb"), 60 ("Dlg.ppc.slb", "toolboxmodules.ppc.slb"),
78 ("Dlg.slb", "toolboxmodules.slb"), 61 ("Evt.ppc.slb", "toolboxmodules.ppc.slb"),
79 ("Evt.slb", "toolboxmodules.slb"), 62 ("Fm.ppc.slb", "toolboxmodules.ppc.slb"),
80 ("Fm.slb", "toolboxmodules.slb"), 63 ("Menu.ppc.slb", "toolboxmodules.ppc.slb"),
81 ("Menu.slb", "toolboxmodules.slb"), 64 ("List.ppc.slb", "toolboxmodules.ppc.slb"),
82 ("List.slb", "toolboxmodules.slb"), 65 ("Qd.ppc.slb", "toolboxmodules.ppc.slb"),
83 ("Qd.slb", "toolboxmodules.slb"), 66 ("Res.ppc.slb", "toolboxmodules.ppc.slb"),
84 ("Qt.slb", "toolboxmodules.slb"), 67 ("Scrap.ppc.slb", "toolboxmodules.ppc.slb"),
85 ("Res.slb", "toolboxmodules.slb"), 68 ("Snd.ppc.slb", "toolboxmodules.ppc.slb"),
86 ("Scrap.slb", "toolboxmodules.slb"), 69 ("TE.ppc.slb", "toolboxmodules.ppc.slb"),
87 ("Snd.slb", "toolboxmodules.slb"), 70 ("Win.ppc.slb", "toolboxmodules.ppc.slb"),
88 ("TE.slb", "toolboxmodules.slb"), 71
89 ("Win.slb", "toolboxmodules.slb"), 72 ("Cm.ppc.slb", "qtmodules.ppc.slb"),
90 ("imgcolormap.slb", "imgmodules.slb"), 73 ("Qt.ppc.slb", "qtmodules.ppc.slb"),
91 ("imgformat.slb", "imgmodules.slb"), 74
92 ("imggif.slb", "imgmodules.slb"), 75 ("imgcolormap.ppc.slb", "imgmodules.ppc.slb"),
93 ("imgjpeg.slb", "imgmodules.slb"), 76 ("imgformat.ppc.slb", "imgmodules.ppc.slb"),
94 ("imgop.slb", "imgmodules.slb"), 77 ("imggif.ppc.slb", "imgmodules.ppc.slb"),
95 ("imgpbm.slb", "imgmodules.slb"), 78 ("imgjpeg.ppc.slb", "imgmodules.ppc.slb"),
96 ("imgpgm.slb", "imgmodules.slb"), 79 ("imgop.ppc.slb", "imgmodules.ppc.slb"),
97 ("imgppm.slb", "imgmodules.slb"), 80 ("imgpbm.ppc.slb", "imgmodules.ppc.slb"),
98 ("imgtiff.slb", "imgmodules.slb"), 81 ("imgpgm.ppc.slb", "imgmodules.ppc.slb"),
99 ("imgsgi.slb", "imgmodules.slb") 82 ("imgppm.ppc.slb", "imgmodules.ppc.slb"),
83 ("imgtiff.ppc.slb", "imgmodules.ppc.slb"),
84 ("imgsgi.ppc.slb", "imgmodules.ppc.slb")
85 ]
86
87 cfm68k_goals = [
88 ("AE.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
89 ("Ctl.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
90 ("Dlg.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
91 ("Evt.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
92 ("Fm.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
93 ("Menu.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
94 ("List.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
95 ("Qd.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
96 ("Res.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
97 ("Scrap.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
98 ("Snd.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
99 ("TE.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
100 ("Win.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
101
102 ("Cm.CFM68K.slb", "qtmodules.CFM68K.slb"),
103 ("Qt.CFM68K.slb", "qtmodules.CFM68K.slb"),
100 ] 104 ]
101 105
102 106
103 def main(): 107 def main():
104 # Ask the user for the plugins directory 108 # Ask the user for the plugins directory
119 else: 123 else:
120 LibFiles.append(f) 124 LibFiles.append(f)
121 125
122 print LibFiles 126 print LibFiles
123 # Create the new aliases. 127 # Create the new aliases.
124 if EasyDialogs.AskYesNoCancel('Proceed with creating new ones?') <= 0: 128 if EasyDialogs.AskYesNoCancel('Proceed with creating PPC aliases?') > 0:
125 sys.exit(0) 129 for dst, src in ppc_goals:
126 for dst, src in goals: 130 if src in LibFiles:
127 if src in LibFiles: 131 macostools.mkalias(src, dst)
128 macostools.mkalias(src, dst) 132 else:
129 else: 133 EasyDialogs.Message(dst+' not created: '+src+' not found')
130 EasyDialogs.Message(dst+' not created: '+src+' not found') 134 if EasyDialogs.AskYesNoCancel('Proceed with creating CFM68K aliases?') > 0:
135 for dst, src in cfm68k_goals:
136 if src in LibFiles:
137 macostools.mkalias(src, dst)
138 else:
139 EasyDialogs.Message(dst+' not created: '+src+' not found')
131 140
132 EasyDialogs.Message('All done!') 141 EasyDialogs.Message('All done!')
133 142
134 if __name__ == '__main__': 143 if __name__ == '__main__':
135 main() 144 main()