summaryrefslogtreecommitdiffstats
path: root/SCons/SConsign.py
diff options
context:
space:
mode:
authorJacob Cassagnol <87133045+jcassagnol-public@users.noreply.github.com>2021-11-10 00:03:39 (GMT)
committerJacob Cassagnol <87133045+jcassagnol-public@users.noreply.github.com>2021-11-10 00:03:39 (GMT)
commitd83d77dd881e683decc1b957f8b0fc3a9d4b8b40 (patch)
tree2d315d6e4632b79b9d3d54c59394edc9a385596a /SCons/SConsign.py
parent3a7e06174766bfb40d64e16758543bdf313a134d (diff)
downloadSCons-d83d77dd881e683decc1b957f8b0fc3a9d4b8b40.zip
SCons-d83d77dd881e683decc1b957f8b0fc3a9d4b8b40.tar.gz
SCons-d83d77dd881e683decc1b957f8b0fc3a9d4b8b40.tar.bz2
Normalized all sconsfiles and sub-sconsfiles to use algorithm if not defaulted to md5.
Dir search now excludes all types of sconsfiles that are now created. Environment now defaults to the current scons filename instead of .sconsfile Sconsign now has a function used by a lot of code that gets the default sconsign filename Any tests referring to .sconsfile have now been changed, including one old legacy test.
Diffstat (limited to 'SCons/SConsign.py')
-rw-r--r--SCons/SConsign.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/SCons/SConsign.py b/SCons/SConsign.py
index 95ceac1..5b78855 100644
--- a/SCons/SConsign.py
+++ b/SCons/SConsign.py
@@ -58,23 +58,25 @@ DB_Module = SCons.dblite
DB_Name = None
DB_sync_list = []
+def current_sconsign_filename():
+ hash_format = SCons.Util.get_hash_format()
+ current_hash_algorithm = SCons.Util.get_current_hash_algorithm_used()
+ # if the user left the options defaulted AND the default algorithm set by
+ # SCons is md5, then set the database name to be the special default name
+ #
+ # otherwise, if it defaults to something like 'sha1' or the user explicitly
+ # set 'md5' as the hash format, set the database name to .sconsign_<algorithm>
+ # eg .sconsign_sha1, etc.
+ if hash_format is None and current_hash_algorithm == 'md5':
+ return ".sconsign"
+ else:
+ return ".sconsign_" + current_hash_algorithm
def Get_DataBase(dir):
global DataBase, DB_Module, DB_Name
if DB_Name is None:
- hash_format = SCons.Util.get_hash_format()
- current_hash_algorithm = SCons.Util.get_current_hash_algorithm_used()
- # if the user left the options defaulted AND the default algorithm set by
- # SCons is md5, then set the database name to be the special default name
- #
- # otherwise, if it defaults to something like 'sha1' or the user explicitly
- # set 'md5' as the hash format, set the database name to .sconsign_<algorithm>
- # eg .sconsign_sha1, etc.
- if hash_format is None and current_hash_algorithm == 'md5':
- DB_Name = ".sconsign"
- else:
- DB_Name = ".sconsign_%s" % current_hash_algorithm
+ DB_Name = current_sconsign_filename()
top = dir.fs.Top
if not os.path.isabs(DB_Name) and top.repositories:
@@ -342,7 +344,7 @@ class DirFile(Dir):
"""
self.dir = dir
- self.sconsign = os.path.join(dir.get_internal_path(), '.sconsign')
+ self.sconsign = os.path.join(dir.get_internal_path(), current_sconsign_filename())
try:
fp = open(self.sconsign, 'rb')