Updates to RELEASE.txt including notice about switching default parallel scheduler...
[scons.git] / scripts / scons-configure-cache.py
blob8f81d8aec579cec0769cc5146ed617b2238953ad
1 #! /usr/bin/env python
3 # SCons - a Software Constructor
5 # MIT License
7 # Copyright The SCons Foundation
9 # Permission is hereby granted, free of charge, to any person obtaining
10 # a copy of this software and associated documentation files (the
11 # "Software"), to deal in the Software without restriction, including
12 # without limitation the rights to use, copy, modify, merge, publish,
13 # distribute, sublicense, and/or sell copies of the Software, and to
14 # permit persons to whom the Software is furnished to do so, subject to
15 # the following conditions:
17 # The above copyright notice and this permission notice shall be included
18 # in all copies or substantial portions of the Software.
20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
21 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
22 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 """Show or convert the configuration of an SCons cache directory.
30 A cache of derived files is stored by file signature.
31 The files are split into directories named by the first few
32 digits of the signature. The prefix length used for directory
33 names can be changed by this script.
34 """
35 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
37 __version__ = "__VERSION__"
39 __build__ = "__BUILD__"
41 __buildsys__ = "__BUILDSYS__"
43 __date__ = "__DATE__"
45 __developer__ = "__DEVELOPER__"
48 import os
49 import sys
51 # python compatibility check
52 if sys.version_info < (3, 6, 0):
53 msg = "scons: *** SCons version %s does not run under Python version %s.\n\
54 Python >= 3.5 is required.\n"
55 sys.stderr.write(msg % (__version__, sys.version.split()[0]))
56 sys.exit(1)
58 # Strip the script directory from sys.path so on case-insensitive
59 # (WIN32) systems Python doesn't think that the "scons" script is the
60 # "SCons" package.
61 script_dir = os.path.dirname(os.path.realpath(__file__))
62 script_path = os.path.realpath(os.path.dirname(__file__))
63 if script_path in sys.path:
64 sys.path.remove(script_path)
66 libs = []
68 if "SCONS_LIB_DIR" in os.environ:
69 libs.append(os.environ["SCONS_LIB_DIR"])
71 # running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR
72 source_path = os.path.join(script_path, os.pardir)
73 if os.path.isdir(source_path):
74 libs.append(source_path)
76 # add local-install locations
77 local_version = 'scons-local-' + __version__
78 local = 'scons-local'
79 if script_dir:
80 local_version = os.path.join(script_dir, local_version)
81 local = os.path.join(script_dir, local)
82 if os.path.isdir(local_version):
83 libs.append(os.path.abspath(local_version))
84 if os.path.isdir(local):
85 libs.append(os.path.abspath(local))
87 scons_version = 'scons-%s' % __version__
89 sys.path = libs + sys.path
91 ##############################################################################
92 # END STANDARD SCons SCRIPT HEADER
93 ##############################################################################
94 from SCons.Utilities.ConfigureCache import main
96 if __name__ == "__main__":
97 main()