Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-sam-cli-bot committed Jan 2, 2024
2 parents 2cef6c8 + 1583ef3 commit 4861691
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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}}"
2 changes: 1 addition & 1 deletion aws_lambda_builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 3 additions & 1 deletion aws_lambda_builders/workflows/python_pip/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions aws_lambda_builders/workflows/python_pip/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 12 additions & 2 deletions tests/functional/workflows/python_pip/test_packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import tarfile
import io
from collections import defaultdict, namedtuple
from unittest import mock
from unittest import TestCase, mock

import pytest

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/workflows/python_pip/test_packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CustomEnv(OSUtils):
def __init__(self, env):
self._env = env

def environ(self):
def original_environ(self):
return self._env


Expand Down

0 comments on commit 4861691

Please sign in to comment.