Commits

mattip committed a1989cb

test, change the name of the windows import library created during translation,
fixes some failing lib-python nightly tests

Comments (0)

Files changed (3)

lib_pypy/_pypy_testcapi.py

     # 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]

rpython/translator/driver.py

         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
                 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,))

rpython/translator/test/test_driver.py

 import py
-
+import os
 from rpython.translator.driver import TranslationDriver
+from rpython.tool.udir import udir 
 
 def test_ctr():
     td = TranslationDriver()
                 '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'
+
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.