Mercurial > cpython-lru_cache-weakref
annotate Mac/scripts/ConfigurePython.py @ 16815:b2cff5705775 legacy-trunk
Various tweaks to make it work on MacOSX.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Tue, 27 Feb 2001 23:22:02 +0000 |
| parents | 5921b129f350 |
| children | 52fe377f07f2 |
| 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 |
|
16815
b2cff5705775
Various tweaks to make it work on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16654
diff
changeset
|
14 import gestalt |
|
2939
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
15 |
|
16653
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
16 SPLASH_COPYCORE=512 |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
17 SPLASH_COPYCARBON=513 |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
18 SPLASH_COPYCLASSIC=514 |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
19 SPLASH_BUILDAPPLETS=515 |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
20 |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
21 ALERT_NOCORE=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
|
22 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
|
23 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
|
24 ALERT_NONBOOT_ALIAS=2 |
|
6274
7a3808edc539
Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents:
6175
diff
changeset
|
25 |
|
16653
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
26 APPLET_LIST=[ |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
27 (":Mac:scripts:EditPythonPrefs.py", "EditPythonPrefs", None), |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
28 (":Mac:scripts:BuildApplet.py", "BuildApplet", None), |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
29 (":Mac:scripts:BuildApplication.py", "BuildApplication", None), |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
30 ## (":Mac:scripts:ConfigurePython.py", "ConfigurePython", None), |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
31 ## (":Mac:scripts:ConfigurePython.py", "ConfigurePythonCarbon", "PythonInterpreterCarbon"), |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
32 ## (":Mac:scripts:ConfigurePython.py", "ConfigurePythonClassic", "PythonInterpreterClassic"), |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
33 (":Mac:Tools:IDE:PythonIDE.py", "Python IDE", None), |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
34 (":Mac:Tools:CGI:PythonCGISlave.py", ":Mac:Tools:CGI:PythonCGISlave", None), |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
35 (":Mac:Tools:CGI:BuildCGIApplet.py", ":Mac:Tools:CGI:BuildCGIApplet", None), |
|
2939
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
36 ] |
|
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
37 |
|
4447
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
38 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
|
39 import macfs |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
40 import MACFS |
|
16815
b2cff5705775
Various tweaks to make it work on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16654
diff
changeset
|
41 try: |
|
b2cff5705775
Various tweaks to make it work on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16654
diff
changeset
|
42 vrefnum, dirid = macfs.FindFolder(MACFS.kOnSystemDisk, MACFS.kExtensionFolderType, 0) |
|
b2cff5705775
Various tweaks to make it work on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16654
diff
changeset
|
43 fss = macfs.FSSpec((vrefnum, dirid, fname)) |
|
b2cff5705775
Various tweaks to make it work on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16654
diff
changeset
|
44 except macfs.error: |
|
b2cff5705775
Various tweaks to make it work on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16654
diff
changeset
|
45 return None |
|
4447
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
46 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
|
47 |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
48 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
|
49 import string |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
50 import macostools |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
51 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
|
52 dst = getextensiondirfile(src+ ' ' + version) |
|
16815
b2cff5705775
Various tweaks to make it work on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16654
diff
changeset
|
53 if not dst: |
|
b2cff5705775
Various tweaks to make it work on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16654
diff
changeset
|
54 return 0 |
|
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
|
55 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
|
56 if not os.path.exists(os.path.join(sys.exec_prefix, altsrc)): |
|
4447
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
57 return 0 |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
58 src = altsrc |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
59 try: |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 macostools.mkalias(os.path.join(sys.exec_prefix, src), dst) |
|
4447
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
76 return 1 |
|
16653
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
77 |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
78 # Copied from fullbuild, should probably go to buildtools |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
79 def buildapplet(top, dummy, list): |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
80 """Create python applets""" |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
81 import buildtools |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
82 for src, dst, tmpl in list: |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
83 template = buildtools.findtemplate(tmpl) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
84 if src[-3:] != '.py': |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
85 raise 'Should end in .py', src |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
86 base = os.path.basename(src) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
87 src = os.path.join(top, src) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
88 dst = os.path.join(top, dst) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
89 try: |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
90 os.unlink(dst) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
91 except os.error: |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
92 pass |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
93 try: |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
94 buildtools.process(template, src, dst, 1) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
95 except buildtools.BuildError, arg: |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
96 print '**', dst, arg |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
97 |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
98 def buildcopy(top, dummy, list): |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
99 import macostools |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
100 for src, dst in list: |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
101 src = os.path.join(top, src) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
102 dst = os.path.join(top, dst) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
103 macostools.copy(src, dst) |
|
2939
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
104 |
|
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
105 def main(): |
|
16653
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
106 os.chdir(sys.prefix) |
|
2939
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
107 |
|
6475
f5f744ed8137
Fixup sys.path to be able to find macostools
Jack Jansen <jack.jansen@cwi.nl>
parents:
6297
diff
changeset
|
108 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
|
109 import macostools |
|
16597
07ffb0c3bd5e
Also create alias to PythonCoreCarbon.
Jack Jansen <jack.jansen@cwi.nl>
parents:
15210
diff
changeset
|
110 |
|
4447
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
111 # Create the PythonCore alias(es) |
|
16653
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
112 MacOS.splash(SPLASH_COPYCORE) |
|
4447
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
113 n = 0 |
|
6109
8cb2afd10119
MkPluginAliases now knows about fat PythonCore (and all resource files
Jack Jansen <jack.jansen@cwi.nl>
parents:
4447
diff
changeset
|
114 n = n + mkcorealias('PythonCore', 'PythonCore') |
|
16597
07ffb0c3bd5e
Also create alias to PythonCoreCarbon.
Jack Jansen <jack.jansen@cwi.nl>
parents:
15210
diff
changeset
|
115 n = n + mkcorealias('PythonCoreCarbon', 'PythonCoreCarbon') |
|
16653
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
116 if n == 0: |
|
16815
b2cff5705775
Various tweaks to make it work on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16654
diff
changeset
|
117 import Dlg |
|
16653
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
118 Dlg.CautionAlert(ALERT_NOCORE, None) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
119 return |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
120 if sys.argv[0][-7:] == 'Classic': |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
121 do_classic = 1 |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
122 elif sys.argv[0][-6:] == 'Carbon': |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
123 do_classic = 0 |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
124 elif sys.argv[0][-15:] == 'ConfigurePython' or sys.argv[0][-18:] == 'ConfigurePython.py': |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
125 return |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
126 else: |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
127 print "I don't know the sys.argv[0] function", sys.argv[0] |
|
4447
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
128 sys.exit(1) |
|
16653
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
129 if do_classic: |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
130 MacOS.splash(SPLASH_COPYCLASSIC) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
131 buildcopy(sys.prefix, None, [("PythonInterpreterClassic", "PythonInterpreter")]) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
132 else: |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
133 MacOS.splash(SPLASH_COPYCARBON) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
134 buildcopy(sys.prefix, None, [("PythonInterpreterCarbon", "PythonInterpreter")]) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
135 MacOS.splash(SPLASH_BUILDAPPLETS) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
136 buildapplet(sys.prefix, None, APPLET_LIST) |
|
b9fe8bd9e5f4
ConfigurePython now comes in two flavors: ConfigurePythonClassic and ConfigurePythonCarbon, which copy the respective interpreters to PythonInterpreter and rebuild all the applets. This allows MacOS9 users to switch back and forth.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16597
diff
changeset
|
137 |
|
2939
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
138 if __name__ == '__main__': |
|
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
139 main() |
