diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 2bca1e9d..6af78bd7 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}}" diff --git a/aws_lambda_builders/__init__.py b/aws_lambda_builders/__init__.py index 32702e3b..668968c4 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" diff --git a/aws_lambda_builders/workflows/python_pip/packager.py b/aws_lambda_builders/workflows/python_pip/packager.py index 575ecb7d..7a752d70 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 207b4cdd..06ab8ab9 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 2a674afe..8a2b8574 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 e2d4300b..cdd33981 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