From e7e8e360d73633a380ece26b6e6c0b7863d15ba4 Mon Sep 17 00:00:00 2001 From: Paulo Vital Date: Mon, 18 Nov 2024 15:06:36 -0300 Subject: [PATCH 1/2] chore: Remove deprecated distutils from AWS build. Signed-off-by: Paulo Vital --- bin/aws-lambda/build_and_publish_lambda_layer.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/aws-lambda/build_and_publish_lambda_layer.py b/bin/aws-lambda/build_and_publish_lambda_layer.py index 6a701765..e8d55abb 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) From 73e04523a12013939d9cf7da74f514be543110b1 Mon Sep 17 00:00:00 2001 From: Paulo Vital Date: Mon, 18 Nov 2024 20:28:57 -0300 Subject: [PATCH 2/2] chore: Add new supported Python runtime to AWS Lambda. Signed-off-by: Paulo Vital --- .../build_and_publish_lambda_layer.py | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/bin/aws-lambda/build_and_publish_lambda_layer.py b/bin/aws-lambda/build_and_publish_lambda_layer.py index e8d55abb..40a2fba5 100755 --- a/bin/aws-lambda/build_and_publish_lambda_layer.py +++ b/bin/aws-lambda/build_and_publish_lambda_layer.py @@ -128,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"]