1 # This python script creates Finder aliases for all the
2 # dynamically-loaded modules that "live in" in a single
4 # It needs a fully functional non-dynamic python to work
5 # but you can run it in a shared python as long as you can point
6 # it to toolboxmodules.slb
8 # Jack Jansen, CWI, August 1995
15 1. Remove any old "Python Preferences" files from the system folder.
16 2. Remove any old "PythonCore" or "PythonCoreCFM68K" files from the system folder.
17 3. Make sure this script, your interpreter and your PythonCore are all located in the
19 4. Run this script again, by dropping it on your interpreter.
21 If this fails try removing starting afresh from the distribution archive.
29 I cannot import the 'os' module, so something is wrong with sys.path
38 # Check that we are actually in the main python directory
40 fss
, ok
= macfs
.StandardGetFile('Where are the toolbox modules?', 'shlb')
41 tblibname
= fss
.as_pathname()
43 for wtd
in ["Ctl", "Dlg", "Evt", "Qd", "Res", "Win"]:
44 imp
.load_dynamic(wtd
, tblibname
)
47 I cannot load the toolbox modules by hand. Are you sure you are
58 ("AE.ppc.slb", "toolboxmodules.ppc.slb"),
59 ("Ctl.ppc.slb", "toolboxmodules.ppc.slb"),
60 ("Dlg.ppc.slb", "toolboxmodules.ppc.slb"),
61 ("Evt.ppc.slb", "toolboxmodules.ppc.slb"),
62 ("Fm.ppc.slb", "toolboxmodules.ppc.slb"),
63 ("Menu.ppc.slb", "toolboxmodules.ppc.slb"),
64 ("List.ppc.slb", "toolboxmodules.ppc.slb"),
65 ("Qd.ppc.slb", "toolboxmodules.ppc.slb"),
66 ("Res.ppc.slb", "toolboxmodules.ppc.slb"),
67 ("Scrap.ppc.slb", "toolboxmodules.ppc.slb"),
68 ("Snd.ppc.slb", "toolboxmodules.ppc.slb"),
69 ("TE.ppc.slb", "toolboxmodules.ppc.slb"),
70 ("Win.ppc.slb", "toolboxmodules.ppc.slb"),
72 ("Cm.ppc.slb", "qtmodules.ppc.slb"),
73 ("Qt.ppc.slb", "qtmodules.ppc.slb"),
75 ("imgcolormap.ppc.slb", "imgmodules.ppc.slb"),
76 ("imgformat.ppc.slb", "imgmodules.ppc.slb"),
77 ("imggif.ppc.slb", "imgmodules.ppc.slb"),
78 ("imgjpeg.ppc.slb", "imgmodules.ppc.slb"),
79 ("imgop.ppc.slb", "imgmodules.ppc.slb"),
80 ("imgpbm.ppc.slb", "imgmodules.ppc.slb"),
81 ("imgpgm.ppc.slb", "imgmodules.ppc.slb"),
82 ("imgppm.ppc.slb", "imgmodules.ppc.slb"),
83 ("imgtiff.ppc.slb", "imgmodules.ppc.slb"),
84 ("imgsgi.ppc.slb", "imgmodules.ppc.slb")
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"),
102 ("Cm.CFM68K.slb", "qtmodules.CFM68K.slb"),
103 ("Qt.CFM68K.slb", "qtmodules.CFM68K.slb"),
108 # Ask the user for the plugins directory
109 dir, ok
= macfs
.GetDirectory('Where is the PlugIns folder?')
110 if not ok
: sys
.exit(0)
111 os
.chdir(dir.as_pathname())
113 # Remove old .slb aliases and collect a list of .slb files
114 if EasyDialogs
.AskYesNoCancel('Proceed with removing old aliases?') <= 0:
117 allfiles
= os
.listdir(':')
120 finfo
= macfs
.FSSpec(f
).GetFInfo()
121 if finfo
.Flags
& 0x8000:
127 # Create the new aliases.
128 if EasyDialogs
.AskYesNoCancel('Proceed with creating PPC aliases?') > 0:
129 for dst
, src
in ppc_goals
:
131 macostools
.mkalias(src
, dst
)
133 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
:
137 macostools
.mkalias(src
, dst
)
139 EasyDialogs
.Message(dst
+' not created: '+src
+' not found')
141 EasyDialogs
.Message('All done!')
143 if __name__
== '__main__':