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

Godefroid Chapelle gotcha at bubblenet.be
Sun Mar 29 17:22:22 EDT 2009


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

Changed:
  U   zc.buildout/branches/help-api/src/zc/buildout/easy_install.py

-=-
Modified: zc.buildout/branches/help-api/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/branches/help-api/src/zc/buildout/easy_install.py	2009-03-29 21:22:15 UTC (rev 98514)
+++ zc.buildout/branches/help-api/src/zc/buildout/easy_install.py	2009-03-29 21:22:22 UTC (rev 98515)
@@ -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