Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python ARM build issue #321

Merged
merged 6 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aws_lambda_builders/workflows/python_pip/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ class DependencyBuilder(object):

_COMPATIBLE_PLATFORM_ARM64 = {
"any",
"linux_aarch64",
"manylinux2014_aarch64",
}

Expand Down
25 changes: 24 additions & 1 deletion tests/integration/workflows/python_pip/test_python_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

logger = logging.getLogger("aws_lambda_builders.workflows.python_pip.workflow")
IS_WINDOWS = platform.system().lower() == "windows"
NOT_ARM = platform.processor() != "aarch64"
ARM_RUNTIMES = {"python3.8", "python3.9"}


class TestPythonPipWorkflow(TestCase):
Expand All @@ -29,12 +31,14 @@ def setUp(self):

self.manifest_path_valid = os.path.join(self.TEST_DATA_FOLDER, "requirements-numpy.txt")
self.manifest_path_invalid = os.path.join(self.TEST_DATA_FOLDER, "requirements-invalid.txt")
self.manifest_path_sdist = os.path.join(self.TEST_DATA_FOLDER, "requirements-wrapt.txt")

self.test_data_files = {
"__init__.py",
"main.py",
"requirements-invalid.txt",
"requirements-numpy.txt",
"requirements-wrapt.txt",
"local-dependencies",
}

Expand Down Expand Up @@ -84,8 +88,27 @@ def test_must_build_python_project(self):
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)

@skipIf(NOT_ARM, "Skip if not running on ARM64")
def test_must_build_python_project_from_sdist_with_arm(self):
if self.runtime not in ARM_RUNTIMES:
self.skipTest("{} is not supported on ARM architecture".format(self.runtime))

self.builder.build(
self.source_dir,
self.artifacts_dir,
self.scratch_dir,
self.manifest_path_sdist,
runtime=self.runtime,
architecture="arm64",
)
expected_files = self.test_data_files.union({"wrapt", "wrapt-1.13.3.dist-info"})
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)

self.check_architecture_in("wrapt-1.13.3.dist-info", ["linux_aarch64"])

def test_must_build_python_project_with_arm_architecture(self):
if self.runtime != "python3.8":
if self.runtime not in ARM_RUNTIMES:
self.skipTest("{} is not supported on ARM architecture".format(self.runtime))
### Check the wheels
self.builder.build(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wrapt==1.13.3