A catch-all compile-tool wrapper
Project description
blight
blight
is a framework for wrapping and instrumenting build tools.
Installation
blight
is available on PyPI and is installable via pip
:
python -m pip install blight
Python 3.7 or newer is required.
Usage
# go to whatever source tree you'd like to build
cd /your/project
# configure blight and run your build system under it
export BLIGHT_ACTION_RECORD="output=/tmp/demo.jsonl"
blight-exec --action=Record --guess-wrapped make
# check the configured output
cat /tmp/demo.jsonl
Goals
- Wrapping
CC
,CXX
,CPP
,LD
,AS
,AR
,STRIP
, andINSTALL
. - Providing a visitor-style API for each of the above, pre- and post-execution.
- Providing a nice set of default actions.
- Being as non-invasive as possible.
Anti-goals
- Using
LD_PRELOAD
to capture everyexec
in a build system, a la Bear. - Supporting
cl.exe
. - Detailed support for non C/C++ languages.
Contributing a new action
New blight actions are easy to write. For example, the following prints a
message before every ld
invocation:
# src/blight/actions/printld.py
from blight.action import LDAction
class PrintLD(LDAction):
def before_run(self, tool):
print(f"ld was run with: {tool.args}")
# src/blight/actions/__init__.py
# bring PrintLD into blight.actions so that `BLIGHT_ACTIONS` can find it
from printld import PrintLD # noqa: F401
eval $(blight-env --guess-wrapped)
export BLIGHT_ACTIONS="PrintLD"
make
Check out blight's API documentation for more details, including the kinds of available actions.
The name?
Build systems and tools that instrument build systems are a blight on my productivity.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
blight-0.0.48.tar.gz
(30.3 kB
view hashes)
Built Distribution
blight-0.0.48-py3-none-any.whl
(38.0 kB
view hashes)