summaryrefslogtreecommitdiffstats
path: root/platform_utils_win32.py
diff options
context:
space:
mode:
authorRemy Böhmer <linux@bohmer.net>2020-01-07 08:48:55 +0100
committerMike Frysinger <vapier@google.com>2020-02-06 14:29:15 +0000
commitdbd277ce500491cea14bdca48ccb0f9148e55b56 (patch)
tree69ff5c39a489259c2f3c732193bd7a9ab18368b4 /platform_utils_win32.py
parent5a03308c5c5f8dbfab05bfe726337dafc10b0c85 (diff)
downloadgit-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>
Diffstat (limited to 'platform_utils_win32.py')
-rw-r--r--platform_utils_win32.py13
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
19from pyversion import is_python3 19from pyversion import is_python3
20from ctypes import WinDLL, get_last_error, FormatError, WinError, addressof 20from ctypes import WinDLL, get_last_error, FormatError, WinError, addressof
21from ctypes import c_buffer 21from ctypes import c_buffer
22from ctypes.wintypes import BOOL, BOOLEAN, LPCWSTR, DWORD, HANDLE, POINTER, c_ubyte 22from ctypes.wintypes import BOOL, BOOLEAN, LPCWSTR, DWORD, HANDLE
23from ctypes.wintypes import WCHAR, USHORT, LPVOID, Structure, Union, ULONG 23from ctypes.wintypes import WCHAR, USHORT, LPVOID, ULONG
24from ctypes.wintypes import byref 24if is_python3():
25 from ctypes import c_ubyte, Structure, Union, byref
26 from ctypes.wintypes import LPDWORD
27else:
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
26kernel32 = WinDLL('kernel32', use_last_error=True) 32kernel32 = WinDLL('kernel32', use_last_error=True)
27 33
28LPDWORD = POINTER(DWORD)
29UCHAR = c_ubyte 34UCHAR = c_ubyte
30 35
31# Win32 error codes 36# Win32 error codes