comparison Mac/scripts/ConfigurePython.py @ 17014:6bdf563c763b legacy-trunk

Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
author Jack Jansen <jack.jansen@cwi.nl>
date Thu, 08 Mar 2001 23:07:57 +0000
parents b7b048da1673
children 3f5a54a8a1fb
comparison
equal deleted inserted replaced
17013:d15ace321102 17014:6bdf563c763b
23 ALERT_NOCORE=516 23 ALERT_NOCORE=516
24 ALERT_NONBOOT=517 24 ALERT_NONBOOT=517
25 ALERT_NONBOOT_COPY=1 25 ALERT_NONBOOT_COPY=1
26 ALERT_NONBOOT_ALIAS=2 26 ALERT_NONBOOT_ALIAS=2
27 27
28 ALERT_NOTPYTHONFOLDER=518
29 ALERT_NOTPYTHONFOLDER_REMOVE_QUIT=1
30 ALERT_NOTPYTHONFOLDER_QUIT=2
31 ALERT_NOTPYTHONFOLDER_CONTINUE=3
32
28 APPLET_LIST=[ 33 APPLET_LIST=[
29 (":Mac:scripts:EditPythonPrefs.py", "EditPythonPrefs", None), 34 (":Mac:scripts:EditPythonPrefs.py", "EditPythonPrefs", None),
30 (":Mac:scripts:BuildApplet.py", "BuildApplet", None), 35 (":Mac:scripts:BuildApplet.py", "BuildApplet", None),
31 (":Mac:scripts:BuildApplication.py", "BuildApplication", None), 36 (":Mac:scripts:BuildApplication.py", "BuildApplication", None),
32 ## (":Mac:scripts:ConfigurePython.py", "ConfigurePython", None), 37 ## (":Mac:scripts:ConfigurePython.py", "ConfigurePython", None),
39 44
40 def getextensiondirfile(fname): 45 def getextensiondirfile(fname):
41 import macfs 46 import macfs
42 import MACFS 47 import MACFS
43 try: 48 try:
44 vrefnum, dirid = macfs.FindFolder(MACFS.kOnSystemDisk, MACFS.kExtensionFolderType, 0) 49 vrefnum, dirid = macfs.FindFolder(MACFS.kOnSystemDisk, MACFS.kSharedLibrariesFolderType, 0)
45 fss = macfs.FSSpec((vrefnum, dirid, fname)) 50 fss = macfs.FSSpec((vrefnum, dirid, fname))
46 except macfs.error: 51 except macfs.error:
47 return None 52 return None
48 return fss.as_pathname() 53 return fss.as_pathname()
49 54
110 h = Res.GetResource('DLOG', SPLASH_COPYCORE) 115 h = Res.GetResource('DLOG', SPLASH_COPYCORE)
111 del h 116 del h
112 except Res.Error: 117 except Res.Error:
113 verbose = 1 118 verbose = 1
114 print "Not running as applet: verbose on" 119 print "Not running as applet: verbose on"
120 oldcwd = os.getcwd()
115 os.chdir(sys.prefix) 121 os.chdir(sys.prefix)
122 newcwd = os.getcwd()
123 if oldcwd != newcwd:
124 import Dlg
125 rv = Dlg.CautionAlert(ALERT_NOTPYTHONFOLDER, None)
126 if rv == ALERT_NOTPYTHONFOLDER_REMOVE_QUIT:
127 print "TBD: Should remove preferences file"
128 sys.exit(0)
129 elif rv == ALERT_NOTPYTHONFOLDER_QUIT:
130 sys.exit(0)
116 131
117 sys.path.append('::Mac:Lib') 132 sys.path.append('::Mac:Lib')
118 import macostools 133 import macostools
119 134
120 # Create the PythonCore alias(es) 135 # Create the PythonCore alias(es)