diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 00000000..9c724696 --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,11 @@ +Note that issues in this repository are only for bugs or feature requests in the pywin32. + +**If you need support or help using this package, please follow [these instructions](https://github.com/mhammond/pywin32/blob/master/README.md#support)** - support or help requests will be closed without comment. + +For all bugs, please provide the following information. + +* Expected behavior and actual behavior. + +* Steps to reproduce the problem. + +* Version of Python and pywin32 diff --git a/CHANGES.txt b/CHANGES.txt index 4b3fcbe3..d209569c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,10 @@ Generally created by hand after running: hg log -rb2xx: > log.out However contributors are encouraged to add their own entries for their work. +Since build 224: +---------------- +* PythonWin is now able to start with non-English active keyboard layout. + Since build 223: ---------------- * Built with a released version of Python 3.7, which fixes various date related diff --git a/Pythonwin/pywin/scintilla/keycodes.py b/Pythonwin/pywin/scintilla/keycodes.py index 6b783761..d9021828 100644 --- a/Pythonwin/pywin/scintilla/keycodes.py +++ b/Pythonwin/pywin/scintilla/keycodes.py @@ -35,7 +35,9 @@ def get_vk(chardesc): # it is a character. info = win32api.VkKeyScan(chardesc) if info==-1: - return None, None + # Note: returning None, None causes an error when keyboard layout is non-English, see the report below + # https://stackoverflow.com/questions/45138084/pythonwin-occasionally-gives-an-error-on-opening + return 0, 0 vk = win32api.LOBYTE(info) state = win32api.HIBYTE(info) modifiers = 0 diff --git a/appveyor.yml b/appveyor.yml index a45bdb39..f84cdbc4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,6 +20,8 @@ environment: PYTHON_MINOR: 5 - PYTHON_MAJOR: 3 PYTHON_MINOR: 6 + - PYTHON_MAJOR: 3 + PYTHON_MINOR: 7 install: # Prepare environment @@ -42,6 +44,7 @@ init: # Following the matrix here: https://wiki.python.org/moin/WindowsCompilers#Which_Microsoft_Visual_C.2B-.2B-_compiler_to_use_with_a_specific_Python_version_.3F - if "%PLATFORM%"=="x86" set VC_ARCH=x86 - if "%PLATFORM%"=="x64" set VC_ARCH=amd64 + - if "%PYTHON_MAJOR%"=="3" if "%PYTHON_MINOR%"=="7" set VC_VERSION=14.0 - if "%PYTHON_MAJOR%"=="3" if "%PYTHON_MINOR%"=="6" set VC_VERSION=14.0 - if "%PYTHON_MAJOR%"=="3" if "%PYTHON_MINOR%"=="5" set VC_VERSION=14.0 - if "%PYTHON_MAJOR%"=="3" if "%PYTHON_MINOR%"=="4" set VC_VERSION=10.0 diff --git a/setup.py b/setup.py index 8c397e1e..7c35d909 100644 --- a/setup.py +++ b/setup.py @@ -1883,6 +1883,7 @@ com_extensions += [ depends=["%(internet)s/internet_pch.h" % dirs]), WinExt_win32com('mapi', libraries="advapi32", pch_header="PythonCOM.h", include_dirs=["%(mapi)s/mapi_headers" % dirs], + optional_headers=['edkmdb.h', 'edkguid.h'], sources=(""" %(mapi)s/mapi.i %(mapi)s/mapi.cpp %(mapi)s/PyIABContainer.i %(mapi)s/PyIABContainer.cpp @@ -1911,6 +1912,7 @@ com_extensions += [ """ % dirs).split()), WinExt_win32com_mapi('exchange', libraries="advapi32", include_dirs=["%(mapi)s/mapi_headers" % dirs], + optional_headers=['edkmdb.h', 'edkguid.h'], sources=(""" %(mapi)s/exchange.i %(mapi)s/exchange.cpp %(mapi)s/PyIExchangeManageStore.i %(mapi)s/PyIExchangeManageStore.cpp @@ -2438,6 +2440,17 @@ cmdclass = { 'install': my_install, 'build_scripts' : my_build_scripts, } +classifiers = [ 'Environment :: Win32 (MS Windows)', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: Python Software Foundation License', + 'Operating System :: Microsoft :: Windows', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: Implementation :: CPython', + ] + dist = setup(name="pywin32", version=str(build_id), description="Python for Window Extensions", @@ -2449,6 +2462,7 @@ dist = setup(name="pywin32", author_email = "mhammond@skippinet.com.au", url="https://github.com/mhammond/pywin32", license="PSF", + classifiers = classifiers, cmdclass = cmdclass, options = {"bdist_wininst": {"install_script": "pywin32_postinstall.py", diff --git a/win32/Lib/win32con.py b/win32/Lib/win32con.py index a37967f7..eb6b8a90 100644 --- a/win32/Lib/win32con.py +++ b/win32/Lib/win32con.py @@ -2060,6 +2060,9 @@ PROCESS_CREATE_PROCESS = (128) PROCESS_SET_QUOTA = (256) PROCESS_SET_INFORMATION = (512) PROCESS_QUERY_INFORMATION = (1024) +PROCESS_SUSPEND_RESUME = (2048) +PROCESS_QUERY_LIMITED_INFORMATION = (4096) +PROCESS_SET_LIMITED_INFORMATION = (8192) PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 4095) THREAD_TERMINATE = (1) THREAD_SUSPEND_RESUME = (2) @@ -2070,6 +2073,9 @@ THREAD_QUERY_INFORMATION = (64) THREAD_SET_THREAD_TOKEN = (128) THREAD_IMPERSONATE = (256) THREAD_DIRECT_IMPERSONATION = (512) +THREAD_SET_LIMITED_INFORMATION = (1024) +THREAD_QUERY_LIMITED_INFORMATION = (2048) +THREAD_RESUME = (4096) TLS_MINIMUM_AVAILABLE = 64 EVENT_MODIFY_STATE = 2 MUTANT_QUERY_STATE = 1 diff --git a/win32/Lib/win32timezone.py b/win32/Lib/win32timezone.py index 83a119dc..6d65af7d 100644 --- a/win32/Lib/win32timezone.py +++ b/win32/Lib/win32timezone.py @@ -715,14 +715,22 @@ class TimeZoneInfo(datetime.tzinfo): @staticmethod def _get_indexed_time_zone_keys(index_key='Index'): """ - Get the names of the registry keys indexed by a value in that key. + Get the names of the registry keys indexed by a value in that key, + ignoring any keys for which that value is empty or missing. """ key_names = list(TimeZoneInfo._get_time_zone_key_names()) + def get_index_value(key_name): key = TimeZoneInfo._get_time_zone_key(key_name) - return key[index_key] + return key.get(index_key) + values = map(get_index_value, key_names) - return zip(values, key_names) + + return ( + (value, key_name) + for value, key_name in zip(values, key_names) + if value + ) @staticmethod def get_sorted_time_zone_names(): @@ -786,25 +794,6 @@ class _RegKeyDict(dict): except WindowsError: pass -# for backward compatibility -def deprecated(func, name='Unknown'): - """This is a decorator which can be used to mark functions - as deprecated. It will result in a warning being emmitted - when the function is used.""" - def newFunc(*args, **kwargs): - warnings.warn("Call to deprecated function %s." % name, - category=DeprecationWarning) - return func(*args, **kwargs) - newFunc.__name__ = func.__name__ - newFunc.__doc__ = func.__doc__ - newFunc.__dict__.update(func.__dict__) - return newFunc - -GetTimeZoneNames = deprecated(TimeZoneInfo._get_time_zone_key_names, 'GetTimeZoneNames') -GetIndexedTimeZoneNames = deprecated(TimeZoneInfo._get_indexed_time_zone_keys, 'GetIndexedTimeZoneNames') -GetSortedTimeZoneNames = deprecated(TimeZoneInfo.get_sorted_time_zone_names, 'GetSortedTimeZoneNames') -# end backward compatibility - def utcnow(): """ Return the UTC time now with timezone awareness as enabled @@ -860,7 +849,7 @@ def resolveMUITimeZone(spec): spec should be of the format @path,-stringID[;comment] see http://msdn2.microsoft.com/en-us/library/ms725481.aspx for details """ - pattern = re.compile('@(?P.*),-(?P\d+)(?:;(?P.*))?') + pattern = re.compile(r'@(?P.*),-(?P\d+)(?:;(?P.*))?') matcher = pattern.match(spec) assert matcher, 'Could not parse MUI spec' diff --git a/win32/Lib/winnt.py b/win32/Lib/winnt.py index 15584efa..021a32b1 100644 --- a/win32/Lib/winnt.py +++ b/win32/Lib/winnt.py @@ -194,6 +194,9 @@ PROCESS_CREATE_PROCESS = (128) PROCESS_SET_QUOTA = (256) PROCESS_SET_INFORMATION = (512) PROCESS_QUERY_INFORMATION = (1024) +PROCESS_SUSPEND_RESUME = (2048) +PROCESS_QUERY_LIMITED_INFORMATION = (4096) +PROCESS_SET_LIMITED_INFORMATION = (8192) MAXIMUM_PROCESSORS = 32 THREAD_TERMINATE = (1) THREAD_SUSPEND_RESUME = (2) @@ -204,6 +207,9 @@ THREAD_QUERY_INFORMATION = (64) THREAD_SET_THREAD_TOKEN = (128) THREAD_IMPERSONATE = (256) THREAD_DIRECT_IMPERSONATION = (512) +THREAD_SET_LIMITED_INFORMATION = (1024) +THREAD_QUERY_LIMITED_INFORMATION = (2048) +THREAD_RESUME = (4096) JOB_OBJECT_ASSIGN_PROCESS = (1) JOB_OBJECT_SET_ATTRIBUTES = (2) JOB_OBJECT_QUERY = (4)