Work around late initialization in distutils._msvccompiler.

This commit is contained in:
Christian Ullrich 2016-01-06 15:04:33 +01:00 committed by Daniele Varrazzo
parent cbeea0f98f
commit b6d1fbdfd1

View File

@ -304,6 +304,10 @@ class psycopg_build_ext(build_ext):
except AttributeError: except AttributeError:
ext_path = os.path.join(self.build_lib, ext_path = os.path.join(self.build_lib,
'psycopg2', '_psycopg.pyd') 'psycopg2', '_psycopg.pyd')
# Make sure spawn() will work if compile() was never
# called. https://github.com/psycopg/psycopg2/issues/380
if not self.compiler.initialized:
self.compiler.initialize()
self.compiler.spawn( self.compiler.spawn(
['mt.exe', '-nologo', '-manifest', ['mt.exe', '-nologo', '-manifest',
os.path.join('psycopg', manifest), os.path.join('psycopg', manifest),