Skip to main content

A catch-all compile-tool wrapper

Project description

blight

CI

blight is a framework for wrapping and instrumenting build tools.

Usage

$ pip3 install blight
$ eval $(blight-env --guess-wrapped)
$ export BLIGHT_ACTIONS="Record"
$ export BLIGHT_ACTION_RECORD="output=/tmp/demo.jsonl"
$ cd /your/project && make
$ cat /tmp/demo.jsonl

Goals

  • Wrapping CC, CXX, CPP, LD, AS, AR, and STRIP.
  • 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 every exec 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


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.32.tar.gz (29.1 kB view details)

Uploaded Source

File details

Details for the file blight-0.0.32.tar.gz.

File metadata

  • Download URL: blight-0.0.32.tar.gz
  • Upload date:
  • Size: 29.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for blight-0.0.32.tar.gz
Algorithm Hash digest
SHA256 6c1408f7a16c8b7a550913b7854d1f9d5d8dc25657ae798e8627c27156fd12f3
MD5 2d6caca046c532e304e4f51172bbee70
BLAKE2b-256 7ca0c0ca4e4bcc716fd938a1c201fe4edd4167bf122dedb13c3964feda1a5eb3

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page