mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	use the same Python for running the bootstrap script and the main program
This commit is contained in:
		
							parent
							
								
									ddf5283ad1
								
							
						
					
					
						commit
						0ff7a4e7c1
					
				
					 1 changed files with 9 additions and 1 deletions
				
			
		| 
						 | 
					@ -266,7 +266,7 @@ def __load():
 | 
				
			||||||
# sys.executable later.
 | 
					# sys.executable later.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
BOOTSTRAP_SCRIPT = """\
 | 
					BOOTSTRAP_SCRIPT = """\
 | 
				
			||||||
#!/usr/bin/env python
 | 
					#!%(hashbang)s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import sys, os
 | 
					import sys, os
 | 
				
			||||||
execdir = os.path.dirname(sys.argv[0])
 | 
					execdir = os.path.dirname(sys.argv[0])
 | 
				
			||||||
| 
						 | 
					@ -423,6 +423,14 @@ def preProcess(self):
 | 
				
			||||||
			execdir = pathjoin(self.bundlepath, self.execdir)
 | 
								execdir = pathjoin(self.bundlepath, self.execdir)
 | 
				
			||||||
			bootstrappath = pathjoin(execdir, self.name)
 | 
								bootstrappath = pathjoin(execdir, self.name)
 | 
				
			||||||
			makedirs(execdir)
 | 
								makedirs(execdir)
 | 
				
			||||||
 | 
								if self.standalone:
 | 
				
			||||||
 | 
									# XXX we're screwed when the end user has deleted
 | 
				
			||||||
 | 
									# /usr/bin/python
 | 
				
			||||||
 | 
									hashbang = "/usr/bin/python"
 | 
				
			||||||
 | 
								else:
 | 
				
			||||||
 | 
									hashbang = sys.executable
 | 
				
			||||||
 | 
									while os.path.islink(hashbang):
 | 
				
			||||||
 | 
										hashbang = os.readlink(hashbang)
 | 
				
			||||||
			open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals())
 | 
								open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals())
 | 
				
			||||||
			os.chmod(bootstrappath, 0775)
 | 
								os.chmod(bootstrappath, 0775)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue