[pypy-svn] pypy default: os.path.samefile does not exist on windows.

amauryfa commits-noreply at bitbucket.org
Mon Apr 25 22:34:05 CEST 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r43613:30610b96e715
Date: 2011-04-25 22:30 +0200
http://bitbucket.org/pypy/pypy/changeset/30610b96e715/

Log:	os.path.samefile does not exist on windows. Use the similar function
	from py.path.local()

diff --git a/pypy/translator/goal/translate.py b/pypy/translator/goal/translate.py
--- a/pypy/translator/goal/translate.py
+++ b/pypy/translator/goal/translate.py
@@ -289,9 +289,11 @@
 
         # Double check to ensure we are not overwriting the current interpreter
         try:
-            exe_name = str(drv.compute_exe_name())
-            assert not os.path.samefile(exe_name, sys.executable), (
-                'Output file %r is the currently running '
+            this_exe = py.path.local(sys.executable).new(ext='')
+            exe_name = drv.compute_exe_name()
+            samefile = this_exe.samefile(exe_name)
+            assert not samefile, (
+                'Output file %s is the currently running '
                 'interpreter (use --output=...)'% exe_name)
         except OSError:
             pass


More information about the Pypy-commit mailing list