Package: ubuild
A no-frills build script framework.IntroductionThis project provides a Python 3.3+ library/utility for creating build
scripts. The main features of Ubuild are:Streamlines the discoverability of build steps/tasks.Build step/task details are captured in Python functions.Provides a CLI menu to show available build steps/tasks.Provides a CLI utilityubuildto locate and run build scripts.StatusCurrently, this project is in thedevelopment releasestage. While
this project is suitable for use, please note that there may be
incompatibilities in new releases.Release notes are maintained in the projectchangelog.RequirementsUbuild should run on any Python 3.3+ interpreter with some additional
third-party libraries (installed automatically).InstallationUbuild isavailable on PyPI
hereand can be installed with
pip using the following command:pip install ubuildAdditionally, Ubuild can be installed from source by running:python setup.py installUsageCreate a_Build.pyfile. Importubuildand use themenudecorator to add functions to the build menu. Use themainfunction
to show the menu. For example:fromubuildimportmenu,main@menudefbuild():...@menudefclean():...main()Running this script will show the following menu:-- MENU --
  (b) Build
  (c) Clean
  (q) Quit
[!] Menu loops until quit.
[?] Enter menu selection:By default, the menu entry names are based off the function name. For
example:something()=(s) Somethingdo_something()=(ds) Do Somethingdo_something_else()=(dse) Do Something ElseHowever the names will attempt to use the shortest available name, e.g.(ds) Do Somethingwill be(d) Do Somethingif there is no
existing(d)entry.Because Ubuild is meant to be lightweight and capture build step
details, often it might be useful to useAuxlyto call other utilities.
For example:@menudefbuild():returnauxly.shell.call("make")Note thereturnon the call. This allows the exit code from themakecall to propagate up through to Ubuild, i.e. if the menu is
quit after the call, the exit code for Ubuild will be themakeexit
code.Theubuildcommand line utility can be used in two different ways:Callingubuildwithout arguments in a directory with_Build.pyor any of the child directories will show the Ubuild
menu.Callingubuildwith arguments in a directory with_Build.pyor any of the child directories will run that menu entry, e.g.ubuild b.A few additional notes about themenudecorator:@menu("x")# (x) Builddefbuild():...@menu(name="x")# (x) Builddefbuild():...@menu(desc="Something")# (s) Somethingdefbuild():...@menu("x",desc="Something")# (x) Somethingdefbuild():...@menu(desc="Flag Set",args=[True])# (fs) Flag Set@menu(desc="Flag Clear",args=[False])# (fc) Flag Cleardefbuild(flag):...@menu(desc="Flag Clear",kwargs={'flag':False})# (fc) Flag Cleardefbuild(flag=True):...Here are some real-world examples of Ubuild in action:Doctrine2QuickWinAlternative Script NamesThe default Ubuild script name is_Build.pybut occasionally it
might make sense to have an alternative name. The script must match the
following regex:_[A-Z][A-z0-9_-]*\.py$The script must also contain the following line exactly without any
changes or trailing whitespace:# -*- ubuild -*-SimilarThe following projects are similar and may be worth checking out:InvokeFAQWhy_Build.pyfor script names?This project follows the naming guidelines provided bythe Unified
Style Guide for naming user
scripts.
The name is meant to distinguish this script as being intended for
direct user interaction. For example, a name likebuild.pyis not
clear whether it is mean for a user or if it is called by something
else.Is Ubuild intended to replace other build tools?No, not at all! In fact, Ubuild is intended to supplement other build
tools by providing a simple abstraction layer for performing build
tasks. For example, a project may start usingmaketo organize
builds but later move toscons. By using Ubuild to capture the
build step details, a user need never be aware of the change. They
just see the build entry in the Ubuild menu.