Author: Philip Jenvey <pjen...@underboss.org>
Branch: py3.3
Changeset: r73638:de00ce0a7596
Date: 2014-09-21 16:20 -0700
http://bitbucket.org/pypy/pypy/changeset/de00ce0a7596/

Log:    merge py3k

diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py
--- a/pypy/module/posix/__init__.py
+++ b/pypy/module/posix/__init__.py
@@ -171,7 +171,8 @@
     if os.name == 'nt':
         interpleveldefs.update({
                 '_getfileinformation': 'interp_posix._getfileinformation',
-                '_getfinalpathname': 'interp_posix._getfinalpathname',
+                # XXX: currently broken
+                #'_getfinalpathname': 'interp_posix._getfinalpathname',
         })
     if hasattr(os, 'chroot'):
         interpleveldefs['chroot'] = 'interp_posix.chroot'
diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py
--- a/pypy/tool/release/package.py
+++ b/pypy/tool/release/package.py
@@ -307,7 +307,13 @@
         argparse = imp.load_source('argparse', 'lib-python/2.7/argparse.py')
     if sys.platform == 'win32':
         pypy_exe = 'pypy3.exe'
-        license_base = os.path.join(basedir, r'..\..\..\local') # as on 
buildbot YMMV
+        for p in [os.path.join(basedir, r'..\..\..\local'), #buildbot
+                os.path.join(basedir, r'..\local')]: # pypy/doc/windows.rst
+            if os.path.exists(p): 
+                license_base = p
+                break
+        else:
+            license_base = 'unkown'
     else:
         pypy_exe = 'pypy3'
         license_base = '/usr/share/doc'
@@ -380,5 +386,21 @@
 
 if __name__ == '__main__':
     import sys
+    if sys.platform == 'win32':
+        # Try to avoid opeing a dialog box if one of the 
+        # subprocesses causes a system error
+        import ctypes
+        winapi = ctypes.windll.kernel32
+        SetErrorMode = winapi.SetErrorMode
+        SetErrorMode.argtypes=[ctypes.c_int]
+
+        SEM_FAILCRITICALERRORS = 1
+        SEM_NOGPFAULTERRORBOX  = 2
+        SEM_NOOPENFILEERRORBOX = 0x8000
+        flags = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | 
SEM_NOOPENFILEERRORBOX
+        #Since there is no GetErrorMode, do a double Set
+        old_mode = SetErrorMode(flags)
+        SetErrorMode(old_mode | flags)
+
     retval, _ = package(*sys.argv[1:])
     sys.exit(retval)
diff --git a/pypy/tool/release/test/test_package.py 
b/pypy/tool/release/test/test_package.py
--- a/pypy/tool/release/test/test_package.py
+++ b/pypy/tool/release/test/test_package.py
@@ -115,15 +115,21 @@
     check(pypy,  0755)
 
 def test_generate_license():
-    from os.path import dirname, abspath, join
+    from os.path import dirname, abspath, join, exists
     class Options(object):
         pass
     options = Options()
     basedir = dirname(dirname(dirname(dirname(dirname(abspath(__file__))))))
     options.no_tk = False
     if sys.platform == 'win32':
-         # as on buildbot YMMV
-        options.license_base = join(basedir, r'..\..\..\local')
+        for p in [join(basedir, r'..\..\..\local'), #buildbot
+                  join(basedir, r'..\local')]: # pypy/doc/windows.rst
+            if exists(p): 
+                license_base = p
+                break
+        else:
+            license_base = 'unkown'
+        options.license_base = license_base
     else:
         options.license_base = '/usr/share/doc'
     license = package.generate_license(py.path.local(basedir), options)
diff --git a/rpython/translator/driver.py b/rpython/translator/driver.py
--- a/rpython/translator/driver.py
+++ b/rpython/translator/driver.py
@@ -476,11 +476,12 @@
                 shutil_copy(str(soname), str(newsoname))
                 self.log.info("copied: %s" % (newsoname,))
                 if sys.platform == 'win32':
-                    # copy the import library as well
-                    libname = soname.new(ext='lib')
-                    newlibname = newexename.new(basename=soname.basename)
-                    shutil.copyfile(str(libname), 
str(newlibname.new(ext='lib')))
-                    self.log.info("copied: %s" % (newlibname,))
+                    ext_to_copy = ['lib', 'pdb']
+                    for ext in ext_to_copy:
+                        name = soname.new(ext=ext)
+                        newname = newexename.new(basename=soname.basename)
+                        shutil.copyfile(str(name), str(newname.new(ext=ext)))
+                        self.log.info("copied: %s" % (newname,))
             self.c_entryp = newexename
         self.log.info('usession directory: %s' % (udir,))
         self.log.info("created: %s" % (self.c_entryp,))
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
@@ -410,7 +410,7 @@
                    'int main(int argc, char* argv[]) '
                    '{ return $(PYPY_MAIN_FUNCTION)(argc, argv); } > $@')
             m.rule('$(DEFAULT_TARGET)', ['$(TARGET)', 'main.obj'],
-                   ['$(CC_LINK) /nologo main.obj $(SHARED_IMPORT_LIB) /out:$@ 
/MANIFEST /MANIFESTFILE:$*.manifest',
+                   ['$(CC_LINK) /nologo /debug main.obj $(SHARED_IMPORT_LIB) 
/out:$@ /MANIFEST /MANIFESTFILE:$*.manifest',
                     'mt.exe -nologo -manifest $*.manifest 
-outputresource:$@;1',
                     ])
             m.rule('debugmode_$(DEFAULT_TARGET)', ['debugmode_$(TARGET)', 
'main.obj'],
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
@@ -55,12 +55,15 @@
     src_name = udir.join('src/dydy2.exe')
     dll_name = udir.join('src/pypy.dll')
     lib_name = udir.join('src/pypy.lib')
+    pdb_name = udir.join('src/pypy.pdb')
     src_name.ensure()
     src_name.write('exe')
     dll_name.ensure()
     dll_name.write('dll')
     lib_name.ensure()
     lib_name.write('lib')
+    pdb_name.ensure()
+    pdb_name.write('pdb')
     dst_name.ensure()
 
     class CBuilder(object):
@@ -75,6 +78,8 @@
     assert dst_name.new(ext='lib').read() == 'lib'
 
 def test_shutil_copy():
+    if os.name == 'nt':
+        py.test.skip('Windows cannot copy or rename to an in-use file')
     a = udir.join('file_a')
     b = udir.join('file_a')
     a.write('hello')
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to