Skip to content

Commit 48eee8b

Browse files
ThomasCJYcopybara-github
authored andcommitted
[Bazel] Fix mobile-install for python2
**Background** Fix issue introduced by 1049fe8 It turns out the queue module name is inconsistent across different python versions. We found that: * On some macos system: - python2 contains both queue and Queue module. All python2 contains Queue module - python3 only contains queue module * On some Linux system - python2 contains only Queue module. - python3 only contains queue module Therefore, some developers are seeing `ImportError: No module named queue` errors locally on linux machine after using mobile-install. **Change** Import correct Queue module instead **Test** Local test pass Closes #12540. PiperOrigin-RevId: 369773133
1 parent 4c59a40 commit 48eee8b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/android/build_incremental_dexmanifest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@
3232

3333
import hashlib
3434
import os
35-
from queue import Queue
35+
# pylint: disable=g-import-not-at-top
36+
try:
37+
# python2 without compatibility package
38+
from Queue import Queue
39+
except ImportError:
40+
# python3
41+
from queue import Queue
3642
import shutil
3743
import sys
3844
import tempfile

0 commit comments

Comments
 (0)