Do not use osutil.c with python 2.4 and Windows (issue1364) stable
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sun, 21 Feb 2010 22:16:35 +0100
branchstable
changeset 10521 bde1bb250fc2
parent 10520 75361931884d
child 10522 b07d487009b2
Do not use osutil.c with python 2.4 and Windows (issue1364) Windows python 2.4 os.stat() reports times including DST offset, while osutil.c reports the correct value, which makes status() systematically compare files content. This bug is fixed in python 2.5. Using osutil.py instead of osutil.c is 4x times slower on large repositories but current code is completely unusable. Given few people are likely to use python 2.4 on Windows this solution was considered a good trade-off compared to more invasive solutions trying to address the offset issue.
setup.py
--- a/setup.py	Sun Feb 21 01:21:17 2010 +0200
+++ b/setup.py	Sun Feb 21 22:16:35 2010 +0100
@@ -229,17 +229,24 @@
 cmdclass = {'build_mo': hgbuildmo,
             'build_py': hgbuildpy}
 
+packages = ['mercurial', 'mercurial.hgweb', 'hgext', 'hgext.convert',
+            'hgext.highlight', 'hgext.zeroconf']
+
+pymodules = []
+
 extmodules = [
     Extension('mercurial.base85', ['mercurial/base85.c']),
     Extension('mercurial.bdiff', ['mercurial/bdiff.c']),
     Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c']),
     Extension('mercurial.mpatch', ['mercurial/mpatch.c']),
     Extension('mercurial.parsers', ['mercurial/parsers.c']),
-    Extension('mercurial.osutil', ['mercurial/osutil.c']),
     ]
 
-packages = ['mercurial', 'mercurial.hgweb', 'hgext', 'hgext.convert',
-            'hgext.highlight', 'hgext.zeroconf']
+# disable osutil.c under windows + python 2.4 (issue1364)
+if sys.platform == 'win32' and sys.version_info < (2, 5, 0, 'final'):
+    pymodules.append('mercurial.pure.osutil')
+else:
+    extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c']))
 
 if sys.platform == 'linux2' and os.uname()[2] > '2.6':
     # The inotify extension is only usable with Linux 2.6 kernels.
@@ -288,6 +295,7 @@
       license='GNU GPLv2+',
       scripts=scripts,
       packages=packages,
+      py_modules=pymodules,
       ext_modules=extmodules,
       data_files=datafiles,
       package_data=packagedata,