Skip to content

Commit

Permalink
pw_build: Include Python setup sources in _package_metadata
Browse files Browse the repository at this point in the history
This will trigger the build venv to regenerate the requirements.txt
and install new packages.

Bug: b/240734482
Change-Id: Ie180ce745d6ba8449b5fce73a5e079a1a038f9ac
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/103888
Reviewed-by: Armando Montanez <[email protected]>
Commit-Queue: Anthony DiGirolamo <[email protected]>
Pigweed-Auto-Submit: Anthony DiGirolamo <[email protected]>
  • Loading branch information
AnthonyDiGirolamo authored and CQ Bot Account committed Jul 30, 2022
1 parent cdb1629 commit 8247e1e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions pw_build/python.gni
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,24 @@ template("pw_python_package") {
# Finally, write out the json
write_file(_package_metadata_json_file, _package_metadata, "json")

# Create a target group for the Python package metadata only.
group("$target_name._package_metadata") {
# Create a target group for the Python package metadata only. This is a
# python_action so the setup sources can be included as inputs.
pw_python_action("$target_name._package_metadata") {
metadata = {
pw_python_package_metadata_json = [ _package_metadata_json_file ]
}

script = "$dir_pw_build/py/pw_build/nop.py"

if (_generate_package) {
inputs = [ "$_setup_dir/setup.json" ]
} else {
inputs = _setup_sources
}

_pw_internal_run_in_venv = false
stamp = true

# Forward the package_metadata subtarget for all python_deps.
public_deps = []
foreach(dep, _python_deps) {
Expand Down
2 changes: 1 addition & 1 deletion pw_build/python_venv.gni
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ template("pw_python_venv") {
]

outputs = [ _generated_requirements_file ]
deps = [ ":${invoker.target_name}._create_virtualenv($pw_build_PYTHON_TOOLCHAIN)" ]
deps = _pkg_gn_labels + [ ":${invoker.target_name}._create_virtualenv($pw_build_PYTHON_TOOLCHAIN)" ]
}
} else {
group("${target_name}._generate_3p_requirements") {
Expand Down

0 comments on commit 8247e1e

Please sign in to comment.