Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/setuptools/windows_support.py @ 5:9b1c78e6ba9c draft default tip
"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
| author | shellac |
|---|---|
| date | Mon, 01 Jun 2020 08:59:25 -0400 |
| parents | 79f47841a781 |
| children |
comparison
equal
deleted
inserted
replaced
| 4:79f47841a781 | 5:9b1c78e6ba9c |
|---|---|
| 1 import platform | |
| 2 import ctypes | |
| 3 | |
| 4 | |
| 5 def windows_only(func): | |
| 6 if platform.system() != 'Windows': | |
| 7 return lambda *args, **kwargs: None | |
| 8 return func | |
| 9 | |
| 10 | |
| 11 @windows_only | |
| 12 def hide_file(path): | |
| 13 """ | |
| 14 Set the hidden attribute on a file or directory. | |
| 15 | |
| 16 From http://stackoverflow.com/questions/19622133/ | |
| 17 | |
| 18 `path` must be text. | |
| 19 """ | |
| 20 __import__('ctypes.wintypes') | |
| 21 SetFileAttributes = ctypes.windll.kernel32.SetFileAttributesW | |
| 22 SetFileAttributes.argtypes = ctypes.wintypes.LPWSTR, ctypes.wintypes.DWORD | |
| 23 SetFileAttributes.restype = ctypes.wintypes.BOOL | |
| 24 | |
| 25 FILE_ATTRIBUTE_HIDDEN = 0x02 | |
| 26 | |
| 27 ret = SetFileAttributes(path, FILE_ATTRIBUTE_HIDDEN) | |
| 28 if not ret: | |
| 29 raise ctypes.WinError() |
