annotate Mac/scripts/ConfigurePython.py @ 15210:d2c205c36d8a legacy-trunk

If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
author Jack Jansen <jack.jansen@cwi.nl>
date Fri, 13 Oct 2000 23:33:34 +0000
parents e9f5985b6ea4
children 07ffb0c3bd5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2939
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1 # This python script creates Finder aliases for all the
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
2 # dynamically-loaded modules that "live in" in a single
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
3 # shared library.
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
4 #
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
5 # This is sort-of a merger between Jack's MkPluginAliases
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
6 # and Guido's mkaliases.
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
7 #
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
8 # Jack Jansen, CWI, August 1996
2939
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
9
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
10 import sys
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
11 import os
3122
2caa3e283568 Load toolbox modules "by hand" using imp, so this script should now
Jack Jansen <jack.jansen@cwi.nl>
parents: 2978
diff changeset
12 import macfs
6274
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
13 import MacOS
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
14 verbose=0
2939
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
15
6274
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
16 SPLASH_LOCATE=512
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
17 SPLASH_REMOVE=513
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
18 SPLASH_CFM68K=514
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
19 SPLASH_PPC=515
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
20 SPLASH_NUMPY=516
15210
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
21 ALERT_NONBOOT=517
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
22 ALERT_NONBOOT_COPY=1
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
23 ALERT_NONBOOT_ALIAS=2
6274
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
24
4058
21b28dcfa865 Adapted for cfm68k, new names and split off of qt.
Jack Jansen <jack.jansen@cwi.nl>
parents: 3933
diff changeset
25 ppc_goals = [
10113
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
26 ## ("AE.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
27 ## ("Ctl.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
28 ## ("Dlg.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
29 ## ("Evt.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
30 ## ("Fm.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
31 ## ("Help.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
32 ## ("Icn.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
33 ## ("Menu.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
34 ## ("List.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
35 ## ("Qd.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
36 ## ("Res.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
37 ## ("Scrap.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
38 ## ("Snd.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
39 ## ("Sndihooks.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
40 ## ("TE.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
41 ## ("Win.ppc.slb", "toolboxmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
42 ##
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
43 ## ("Cm.ppc.slb", "qtmodules.ppc.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
44 ## ("Qt.ppc.slb", "qtmodules.ppc.slb"),
4058
21b28dcfa865 Adapted for cfm68k, new names and split off of qt.
Jack Jansen <jack.jansen@cwi.nl>
parents: 3933
diff changeset
45
21b28dcfa865 Adapted for cfm68k, new names and split off of qt.
Jack Jansen <jack.jansen@cwi.nl>
parents: 3933
diff changeset
46 ]
21b28dcfa865 Adapted for cfm68k, new names and split off of qt.
Jack Jansen <jack.jansen@cwi.nl>
parents: 3933
diff changeset
47
21b28dcfa865 Adapted for cfm68k, new names and split off of qt.
Jack Jansen <jack.jansen@cwi.nl>
parents: 3933
diff changeset
48 cfm68k_goals = [
10113
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
49 ## ("AE.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
50 ## ("Ctl.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
51 ## ("Dlg.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
52 ## ("Evt.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
53 ## ("Fm.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
54 ## ("Help.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
55 ## ("Icn.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
56 ## ("Menu.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
57 ## ("List.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
58 ## ("Qd.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
59 ## ("Res.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
60 ## ("Scrap.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
61 ## ("Snd.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
62 ## ("Sndihooks.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
63 ## ("TE.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
64 ## ("Win.CFM68K.slb", "toolboxmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
65 ##
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
66 ## ("Cm.CFM68K.slb", "qtmodules.CFM68K.slb"),
e9f5985b6ea4 Don't create symlinks to toolbox modules any more.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10109
diff changeset
67 ## ("Qt.CFM68K.slb", "qtmodules.CFM68K.slb"),
2939
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
68 ]
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
69
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
70 def gotopluginfolder():
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
71 """Go to the plugin folder, assuming we are somewhere in the Python tree"""
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
72 import os
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
73
10040
3ad2b2e31f53 Fixed two typo's (Plugins -> PlugIns) and added some explicit path munging to allow the script to also work from the Scripts folder. Somehow either of these fixes solved a problem where it suddenly refused to make a PythonCore alias in the Extensions folder. -- jvr
Just van Rossum <just@lettererror.com>
parents: 9990
diff changeset
74 while not os.path.isdir(":Mac:PlugIns"):
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
75 os.chdir("::")
10040
3ad2b2e31f53 Fixed two typo's (Plugins -> PlugIns) and added some explicit path munging to allow the script to also work from the Scripts folder. Somehow either of these fixes solved a problem where it suddenly refused to make a PythonCore alias in the Extensions folder. -- jvr
Just van Rossum <just@lettererror.com>
parents: 9990
diff changeset
76 os.chdir(":Mac:PlugIns")
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
77 if verbose: print "current directory is", os.getcwd()
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
78
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
79 def loadtoolboxmodules():
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
80 """Attempt to load the Res module"""
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
81 try:
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
82 import Res
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
83 except ImportError, arg:
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
84 err1 = arg
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
85 pass
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
86 else:
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
87 if verbose: print 'imported Res the standard way.'
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
88 return
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
89
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
90 # We cannot import it. First attempt to load the cfm68k version
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
91 import imp
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
92 try:
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
93 dummy = imp.load_dynamic('Res', 'toolboxmodules.CFM68K.slb')
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
94 except ImportError, arg:
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
95 err2 = arg
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
96 pass
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
97 else:
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
98 if verbose: print 'Loaded Res from toolboxmodules.CFM68K.slb.'
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
99 return
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
100
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
101 # Ok, try the ppc version
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
102 try:
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
103 dummy = imp.load_dynamic('Res', 'toolboxmodules.ppc.slb')
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
104 except ImportError, arg:
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
105 err3 = arg
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
106 pass
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
107 else:
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
108 if verbose: print 'Loaded Res from toolboxmodules.ppc.slb.'
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
109 return
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
110
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
111 # Tough luck....
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
112 print "I cannot import the Res module, nor load it from either of"
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
113 print "toolboxmodules shared libraries. The errors encountered were:"
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
114 print "import Res:", err1
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
115 print "load from toolboxmodules.CFM68K.slb:", err2
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
116 print "load from toolboxmodules.ppc.slb:", err3
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
117 sys.exit(1)
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
118
4447
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
119 def getextensiondirfile(fname):
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
120 import macfs
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
121 import MACFS
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
122 vrefnum, dirid = macfs.FindFolder(MACFS.kOnSystemDisk, MACFS.kExtensionFolderType, 0)
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
123 fss = macfs.FSSpec((vrefnum, dirid, fname))
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
124 return fss.as_pathname()
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
125
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
126 def mkcorealias(src, altsrc):
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
127 import string
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
128 import macostools
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
129 version = string.split(sys.version)[0]
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
130 dst = getextensiondirfile(src+ ' ' + version)
10040
3ad2b2e31f53 Fixed two typo's (Plugins -> PlugIns) and added some explicit path munging to allow the script to also work from the Scripts folder. Somehow either of these fixes solved a problem where it suddenly refused to make a PythonCore alias in the Extensions folder. -- jvr
Just van Rossum <just@lettererror.com>
parents: 9990
diff changeset
131 if not os.path.exists(os.path.join(sys.exec_prefix, src)):
3ad2b2e31f53 Fixed two typo's (Plugins -> PlugIns) and added some explicit path munging to allow the script to also work from the Scripts folder. Somehow either of these fixes solved a problem where it suddenly refused to make a PythonCore alias in the Extensions folder. -- jvr
Just van Rossum <just@lettererror.com>
parents: 9990
diff changeset
132 if not os.path.exists(os.path.join(sys.exec_prefix, altsrc)):
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
133 if verbose: print '*', src, 'not found'
4447
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
134 return 0
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
135 src = altsrc
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
136 try:
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
137 os.unlink(dst)
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
138 except os.error:
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
139 pass
15210
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
140 do_copy = 0
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
141 if macfs.FSSpec(sys.exec_prefix).as_tuple()[0] != -1: # XXXX
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
142 try:
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
143 import Dlg
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
144 rv = Dlg.CautionAlert(ALERT_NONBOOT, None)
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
145 if rv == ALERT_NONBOOT_COPY:
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
146 do_copy = 1
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
147 except ImportError:
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
148 pass
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
149 if do_copy:
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
150 macostools.copy(os.path.join(sys.exec_prefix, src), dst)
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
151 else:
d2c205c36d8a If we're installing to another partition than the system partition offer to copy PythonCore in stead of aliasing it. This should fix the applet problems some people have.
Jack Jansen <jack.jansen@cwi.nl>
parents: 10113
diff changeset
152 macostools.mkalias(os.path.join(sys.exec_prefix, src), dst)
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
153 if verbose: print ' ', dst, '->', src
4447
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
154 return 1
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
155
2939
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
156
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
157 def main():
6274
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
158 MacOS.splash(SPLASH_LOCATE)
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
159 gotopluginfolder()
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
160
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
161 loadtoolboxmodules()
2939
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
162
6475
f5f744ed8137 Fixup sys.path to be able to find macostools
Jack Jansen <jack.jansen@cwi.nl>
parents: 6297
diff changeset
163 sys.path.append('::Mac:Lib')
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
164 import macostools
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
165
2939
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
166 # Remove old .slb aliases and collect a list of .slb files
6274
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
167 didsplash = 0
2939
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
168 LibFiles = []
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
169 allfiles = os.listdir(':')
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
170 if verbose: print 'Removing old aliases...'
2939
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
171 for f in allfiles:
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
172 if f[-4:] == '.slb':
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
173 finfo = macfs.FSSpec(f).GetFInfo()
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
174 if finfo.Flags & 0x8000:
6274
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
175 if not didsplash:
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
176 MacOS.splash(SPLASH_REMOVE)
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
177 didsplash = 1
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
178 if verbose: print ' Removing', f
2939
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
179 os.unlink(f)
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
180 else:
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
181 LibFiles.append(f)
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
182 if verbose: print ' Found', f
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
183 if verbose: print
2939
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
184
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
185 # Create the new PPC aliases.
6274
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
186 didsplash = 0
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
187 if verbose: print 'Creating PPC aliases...'
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
188 for dst, src in ppc_goals:
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
189 if src in LibFiles:
6274
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
190 if not didsplash:
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
191 MacOS.splash(SPLASH_PPC)
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
192 didsplash = 1
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
193 macostools.mkalias(src, dst)
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
194 if verbose: print ' ', dst, '->', src
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
195 else:
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
196 if verbose: print '*', dst, 'not created:', src, 'not found'
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
197 if verbose: print
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
198
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
199 # Create the CFM68K aliases.
6274
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
200 didsplash = 0
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
201 if verbose: print 'Creating CFM68K aliases...'
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
202 for dst, src in cfm68k_goals:
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
203 if src in LibFiles:
6274
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
204 if not didsplash:
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
205 MacOS.splash(SPLASH_CFM68K)
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
206 didsplash = 1
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
207 macostools.mkalias(src, dst)
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
208 if verbose: print ' ', dst, '->', src
4169
687899c563e3 Merged Guido's mkaliases and Jack's MkPluginAliases
Jack Jansen <jack.jansen@cwi.nl>
parents: 4058
diff changeset
209 else:
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
210 if verbose: print '*', dst, 'not created:', src, 'not found'
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
211 if verbose: print
4447
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
212
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
213 # Create the PythonCore alias(es)
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
214 if verbose: print 'Creating PythonCore aliases in Extensions folder...'
4447
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
215 os.chdir('::')
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
216 n = 0
6109
8cb2afd10119 MkPluginAliases now knows about fat PythonCore (and all resource files
Jack Jansen <jack.jansen@cwi.nl>
parents: 4447
diff changeset
217 n = n + mkcorealias('PythonCore', 'PythonCore')
4447
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
218 n = n + mkcorealias('PythonCorePPC', ':build.macppc.shared:PythonCorePPC')
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
219 n = n + mkcorealias('PythonCoreCFM68K', ':build.mac68k.shared:PythonCoreCFM68K')
6274
7a3808edc539 Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents: 6175
diff changeset
220
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
221 if verbose and n == 0:
4447
1ba22f749489 Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents: 4362
diff changeset
222 sys.exit(1)
2939
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
223
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
224 if __name__ == '__main__':
6175
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
225 if len(sys.argv) > 1 and sys.argv[1] == '-v':
19fe880ca919 Put all prints inside "if verbose:"
Jack Jansen <jack.jansen@cwi.nl>
parents: 6109
diff changeset
226 verbose = 1
2939
4dfdf234cda8 MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
227 main()