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 Dec 15, 2023
2 parents c17b01a + c5ccdb6 commit 2cef6c8
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 74 deletions.
42 changes: 28 additions & 14 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,41 @@
area/workflow/dotnet_clipackage:
- aws_lambda_builders/workflows/dotnet_clipackage/*
- aws_lambda_builders/workflows/dotnet_clipackage/**/*
- changed-files:
- any-glob-to-any-file:
- aws_lambda_builders/workflows/dotnet_clipackage/*
- aws_lambda_builders/workflows/dotnet_clipackage/**/*

area/workflow/go_modules:
- aws_lambda_builders/workflows/go_modules/*
- aws_lambda_builders/workflows/go_modules/**/*
- changed-files:
- any-glob-to-any-file:
- aws_lambda_builders/workflows/go_modules/*
- aws_lambda_builders/workflows/go_modules/**/*

area/workflow/java_gradle:
- aws_lambda_builders/workflows/java_gradle/*
- aws_lambda_builders/workflows/java_gradle/**/*
- changed-files:
- any-glob-to-any-file:
- aws_lambda_builders/workflows/java_gradle/*
- aws_lambda_builders/workflows/java_gradle/**/*

area/workflow/java_maven:
- aws_lambda_builders/workflows/java_maven/*
- aws_lambda_builders/workflows/java_maven/**/*
- changed-files:
- any-glob-to-any-file:
- aws_lambda_builders/workflows/java_maven/*
- aws_lambda_builders/workflows/java_maven/**/*

area/workflow/node_npm:
- aws_lambda_builders/workflows/nodejs_npm/*
- aws_lambda_builders/workflows/nodejs_npm/**/*
- changed-files:
- any-glob-to-any-file:
- aws_lambda_builders/workflows/nodejs_npm/*
- aws_lambda_builders/workflows/nodejs_npm/**/*

area/workflow/python_pip:
- aws_lambda_builders/workflows/python_pip/*
- aws_lambda_builders/workflows/python_pip/**/*
- changed-files:
- any-glob-to-any-file:
- aws_lambda_builders/workflows/python_pip/*
- aws_lambda_builders/workflows/python_pip/**/*

area/workflow/ruby_bundler:
- aws_lambda_builders/workflows/ruby_bundler/*
- aws_lambda_builders/workflows/ruby_bundler/**/*
- changed-files:
- any-glob-to-any-file:
- aws_lambda_builders/workflows/ruby_bundler/*
- aws_lambda_builders/workflows/ruby_bundler/**/*
28 changes: 14 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- "3.10"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Unit Testing
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
- 9
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
- 9
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -162,10 +162,10 @@ jobs:
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.16'
- run: make init
Expand All @@ -190,10 +190,10 @@ jobs:
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
Expand Down Expand Up @@ -221,10 +221,10 @@ jobs:
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
Expand All @@ -250,7 +250,7 @@ jobs:
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: make init
Expand All @@ -275,7 +275,7 @@ jobs:
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: |
Expand Down Expand Up @@ -304,7 +304,7 @@ jobs:
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: ruby/setup-ruby@v1
Expand Down Expand Up @@ -335,7 +335,7 @@ jobs:
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: make init
Expand Down Expand Up @@ -364,7 +364,7 @@ jobs:
- stable
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/close-issue-on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Close issues on release cut

on:
release:
types: [released]

jobs:
run-workflow:
permissions:
issues: write
runs-on: ubuntu-latest
steps:
- name: Close issues marked
env:
REPO : ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
release_url=$(gh release view ${{ github.ref_name }} --repo $REPO --json url --jq ".url")
for issue_number in $(gh issue list -l "stage/waiting-for-release" --repo $REPO --json number --jq ".[].number"); do
gh issue close $issue_number -c "Patch is released in [${{ github.ref_name }}]($release_url). If you are AWS SAM CLI user, please wait for next AWS SAM CLI release. Closing" -r completed --repo $REPO
done
2 changes: 1 addition & 1 deletion .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
apply-internal-external-label:
Expand Down
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.43.0"
__version__ = "1.44.0"
RPC_PROTOCOL_VERSION = "0.3"
11 changes: 9 additions & 2 deletions aws_lambda_builders/workflows/python_pip/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,18 @@ def execute(self) -> None:
pip_runner = PipRunner(python_exe=python_with_pip, pip=pip)

dependency_builder = DependencyBuilder(
osutils=self._os_utils, pip_runner=pip_runner, runtime=self.runtime, architecture=self.architecture
osutils=self._os_utils,
python_exe=python_with_pip,
pip_runner=pip_runner,
runtime=self.runtime,
architecture=self.architecture,
)

package_builder = PythonPipDependencyBuilder(
osutils=self._os_utils, runtime=self.runtime, dependency_builder=dependency_builder
osutils=self._os_utils,
runtime=self.runtime,
python_exe=python_with_pip,
dependency_builder=dependency_builder,
)
try:
target_artifact_dir = self.artifacts_dir
Expand Down
27 changes: 16 additions & 11 deletions aws_lambda_builders/workflows/python_pip/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import logging
import re
import subprocess
import sys
from email.parser import FeedParser
from typing import Tuple

Expand Down Expand Up @@ -97,7 +96,7 @@ def get_lambda_abi(runtime):


