mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
[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>
This commit is contained in:
parent
5a03308c5c
commit
dbd277ce50
@ -19,13 +19,18 @@ import errno
|
|||||||
from pyversion import is_python3
|
from pyversion import is_python3
|
||||||
from ctypes import WinDLL, get_last_error, FormatError, WinError, addressof
|
from ctypes import WinDLL, get_last_error, FormatError, WinError, addressof
|
||||||
from ctypes import c_buffer
|
from ctypes import c_buffer
|
||||||
from ctypes.wintypes import BOOL, BOOLEAN, LPCWSTR, DWORD, HANDLE, POINTER, c_ubyte
|
from ctypes.wintypes import BOOL, BOOLEAN, LPCWSTR, DWORD, HANDLE
|
||||||
from ctypes.wintypes import WCHAR, USHORT, LPVOID, Structure, Union, ULONG
|
from ctypes.wintypes import WCHAR, USHORT, LPVOID, ULONG
|
||||||
from ctypes.wintypes import byref
|
if is_python3():
|
||||||
|
from ctypes import c_ubyte, Structure, Union, byref
|
||||||
|
from ctypes.wintypes import LPDWORD
|
||||||
|
else:
|
||||||
|
# For legacy Python2 different imports are needed.
|
||||||
|
from ctypes.wintypes import POINTER, c_ubyte, Structure, Union, byref
|
||||||
|
LPDWORD = POINTER(DWORD)
|
||||||
|
|
||||||
kernel32 = WinDLL('kernel32', use_last_error=True)
|
kernel32 = WinDLL('kernel32', use_last_error=True)
|
||||||
|
|
||||||
LPDWORD = POINTER(DWORD)
|
|
||||||
UCHAR = c_ubyte
|
UCHAR = c_ubyte
|
||||||
|
|
||||||
# Win32 error codes
|
# Win32 error codes
|
||||||
|
Loading…
Reference in New Issue
Block a user