[Checkins] SVN: zc.buildout/trunk/src/zc/buildout/easy_install.py Don't write .exe files if the files exist and are the same. This makes

Jim Fulton jim at zope.com
Fri Jul 18 16:39:54 EDT 2008


Log message for revision 88546:
  Don't write .exe files if the files exist and are the same. This makes
  stupid windows errors less likely.
  

Changed:
  U   zc.buildout/trunk/src/zc/buildout/easy_install.py

-=-
Modified: zc.buildout/trunk/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/easy_install.py	2008-07-18 20:38:29 UTC (rev 88545)
+++ zc.buildout/trunk/src/zc/buildout/easy_install.py	2008-07-18 20:39:52 UTC (rev 88546)
@@ -925,9 +925,10 @@
     if sys.platform == 'win32':
         # generate exe file and give the script a magic name:
         exe = script+'.exe'
-        open(exe, 'wb').write(
-            pkg_resources.resource_string('setuptools', 'cli.exe')
-            )
+        new_data = pkg_resources.resource_string('setuptools', 'cli.exe')
+        if not os.path.exists(exe) or (open(exe, 'rb').read() != new_data):
+            # Only write it if it's different.
+            open(exe, 'wb').write(new_data)
         generated.append(exe)
         
     if changed:



More information about the Checkins mailing list