mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 19:34:08 +00:00 
			
		
		
		
	Detect that the preference file may be incorrect, and offer to remove it. This isn't finished yet.
This commit is contained in:
		
							parent
							
								
									4c52203b51
								
							
						
					
					
						commit
						54f3bdbfe1
					
				
					 2 changed files with 17 additions and 2 deletions
				
			
		| 
						 | 
					@ -25,6 +25,11 @@ ALERT_NONBOOT=517
 | 
				
			||||||
ALERT_NONBOOT_COPY=1
 | 
					ALERT_NONBOOT_COPY=1
 | 
				
			||||||
ALERT_NONBOOT_ALIAS=2
 | 
					ALERT_NONBOOT_ALIAS=2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ALERT_NOTPYTHONFOLDER=518
 | 
				
			||||||
 | 
					ALERT_NOTPYTHONFOLDER_REMOVE_QUIT=1
 | 
				
			||||||
 | 
					ALERT_NOTPYTHONFOLDER_QUIT=2
 | 
				
			||||||
 | 
					ALERT_NOTPYTHONFOLDER_CONTINUE=3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
APPLET_LIST=[
 | 
					APPLET_LIST=[
 | 
				
			||||||
		(":Mac:scripts:EditPythonPrefs.py", "EditPythonPrefs", None),
 | 
							(":Mac:scripts:EditPythonPrefs.py", "EditPythonPrefs", None),
 | 
				
			||||||
		(":Mac:scripts:BuildApplet.py", "BuildApplet", None),
 | 
							(":Mac:scripts:BuildApplet.py", "BuildApplet", None),
 | 
				
			||||||
| 
						 | 
					@ -41,7 +46,7 @@ def getextensiondirfile(fname):
 | 
				
			||||||
	import macfs
 | 
						import macfs
 | 
				
			||||||
	import MACFS
 | 
						import MACFS
 | 
				
			||||||
	try:
 | 
						try:
 | 
				
			||||||
		vrefnum, dirid = macfs.FindFolder(MACFS.kOnSystemDisk, MACFS.kExtensionFolderType, 0)
 | 
							vrefnum, dirid = macfs.FindFolder(MACFS.kOnSystemDisk, MACFS.kSharedLibrariesFolderType, 0)
 | 
				
			||||||
		fss = macfs.FSSpec((vrefnum, dirid, fname))
 | 
							fss = macfs.FSSpec((vrefnum, dirid, fname))
 | 
				
			||||||
	except macfs.error:
 | 
						except macfs.error:
 | 
				
			||||||
		return None
 | 
							return None
 | 
				
			||||||
| 
						 | 
					@ -112,7 +117,17 @@ def main():
 | 
				
			||||||
	except Res.Error:
 | 
						except Res.Error:
 | 
				
			||||||
		verbose = 1
 | 
							verbose = 1
 | 
				
			||||||
		print "Not running as applet: verbose on"
 | 
							print "Not running as applet: verbose on"
 | 
				
			||||||
 | 
						oldcwd = os.getcwd()
 | 
				
			||||||
	os.chdir(sys.prefix)
 | 
						os.chdir(sys.prefix)
 | 
				
			||||||
 | 
						newcwd = os.getcwd()
 | 
				
			||||||
 | 
						if oldcwd != newcwd:
 | 
				
			||||||
 | 
							import Dlg
 | 
				
			||||||
 | 
							rv = Dlg.CautionAlert(ALERT_NOTPYTHONFOLDER, None)
 | 
				
			||||||
 | 
							if rv == ALERT_NOTPYTHONFOLDER_REMOVE_QUIT:
 | 
				
			||||||
 | 
								print "TBD: Should remove preferences file"
 | 
				
			||||||
 | 
								sys.exit(0)
 | 
				
			||||||
 | 
							elif rv == ALERT_NOTPYTHONFOLDER_QUIT:
 | 
				
			||||||
 | 
								sys.exit(0)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	sys.path.append('::Mac:Lib')
 | 
						sys.path.append('::Mac:Lib')
 | 
				
			||||||
	import macostools
 | 
						import macostools
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue