Skip to content

Commit beeeca4

Browse files
author
Fredrik Orderud
committed
Remove Windows CE support
I don't think the Windows CE kernel is supported by Microsoft any more. The latest release was 8.0 in 2013 according to Wikipedia (https://en.wikipedia.org/wiki/Windows_Embedded_Compact). Python 3.6 and newer also no longer support Windows CE (https://docs.python.org/3.6/library/os.html#os.name).
1 parent d5a9763 commit beeeca4

File tree

7 files changed

+13
-56
lines changed

7 files changed

+13
-56
lines changed

comtypes/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,7 @@ def CoInitialize():
148148

149149
def CoInitializeEx(flags=None):
150150
if flags is None:
151-
if os.name == "ce":
152-
flags = getattr(sys, "coinit_flags", COINIT_MULTITHREADED)
153-
else:
154-
flags = getattr(sys, "coinit_flags", COINIT_APARTMENTTHREADED)
151+
flags = getattr(sys, "coinit_flags", COINIT_APARTMENTTHREADED)
155152
logger.debug("CoInitializeEx(None, %s)", flags)
156153
_ole32.CoInitializeEx(None, flags)
157154

comtypes/_comobject.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,8 @@ class Vtbl(Structure):
275275
################################################################
276276

277277
try:
278-
if os.name == "ce":
279-
_InterlockedIncrement = windll.coredll.InterlockedIncrement
280-
_InterlockedDecrement = windll.coredll.InterlockedDecrement
281-
else:
282-
_InterlockedIncrement = windll.kernel32.InterlockedIncrement
283-
_InterlockedDecrement = windll.kernel32.InterlockedDecrement
278+
_InterlockedIncrement = windll.kernel32.InterlockedIncrement
279+
_InterlockedDecrement = windll.kernel32.InterlockedDecrement
284280
except AttributeError:
285281
import threading
286282
_lock = threading.Lock()

comtypes/client/_code_cache.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,8 @@ def _find_gen_dir():
7474

7575
################################################################
7676

77-
if os.name == "ce":
78-
SHGetSpecialFolderPath = ctypes.OleDLL("coredll").SHGetSpecialFolderPath
79-
GetModuleFileName = ctypes.WinDLL("coredll").GetModuleFileNameW
80-
else:
81-
SHGetSpecialFolderPath = ctypes.OleDLL("shell32.dll").SHGetSpecialFolderPathW
82-
GetModuleFileName = ctypes.WinDLL("kernel32.dll").GetModuleFileNameW
77+
SHGetSpecialFolderPath = ctypes.OleDLL("shell32.dll").SHGetSpecialFolderPathW
78+
GetModuleFileName = ctypes.WinDLL("kernel32.dll").GetModuleFileNameW
8379
SHGetSpecialFolderPath.argtypes = [ctypes.c_ulong, ctypes.c_wchar_p,
8480
ctypes.c_int, ctypes.c_int]
8581
GetModuleFileName.restype = ctypes.c_ulong

comtypes/client/_generate.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@
77
import logging
88
logger = logging.getLogger(__name__)
99

10-
if os.name == "ce":
11-
# Windows CE has a hard coded PATH
12-
# XXX Additionally there's an OEM path, plus registry settings.
13-
# We don't currently use the latter.
14-
PATH = ["\\Windows", "\\"]
15-
else:
16-
PATH = os.environ["PATH"].split(os.pathsep)
10+
PATH = os.environ["PATH"].split(os.pathsep)
1711

1812
def _my_import(fullname):
1913
# helper function to import dotted modules

comtypes/test/test_GUID.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ def test(self):
2525
GUID("{0002DF01-0000-0000-C000-000000000046}"))
2626
self.failUnlessEqual(GUID("{0002DF01-0000-0000-C000-000000000046}").as_progid(),
2727
u'InternetExplorer.Application.1')
28-
elif os.name == "ce":
29-
self.failUnlessEqual(GUID.from_progid("JScript"),
30-
GUID("{f414c260-6ac0-11cf-b6d1-00aa00bbbb58}"))
31-
self.failUnlessEqual(GUID("{f414c260-6ac0-11cf-b6d1-00aa00bbbb58}").as_progid(),
32-
u'JScript')
33-
3428

3529
self.failIfEqual(GUID.create_new(), GUID.create_new())
3630

comtypes/test/test_findgendir.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,8 @@ def tearDown(self):
3939

4040
def test_script(self):
4141
# %APPDATA%\Python\Python25\comtypes_cache
42-
if os.name == "ce":
43-
ma, mi = sys.version_info[:2]
44-
path = r"%s\Python\Python%d%d\comtypes_cache" % \
45-
(_get_appdata_dir(), ma, mi)
46-
else:
47-
template = r"$APPDATA\Python\Python%d%d\comtypes_cache"
48-
path = os.path.expandvars(template % sys.version_info[:2])
42+
template = r"$APPDATA\Python\Python%d%d\comtypes_cache"
43+
path = os.path.expandvars(template % sys.version_info[:2])
4944
gen_dir = comtypes.client._find_gen_dir()
5045
self.failUnlessEqual(path, gen_dir)
5146

comtypes/typeinfo.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -511,26 +511,11 @@ def CreateTypeLib(filename, syskind=SYS_WIN32):
511511
_oleaut32.CreateTypeLib2(syskind, c_wchar_p(filename), byref(ctlib))
512512
return ctlib
513513

514-
if os.name == "ce":
515-
# See also:
516-
# http://blogs.msdn.com/larryosterman/archive/2006/01/09/510856.aspx
517-
#
518-
# windows CE does not have QueryPathOfRegTypeLib. Emulate by reading the registry:
519-
def QueryPathOfRegTypeLib(libid, wVerMajor, wVerMinor, lcid=0):
520-
"Return the path of a registered type library"
521-
import _winreg
522-
try:
523-
hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, r"Typelib\%s\%s.%s\%x\win32" % (libid, wVerMajor, wVerMinor, lcid))
524-
except WindowsError:
525-
# On CE, some typelib names are not in the ..\win32 subkey:
526-
hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, r"Typelib\%s\%s.%s\%x" % (libid, wVerMajor, wVerMinor, lcid))
527-
return _winreg.QueryValueEx(hkey, "")[0]
528-
else:
529-
def QueryPathOfRegTypeLib(libid, wVerMajor, wVerMinor, lcid=0):
530-
"Return the path of a registered type library"
531-
pathname = BSTR()
532-
_oleaut32.QueryPathOfRegTypeLib(byref(GUID(libid)), wVerMajor, wVerMinor, lcid, byref(pathname))
533-
return pathname.value.split("\0")[0]
514+
def QueryPathOfRegTypeLib(libid, wVerMajor, wVerMinor, lcid=0):
515+
"Return the path of a registered type library"
516+
pathname = BSTR()
517+
_oleaut32.QueryPathOfRegTypeLib(byref(GUID(libid)), wVerMajor, wVerMinor, lcid, byref(pathname))
518+
return pathname.value.split("\0")[0]
534519

535520
################################################################
536521
# Structures

0 commit comments

Comments
 (0)