Skip to main content

SCons builders.

Project description

Miniscons

SCons builders.

Review Version Downloads Quality Coverage

Motivation

When writing an SConstruct.py configuration it is difficult to:

  • Specify libraries and warnings for each build since the default environment is global
  • Declare executable targets that depend on builds and don't need to be built themselves
  • Parse outputs from conan to get include paths for build dependencies since they don't appear in the exported conandeps
  • Declare and chain together aliases for external scripts

We can use miniscons to keep the SConstruct.py file short and get an interface like this:

builds: build
  tests

targets: start -> build
  test -> tests

scripts: clang-tidy
  cppclean

routines: lint -> [clang-tidy, cppclean]

flags: --dump

Installing

pip install miniscons

Documentation

Documentation and more detailed examples are hosted on Github Pages.

 Usage

Parse the SConscript_conandeps if you are using conan:

from miniscons import conan

env = conan()

Add the builds with their specific warning flags and libs to include:

from miniscons import Build, flags, packages
from walkmate import tree

build = Build(
    "build",
    tree("src", r"(?<!\.spec)\.cpp$"),
    flags("c++11", ["shadow"]),
)

tests = Build(
    "tests",
    tree("src", r"\.cpp$", ["main.cpp"]),
    flags("c++11"),
    packages(["gtest"]),
)

Add the executable targets that depend on the builds with their runtime arguments:

from miniscons import Target

start = Target("start", build)

test = Target("test", tests, ["--gtest_brief"])

Add the scripts to invoke your tooling:

from miniscons import Script
from walkmate import tree

cppclean = Script("cppclean", ["."])

includes = tests.packages["CPPPATH"]

tidy = Script(
    "clang-tidy",
    [tree("src", r"\.(cpp)$"), "--", [f"-I{i}" for i in includes]],
)

Add the routines and flags for your interface:

from miniscons import Flag, Routine

lint = Routine("lint", [cppclean, tidy])

dump = Flag("--dump")

Register all the declarations with the environment and add handlers for each flag:

from miniscons import Tasks
from SCons.Script.Main import GetOption

cli = Tasks(
    [build, tests],
    [start, test],
    [tidy, cppclean],
    [lint],
    [dump],
)

cli.register(env)

if GetOption("dump"):
    cli.dump()

Now if we run

scons --dump

We get our interface:

scons: Reading SConscript files ...

builds: build
  tests

targets: start -> build
  test -> tests

scripts: clang-tidy
  cppclean

routines: lint -> [clang-tidy, cppclean]

flags: --dump

Discussion

Why not use a simple task runner for scripts and routines?

Some scripts need access to the include paths that appear in the SConstruct.py file so they need to be integrated into the scons workflow.

Tooling

Dependencies

To install dependencies:

yarn install
pip install .[all]

Tests

To run tests:

thx test

Documentation

To generate the documentation locally:

thx docs

Linters

To run linters:

thx lint

Formatters

To run formatters:

thx format

Contributing

Please read this repository's Code of Conduct which outlines our collaboration standards and the Changelog for details on breaking changes that have been made.

This repository adheres to semantic versioning standards. For more information on semantic versioning visit SemVer.

Bump2version is used to version and tag changes. For example:

bump2version patch

Contributors

Remarks

Lots of love to the open source community!

Be kind to your mind Love each other It's ok to have a bad day

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

miniscons-0.11.3.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

miniscons-0.11.3-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file miniscons-0.11.3.tar.gz.

File metadata

  • Download URL: miniscons-0.11.3.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for miniscons-0.11.3.tar.gz
Algorithm Hash digest
SHA256 6eb4ea339776b9afe97eaea20063cd3ec36669adc9f6f4576871b022f85f0eb5
MD5 3d11da7329c463c5eb774b87c6c8d176
BLAKE2b-256 6f9f5d0c0b9853ae33a679c52ae5021dd909a3250e261449d8d42a6b236a843a

See more details on using hashes here.

Provenance

The following attestation bundles were made for miniscons-0.11.3.tar.gz:

Publisher: publish.yml on JoelLefkowitz/miniscons

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file miniscons-0.11.3-py3-none-any.whl.

File metadata

  • Download URL: miniscons-0.11.3-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for miniscons-0.11.3-py3-none-any.whl
Algorithm Hash digest
SHA256 33bee3c4f74b78dbcbf73e8375fbbc6b508c3640afdecc8f0c7286fc60b123dc
MD5 8d21f4e526bf564a795c4cfe7ffd2a9e
BLAKE2b-256 87770251345ec2c1db7b7d6b140a62ada89d80c77144bdb4e4eb42ca956e3d23

See more details on using hashes here.

Provenance

The following attestation bundles were made for miniscons-0.11.3-py3-none-any.whl:

Publisher: publish.yml on JoelLefkowitz/miniscons

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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