Skip to content

Commit 95a715c

Browse files
committed
Version bump to v2.0.0-beta.30
+ Windows support should be ready
1 parent 5ff5c1e commit 95a715c

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

codeintel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.0-beta.29'
1+
__version__ = '2.0.0-beta.30'

codeintel/process.py

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,24 +92,33 @@ def __init__(self, msg, errno=-1):
9292
if sys.platform == "win32" and sys.getwindowsversion()[3] == 2:
9393

9494
import winprocess
95+
import subprocess
96+
97+
# In Python 3 on Windows, a lot of the functions previously
98+
# in _subprocess moved to _winapi
99+
_subprocess = getattr(subprocess, '_subprocess', None)
100+
_winapi = getattr(subprocess, '_winapi', None)
101+
102+
def subprocess_import(attr):
103+
for mod in (subprocess, _subprocess, _winapi):
104+
value = getattr(mod, attr, None)
105+
if value is not None:
106+
return value
107+
raise ImportError
108+
95109
try:
96-
from subprocess import pywintypes, list2cmdline, STARTUPINFO
110+
# These subprocess variables have moved around between Python versions.
111+
list2cmdline = subprocess_import('list2cmdline')
112+
STARTUPINFO = subprocess_import('STARTUPINFO')
113+
SW_HIDE = subprocess_import('SW_HIDE')
114+
STARTF_USESTDHANDLES = subprocess_import('STARTF_USESTDHANDLES')
115+
STARTF_USESHOWWINDOW = subprocess_import('STARTF_USESHOWWINDOW')
116+
GetVersion = subprocess_import('GetVersion')
117+
CreateProcess = subprocess_import('CreateProcess')
118+
TerminateProcess = subprocess_import('TerminateProcess')
97119
except ImportError:
98120
pass
99121
else:
100-
try:
101-
# These subprocess variables have moved around between Python versions.
102-
from subprocess import (SW_HIDE,
103-
STARTF_USESTDHANDLES, STARTF_USESHOWWINDOW,
104-
GetVersion, CreateProcess, TerminateProcess)
105-
except ImportError:
106-
import subprocess
107-
SW_HIDE = subprocess._subprocess.SW_HIDE
108-
STARTF_USESTDHANDLES = subprocess._subprocess.STARTF_USESTDHANDLES
109-
STARTF_USESHOWWINDOW = subprocess._subprocess.STARTF_USESHOWWINDOW
110-
GetVersion = subprocess._subprocess.GetVersion
111-
CreateProcess = subprocess._subprocess.CreateProcess
112-
TerminateProcess = subprocess._subprocess.TerminateProcess
113122

114123
# This fix is for killing child processes on windows, based on:
115124
# http://www.microsoft.com/msj/0698/win320698.aspx
@@ -187,7 +196,7 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
187196
env,
188197
cwd,
189198
startupinfo)
190-
except pywintypes.error as e:
199+
except IOError as e: # From 2.6 on, pywintypes.error was defined as IOError
191200
# Translate pywintypes.error to WindowsError, which is
192201
# a subclass of OSError. FIXME: We should really
193202
# translate errno using _sys_errlist (or simliar), but

0 commit comments

Comments
 (0)