2424 import cPickle as pickle
2525except ImportError :
2626 import pickle
27+
2728from . import declarations_cache
29+ from .. import utils
2830
2931
3032class index_entry_t (object ):
@@ -238,6 +240,10 @@ def _load(self):
238240 self .__index = {}
239241 self .__filename_rep = filename_repository_t (self .__sha1_sigs )
240242
243+ # Read the xml generator from the cache and set it
244+ with open (os .path .join (self .__dir , "gen.dat" ), "r" ) as gen_file :
245+ utils .xml_generator = gen_file .read ()
246+
241247 self .__modified_flag = False
242248
243249 def _save (self ):
@@ -255,6 +261,11 @@ def _save(self):
255261 indexfilename ,
256262 (self .__index ,
257263 self .__filename_rep ))
264+
265+ # Read the xml generator from the cache and set it
266+ with open (os .path .join (self .__dir , "gen.dat" ), "w" ) as gen_file :
267+ gen_file .write (utils .xml_generator )
268+
258269 self .__modified_flag = False
259270
260271 def _read_file (self , filename ):
@@ -366,15 +377,15 @@ def _create_config_signature(config):
366377 :rtype: str
367378 """
368379 m = hashlib .sha1 ()
369- m .update (config .working_directory )
380+ m .update (config .working_directory . encode ( "utf-8" ) )
370381 for p in config .include_paths :
371- m .update (p )
382+ m .update (p . encode ( "utf-8" ) )
372383 for p in config .define_symbols :
373- m .update (p )
384+ m .update (p . encode ( "utf-8" ) )
374385 for p in config .undefine_symbols :
375- m .update (p )
386+ m .update (p . encode ( "utf-8" ) )
376387 for p in config .cflags :
377- m .update (p )
388+ m .update (p . encode ( "utf-8" ) )
378389 return m .digest ()
379390
380391
@@ -531,13 +542,13 @@ def _get_signature(self, entry):
531542 if not os .path .exists (entry .filename ):
532543 return None
533544 try :
534- f = open (entry .filename )
545+ f = open (entry .filename , "r" )
535546 except IOError as e :
536547 print ("Cannot determine sha1 digest:" , e )
537548 return None
538549 data = f .read ()
539550 f .close ()
540- return hashlib .sha1 (data ).digest ()
551+ return hashlib .sha1 (data . encode ( "utf-8" ) ).digest ()
541552 else :
542553 # return file modification date...
543554 try :
0 commit comments