mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Touch up Setup.local handling in Tools/wasm/wasi (GH-137051)
				
					
				
			The comment in the generated file is now more self-explanatory. The checks for unexpected file contents are also strengthened.
This commit is contained in:
		
							parent
							
								
									a10235ea67
								
							
						
					
					
						commit
						ec7fad79d2
					
				
					 1 changed files with 9 additions and 6 deletions
				
			
		| 
						 | 
					@ -23,7 +23,8 @@
 | 
				
			||||||
BUILD_DIR = CROSS_BUILD_DIR / "build"
 | 
					BUILD_DIR = CROSS_BUILD_DIR / "build"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LOCAL_SETUP = CHECKOUT / "Modules" / "Setup.local"
 | 
					LOCAL_SETUP = CHECKOUT / "Modules" / "Setup.local"
 | 
				
			||||||
LOCAL_SETUP_MARKER = "# Generated by Tools/wasm/wasi.py\n".encode("utf-8")
 | 
					LOCAL_SETUP_MARKER = ("# Generated by Tools/wasm/wasi .\n"
 | 
				
			||||||
 | 
					                      "# Required to statically build extension modules.").encode("utf-8")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
WASMTIME_VAR_NAME = "WASMTIME"
 | 
					WASMTIME_VAR_NAME = "WASMTIME"
 | 
				
			||||||
WASMTIME_HOST_RUNNER_VAR = f"{{{WASMTIME_VAR_NAME}}}"
 | 
					WASMTIME_HOST_RUNNER_VAR = f"{{{WASMTIME_VAR_NAME}}}"
 | 
				
			||||||
| 
						 | 
					@ -141,9 +142,12 @@ def build_python_is_pydebug():
 | 
				
			||||||
def configure_build_python(context, working_dir):
 | 
					def configure_build_python(context, working_dir):
 | 
				
			||||||
    """Configure the build/host Python."""
 | 
					    """Configure the build/host Python."""
 | 
				
			||||||
    if LOCAL_SETUP.exists():
 | 
					    if LOCAL_SETUP.exists():
 | 
				
			||||||
        print(f"👍 {LOCAL_SETUP} exists ...")
 | 
					        if LOCAL_SETUP.read_bytes() == LOCAL_SETUP_MARKER:
 | 
				
			||||||
 | 
					            print(f"👍 {LOCAL_SETUP} exists ...")
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            print(f"⚠️ {LOCAL_SETUP} exists, but has unexpected contents")
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        print(f"📝 Touching {LOCAL_SETUP} ...")
 | 
					        print(f"📝 Creating {LOCAL_SETUP} ...")
 | 
				
			||||||
        LOCAL_SETUP.write_bytes(LOCAL_SETUP_MARKER)
 | 
					        LOCAL_SETUP.write_bytes(LOCAL_SETUP_MARKER)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    configure = [os.path.relpath(CHECKOUT / 'configure', working_dir)]
 | 
					    configure = [os.path.relpath(CHECKOUT / 'configure', working_dir)]
 | 
				
			||||||
| 
						 | 
					@ -297,9 +301,8 @@ def clean_contents(context):
 | 
				
			||||||
        shutil.rmtree(CROSS_BUILD_DIR)
 | 
					        shutil.rmtree(CROSS_BUILD_DIR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if LOCAL_SETUP.exists():
 | 
					    if LOCAL_SETUP.exists():
 | 
				
			||||||
        with LOCAL_SETUP.open("rb") as file:
 | 
					        if LOCAL_SETUP.read_bytes() == LOCAL_SETUP_MARKER:
 | 
				
			||||||
            if file.read(len(LOCAL_SETUP_MARKER)) == LOCAL_SETUP_MARKER:
 | 
					            print(f"🧹 Deleting generated {LOCAL_SETUP} ...")
 | 
				
			||||||
                print(f"🧹 Deleting generated {LOCAL_SETUP} ...")
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def main():
 | 
					def main():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue