Mercurial > cpython-lru_cache-weakref
annotate Mac/scripts/ConfigurePython.py @ 21286:1e7c0b849584 legacy-trunk
Not being able to copy PythonCore to the system-folder is not a fatal error, on OSX the user may not have permission to do so. Also give a more informative message in this case.
Fixes bug 475253.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Fri, 07 Dec 2001 16:07:04 +0000 |
| parents | 42b2f1936254 |
| children | eb6b36b26e8d |
| 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 |
|
16834
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
15 import string |
|
19488
42b2f1936254
Import the MacOS toolbox modules from the Carbon package.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17247
diff
changeset
|
16 from Carbon import Res |
|
2939
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
17 |
|
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
|
18 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
|
19 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
|
20 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
|
21 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
|
22 |
|
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
|
23 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
|
24 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
|
25 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
|
26 ALERT_NONBOOT_ALIAS=2 |
|
6274
7a3808edc539
Run NumPy installer, if present.
Jack Jansen <jack.jansen@cwi.nl>
parents:
6175
diff
changeset
|
27 |
|
17014
6bdf563c763b
Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17004
diff
changeset
|
28 ALERT_NOTPYTHONFOLDER=518 |
|
6bdf563c763b
Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17004
diff
changeset
|
29 ALERT_NOTPYTHONFOLDER_REMOVE_QUIT=1 |
|
6bdf563c763b
Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17004
diff
changeset
|
30 ALERT_NOTPYTHONFOLDER_QUIT=2 |
|
6bdf563c763b
Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17004
diff
changeset
|
31 ALERT_NOTPYTHONFOLDER_CONTINUE=3 |
|
6bdf563c763b
Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17004
diff
changeset
|
32 |
|
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
|
33 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
|
34 (":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
|
35 (":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
|
36 (":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
|
37 ## (":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
|
38 ## (":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
|
39 ## (":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
|
40 (":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
|
41 (":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
|
42 (":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
|
43 ] |
|
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
44 |
|
4447
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
45 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
|
46 import macfs |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
47 import MACFS |
|
16815
b2cff5705775
Various tweaks to make it work on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16654
diff
changeset
|
48 try: |
|
17046
1f700a7206b2
Look for shared libraries first in kLocalDomain and then in kOnSystemDisk.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17017
diff
changeset
|
49 vrefnum, dirid = macfs.FindFolder(MACFS.kLocalDomain, MACFS.kSharedLibrariesFolderType, 1) |
|
16815
b2cff5705775
Various tweaks to make it work on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16654
diff
changeset
|
50 except macfs.error: |
|
17046
1f700a7206b2
Look for shared libraries first in kLocalDomain and then in kOnSystemDisk.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17017
diff
changeset
|
51 try: |
|
1f700a7206b2
Look for shared libraries first in kLocalDomain and then in kOnSystemDisk.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17017
diff
changeset
|
52 vrefnum, dirid = macfs.FindFolder(MACFS.kOnSystemDisk, MACFS.kSharedLibrariesFolderType, 1) |
|
1f700a7206b2
Look for shared libraries first in kLocalDomain and then in kOnSystemDisk.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17017
diff
changeset
|
53 except macfs.error: |
|
1f700a7206b2
Look for shared libraries first in kLocalDomain and then in kOnSystemDisk.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17017
diff
changeset
|
54 return None |
|
1f700a7206b2
Look for shared libraries first in kLocalDomain and then in kOnSystemDisk.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17017
diff
changeset
|
55 fss = macfs.FSSpec((vrefnum, dirid, fname)) |
|
4447
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
56 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
|
57 |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
58 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
|
59 import string |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
60 import macostools |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
61 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
|
62 dst = getextensiondirfile(src+ ' ' + version) |
|
16815
b2cff5705775
Various tweaks to make it work on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16654
diff
changeset
|
63 if not dst: |
|
b2cff5705775
Various tweaks to make it work on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16654
diff
changeset
|
64 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
|
65 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
|
66 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
|
67 return 0 |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
68 src = altsrc |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
69 try: |
|
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
70 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
|
71 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
|
72 pass |
|
17247
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
73 do_copy = ask_copy() |
|
21286
1e7c0b849584
Not being able to copy PythonCore to the system-folder is not a fatal error, on OSX the user may not have permission to do so. Also give a more informative message in this case.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19488
diff
changeset
|
74 try: |
|
1e7c0b849584
Not being able to copy PythonCore to the system-folder is not a fatal error, on OSX the user may not have permission to do so. Also give a more informative message in this case.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19488
diff
changeset
|
75 if do_copy: |
|
1e7c0b849584
Not being able to copy PythonCore to the system-folder is not a fatal error, on OSX the user may not have permission to do so. Also give a more informative message in this case.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19488
diff
changeset
|
76 macostools.copy(os.path.join(sys.exec_prefix, src), dst) |
|
1e7c0b849584
Not being able to copy PythonCore to the system-folder is not a fatal error, on OSX the user may not have permission to do so. Also give a more informative message in this case.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19488
diff
changeset
|
77 else: |
|
1e7c0b849584
Not being able to copy PythonCore to the system-folder is not a fatal error, on OSX the user may not have permission to do so. Also give a more informative message in this case.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19488
diff
changeset
|
78 macostools.mkalias(os.path.join(sys.exec_prefix, src), dst) |
|
1e7c0b849584
Not being able to copy PythonCore to the system-folder is not a fatal error, on OSX the user may not have permission to do so. Also give a more informative message in this case.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19488
diff
changeset
|
79 except IOError: |
|
1e7c0b849584
Not being able to copy PythonCore to the system-folder is not a fatal error, on OSX the user may not have permission to do so. Also give a more informative message in this case.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19488
diff
changeset
|
80 return 0 |
|
17247
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
81 return 1 |
|
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
82 |
|
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
83 do_copy = None |
|
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
84 def ask_copy(): |
|
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
85 global do_copy |
|
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
86 if do_copy != None: |
|
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
87 return do_copy |
|
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
88 # On OSX always copy |
|
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
89 if gestalt.gestalt('sysv') > 0x9ff: |
|
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
90 do_copy = 1 |
|
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
91 return do_copy |
|
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
|
92 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
|
93 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
|
94 try: |
|
19488
42b2f1936254
Import the MacOS toolbox modules from the Carbon package.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17247
diff
changeset
|
95 from Carbon import Dlg |
|
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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 pass |
|
17247
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
101 return do_copy |
|
59472bcbfb8e
On OSX always copy PythonCore. It turns out an orphaned alias in /Library/CFMSupport (happens when you remove python and aliased pythoncore) wreaks havoc with the system.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17046
diff
changeset
|
102 |
|
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
|
103 |
|
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
|
104 # 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
|
105 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
|
106 """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
|
107 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
|
108 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
|
109 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
|
110 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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 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
|
123 |
|
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 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
|
125 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
|
126 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
|
127 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
|
128 dst = os.path.join(top, dst) |
|
17004
b7b048da1673
macostools.copy() now has an optional forcetype flag, which sets the filetype. This is used by various tools to set the type to APPL when copying interpreter template files (Atmp filetype).
Jack Jansen <jack.jansen@cwi.nl>
parents:
16835
diff
changeset
|
129 macostools.copy(src, dst, forcetype="APPL") |
|
2939
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
130 |
|
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
131 def main(): |
|
16834
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
132 verbose = 0 |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
133 try: |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
134 h = Res.GetResource('DLOG', SPLASH_COPYCORE) |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
135 del h |
|
16835
5902b5794a17
Oops, need to import Res.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16834
diff
changeset
|
136 except Res.Error: |
|
16834
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
137 verbose = 1 |
|
16835
5902b5794a17
Oops, need to import Res.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16834
diff
changeset
|
138 print "Not running as applet: verbose on" |
|
17014
6bdf563c763b
Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17004
diff
changeset
|
139 oldcwd = os.getcwd() |
|
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
|
140 os.chdir(sys.prefix) |
|
17014
6bdf563c763b
Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17004
diff
changeset
|
141 newcwd = os.getcwd() |
|
17046
1f700a7206b2
Look for shared libraries first in kLocalDomain and then in kOnSystemDisk.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17017
diff
changeset
|
142 if verbose: |
|
1f700a7206b2
Look for shared libraries first in kLocalDomain and then in kOnSystemDisk.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17017
diff
changeset
|
143 print "Not running as applet: Skipping check for preference file correctness." |
|
1f700a7206b2
Look for shared libraries first in kLocalDomain and then in kOnSystemDisk.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17017
diff
changeset
|
144 elif oldcwd != newcwd: |
|
1f700a7206b2
Look for shared libraries first in kLocalDomain and then in kOnSystemDisk.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17017
diff
changeset
|
145 # Hack to make sure we get the new MACFS |
|
1f700a7206b2
Look for shared libraries first in kLocalDomain and then in kOnSystemDisk.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17017
diff
changeset
|
146 sys.path.insert(0, os.path.join(oldcwd, ':Mac:Lib')) |
|
19488
42b2f1936254
Import the MacOS toolbox modules from the Carbon package.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17247
diff
changeset
|
147 from Carbon import Dlg |
|
17014
6bdf563c763b
Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17004
diff
changeset
|
148 rv = Dlg.CautionAlert(ALERT_NOTPYTHONFOLDER, None) |
|
6bdf563c763b
Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17004
diff
changeset
|
149 if rv == ALERT_NOTPYTHONFOLDER_REMOVE_QUIT: |
|
17017
3f5a54a8a1fb
Finished implementation of removing incorrect preferences file.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17014
diff
changeset
|
150 import pythonprefs, preferences |
|
3f5a54a8a1fb
Finished implementation of removing incorrect preferences file.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17014
diff
changeset
|
151 prefpathname = pythonprefs.pref_fss.as_pathname() |
|
3f5a54a8a1fb
Finished implementation of removing incorrect preferences file.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17014
diff
changeset
|
152 os.remove(prefpathname) |
|
17014
6bdf563c763b
Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17004
diff
changeset
|
153 sys.exit(0) |
|
6bdf563c763b
Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17004
diff
changeset
|
154 elif rv == ALERT_NOTPYTHONFOLDER_QUIT: |
|
6bdf563c763b
Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17004
diff
changeset
|
155 sys.exit(0) |
|
2939
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
156 |
|
6475
f5f744ed8137
Fixup sys.path to be able to find macostools
Jack Jansen <jack.jansen@cwi.nl>
parents:
6297
diff
changeset
|
157 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
|
158 import macostools |
|
16597
07ffb0c3bd5e
Also create alias to PythonCoreCarbon.
Jack Jansen <jack.jansen@cwi.nl>
parents:
15210
diff
changeset
|
159 |
|
4447
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
160 # 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
|
161 MacOS.splash(SPLASH_COPYCORE) |
|
16834
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
162 if verbose: |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
163 print "Copying PythonCore..." |
|
4447
1ba22f749489
Also put aliases to PythonCore{PPC,CFM68K} in the extensions folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
4362
diff
changeset
|
164 n = 0 |
|
6109
8cb2afd10119
MkPluginAliases now knows about fat PythonCore (and all resource files
Jack Jansen <jack.jansen@cwi.nl>
parents:
4447
diff
changeset
|
165 n = n + mkcorealias('PythonCore', 'PythonCore') |
|
16597
07ffb0c3bd5e
Also create alias to PythonCoreCarbon.
Jack Jansen <jack.jansen@cwi.nl>
parents:
15210
diff
changeset
|
166 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
|
167 if n == 0: |
|
19488
42b2f1936254
Import the MacOS toolbox modules from the Carbon package.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17247
diff
changeset
|
168 from Carbon 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
|
169 Dlg.CautionAlert(ALERT_NOCORE, None) |
|
16834
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
170 if verbose: |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
171 print "Warning: PythonCore not copied to Extensions folder" |
|
21286
1e7c0b849584
Not being able to copy PythonCore to the system-folder is not a fatal error, on OSX the user may not have permission to do so. Also give a more informative message in this case.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19488
diff
changeset
|
172 print " (Applets will not work unless run from the Python folder)" |
|
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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 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
|
178 print "I don't know the sys.argv[0] function", sys.argv[0] |
|
16834
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
179 if verbose: |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
180 print "Configure classic or carbon - ", |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
181 rv = string.strip(sys.stdin.readline()) |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
182 while rv and rv != "classic" and rv != "carbon": |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
183 print "Configure classic or carbon - ", |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
184 rv = string.strip(sys.stdin.readline()) |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
185 if rv == "classic": |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
186 do_classic = 1 |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
187 elif rv == "carbon": |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
188 do_classic = 0 |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
189 else: |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
190 return |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
191 else: |
|
52fe377f07f2
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16815
diff
changeset
|
192 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
|
193 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
|
194 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
|
195 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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 |
|
2939
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
202 if __name__ == '__main__': |
|
4dfdf234cda8
MkPluginAliases - Scripts (AppleScript and Python) to create aliases
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
203 main() |
|
16835
5902b5794a17
Oops, need to import Res.
Jack Jansen <jack.jansen@cwi.nl>
parents:
16834
diff
changeset
|
204 MacOS.splash() |
