diff options
author | Remy Böhmer <linux@bohmer.net> | 2020-01-07 08:48:55 +0100 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2020-02-06 14:29:15 +0000 |
commit | dbd277ce500491cea14bdca48ccb0f9148e55b56 (patch) | |
tree | 69ff5c39a489259c2f3c732193bd7a9ab18368b4 | |
parent | 5a03308c5c5f8dbfab05bfe726337dafc10b0c85 (diff) | |
download | git-repo-dbd277ce500491cea14bdca48ccb0f9148e55b56.tar.gz |
[Win32] Make platform_utils compatible for Python3
On Python 3 several imports are to be imported from
different locations.
Signed-off-by: Remy Böhmer <linux@bohmer.net>
Change-Id: I4f243d145f65e38f74743a742583cfc5c5d76deb
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/249610
Reviewed-by: Mike Frysinger <vapier@google.com>
-rw-r--r-- | platform_utils_win32.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/platform_utils_win32.py b/platform_utils_win32.py index e20755a4..8eb3d2c3 100644 --- a/platform_utils_win32.py +++ b/platform_utils_win32.py | |||
@@ -19,13 +19,18 @@ import errno | |||
19 | from pyversion import is_python3 | 19 | from pyversion import is_python3 |
20 | from ctypes import WinDLL, get_last_error, FormatError, WinError, addressof | 20 | from ctypes import WinDLL, get_last_error, FormatError, WinError, addressof |
21 | from ctypes import c_buffer | 21 | from ctypes import c_buffer |
22 | from ctypes.wintypes import BOOL, BOOLEAN, LPCWSTR, DWORD, HANDLE, POINTER, c_ubyte | 22 | from ctypes.wintypes import BOOL, BOOLEAN, LPCWSTR, DWORD, HANDLE |
23 | from ctypes.wintypes import WCHAR, USHORT, LPVOID, Structure, Union, ULONG | 23 | from ctypes.wintypes import WCHAR, USHORT, LPVOID, ULONG |
24 | from ctypes.wintypes import byref | 24 | if is_python3(): |
25 | from ctypes import c_ubyte, Structure, Union, byref | ||
26 | from ctypes.wintypes import LPDWORD | ||
27 | else: | ||
28 | # For legacy Python2 different imports are needed. | ||
29 | from ctypes.wintypes import POINTER, c_ubyte, Structure, Union, byref | ||
30 | LPDWORD = POINTER(DWORD) | ||
25 | 31 | ||
26 | kernel32 = WinDLL('kernel32', use_last_error=True) | 32 | kernel32 = WinDLL('kernel32', use_last_error=True) |
27 | 33 | ||
28 | LPDWORD = POINTER(DWORD) | ||
29 | UCHAR = c_ubyte | 34 | UCHAR = c_ubyte |
30 | 35 | ||
31 | # Win32 error codes | 36 | # Win32 error codes |