From 12511f4085e149173b84eb917ec72e415db7c6c7 Mon Sep 17 00:00:00 2001 From: Steve Cook Date: Mon, 31 Jan 2022 03:43:01 +0000 Subject: [PATCH 1/3] Added linux_aarch64 to the compatible platforms. --- .../workflows/python_pip/packager.py | 1 + .../workflows/python_pip/test_python_pip.py | 24 ++++++++++++++++++- .../testdata/requirements-wrapt.txt | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/integration/workflows/python_pip/testdata/requirements-wrapt.txt diff --git a/aws_lambda_builders/workflows/python_pip/packager.py b/aws_lambda_builders/workflows/python_pip/packager.py index 1f7864d47..9c7b8ee90 100644 --- a/aws_lambda_builders/workflows/python_pip/packager.py +++ b/aws_lambda_builders/workflows/python_pip/packager.py @@ -172,6 +172,7 @@ class DependencyBuilder(object): _COMPATIBLE_PLATFORM_ARM64 = { "any", + "linux_aarch64", "manylinux2014_aarch64", } diff --git a/tests/integration/workflows/python_pip/test_python_pip.py b/tests/integration/workflows/python_pip/test_python_pip.py index 43ac86ffc..6f0d8361c 100644 --- a/tests/integration/workflows/python_pip/test_python_pip.py +++ b/tests/integration/workflows/python_pip/test_python_pip.py @@ -12,6 +12,7 @@ logger = logging.getLogger("aws_lambda_builders.workflows.python_pip.workflow") IS_WINDOWS = platform.system().lower() == "windows" +NOT_ARM = platform.processor() != "aarch64" class TestPythonPipWorkflow(TestCase): @@ -29,12 +30,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", } @@ -91,8 +94,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 {"python3.8", "python3.9"}: + 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 {"python3.8", "python3.9"}: self.skipTest("{} is not supported on ARM architecture".format(self.runtime)) ### Check the wheels self.builder.build( diff --git a/tests/integration/workflows/python_pip/testdata/requirements-wrapt.txt b/tests/integration/workflows/python_pip/testdata/requirements-wrapt.txt new file mode 100644 index 000000000..3000b0f5f --- /dev/null +++ b/tests/integration/workflows/python_pip/testdata/requirements-wrapt.txt @@ -0,0 +1 @@ +wrapt==1.13.3 \ No newline at end of file From 53bf680c00f90c2743bd626097faec57094debe6 Mon Sep 17 00:00:00 2001 From: Steve Cook Date: Tue, 1 Feb 2022 05:41:27 +0000 Subject: [PATCH 2/3] Refactored test. --- tests/integration/workflows/python_pip/test_python_pip.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/workflows/python_pip/test_python_pip.py b/tests/integration/workflows/python_pip/test_python_pip.py index 6f0d8361c..b954919c3 100644 --- a/tests/integration/workflows/python_pip/test_python_pip.py +++ b/tests/integration/workflows/python_pip/test_python_pip.py @@ -13,6 +13,7 @@ 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): @@ -96,7 +97,7 @@ def test_must_build_python_project(self): @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 {"python3.8", "python3.9"}: + if self.runtime not in ARM_RUNTIMES: self.skipTest("{} is not supported on ARM architecture".format(self.runtime)) self.builder.build( From dbc85b4f716a8e7773b0952062e8d0b9f2814c80 Mon Sep 17 00:00:00 2001 From: Steve Cook Date: Tue, 1 Feb 2022 05:44:59 +0000 Subject: [PATCH 3/3] Refactored test. --- tests/integration/workflows/python_pip/test_python_pip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/workflows/python_pip/test_python_pip.py b/tests/integration/workflows/python_pip/test_python_pip.py index b954919c3..e5bdaf584 100644 --- a/tests/integration/workflows/python_pip/test_python_pip.py +++ b/tests/integration/workflows/python_pip/test_python_pip.py @@ -115,7 +115,7 @@ def test_must_build_python_project_from_sdist_with_arm(self): 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 not in {"python3.8", "python3.9"}: + if self.runtime not in ARM_RUNTIMES: self.skipTest("{} is not supported on ARM architecture".format(self.runtime)) ### Check the wheels self.builder.build(