From 2b32c3ce88914e1e08b702934c429176f6ebb12f Mon Sep 17 00:00:00 2001 From: Emilio Garcia Date: Mon, 22 Jan 2024 12:20:12 -0500 Subject: [PATCH 1/2] local testing for python 3.8 --- libBuild.sh | 10 ++++++++++ python/publish-layers.sh | 25 +++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/libBuild.sh b/libBuild.sh index 2b532904..9f5e34b8 100644 --- a/libBuild.sh +++ b/libBuild.sh @@ -69,6 +69,16 @@ function list_all_regions { --output text | sort } +function build_and_fetch_local { + arch=$1 + extDir=$2 + cd ${extDir} + make dist-${arch} + + cd - + cp -r ${extDir}/extensions . +} + function fetch_extension { arch=$1 diff --git a/python/publish-layers.sh b/python/publish-layers.sh index 1c21974a..3ef23aa1 100755 --- a/python/publish-layers.sh +++ b/python/publish-layers.sh @@ -50,26 +50,36 @@ function publish-python37-x86 { } function build-python38-arm64 { + extDir=$1 echo "Building New Relic layer for python3.8 (arm64)" rm -rf $BUILD_DIR $PY38_DIST_ARM64 mkdir -p $DIST_DIR - pip install --no-cache-dir -qU newrelic newrelic-lambda -t $BUILD_DIR/lib/python3.8/site-packages + pip3 install --no-cache-dir -qU newrelic newrelic-lambda -t $BUILD_DIR/lib/python3.8/site-packages cp newrelic_lambda_wrapper.py $BUILD_DIR/lib/python3.8/site-packages/newrelic_lambda_wrapper.py find $BUILD_DIR -name '__pycache__' -exec rm -rf {} + - download_extension arm64 + if [ "$LOCAL" -eq 1 ]; then + build_and_fetch_local arm64 ${extDir} + else + download_extension arm64 + fi zip -rq $PY38_DIST_ARM64 $BUILD_DIR $EXTENSION_DIST_DIR $EXTENSION_DIST_PREVIEW_FILE rm -rf $BUILD_DIR $EXTENSION_DIST_DIR $EXTENSION_DIST_PREVIEW_FILE echo "Build complete: ${PY38_DIST_ARM64}" } function build-python38-x86 { + extDir=$1 echo "Building New Relic layer for python3.8 (x86_64)" rm -rf $BUILD_DIR $PY38_DIST_X86_64 mkdir -p $DIST_DIR - pip install --no-cache-dir -qU newrelic newrelic-lambda -t $BUILD_DIR/lib/python3.8/site-packages + pip3 install --no-cache-dir -qU newrelic newrelic-lambda -t $BUILD_DIR/lib/python3.8/site-packages cp newrelic_lambda_wrapper.py $BUILD_DIR/lib/python3.8/site-packages/newrelic_lambda_wrapper.py find $BUILD_DIR -name '__pycache__' -exec rm -rf {} + - download_extension x86_64 + if [ "$LOCAL" -eq 1 ]; then + build_and_fetch_local x86_64 ${extDir} + else + download_extension x86_64 + fi zip -rq $PY38_DIST_X86_64 $BUILD_DIR $EXTENSION_DIST_DIR $EXTENSION_DIST_PREVIEW_FILE rm -rf $BUILD_DIR $EXTENSION_DIST_DIR $EXTENSION_DIST_PREVIEW_FILE echo "Build complete: ${PY38_DIST_X86_64}" @@ -299,6 +309,13 @@ case "$1" in build-python38-x86 publish-python38-x86 ;; + "build-python3.8") + export LOCAL=1 + set -x + build-python38-arm64 "$2" + build-python38-x86 "$2" + set +x + ;; "python3.9") build-python39-arm64 publish-python39-arm64 From 7f17dcea9103a54bc8e098d9e6a6cb931a1e0e00 Mon Sep 17 00:00:00 2001 From: Emilio Garcia Date: Mon, 22 Jan 2024 12:36:53 -0500 Subject: [PATCH 2/2] Update publish-layers.sh remove pip3 --- python/publish-layers.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/publish-layers.sh b/python/publish-layers.sh index 3ef23aa1..e62d05e1 100755 --- a/python/publish-layers.sh +++ b/python/publish-layers.sh @@ -54,7 +54,7 @@ function build-python38-arm64 { echo "Building New Relic layer for python3.8 (arm64)" rm -rf $BUILD_DIR $PY38_DIST_ARM64 mkdir -p $DIST_DIR - pip3 install --no-cache-dir -qU newrelic newrelic-lambda -t $BUILD_DIR/lib/python3.8/site-packages + pip install --no-cache-dir -qU newrelic newrelic-lambda -t $BUILD_DIR/lib/python3.8/site-packages cp newrelic_lambda_wrapper.py $BUILD_DIR/lib/python3.8/site-packages/newrelic_lambda_wrapper.py find $BUILD_DIR -name '__pycache__' -exec rm -rf {} + if [ "$LOCAL" -eq 1 ]; then @@ -72,7 +72,7 @@ function build-python38-x86 { echo "Building New Relic layer for python3.8 (x86_64)" rm -rf $BUILD_DIR $PY38_DIST_X86_64 mkdir -p $DIST_DIR - pip3 install --no-cache-dir -qU newrelic newrelic-lambda -t $BUILD_DIR/lib/python3.8/site-packages + pip install --no-cache-dir -qU newrelic newrelic-lambda -t $BUILD_DIR/lib/python3.8/site-packages cp newrelic_lambda_wrapper.py $BUILD_DIR/lib/python3.8/site-packages/newrelic_lambda_wrapper.py find $BUILD_DIR -name '__pycache__' -exec rm -rf {} + if [ "$LOCAL" -eq 1 ]; then