Skip to content

Commit

Permalink
[Bazel] Fix mobile-install for python2
Browse files Browse the repository at this point in the history
**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
  • Loading branch information
ThomasCJY authored and copybara-github committed Apr 22, 2021
1 parent 4c59a40 commit 48eee8b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/android/build_incremental_dexmanifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@

import hashlib
import os
from queue import Queue
# pylint: disable=g-import-not-at-top
try:
# python2 without compatibility package
from Queue import Queue
except ImportError:
# python3
from queue import Queue
import shutil
import sys
import tempfile
Expand Down

0 comments on commit 48eee8b

Please sign in to comment.