Author: Matti Picus <[email protected]>
Branch:
Changeset: r68338:a1989cb701a7
Date: 2013-11-29 07:38 +0200
http://bitbucket.org/pypy/pypy/changeset/a1989cb701a7/
Log: test, change the name of the windows import library created during
translation, fixes some failing lib-python nightly tests
diff --git a/lib_pypy/_pypy_testcapi.py b/lib_pypy/_pypy_testcapi.py
--- a/lib_pypy/_pypy_testcapi.py
+++ b/lib_pypy/_pypy_testcapi.py
@@ -33,14 +33,13 @@
# set link options
output_filename = modulename + _get_c_extension_suffix()
if sys.platform == 'win32':
- # XXX libpypy-c.lib is currently not installed automatically
- library = os.path.join(thisdir, '..', 'include', 'libpypy-c')
+ # XXX pyconfig.h uses a pragma to link to the import library,
+ # which is currently python27.lib
+ library = os.path.join(thisdir, '..', 'include', 'python27')
if not os.path.exists(library + '.lib'):
- #For a nightly build
- library = os.path.join(thisdir, '..', 'include', 'python27')
- if not os.path.exists(library + '.lib'):
- # For a local translation
- library = os.path.join(thisdir, '..', 'pypy', 'goal', 'libpypy-c')
+ # For a local translation or nightly build
+ library = os.path.join(thisdir, '..', 'pypy', 'goal', 'python27')
+ assert os.path.exists(library + '.lib'),'Could not find import library
"%s"' % library
libraries = [library, 'oleaut32']
extra_ldargs = ['/MANIFEST', # needed for VC10
'/EXPORT:init' + modulename]
diff --git a/rpython/translator/driver.py b/rpython/translator/driver.py
--- a/rpython/translator/driver.py
+++ b/rpython/translator/driver.py
@@ -470,7 +470,8 @@
return py.path.local(newexename)
def create_exe(self):
- """ Copy the compiled executable into translator/goal
+ """ Copy the compiled executable into current directory, which is
+ pypy/goal on nightly builds
"""
if self.exe_name is not None:
exename = self.c_entryp
@@ -482,8 +483,11 @@
shutil.copy(str(soname), str(newsoname))
self.log.info("copied: %s" % (newsoname,))
if sys.platform == 'win32':
- shutil.copyfile(str(soname.new(ext='lib')),
- str(newsoname.new(ext='lib')))
+ # the import library is named python27.lib, according
+ # to the pragma in pyconfig.h
+ libname = str(newsoname.dirpath().join('python27.lib'))
+ shutil.copyfile(str(soname.new(ext='lib')), libname)
+ self.log.info("copied: %s" % (libname,))
self.c_entryp = newexename
self.log.info('usession directory: %s' % (udir,))
self.log.info("created: %s" % (self.c_entryp,))
diff --git a/rpython/translator/test/test_driver.py
b/rpython/translator/test/test_driver.py
--- a/rpython/translator/test/test_driver.py
+++ b/rpython/translator/test/test_driver.py
@@ -1,6 +1,7 @@
import py
-
+import os
from rpython.translator.driver import TranslationDriver
+from rpython.tool.udir import udir
def test_ctr():
td = TranslationDriver()
@@ -44,3 +45,33 @@
'compile_c', 'pyjitpl']
assert set(td.exposed) == set(expected)
+
+
+def test_create_exe():
+ if not os.name == 'nt':
+ py.skip('Windows only test')
+
+ dst_name = udir.join('dst/pypy.exe')
+ src_name = udir.join('src/dydy2.exe')
+ dll_name = udir.join('src/pypy.dll')
+ lib_name = udir.join('src/pypy.lib')
+ src_name.ensure()
+ src_name.write('exe')
+ dll_name.ensure()
+ dll_name.write('dll')
+ lib_name.ensure()
+ lib_name.write('lib')
+ dst_name.ensure()
+
+ class CBuilder(object):
+ shared_library_name = dll_name
+
+ td = TranslationDriver(exe_name=str(dst_name))
+ td.c_entryp = str(src_name)
+ td.cbuilder = CBuilder()
+ td.create_exe()
+ assert dst_name.read() == 'exe'
+ assert dst_name.new(ext='dll').read() == 'dll'
+ assert dst_name.new(purebasename='python27',ext='lib').read() == 'lib'
+
+
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit