diff --git a/pw_build/python.gni b/pw_build/python.gni index add1d8278f..311e6f4fa0 100644 --- a/pw_build/python.gni +++ b/pw_build/python.gni @@ -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) { diff --git a/pw_build/python_venv.gni b/pw_build/python_venv.gni index dfb0dd2a81..959526bc38 100644 --- a/pw_build/python_venv.gni +++ b/pw_build/python_venv.gni @@ -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") {