From ed0183333509c36aa4401cff25d68db73be0613e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 10:23:41 -0800 Subject: [PATCH 1/3] chore(deps): bump github/codeql-action from 2 to 3 (#597) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v2...v3) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 2bca1e9d3..6af78bd76 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -60,7 +60,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -73,6 +73,6 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 with: category: "/language:${{matrix.language}}" From 686712f62e9bf9ff81c265c67054e0708cb44b4c Mon Sep 17 00:00:00 2001 From: Mehmet Nuri Deveci <5735811+mndeveci@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:32:14 -0800 Subject: [PATCH 2/3] fix: remove ld_library_path when running from native executable (#602) * fix: remove ld_library_path when running from native executable * reformat with black --------- Co-authored-by: Wing Fung Lau <4760060+hawflau@users.noreply.github.com> --- .../workflows/python_pip/packager.py | 4 +++- aws_lambda_builders/workflows/python_pip/utils.py | 3 --- .../workflows/python_pip/test_packager.py | 14 ++++++++++++-- tests/unit/workflows/python_pip/test_packager.py | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/aws_lambda_builders/workflows/python_pip/packager.py b/aws_lambda_builders/workflows/python_pip/packager.py index 575ecb7d2..7a752d70c 100644 --- a/aws_lambda_builders/workflows/python_pip/packager.py +++ b/aws_lambda_builders/workflows/python_pip/packager.py @@ -772,12 +772,14 @@ def _execute(self, command, args, env_vars=None, shim=None): main_args = [command] + args LOG.debug("calling pip %s", " ".join(main_args)) rc, out, err = self._wrapped_pip.main(main_args, env_vars=env_vars, shim=shim) + LOG.debug("pip stdout: %s", out) + LOG.debug("pip stderr: %s", err) return rc, out, err def build_wheel(self, wheel, directory, compile_c=True): """Build an sdist into a wheel file.""" arguments = ["--no-deps", "--wheel-dir", directory, wheel] - env_vars = self._osutils.environ() + env_vars = self._osutils.original_environ() shim = "" if not compile_c: env_vars.update(pip_no_compile_c_env_vars) diff --git a/aws_lambda_builders/workflows/python_pip/utils.py b/aws_lambda_builders/workflows/python_pip/utils.py index 207b4cdd4..06ab8ab96 100644 --- a/aws_lambda_builders/workflows/python_pip/utils.py +++ b/aws_lambda_builders/workflows/python_pip/utils.py @@ -16,9 +16,6 @@ class OSUtils(object): - def environ(self): - return os.environ - def original_environ(self): # https://pyinstaller.readthedocs.io/en/stable/runtime-information.html#ld-library-path-libpath-considerations env = dict(os.environ) diff --git a/tests/functional/workflows/python_pip/test_packager.py b/tests/functional/workflows/python_pip/test_packager.py index 2a674afe8..8a2b85749 100644 --- a/tests/functional/workflows/python_pip/test_packager.py +++ b/tests/functional/workflows/python_pip/test_packager.py @@ -4,7 +4,7 @@ import tarfile import io from collections import defaultdict, namedtuple -from unittest import mock +from unittest import TestCase, mock import pytest @@ -182,7 +182,7 @@ def osutils(): @pytest.fixture def empty_env_osutils(): class EmptyEnv(object): - def environ(self): + def original_environ(self): return {} return EmptyEnv() @@ -830,6 +830,16 @@ def test_build_into_existing_dir_with_preinstalled_packages(self, tmpdir, osutil assert installed_packages == ["bar"] +class TestPipRunner(TestCase): + def test_build_wheel_calls_pip_without_ld_library_path(self): + pip_mock = mock.Mock() + pip_mock.main.return_value = (0, "out", "err") + os_utils_mock = mock.Mock() + pip_runner = PipRunner(mock.Mock(), pip_mock, os_utils_mock) + pip_runner.build_wheel("wheel", "dir") + os_utils_mock.original_environ.assert_called_once() + + class TestSubprocessPip(object): def test_can_invoke_pip(self): pip = SubprocessPip(python_exe=sys.executable) diff --git a/tests/unit/workflows/python_pip/test_packager.py b/tests/unit/workflows/python_pip/test_packager.py index e2d4300bc..cdd339811 100644 --- a/tests/unit/workflows/python_pip/test_packager.py +++ b/tests/unit/workflows/python_pip/test_packager.py @@ -61,7 +61,7 @@ class CustomEnv(OSUtils): def __init__(self, env): self._env = env - def environ(self): + def original_environ(self): return self._env From 1583ef3b60b9ee6088761e574bf8b87be91a09b5 Mon Sep 17 00:00:00 2001 From: Mehmet Nuri Deveci <5735811+mndeveci@users.noreply.github.com> Date: Tue, 2 Jan 2024 12:21:32 -0800 Subject: [PATCH 3/3] chore: bump version to 1.45.0 (#604) --- aws_lambda_builders/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws_lambda_builders/__init__.py b/aws_lambda_builders/__init__.py index 32702e3b4..668968c42 100644 --- a/aws_lambda_builders/__init__.py +++ b/aws_lambda_builders/__init__.py @@ -5,5 +5,5 @@ # Changing version will trigger a new release! # Please make the version change as the last step of your development. -__version__ = "1.44.0" +__version__ = "1.45.0" RPC_PROTOCOL_VERSION = "0.3"