diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-10-19 13:02:37 +0100 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-10-19 13:02:37 +0100 |
commit | ae6eb3131a935824d1aca43c6ac5ac6bb4907078 (patch) | |
tree | ef06beac9a016ffd4aa2ac8e020d3a557aa408e5 /setuptools/windows_support.py | |
parent | 3d532f52850f0c860f0031519a25231797320976 (diff) | |
download | external_python_setuptools-ae6eb3131a935824d1aca43c6ac5ac6bb4907078.tar.gz external_python_setuptools-ae6eb3131a935824d1aca43c6ac5ac6bb4907078.tar.bz2 external_python_setuptools-ae6eb3131a935824d1aca43c6ac5ac6bb4907078.zip |
Declare argtypes and restype on SetFileAttributesW so that it will cast Python 2 bytestrings to Unicode automatically.
Diffstat (limited to 'setuptools/windows_support.py')
-rw-r--r-- | setuptools/windows_support.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/setuptools/windows_support.py b/setuptools/windows_support.py index 8da71243..df35a5f4 100644 --- a/setuptools/windows_support.py +++ b/setuptools/windows_support.py @@ -1,4 +1,4 @@ -import ctypes +import ctypes.wintypes def hide_file(path): @@ -9,11 +9,12 @@ def hide_file(path): `path` must be text. """ - - SetFileAttributesW = ctypes.windll.kernel32.SetFileAttributesW + SetFileAttributes = ctypes.windll.kernel32.SetFileAttributesW + SetFileAttributes.argtypes = ctypes.wintypes.LPWSTR, ctypes.wintypes.DWORD + SetFileAttributes.restype = ctypes.wintypes.BOOL FILE_ATTRIBUTE_HIDDEN = 0x02 - ret = SetFileAttributesW(path, FILE_ATTRIBUTE_HIDDEN) + ret = SetFileAttributes(path, FILE_ATTRIBUTE_HIDDEN) if not ret: raise ctypes.WinError() |