Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/pip/requirements/develop/setup…
Browse files Browse the repository at this point in the history
…tools-71.1.0
  • Loading branch information
mndeveci authored Jul 29, 2024
2 parents acd8c0c + 94407b0 commit 4a42e33
Show file tree
Hide file tree
Showing 9 changed files with 416 additions and 365 deletions.
2 changes: 1 addition & 1 deletion installer/pyinstaller/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ mkdir -p .build/output/openssl
cd .build/output/openssl

echo "Building OpenSSL"
curl "https://www.openssl.org/source/openssl-${openssl_version}.tar.gz" --output openssl.tar.gz
curl -L "https://github.com/openssl/openssl/releases/download/OpenSSL_${openssl_version//./_}/openssl-${openssl_version}.tar.gz" --output openssl.tar.gz
tar xzf openssl.tar.gz
cd openssl-${openssl_version}
# install_sw installs OpenSSL without manual pages
Expand Down
4 changes: 2 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ aws_lambda_builders==1.50.0
tomlkit==0.13.0
watchdog==4.0.1
rich~=13.7.1
pyopenssl~=24.1.0
pyopenssl~=24.2.1
# Pin to <4.18 to until SAM-T no longer uses RefResolver
jsonschema<4.24

Expand All @@ -31,4 +31,4 @@ tzlocal==5.2
cfn-lint~=0.87.7

# Type checking boto3 objects
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.145
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.147
10 changes: 5 additions & 5 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ pytest-cov==5.0.0
# here we fix its version and upgrade it manually in the future
mypy==1.10.1
types-pywin32==306.0.0.20240408
types-PyYAML==6.0.12.20240311
types-PyYAML==6.0.12.20240724
types-chevron==0.14.2.20240310
types-psutil==6.0.0.20240621
types-setuptools==70.3.0.20240710
types-setuptools==71.1.0.20240724
types-Pygments==2.18.0.20240506
types-colorama==0.4.15.20240311
types-dateparser==1.2.0.20240420
types-docutils==0.21.0.20240711
types-docutils==0.21.0.20240724
types-jsonschema==4.23.0.20240712
types-pyOpenSSL==24.1.0.20240425
types-pyOpenSSL==24.1.0.20240722
# lucashuy: pin `types-request` based on the Python version since newer versions of
# the types require a newer version of requests, which is only installed in newer versions of Python
types-requests==2.31.0.6; python_version<"3.10"
Expand All @@ -27,7 +27,7 @@ types-urllib3==1.26.25.14

# Test requirements

pytest==8.2.1
pytest==8.3.1

parameterized==0.9.0
pytest-xdist==3.6.1
Expand Down
2 changes: 1 addition & 1 deletion requirements/pre-dev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruff==0.5.3
ruff==0.5.4
240 changes: 122 additions & 118 deletions requirements/reproducible-linux.txt

Large diffs are not rendered by default.

240 changes: 122 additions & 118 deletions requirements/reproducible-mac.txt

Large diffs are not rendered by default.

240 changes: 122 additions & 118 deletions requirements/reproducible-win.txt

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions samcli/lib/build/app_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
from samcli.lib.utils.colors import Colored, Colors
from samcli.lib.utils.lambda_builders import patch_runtime
from samcli.lib.utils.packagetype import IMAGE, ZIP
from samcli.lib.utils.path_utils import convert_path_to_unix_path
from samcli.lib.utils.path_utils import check_path_valid_type, convert_path_to_unix_path
from samcli.lib.utils.resources import (
AWS_CLOUDFORMATION_STACK,
AWS_LAMBDA_FUNCTION,
Expand Down Expand Up @@ -662,7 +662,9 @@ def _build_function( # pylint: disable=R1710
Path to the location where built artifacts are available
"""
if packagetype == IMAGE:
if imageuri and Path(imageuri).is_file(): # something exists at this path and what exists is a file
if (
imageuri and check_path_valid_type(imageuri) and Path(imageuri).is_file()
): # something exists at this path and what exists is a file
return self._load_lambda_image(imageuri) # should be an image archive – load it instead of building it
# pylint: disable=fixme
# FIXME: _build_lambda_image assumes metadata is not None, we need to throw an exception here
Expand Down
37 changes: 37 additions & 0 deletions tests/unit/lib/build_module/test_app_builder.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from collections import OrderedDict
import os
import posixpath
import sys
Expand Down Expand Up @@ -2295,6 +2296,42 @@ def test_must_custom_build_function_with_empty_metadata_in_process(self, osutils
scratch_dir="scratch",
)

@patch("samcli.lib.build.app_builder.get_workflow_config")
@patch("samcli.lib.build.app_builder.osutils")
def test_must_build_in_process_with_metadata1(self, osutils_mock, get_workflow_config_mock):
function_name = "function_name"
codeuri = "path/to/source"
runtime = "runtime"
packagetype = IMAGE
architecture = ARM64
scratch_dir = "scratch"
handler = "handler.handle"
imageuri = OrderedDict()
config_mock = get_workflow_config_mock.return_value = Mock()
config_mock.manifest_name = "manifest_name"

osutils_mock.mkdir_temp.return_value.__enter__ = Mock(return_value=scratch_dir)
osutils_mock.mkdir_temp.return_value.__exit__ = Mock()

self.builder._build_function_in_process = Mock()
self.builder._build_lambda_image = Mock()

artifacts_dir = str(Path("/build/dir/function_full_path"))

self.builder._build_function(
function_name,
codeuri,
imageuri,
packagetype,
runtime,
architecture,
handler,
artifacts_dir,
metadata={"BuildMethod": "Workflow"},
)

self.builder._build_lambda_image.assert_called_once()

@patch("samcli.lib.build.app_builder.get_workflow_config")
@patch("samcli.lib.build.app_builder.osutils")
def test_must_build_in_process_with_metadata(self, osutils_mock, get_workflow_config_mock):
Expand Down

0 comments on commit 4a42e33

Please sign in to comment.