Skip to content

Commit 908ad5f

Browse files
eldritchideenmndevecijfusstorresxb1
authored
Fix python ARM build issue (#321)
* Added linux_aarch64 to the compatible platforms. * Refactored test. * Refactored test. Co-authored-by: Mehmet Nuri Deveci <[email protected]> Co-authored-by: Jacob Fuss <[email protected]> Co-authored-by: Ruperto Torres <[email protected]>
1 parent 0e921ff commit 908ad5f

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

aws_lambda_builders/workflows/python_pip/packager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ class DependencyBuilder(object):
171171

172172
_COMPATIBLE_PLATFORM_ARM64 = {
173173
"any",
174+
"linux_aarch64",
174175
"manylinux2014_aarch64",
175176
}
176177

tests/integration/workflows/python_pip/test_python_pip.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

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

1618

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

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

3336
self.test_data_files = {
3437
"__init__.py",
3538
"main.py",
3639
"requirements-invalid.txt",
3740
"requirements-numpy.txt",
41+
"requirements-wrapt.txt",
3842
"local-dependencies",
3943
}
4044

@@ -84,8 +88,27 @@ def test_must_build_python_project(self):
8488
output_files = set(os.listdir(self.artifacts_dir))
8589
self.assertEqual(expected_files, output_files)
8690

91+
@skipIf(NOT_ARM, "Skip if not running on ARM64")
92+
def test_must_build_python_project_from_sdist_with_arm(self):
93+
if self.runtime not in ARM_RUNTIMES:
94+
self.skipTest("{} is not supported on ARM architecture".format(self.runtime))
95+
96+
self.builder.build(
97+
self.source_dir,
98+
self.artifacts_dir,
99+
self.scratch_dir,
100+
self.manifest_path_sdist,
101+
runtime=self.runtime,
102+
architecture="arm64",
103+
)
104+
expected_files = self.test_data_files.union({"wrapt", "wrapt-1.13.3.dist-info"})
105+
output_files = set(os.listdir(self.artifacts_dir))
106+
self.assertEqual(expected_files, output_files)
107+
108+
self.check_architecture_in("wrapt-1.13.3.dist-info", ["linux_aarch64"])
109+
87110
def test_must_build_python_project_with_arm_architecture(self):
88-
if self.runtime != "python3.8":
111+
if self.runtime not in ARM_RUNTIMES:
89112
self.skipTest("{} is not supported on ARM architecture".format(self.runtime))
90113
### Check the wheels
91114
self.builder.build(
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
wrapt==1.13.3

0 commit comments

Comments
 (0)