tags 588843 + patch
thanks

This patch could probably fix the problem.

-- 
Regards,
Aron Xu
--- a/pygccxml/parser/declarations_cache.py
+++ b/pygccxml/parser/declarations_cache.py
@@ -5,11 +5,18 @@
 # http://www.boost.org/LICENSE_1_0.txt)
 
 import os
-import md5
 import time
 import cPickle 
 from pygccxml import utils
 import config as cxx_parsers_cfg
+import sys
+if sys.version_info < (2, 5):
+    import md5 as _mod_md5
+    md5 = _mod_md5.new
+else:
+    from hashlib import (
+        md5,
+	)
 
 def file_signature( filename ):
     if not os.path.isfile( filename ):
@@ -19,7 +26,7 @@
     # Extend here to use md5 hash for signature
     # - This change allows duplicate autogenerated files to be recognized
     #return os.path.getmtime( source )
-    sig = md5.new()
+    sig = md5()
     f = file(filename,'r')
     sig.update(f.read())
     f.close()    
@@ -32,7 +39,7 @@
         a configuration that could cause the declarations generated
         to be different between runs.
     """
-    sig = md5.new()
+    sig = md5()
     if isinstance( config, cxx_parsers_cfg.gccxml_configuration_t ):
         sig.update(str(config.gccxml_path))
     sig.update(str(config.working_directory))
@@ -234,4 +241,4 @@
         pass
         
     def cached_value(self, source_file, configuration):
-        return None
\ No newline at end of file
+        return None
--- a/pygccxml/parser/directory_cache.py
+++ b/pygccxml/parser/directory_cache.py
@@ -14,9 +14,17 @@
 argument of the L{parse()} function.
 """
 
-import os, os.path, gzip, md5
+import os, os.path, gzip
 import cPickle
 import declarations_cache
+import sys
+if sys.version_info < (2, 5):
+    import md5 as _mod_md5
+    md5 = _mod_md5.new
+else:
+    from hashlib import (
+        md5,
+	)
 
 class index_entry_t:
     """Entry of the index table in the directory cache index.
@@ -340,7 +348,7 @@
         @returns: Signature
         @rtype: str
         """
-        m = md5.new()
+        m = md5()
         m.update(config.working_directory)
         map(lambda p: m.update(p), config.include_paths)
         map(lambda p: m.update(p), config.define_symbols)
@@ -501,7 +509,7 @@
                 return None
             data = f.read()
             f.close()
-            return md5.new(data).digest()
+            return md5(data).digest()
         else:
             # return file modification date...
             try:

Attachment: signature.asc
Description: Digital signature

Reply via email to