diff --git a/scripts/setup/bootstrap.sh b/scripts/setup/bootstrap.sh index ce3ab42dd56c79..f7e733da6b84b4 100644 --- a/scripts/setup/bootstrap.sh +++ b/scripts/setup/bootstrap.sh @@ -141,7 +141,8 @@ _bootstrap_or_activate() { $_CHIP_ROOT/scripts/setup/gen_pigweed_cipd_json.py \ -i $_PIGWEED_CIPD_JSON \ -o $_GENERATED_PIGWEED_CIPD_JSON \ - -e darwin:$_PYTHON_CIPD_JSON + -e darwin:$_PYTHON_CIPD_JSON \ + -e windows:$_PYTHON_CIPD_JSON if test -n "$GITHUB_ACTION"; then tee <"${_PW_ACTUAL_ENVIRONMENT_ROOT}/pip.conf" diff --git a/scripts/setup/environment.json b/scripts/setup/environment.json index fc9ace2b99b11c..09e31468771cd1 100644 --- a/scripts/setup/environment.json +++ b/scripts/setup/environment.json @@ -1,7 +1,6 @@ { "cipd_package_files": [ "third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/cipd_setup/arm.json", - "scripts/setup/python.json", "scripts/setup/zap.json" ], "virtualenv": { diff --git a/scripts/setup/gen_pigweed_cipd_json.py b/scripts/setup/gen_pigweed_cipd_json.py index d1a47fe2cef7be..4fe77aaf09dce4 100755 --- a/scripts/setup/gen_pigweed_cipd_json.py +++ b/scripts/setup/gen_pigweed_cipd_json.py @@ -15,10 +15,15 @@ # limitations under the License. import argparse +import itertools import json +import logging import platform -_LIST_OF_PACKAGES_TO_EXCLUDE = ['fuchsia/third_party/rust/'] +_LIST_OF_PACKAGES_TO_EXCLUDE = { + 'fuchsia/third_party/rust/', + 'infra/3pp/tools/renode', +} def include_package(package: dict) -> bool: @@ -43,12 +48,20 @@ def generate_new_cipd_package_json(input, output, extra): # Extra is a list of platform:json. # Filter it for the given platform and append any resulting packages my_platform = platform.system().lower() - for item in extra: + + logging.info("Loading extra packages for %s", my_platform) + + # Extra chain because extra is a list of lists like: + # [['darwin:path1'], ['windows:path2']] + for item in itertools.chain.from_iterable(extra): inject_platform, path = item.split(':', 1) if inject_platform.lower() != my_platform: + logging.info("Skipping: %s (i.e. %s)", inject_platform.lower(), path) continue + logging.info("Appending: %s for this platform", path) + with open(path) as ins: for package in json.load(ins).get('packages'): new_file_packages.append(package) @@ -57,6 +70,8 @@ def generate_new_cipd_package_json(input, output, extra): with open(output, 'w') as f: json.dump(new_packages, f, indent=2) + logging.debug("PACKAGES:\n%s\n", json.dumps(new_packages, indent=2)) + def main(): parser = argparse.ArgumentParser( @@ -70,10 +85,11 @@ def main(): '--output', '-o', required=True ) parser.add_argument( - '--extra', '-e', nargs='*', default=[], + '--extra', '-e', nargs='*', action="append", default=[], help="Inject extra packages for specific platforms. Format is :" ) + logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO) generate_new_cipd_package_json(**vars(parser.parse_args())) diff --git a/scripts/setup/python.json b/scripts/setup/python.json deleted file mode 100644 index 0df6cc494ab40a..00000000000000 --- a/scripts/setup/python.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "packages": [ - { - "path": "infra/3pp/tools/cpython3/${platform}", - "platforms": ["mac-amd64", "windows-amd64"], - "tags": ["version:2@3.9.5.chromium.19"] - } - ] -}