[pypy-svn] r75775 - pypy/trunk/pypy/module/cpyext

arigo at codespeak.net arigo at codespeak.net
Fri Jul 2 17:14:34 CEST 2010


Author: arigo
Date: Fri Jul  2 17:14:33 2010
New Revision: 75775

Modified:
   pypy/trunk/pypy/module/cpyext/api.py
Log:
The files in pypy-trunk/include are created read-only, but then if they are
modified, the copy() fails to overwrite them.  In that case, remove the target
and try again.


Modified: pypy/trunk/pypy/module/cpyext/api.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/api.py	(original)
+++ pypy/trunk/pypy/module/cpyext/api.py	Fri Jul  2 17:14:33 2010
@@ -104,8 +104,12 @@
     for name in ("pypy_decl.h", "pypy_macros.h"):
         headers.append(udir.join(name))
     for header in headers:
-        header.copy(dstdir)
         target = dstdir.join(header.basename)
+        try:
+            header.copy(dstdir)
+        except py.error.EACCES:
+            target.remove()   # maybe it was a read-only file
+            header.copy(dstdir)
         target.chmod(0444) # make the file read-only, to make sure that nobody
                            # edits it by mistake
 



More information about the Pypy-commit mailing list