| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,6 +61,12 @@ done | |||
| 61 | 61 | export CFLAGS="" | |
| 62 | 62 | export LDFLAGS="-Wl,--build-id=sha1 -Wl,--no-rosegment" | |
| 63 | 63 | ||
| 64 | + # Unlike Linux, Android does not implicitly use a dlopened library to resolve | ||
| 65 | + # relocations in subsequently-loaded libraries, even if RTLD_GLOBAL is used | ||
| 66 | + # (https://github.com/android/ndk/issues/1244). So any library that fails to | ||
| 67 | + # build with this flag, would also fail to load at runtime. | ||
| 68 | + LDFLAGS="$LDFLAGS -Wl,--no-undefined" | ||
| 69 | + | ||
| 64 | 70 | # Many packages get away with omitting -lm on Linux, but Android is stricter. | |
| 65 | 71 | LDFLAGS="$LDFLAGS -lm" | |
| 66 | 72 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -601,10 +601,22 @@ def get_platform(): | |||
| 601 | 601 | machine = machine.replace('/', '-') | |
| 602 | 602 | ||
| 603 | 603 | if osname[:5] == "linux": | |
| 604 | - # At least on Linux/Intel, 'machine' is the processor -- | ||
| 605 | - # i386, etc. | ||
| 606 | - # XXX what about Alpha, SPARC, etc? | ||
| 607 | - return f"{osname}-{machine}" | ||
| 604 | + if sys.platform == "android": | ||
| 605 | + osname = "android" | ||
| 606 | + release = get_config_var("ANDROID_API_LEVEL") | ||
| 607 | + | ||
| 608 | + # Wheel tags use the ABI names from Android's own tools. | ||
| 609 | + machine = { | ||
| 610 | + "x86_64": "x86_64", | ||
| 611 | + "i686": "x86", | ||
| 612 | + "aarch64": "arm64_v8a", | ||
| 613 | + "armv7l": "armeabi_v7a", | ||
| 614 | + }[machine] | ||
| 615 | + else: | ||
| 616 | + # At least on Linux/Intel, 'machine' is the processor -- | ||
| 617 | + # i386, etc. | ||
| 618 | + # XXX what about Alpha, SPARC, etc? | ||
| 619 | + return f"{osname}-{machine}" | ||
| 608 | 620 | elif osname[:5] == "sunos": | |
| 609 | 621 | if release[0] >= "5": # SunOS 5 == Solaris 2 | |
| 610 | 622 | osname = "solaris" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -232,6 +232,11 @@ def test_get_config_vars(self): | |||
| 232 | 232 | self.assertTrue(cvars) | |
| 233 | 233 | ||
| 234 | 234 | def test_get_platform(self): | |
| 235 | + # Check the actual platform returns something reasonable. | ||
| 236 | + actual_platform = get_platform() | ||
| 237 | + self.assertIsInstance(actual_platform, str) | ||
| 238 | + self.assertTrue(actual_platform) | ||
| 239 | + | ||
| 235 | 240 | # windows XP, 32bits | |
| 236 | 241 | os.name = 'nt' | |
| 237 | 242 | sys.version = ('2.4.4 (#71, Oct 18 2006, 08:34:43) ' | |
@@ -347,6 +352,21 @@ def test_get_platform(self): | |||
| 347 | 352 | ||
| 348 | 353 | self.assertEqual(get_platform(), 'linux-i686') | |
| 349 | 354 | ||
| 355 | + # Android | ||
| 356 | + os.name = 'posix' | ||
| 357 | + sys.platform = 'android' | ||
| 358 | + get_config_vars()['ANDROID_API_LEVEL'] = 9 | ||
| 359 | + for machine, abi in { | ||
| 360 | + 'x86_64': 'x86_64', | ||
| 361 | + 'i686': 'x86', | ||
| 362 | + 'aarch64': 'arm64_v8a', | ||
| 363 | + 'armv7l': 'armeabi_v7a', | ||
| 364 | + }.items(): | ||
| 365 | + with self.subTest(machine): | ||
| 366 | + self._set_uname(('Linux', 'localhost', '3.18.91+', | ||
| 367 | + '#1 Tue Jan 9 20:35:43 UTC 2018', machine)) | ||
| 368 | + self.assertEqual(get_platform(), f'android-9-{abi}') | ||
| 369 | + | ||
| 350 | 370 | # XXX more platforms to tests here | |
| 351 | 371 | ||
| 352 | 372 | @unittest.skipIf(is_wasi, "Incompatible with WASI mapdir and OOT builds") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + On Android, :any:`sysconfig.get_platform` now returns the format specified | ||
| 2 | + by :pep:`738`. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1148,6 +1148,9 @@ AS_CASE([$host/$ac_cv_cc_name], | |||
| 1148 | 1148 | [x86_64-*-freebsd*/clang], [PY_SUPPORT_TIER=3], dnl FreeBSD on AMD64 | |
| 1149 | 1149 | [aarch64-apple-ios*-simulator/clang], [PY_SUPPORT_TIER=3], dnl iOS Simulator on arm64 | |
| 1150 | 1150 | [aarch64-apple-ios*/clang], [PY_SUPPORT_TIER=3], dnl iOS on ARM64 | |
| 1151 | + [aarch64-*-linux-android/clang], [PY_SUPPORT_TIER=3], dnl Android on ARM64 | ||
| 1152 | + [x86_64-*-linux-android/clang], [PY_SUPPORT_TIER=3], dnl Android on AMD64 | ||
| 1153 | + | ||
| 1151 | 1154 | [PY_SUPPORT_TIER=0] | |
| 1152 | 1155 | ) | |
| 1153 | 1156 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments