diff --git a/bin/aws-lambda/build_and_publish_lambda_layer.py b/bin/aws-lambda/build_and_publish_lambda_layer.py index 6a701765..40a2fba5 100755 --- a/bin/aws-lambda/build_and_publish_lambda_layer.py +++ b/bin/aws-lambda/build_and_publish_lambda_layer.py @@ -8,7 +8,6 @@ import json import shutil import time -import distutils.spawn from subprocess import call, check_call, check_output, CalledProcessError, DEVNULL for profile in ("china", "non-china"): @@ -33,7 +32,7 @@ # Check requirements first for cmd in ["pip", "zip"]: - if distutils.spawn.find_executable(cmd) is None: + if not shutil.which(cmd): print(f"Can't find required tool: {cmd}") exit(1) @@ -129,13 +128,34 @@ print(f"===> Uploading layer to AWS {region} ") profile = "china" if region in cn_regions else "non-china" - response = check_output(["aws", "--region", region, "lambda", "publish-layer-version", - "--description", - "Provides Instana tracing and monitoring of AWS Lambda functions built with Python", - "--license-info", "MIT", "--output", "json", - "--layer-name", LAYER_NAME, "--zip-file", aws_zip_filename, - "--compatible-runtimes", "python3.8", "python3.9", "python3.10", "python3.11", "python3.12", - "--profile", profile]) + response = check_output( + [ + "aws", + "lambda", + "publish-layer-version", + "--layer-name", + LAYER_NAME, + "--description", + "Provides Instana tracing and monitoring of AWS Lambda functions built with Python", + "--license-info", + "MIT", + "--output", + "json", + "--zip-file", + aws_zip_filename, + "--compatible-runtimes", + "python3.8", + "python3.9", + "python3.10", + "python3.11", + "python3.12", + "python3.13", + "--region", + region, + "--profile", + profile, + ] + ) json_data = json.loads(response) version = json_data["Version"]