diff options
author | William Deegan <bill@baddogconsulting.com> | 2020-03-21 23:35:56 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2020-04-09 20:47:32 (GMT) |
commit | 072ebad9f866bdb4b79f5309071c0a92df1e21be (patch) | |
tree | 6a78442474f32f913fd0d90db6522d7f727dbbca | |
parent | 23197f27e50f9f66d9f7263fbac5c38855731922 (diff) | |
download | SCons-072ebad9f866bdb4b79f5309071c0a92df1e21be.zip SCons-072ebad9f866bdb4b79f5309071c0a92df1e21be.tar.gz SCons-072ebad9f866bdb4b79f5309071c0a92df1e21be.tar.bz2 |
Move scripts from src/scripts to scripts. Simplify scons.py to only be used for running from this source tree and for scons-local packaging
-rw-r--r-- | scripts/MANIFEST.in (renamed from src/script/MANIFEST.in) | 0 | ||||
-rw-r--r-- | scripts/scons-configure-cache.py (renamed from src/script/scons-configure-cache.py) | 0 | ||||
-rw-r--r-- | scripts/scons-time.py (renamed from src/script/scons-time.py) | 0 | ||||
-rw-r--r-- | scripts/scons.bat (renamed from src/script/scons.bat) | 0 | ||||
-rwxr-xr-x | scripts/scons.py | 102 | ||||
-rw-r--r-- | scripts/sconsign.py (renamed from src/script/sconsign.py) | 0 | ||||
-rwxr-xr-x | src/script/scons.py | 208 |
7 files changed, 102 insertions, 208 deletions
diff --git a/src/script/MANIFEST.in b/scripts/MANIFEST.in index d10cc82..d10cc82 100644 --- a/src/script/MANIFEST.in +++ b/scripts/MANIFEST.in diff --git a/src/script/scons-configure-cache.py b/scripts/scons-configure-cache.py index 716315c..716315c 100644 --- a/src/script/scons-configure-cache.py +++ b/scripts/scons-configure-cache.py diff --git a/src/script/scons-time.py b/scripts/scons-time.py index e4dd863..e4dd863 100644 --- a/src/script/scons-time.py +++ b/scripts/scons-time.py diff --git a/src/script/scons.bat b/scripts/scons.bat index 10b8637..10b8637 100644 --- a/src/script/scons.bat +++ b/scripts/scons.bat diff --git a/scripts/scons.py b/scripts/scons.py new file mode 100755 index 0000000..1dc6c78 --- /dev/null +++ b/scripts/scons.py @@ -0,0 +1,102 @@ +#! /usr/bin/env python +# +# SCons - a Software Constructor +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +__version__ = "__VERSION__" + +__build__ = "__BUILD__" + +__buildsys__ = "__BUILDSYS__" + +__date__ = "__DATE__" + +__developer__ = "__DEVELOPER__" + + +import os +import sys + + +# Python compatibility check +if sys.version_info < (3, 5, 0): + msg = "scons: *** SCons version %s does not run under Python version %s.\n\ +Python >= 3.5 is required.\n" + sys.stderr.write(msg % (__version__, sys.version.split()[0])) + sys.exit(1) + +# Strip the script directory from sys.path so on case-insensitive +# (WIN32) systems Python doesn't think that the "scons" script is the +# "SCons" package. +script_dir = os.path.dirname(os.path.realpath(__file__)) +script_path = os.path.realpath(os.path.dirname(__file__)) +if script_path in sys.path: + sys.path.remove(script_path) + +libs = [] + +if "SCONS_LIB_DIR" in os.environ: + libs.append(os.environ["SCONS_LIB_DIR"]) + +# running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR +source_path = os.path.join(script_path, os.pardir, 'src', 'engine') +if os.path.isdir(source_path): + libs.append(source_path) + +# add local-install locations +local_version = 'scons-local-' + __version__ +local = 'scons-local' +if script_dir: + local_version = os.path.join(script_dir, local_version) + local = os.path.join(script_dir, local) +if os.path.isdir(local_version): + libs.append(os.path.abspath(local_version)) +if os.path.isdir(local): + libs.append(os.path.abspath(local)) + +sys.path = libs + sys.path + +############################################################################## +# END STANDARD SCons SCRIPT HEADER +############################################################################## + +if __name__ == "__main__": + try: + import SCons.Script + except ImportError: + sys.stderr.write("SCons import failed. Unable to find engine files in:\n") + for path in libs: + sys.stderr.write(" {}\n".format(path)) + raise + + # this does all the work, and calls sys.exit + # with the proper exit status when done. + SCons.Script.main() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/src/script/sconsign.py b/scripts/sconsign.py index 726838c..726838c 100644 --- a/src/script/sconsign.py +++ b/scripts/sconsign.py diff --git a/src/script/scons.py b/src/script/scons.py deleted file mode 100755 index 1e12898..0000000 --- a/src/script/scons.py +++ /dev/null @@ -1,208 +0,0 @@ -#! /usr/bin/env python -# -# SCons - a Software Constructor -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -__version__ = "__VERSION__" - -__build__ = "__BUILD__" - -__buildsys__ = "__BUILDSYS__" - -__date__ = "__DATE__" - -__developer__ = "__DEVELOPER__" - -# This is the entry point to the SCons program. -# The only job of this script is to work out where the guts of the program -# could be and import them, where the real work begins. -# SCons can be invoked several different ways -# - from an installed location -# - from a "local install" copy -# - from a source tree, which has a different dir struture than the other two -# Try to account for all those possibilities. - -import os -import sys - -############################################################################## -# BEGIN STANDARD SCons SCRIPT HEADER -# -# This is the cut-and-paste logic so that a self-contained script can -# interoperate correctly with different SCons versions and installation -# locations for the engine. If you modify anything in this section, you -# should also change other scripts that use this same header. -############################################################################## - -# compatibility check -if sys.version_info < (3,5,0): - msg = "scons: *** SCons version %s does not run under Python version %s.\n\ -Python >= 3.5 is required.\n" - sys.stderr.write(msg % (__version__, sys.version.split()[0])) - sys.exit(1) - -# Strip the script directory from sys.path so on case-insensitive -# (WIN32) systems Python doesn't think that the "scons" script is the -# "SCons" package. -script_dir = os.path.dirname(os.path.realpath(__file__)) -script_path = os.path.realpath(os.path.dirname(__file__)) -if script_path in sys.path: - sys.path.remove(script_path) - -libs = [] - -if "SCONS_LIB_DIR" in os.environ: - libs.append(os.environ["SCONS_LIB_DIR"]) - -# running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR -source_path = os.path.join(script_path, os.pardir, 'engine') -if os.path.isdir(source_path): - libs.append(source_path) - -# add local-install locations -local_version = 'scons-local-' + __version__ -local = 'scons-local' -if script_dir: - local_version = os.path.join(script_dir, local_version) - local = os.path.join(script_dir, local) -if os.path.isdir(local_version): - libs.append(os.path.abspath(local_version)) -if os.path.isdir(local): - libs.append(os.path.abspath(local)) - -scons_version = 'scons-%s' % __version__ - -# preferred order of scons lookup paths -prefs = [] - -# if we can find package information, use it -try: - import pkg_resources -except ImportError: - pass -else: - try: - d = pkg_resources.get_distribution('scons') - except pkg_resources.DistributionNotFound: - pass - else: - prefs.append(d.location) - -if sys.platform == 'win32': - # Use only sys.prefix on Windows - prefs.append(sys.prefix) - prefs.append(os.path.join(sys.prefix, 'Lib', 'site-packages')) -else: - # On other (POSIX) platforms, things are more complicated due to - # the variety of path names and library locations. - # Build up some possibilities, then transform them into candidates - temp = [] - if script_dir == 'bin': - # script_dir is `pwd`/bin; - # check `pwd`/lib/scons*. - temp.append(os.getcwd()) - else: - if script_dir == '.' or script_dir == '': - script_dir = os.getcwd() - head, tail = os.path.split(script_dir) - if tail == "bin": - # script_dir is /foo/bin; - # check /foo/lib/scons*. - temp.append(head) - - head, tail = os.path.split(sys.prefix) - if tail == "usr": - # sys.prefix is /foo/usr; - # check /foo/usr/lib/scons* first, - # then /foo/usr/local/lib/scons*. - temp.append(sys.prefix) - temp.append(os.path.join(sys.prefix, "local")) - elif tail == "local": - h, t = os.path.split(head) - if t == "usr": - # sys.prefix is /foo/usr/local; - # check /foo/usr/local/lib/scons* first, - # then /foo/usr/lib/scons*. - temp.append(sys.prefix) - temp.append(head) - else: - # sys.prefix is /foo/local; - # check only /foo/local/lib/scons*. - temp.append(sys.prefix) - else: - # sys.prefix is /foo (ends in neither /usr or /local); - # check only /foo/lib/scons*. - temp.append(sys.prefix) - - # suffix these to add to our original prefs: - prefs.extend([os.path.join(x, 'lib') for x in temp]) - prefs.extend([os.path.join(x, 'lib', 'python' + sys.version[:3], - 'site-packages') for x in temp]) - - - # Add the parent directory of the current python's library to the - # preferences. This picks up differences between, e.g., lib and lib64, - # and finds the base location in case of a non-copying virtualenv. - try: - libpath = os.__file__ - except AttributeError: - pass - else: - # Split /usr/libfoo/python*/os.py to /usr/libfoo/python*. - libpath, tail = os.path.split(libpath) - # Split /usr/libfoo/python* to /usr/libfoo - libpath, tail = os.path.split(libpath) - # Check /usr/libfoo/scons*. - prefs.append(libpath) - -# Look first for 'scons-__version__' in all of our preference libs, -# then for 'scons'. Skip paths that do not exist. -libs.extend([os.path.join(x, scons_version) for x in prefs if os.path.isdir(x)]) -libs.extend([os.path.join(x, 'scons') for x in prefs if os.path.isdir(x)]) - -sys.path = libs + sys.path - -############################################################################## -# END STANDARD SCons SCRIPT HEADER -############################################################################## - -if __name__ == "__main__": - try: - import SCons.Script - except ImportError: - sys.stderr.write("SCons import failed. Unable to find engine files in:\n") - for path in libs: - sys.stderr.write(" {}\n".format(path)) - raise - - # this does all the work, and calls sys.exit - # with the proper exit status when done. - SCons.Script.main() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: |