Skip to main content

Library implementing common processes and logging for buildsystems

Project description


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.


from buildtools import os_utils

# Ensure test/ exists

# 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

# 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)

# 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)


from buildtools import log

def a():'This will be indented if a() is called in a log block.')'No indentation, yet.')
with log.warning('A warning. Next line will be indented.'):
  with'The following function\'s log output will be indented by another layer.')
    log.critical('So will %s!', 'this')


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/']))
bm.add(CoffeeBuildTarget('htdocs/js/editpoll.multichoice.js', ['coffee/'], dependencies=['htdocs/js/vgws.js']))
bm.add(CoffeeBuildTarget('htdocs/js/editpoll.option.js',      ['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.

# Same as above, but providing command line arguments such as --clean, and --rebuild.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pybuildtools, version 0.4.3
Filename, size File type Python version Upload date Hashes
Filename, size pybuildtools-0.4.3-py3-none-any.whl (121.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pybuildtools-0.4.3.tar.gz (70.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page