class PythonPipDependencyBuilder(object):
def __init__(self, runtime, osutils=None, dependency_builder=None, architecture=X86_64):
def __init__(self, runtime, python_exe, osutils=None, dependency_builder=None, architecture=X86_64):
"""Initialize a PythonPipDependencyBuilder.
:type runtime: str
Expand All @@ -122,7 +121,7 @@ def __init__(self, runtime, osutils=None, dependency_builder=None, architecture=
self.osutils = OSUtils()

if dependency_builder is None:
dependency_builder = DependencyBuilder(self.osutils, runtime, architecture=architecture)
dependency_builder = DependencyBuilder(self.osutils, python_exe, runtime, architecture=architecture)
self._dependency_builder = dependency_builder

def build_dependencies(self, artifacts_dir_path, scratch_dir_path, requirements_path, ui=None, config=None):
Expand Down Expand Up @@ -211,7 +210,7 @@ class DependencyBuilder(object):
# Unlikely to hit this case.
_DEFAULT_GLIBC = (2, 17)

def __init__(self, osutils, runtime, pip_runner=None, architecture=X86_64):
def __init__(self, osutils, runtime, python_exe, pip_runner=None, architecture=X86_64):
"""Initialize a DependencyBuilder.
:type osutils: :class:`lambda_builders.utils.OSUtils`
Expand All @@ -229,8 +228,9 @@ def __init__(self, osutils, runtime, pip_runner=None, architecture=X86_64):
:param architecture: Architecture to build for.
"""
self._osutils = osutils
self.python_exe = python_exe
if pip_runner is None:
pip_runner = PipRunner(python_exe=None, pip=SubprocessPip(osutils))
pip_runner = PipRunner(python_exe=python_exe, pip=SubprocessPip(osutils))
self._pip = pip_runner
self.runtime = runtime
self.architecture = architecture
Expand Down Expand Up @@ -364,7 +364,10 @@ def _download_all_dependencies(self, requirements_filename, directory):
# which will serve as the primary list of dependencies needed to deploy
# successfully.
self._pip.download_all_dependencies(requirements_filename, directory)
deps = {Package(directory, filename) for filename in self._osutils.get_directory_contents(directory)}
deps = {
Package(directory, filename, self.python_exe)
for filename in self._osutils.get_directory_contents(directory)
}
LOG.debug("Full dependency closure: %s", deps)
return deps

Expand All @@ -383,7 +386,7 @@ def _build_sdists(self, sdists, directory, compile_c=True):

def _categorize_wheel_files(self, directory):
final_wheels = [
Package(directory, filename)
Package(directory, filename, self.python_exe)
for filename in self._osutils.get_directory_contents(directory)
if filename.endswith(".whl")
]
Expand Down Expand Up @@ -506,13 +509,14 @@ def _install_wheels(self, src_dir, dst_dir, wheels):
class Package(object):
"""A class to represent a package downloaded but not yet installed."""

def __init__(self, directory, filename, osutils=None):
def __init__(self, directory, filename, python_exe, osutils=None):
self.dist_type = "wheel" if filename.endswith(".whl") else "sdist"
self._directory = directory
self.filename = filename
if osutils is None:
osutils = OSUtils()
self._osutils = osutils
self.python_exe = python_exe
self._name, self._version = self._calculate_name_and_version()

@property
Expand Down Expand Up @@ -553,7 +557,7 @@ def _calculate_name_and_version(self):
# {platform tag}.whl
name, version = self.filename.split("-")[:2]
else:
info_fetcher = SDistMetadataFetcher(osutils=self._osutils)
info_fetcher = SDistMetadataFetcher(self.python_exe, osutils=self._osutils)
sdist_path = self._osutils.joinpath(self._directory, self.filename)
name, version = info_fetcher.get_package_name_and_version(sdist_path)
normalized_name = self._normalize_name(name)
Expand All @@ -572,10 +576,11 @@ class SDistMetadataFetcher(object):
"exec(compile(code, __file__, 'exec'))"
)

def __init__(self, osutils=None):
def __init__(self, python_exe, osutils=None):
if osutils is None:
osutils = OSUtils()
self._osutils = osutils
self.python_exe = python_exe

def _parse_pkg_info_file(self, filepath):
# The PKG-INFO generated by the egg-info command is in an email feed
Expand All @@ -590,7 +595,7 @@ def _get_pkg_info_filepath(self, package_dir):
setup_py = self._osutils.joinpath(package_dir, "setup.py")
script = self._SETUPTOOLS_SHIM % setup_py

cmd = [sys.executable, "-c", script, "--no-user-cfg", "egg_info", "--egg-base", "egg-info"]
cmd = [self.python_exe, "-c", script, "--no-user-cfg", "egg_info", "--egg-base", "egg-info"]
egg_info_dir = self._osutils.joinpath(package_dir, "egg-info")
self._osutils.makedirs(egg_info_dir)
p = subprocess.Popen(
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ pyelftools~=0.30 # Used to verify the generated Go binary architecture in integr
# formatter
black==22.6.0; python_version < "3.8"
black==23.11.0; python_version >= "3.8"
ruff==0.1.5
ruff==0.1.7
Loading

0 comments on commit 2cef6c8

Please sign in to comment.