@@ -68,15 +68,15 @@ class directory_cache_t (declarations_cache.cache_base_t):
68
68
modified since the last run).
69
69
"""
70
70
71
- def __init__ (self , dir = "cache" , compression = False , md5_sigs = True ):
71
+ def __init__ (self , dir = "cache" , compression = False , sha1_sigs = True ):
72
72
"""
73
73
:param dir: cache directory path, it is created, if it does not exist
74
74
75
75
:param compression: if `True`, the cache files will be compressed
76
76
using `gzip`
77
77
78
- :param md5_sigs : `md5_sigs ` determines whether file modifications is
79
- checked by computing a `md5 ` digest or by checking
78
+ :param sha1_sigs : `sha1_sigs ` determines whether file modifications is
79
+ checked by computing a `sha1 ` digest or by checking
80
80
the modification date
81
81
"""
82
82
@@ -88,13 +88,13 @@ def __init__(self, dir="cache", compression=False, md5_sigs=True):
88
88
# Flag that determines whether the cache files will be compressed
89
89
self .__compression = compression
90
90
91
- # Flag that determines whether the signature is a md5 digest or
91
+ # Flag that determines whether the signature is a sha1 digest or
92
92
# the modification time
93
93
# (this flag is passed to the filename_repository_t class)
94
- self .__md5_sigs = md5_sigs
94
+ self .__sha1_sigs = sha1_sigs
95
95
96
96
# Filename repository
97
- self .__filename_rep = filename_repository_t (self .__md5_sigs )
97
+ self .__filename_rep = filename_repository_t (self .__sha1_sigs )
98
98
99
99
# Index dictionary (Key is the value returned by _create_cache_key()
100
100
# (which is based on the header file name) and value is an
@@ -228,15 +228,15 @@ def _load(self):
228
228
data = self ._read_file (indexfilename )
229
229
self .__index = data [0 ]
230
230
self .__filename_rep = data [1 ]
231
- if self .__filename_rep ._md5_sigs != self .__md5_sigs :
231
+ if self .__filename_rep ._sha1_sigs != self .__sha1_sigs :
232
232
print ((
233
- "CACHE: Warning: md5_sigs stored in the cache is set " +
234
- "to %s." ) % self .__filename_rep ._md5_sigs )
233
+ "CACHE: Warning: sha1_sigs stored in the cache is set " +
234
+ "to %s." ) % self .__filename_rep ._sha1_sigs )
235
235
print ("Please remove the cache to change this setting." )
236
- self .__md5_sigs = self .__filename_rep ._md5_sigs
236
+ self .__sha1_sigs = self .__filename_rep ._sha1_sigs
237
237
else :
238
238
self .__index = {}
239
- self .__filename_rep = filename_repository_t (self .__md5_sigs )
239
+ self .__filename_rep = filename_repository_t (self .__sha1_sigs )
240
240
241
241
self .__modified_flag = False
242
242
@@ -355,15 +355,15 @@ def _create_config_signature(self, config):
355
355
"""
356
356
return the signature for a config object.
357
357
358
- The signature is computed as md5 digest of the contents of
358
+ The signature is computed as sha1 digest of the contents of
359
359
working_directory, include_paths, define_symbols and
360
360
undefine_symbols.
361
361
362
362
:param config: Configuration object
363
363
:type config: :class:`parser.xml_generator_configuration_t`
364
364
:rtype: str
365
365
"""
366
- m = hashlib .md5 ()
366
+ m = hashlib .sha1 ()
367
367
m .update (config .working_directory )
368
368
for p in config .include_paths :
369
369
m .update (p )
@@ -436,14 +436,14 @@ class filename_repository_t:
436
436
called so that the entry can be removed from the repository.
437
437
"""
438
438
439
- def __init__ (self , md5_sigs ):
439
+ def __init__ (self , sha1_sigs ):
440
440
"""Constructor.
441
441
"""
442
442
443
- # Flag that determines whether the signature is a md5 digest or
443
+ # Flag that determines whether the signature is a sha1 digest or
444
444
# the modification time
445
445
# (this flag is passed to the filename_repository_t class)
446
- self ._md5_sigs = md5_sigs
446
+ self ._sha1_sigs = sha1_sigs
447
447
448
448
# ID lookup table (key: filename / value: id_)
449
449
self .__id_lut = {}
@@ -524,18 +524,18 @@ def _get_signature(self, entry):
524
524
"""Return the signature of the file stored in entry.
525
525
"""
526
526
527
- if self ._md5_sigs :
528
- # return md5 digest of the file content...
527
+ if self ._sha1_sigs :
528
+ # return sha1 digest of the file content...
529
529
if not os .path .exists (entry .filename ):
530
530
return None
531
531
try :
532
532
f = open (entry .filename )
533
533
except IOError as e :
534
- print ("Cannot determine md5 digest:" , e )
534
+ print ("Cannot determine sha1 digest:" , e )
535
535
return None
536
536
data = f .read ()
537
537
f .close ()
538
- return hashlib .md5 (data ).digest ()
538
+ return hashlib .sha1 (data ).digest ()
539
539
else :
540
540
# return file modification date...
541
541
try :
0 commit comments