Skip to content

Latest commit

 

History

History
48 lines (32 loc) · 1.15 KB

build.rst

File metadata and controls

48 lines (32 loc) · 1.15 KB

The Build Object

The core functionality in Uranium is contained inside the build object. The build is an interface the environment that uranium is building: You can use the various attributes to manipulate it.

Examples include:

  • build.packages to modify packages
  • build.envvars to modify environment variables

And so on. For tasks, the build object is always passed in as the only argument:

def main(build):
    print(build.root)

uranium.current_build

There are situations where one needs to bootstrap a ubuild.py before executing a task, such as installing hooks or setting configuration.

In that situation, uranium.current_build works well: It is a proxy object that returns back whatever build object is currently executing:

from uranium import current_build
current_build.config.set_defaults({"debug": False})

def main(build):
    if build.config["debug"]:
        print("debug message")

Full API Reference

uranium.build.Build