bits-400 released with these changes:

This release of BITS incorporates Python. You can now run Python expressions on the command line, and import Python modules from .py files in /boot/python. As a demonstration, we have included a port of the ACPI exploratory menu to a Python script.

You can run Python expressions from the BITS command line using the new "py" command: py 'python expression'. For example:

py 'print "Hello from Python!"'

To run larger quantities of Python code, put it in a module in the /boot/python directory (included in the default module load path), and import it from a Python expression. For example:

py 'import acpi'
py 'acpi.display_pss()'

BITS provides a built-in module "bits" which includes some preliminary bindings to existing BITS functionality; these bindings will expand significantly in subsequent releases, to expose the full functionality currently exposed as GRUB commands. Some examples:

py 'import bits'
py 'print "TSC: 0x%x" % bits.rdmsr(0, 0x10)'
py 'print bits.acpi_eval("\\_PR_.CPU0._PSS")'
py 'print repr(bits.acpi_get_table("APIC"))'

We currently provide a few other built-in modules, including the "struct" module for decoding more complex binary structures. Future releases will include more of the Python standard library as needed.

A few notable limitations: - Floating-point functions will fail when called. - Many file-related functions have limitations based on those of GRUB, and/or things we didn't feel like implementing (such as ungetc and reading from stdin). - No dynamic loading of binary modules; only modules built-in at compile time, and Python source modules.

Other changes in this release:

  • Bugfixes in the existing ACPI menuentries based on GRUB scripting.