-
Notifications
You must be signed in to change notification settings - Fork 923
fix: make preconfigure download paths consistent #2648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
302a211
174c465
281b10f
4acce6f
a31eeaf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ def build_ninja(): | |
| # If we are on windows, we don't need to compile ninja, we just download the executable | ||
| if os.name == "nt": | ||
| ninja_exe_url = "https://github.com/ninja-build/ninja/releases/download/v1.13.0/ninja-win.zip" | ||
| ninja_zip_path = sys.path[0] + os.path.sep + "ninja-win.zip" | ||
|
||
|
|
||
| # Try to execute ninja, if it fails, download .exe from github | ||
| try: | ||
|
|
@@ -48,18 +49,18 @@ def build_ninja(): | |
| except OSError: | ||
| print("Downloading ninja ... ") | ||
| try: | ||
| urllib.request.urlretrieve(ninja_exe_url, "ninja-win.zip") | ||
| except: | ||
| urllib.request.urlretrieve(ninja_exe_url, ninja_zip_path) | ||
| except Exception as e: | ||
| print(e) | ||
| print("Download of ninja executable failed.") | ||
| print("Get archive at " + ninja_exe_url) | ||
| print("extract ninja.exe in the source code root folder.") | ||
| print("Run meson.py again.") | ||
| sys.exit(1) | ||
|
|
||
| zipf = zipfile.ZipFile(sys.path[0] + os.path.sep + "ninja-win.zip") | ||
| zipf.extractall(sys.path[0]) | ||
| remove_file(sys.path[0] + os.path.sep + "ninja-win.zip") | ||
| with zipfile.ZipFile(ninja_zip_path) as zipf: | ||
| zipf.extractall(sys.path[0]) | ||
| remove_file(ninja_zip_path) | ||
| else: | ||
| ninjapath = sys.path[0] + os.path.sep + "externals" + os.path.sep + "ninja" | ||
| try: | ||
|
|
@@ -75,7 +76,9 @@ def build_ninja(): | |
| subprocess.run( | ||
| ["python3", "configure.py", "--bootstrap"], cwd=ninjapath, env=env | ||
| ) | ||
| shutil.copy(ninjapath + os.path.sep + "ninja", ".") | ||
| shutil.copy( | ||
| ninjapath + os.path.sep + "ninja", sys.path[0] + os.path.sep + "ninja" | ||
|
||
| ) | ||
|
|
||
|
|
||
| def run( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look equivalent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
urlretrieve() now writes to filename again (commit_sha + ".zip"), which matches the previous behavior. We still compute filepath/alt_filepath for the later existence check/unzip. Verified locally with python -m compileall preconfigure.py meson_scripts/init.py.