A set of tools for putting together buildscripts and other CLI applications
Project description
python-build-tools
A toolkit containing many powerful utilities, including:
- OS utilities (buildtools.os_utils)
- Indented logging with colorama support (buildtools.bt_logging.log)
- The powerful Maestro build management system (buildtools.maestro)
- A powerful VCS repository wrapper system (buildtools.repo)
- A mess of other random things.
This is mostly a personal toolkit that grew out of control.
os_utils
from buildtools import os_utils
# Ensure test/ exists
os_utils.ensureDirExists('test')
# Get copy of current environmental variables.
ENV = os_utils.ENV.clone()
# Add .bin/ to the beginning of PATH in our virtual environment
ENV.prependTo('PATH', '.bin/')
# Remove any duplicate entries from PATH
ENV.removeDuplicatedEntries('PATH')
# Find gcc in our virtual environment (checks PATHEXT on Windows, too!)
# Returns the path to gcc, or None if it couldn't be found.
GCC = ENV.which('gcc')
# Ensure bash exists before continuing (same rules as above)
ENV.assertWhich('bash')
# Bring up gcc's help page. Crash if non-0 exit code, echo command to console, and output STDOUT/STDERR to console.
os_utils.cmd([GCC, '--help'], critical=True, echo=True, show_output=True)
Logging
from buildtools import log
def a():
log.info('This will be indented if a() is called in a log block.')
log.info('No indentation, yet.')
with log.warning('A warning. Next line will be indented.'):
log.error('Error!')
with log.info('The following function\'s log output will be indented by another layer.')
a()
log.critical('So will %s!', 'this')
Maestro
Maestro is currently synchronous, with plans to make it async.
from buildtools.maestro import BuildMaestro
from buildtools.maestro.fileio import ReplaceTextTarget
from buildtools.maestro.coffeescript import CoffeeBuildTarget
from buildtools.maestro.web import SCSSBuildTarget, SCSSConvertTarget
bm = BuildMaestro()
# Compile CoffeeScript to JS
bm.add(CoffeeBuildTarget('htdocs/js/vgws.js', ['coffee/src/vgws.coffee']))
bm.add(CoffeeBuildTarget('htdocs/js/editpoll.multichoice.js', ['coffee/editpoll.multichoice.coffee'], dependencies=['htdocs/js/vgws.js']))
bm.add(CoffeeBuildTarget('htdocs/js/editpoll.option.js', ['coffee/editpoll.editpoll.coffee'], dependencies=['htdocs/js/vgws.js']))
# Convert CSS to SCSS
bm.add(SCSSBuildTarget('htdocs/css/style.css', ['style/style.scss'], [], import_paths=['style'], compass=True))
# Compile, taking dependencies into count when ordering operations.
bm.run()
# Same as above, but providing command line arguments such as --clean, and --rebuild.
bm.as_app()
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
pybuildtools-0.7.3.tar.gz
(81.9 kB
view details)
Built Distribution
pybuildtools-0.7.3-py3-none-any.whl
(135.3 kB
view details)
File details
Details for the file pybuildtools-0.7.3.tar.gz
.
File metadata
- Download URL: pybuildtools-0.7.3.tar.gz
- Upload date:
- Size: 81.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e302a8db6f5559592337ef4f4e1b73ae7d21e52dec953b4088681d0d93ac176f |
|
MD5 | 611c2e9c3cd9f3e1da2a55331fad7967 |
|
BLAKE2b-256 | ae0856c33566fbdc3e0f63938557d4286f707c76493439af8c4ed7f9cba54987 |
File details
Details for the file pybuildtools-0.7.3-py3-none-any.whl
.
File metadata
- Download URL: pybuildtools-0.7.3-py3-none-any.whl
- Upload date:
- Size: 135.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b02f33a7e23e9639b03a25b16b745bae53d6096d74a1e01401cbcbf73e03b1bf |
|
MD5 | c14cc5de52a46b7d75f7a270dd34ffdb |
|
BLAKE2b-256 | d479e7ef42ea1b9aa6def398f08edf90430fa33df6bb6d24f592dcd7a8450d58 |