A little python package that helps loading externally managed SCons tools.
To install module from pypi, type
pip install scons-tool-loader
or, if your project uses pipenv:
pipenv install --dev scons-tool-loader
Alternativelly, you may add this to your Pipfile
[dev-packages]
scons-tool-loader = "*"
This will install a namespaced package sconstool.loader
in project's
virtual environment.
The "standard" namespace for pip-managed SCons tools is assumed to be
sconstool
namespace. In the following examples we assume that tools are
installed as namespaced packages, under sconstool
namespace. This is
exactly how all the tools developed by the original author of the
scons-tool-loader get installed.
For example, the following code
pip install scons-tool-clang
will install clang
tool as sconstool.clang
package. Once installed, it
may be used in a SCons script by extending default toolpath and loading the
tool to the construction environment
# SConstruct
import sconstool.loader
sconstool.loader.extend_toolpath()
env = Environment(tools=['default', 'sconstool.clang'])
env.Program('test.c')
If, for some reason, fully qualified package name can't be used as the tool name, one may use "transparent" mode when extending toolpath
# SConstruct
import sconstool.loader
sconstool.loader.extend_toolpath(transparent=True)
env = Environment(tools=['default', 'clang'])
env.Program('test.c')
The above code will still load the sconstool.clang
tool.
Suppose, some tools get installed into vendor
namespace. For example,
vendor.foo
and vendor.bar
are installed somewhere under sys.path
.
These tools may be made visible to scons by using namespace
parameter,
and scan
.
# SConstruct
import sconstool.loader
sconstool.loader.extend_toolpath(namespace='vendor', scan=True)
env = Environment(tools=['default', 'sconstool.clang', 'vendor.foo', 'vendor.bar'])
# ...
See the online documentation.
Copyright (c) 2018-2020 by Paweł Tomulik <ptomulik@meil.pw.edu.pl>
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