-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-138489: Install build-details.json
on Windows
#138490
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
base: main
Are you sure you want to change the base?
Changes from all commits
1901e80
dbe1cbd
c80344c
ee39ea7
f5f0548
fdba9f0
6a2cc71
bd9bf46
8d58be4
a927601
d743693
d18f70e
57f3b26
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 |
---|---|---|
|
@@ -45,6 +45,8 @@ gmon.out | |
.pytest_cache/ | ||
.ruff_cache/ | ||
.DS_Store | ||
__install__.json | ||
build-details.json | ||
|
||
*.exe | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
The :pep:`739` :file:`build-details.json` file is now generated and | ||
installed on Windows. | ||
Patch by Adam Turner. |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,37 @@ | ||||||||||
""" | ||||||||||
Generate the PEP 739 'build-details.json' document. | ||||||||||
""" | ||||||||||
|
||||||||||
import sys | ||||||||||
from pathlib import Path | ||||||||||
|
||||||||||
PEP739_SCHEMA_VERSION = '1.0' | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
ROOT_DIR = Path( | ||||||||||
__file__, # PC/layout/support/build_details.py | ||||||||||
'..', # PC/layout/support | ||||||||||
'..', # PC/layout | ||||||||||
'..', # PC | ||||||||||
'..', # <src/install dir> | ||||||||||
).resolve() | ||||||||||
TOOLS_BUILD_DIR = ROOT_DIR / 'Tools' / 'build' | ||||||||||
|
||||||||||
sys_path = sys.path[:] | ||||||||||
try: | ||||||||||
sys.path.insert(0, str(TOOLS_BUILD_DIR)) | ||||||||||
import generate_build_details | ||||||||||
except ImportError: | ||||||||||
generate_build_details = None | ||||||||||
finally: | ||||||||||
sys.path = sys_path | ||||||||||
del sys_path | ||||||||||
Comment on lines
+10
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm afraid this probably needs to replicate most of the functionality from that script and do trickier calculations. The repo containing the running PC/layout isn't necessarily the same as the commit used to build, and the running interpreter isn't necessarily the same as the one we just built. So the details have to be calculated from the referenced source files (i.e. That said, I haven't dug into the
Comment on lines
+10
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need to import the script here instead of invoking it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't do either - we might need to generate the file without being able to launch the runtime. See my comment above on the same section of code. |
||||||||||
|
||||||||||
|
||||||||||
def write_relative_build_details(out_path, base_path): | ||||||||||
if generate_build_details is None: | ||||||||||
return | ||||||||||
generate_build_details.write_build_details( | ||||||||||
schema_version=PEP739_SCHEMA_VERSION, | ||||||||||
base_path=base_path, | ||||||||||
location=out_path, | ||||||||||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ def public(f): | |
"install-json": {"help": "a PyManager __install__.json file"}, | ||
"install-embed-json": {"help": "a PyManager __install__.json file for embeddable distro"}, | ||
"install-test-json": {"help": "a PyManager __install__.json for the test distro"}, | ||
"build-details-json": {"help": "a PEP 739 build-details.json file"}, | ||
} | ||
|
||
|
||
|
@@ -56,6 +57,7 @@ def public(f): | |
"appxmanifest", | ||
"alias", | ||
"alias3x", | ||
"build-details-json", | ||
# XXX: Disabled for now "precompile", | ||
], | ||
}, | ||
|
@@ -69,9 +71,10 @@ def public(f): | |
"props", | ||
"nuspec", | ||
"alias", | ||
"build-details-json", | ||
], | ||
}, | ||
"iot": {"help": "Windows IoT Core", "options": ["alias", "stable", "pip"]}, | ||
"iot": {"help": "Windows IoT Core", "options": ["alias", "stable", "pip", "build-details-json"]}, | ||
"default": { | ||
"help": "development kit package", | ||
"options": [ | ||
|
@@ -85,6 +88,7 @@ def public(f): | |
"symbols", | ||
"html-doc", | ||
"alias", | ||
"build-details-json", | ||
], | ||
}, | ||
"embed": { | ||
|
@@ -96,6 +100,7 @@ def public(f): | |
"flat-dlls", | ||
"underpth", | ||
"precompile", | ||
"build-details-json", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect the contents of the file needs to be different for the embeddable package (no |
||
], | ||
}, | ||
"pymanager": { | ||
|
@@ -109,6 +114,7 @@ def public(f): | |
"dev", | ||
"html-doc", | ||
"install-json", | ||
"build-details-json", | ||
], | ||
}, | ||
"pymanager-test": { | ||
|
@@ -124,6 +130,7 @@ def public(f): | |
"symbols", | ||
"tests", | ||
"install-test-json", | ||
"build-details-json", | ||
], | ||
}, | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,12 @@ | |
<Message Text="Generating $(OutDir)pybuilddir.txt" /> | ||
<WriteLinesToFile File="$(OutDir)pybuilddir.txt" Lines="%0D%0A" Overwrite="true" /> | ||
</Target> | ||
<Target Name="GenerateBuildDetailsJSON" AfterTargets="Link"> | ||
<Message Text="Generating $(OutDir)build-details.json" /> | ||
<Exec Command='setlocal | ||
set PYTHONPATH=$(PySourcePath)Lib | ||
Comment on lines
+131
to
+132
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unsure if these bits are needed, I copied them from the entry slightly further down. |
||
"$(OutDir)$(PyExeName)$(PyDebugExt).exe" "$(PySourcePath)Tools\build\generate_build_details.py" "$(OutDir)build-details.json"' ContinueOnError="true" /> | ||
</Target> | ||
<Target Name="ValidateUcrtbase" AfterTargets="AfterBuild" Condition="$(Configuration) != 'PGInstrument' and $(Platform) != 'ARM' and $(Platform) != 'ARM64'"> | ||
<PropertyGroup> | ||
<UcrtName>ucrtbase</UcrtName> | ||
|
Uh oh!
There was an error while loading. Please reload this page.