Author: mattip <[email protected]>
Branch: pypyw
Changeset: r77432:7ed3a3e3b540
Date: 2015-05-20 22:11 +0300
http://bitbucket.org/pypy/pypy/changeset/7ed3a3e3b540/
Log: test, add *w.exe target when shared build for win32. Test is still
failing.
diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py
--- a/rpython/translator/c/genc.py
+++ b/rpython/translator/c/genc.py
@@ -293,7 +293,7 @@
bk = self.translator.annotator.bookkeeper
return getfunctionptr(bk.getdesc(self.entrypoint).getuniquegraph())
- def cmdexec(self, args='', env=None, err=False, expect_crash=False):
+ def cmdexec(self, args='', env=None, err=False, expect_crash=False,
exe=None):
assert self._compiled
if sys.platform == 'win32':
#Prevent opening a dialog box
@@ -314,9 +314,10 @@
envrepr = ''
else:
envrepr = ' [env=%r]' % (env,)
- log.cmdexec('%s %s%s' % (self.executable_name, args, envrepr))
- res = self.translator.platform.execute(self.executable_name, args,
- env=env)
+ if exe is None:
+ exe = self.executable_name
+ log.cmdexec('%s %s%s' % (exe, args, envrepr))
+ res = self.translator.platform.execute(exe, args, env=env)
if sys.platform == 'win32':
SetErrorMode(old_mode)
if res.returncode != 0:
diff --git a/rpython/translator/c/test/test_standalone.py
b/rpython/translator/c/test/test_standalone.py
--- a/rpython/translator/c/test/test_standalone.py
+++ b/rpython/translator/c/test/test_standalone.py
@@ -845,6 +845,12 @@
#Do not set LD_LIBRARY_PATH, make sure $ORIGIN flag is working
out, err = cbuilder.cmdexec("a b")
assert out == "3"
+ if sys.platform == 'win32':
+ # Make sure we have a test_1w.exe and it does not use stdout,
stderr
+ exe = cbuilder.executable_name
+ wexe = exe.new(purebasename=exe.purebasename + 'w')
+ out, err = cbuilder.cmdexec("a b", exe = wexe)
+ assert out == ''
def test_gcc_options(self):
# check that the env var CC is correctly interpreted, even if
diff --git a/rpython/translator/platform/windows.py
b/rpython/translator/platform/windows.py
--- a/rpython/translator/platform/windows.py
+++ b/rpython/translator/platform/windows.py
@@ -260,6 +260,8 @@
if shared:
so_name = exe_name.new(purebasename='lib' + exe_name.purebasename,
ext=self.so_ext)
+ wtarget_name = exe_name.new(purebasename=exe_name.purebasename +
'w',
+ ext=self.exe_ext)
target_name = so_name.basename
else:
target_name = exe_name.basename
@@ -313,11 +315,13 @@
('MAKE', 'nmake.exe'),
('_WIN32', '1'),
]
+ if shared:
+ definitions.insert(0, ('WTARGET', wtarget_name.basename))
if self.x64:
definitions.append(('_WIN64', '1'))
rules = [
- ('all', '$(DEFAULT_TARGET)', []),
+ ('all', '$(DEFAULT_TARGET) $(WTARGET)', []),
('.asm.obj', '', '$(MASM) /nologo /Fo$@ /c $< $(INCLUDEDIRS)'),
]
@@ -411,14 +415,33 @@
'int main(int argc, char* argv[]) '
'{ return $(PYPY_MAIN_FUNCTION)(argc, argv); } > $@')
deps = ['main.obj']
+ m.rule('wmain.c', '',
+ ['echo #define WIN32_LEAN_AND_MEAN > $@',
+ 'echo #include "windows.h" >> $@',
+ 'echo int $(PYPY_MAIN_FUNCTION)(int, char*[]); >> $@',
+ 'echo int WINAPI WinMain( >> $@',
+ 'echo HINSTANCE hInstance, /* handle to current
instance */ >> $@',
+ 'echo HINSTANCE hPrevInstance, /* handle to previous
instance */ >> $@',
+ 'echo LPSTR lpCmdLine, /* pointer to command
line */ >> $@',
+ 'echo int nCmdShow /* show state of window
*/ >> $@',
+ 'echo ) >> $@',
+ 'echo { return $(PYPY_MAIN_FUNCTION)(__argc, __argv); }
>> $@'])
+ wdeps = ['wmain.obj']
if icon:
deps.append('icon.res')
+ wdeps.append('icon.res')
m.rule('$(DEFAULT_TARGET)', ['$(TARGET)'] + deps,
['$(CC_LINK) /nologo /debug %s ' % (' '.join(deps),) + \
'$(SHARED_IMPORT_LIB) /out:$@ ' + \
'/MANIFEST /MANIFESTFILE:$*.manifest',
'mt.exe -nologo -manifest $*.manifest
-outputresource:$@;1',
])
+ m.rule('$(WTARGET)', ['$(TARGET)'] + wdeps,
+ ['$(CC_LINK) /nologo /debug /SUBSYSTEM:WINDOWS %s ' % ('
'.join(wdeps),) + \
+ '$(SHARED_IMPORT_LIB) /out:$@ ' + \
+ '/MANIFEST /MANIFESTFILE:$*.manifest',
+ 'mt.exe -nologo -manifest $*.manifest
-outputresource:$@;1',
+ ])
m.rule('debugmode_$(DEFAULT_TARGET)', ['debugmode_$(TARGET)']+deps,
['$(CC_LINK) /nologo /DEBUG %s ' % (' '.join(deps),) + \
'debugmode_$(SHARED_IMPORT_LIB) /out:$@',
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit