py-xbc
py-xbc is a pure-Python library for reading and writing files in the
eXtra BootConfig (XBC) file format specified by the Linux kernel. This
is not a strictly-conforming implementation: in particular, this
implementation does not enforce the 32,767-byte ceiling on XBC files,
nor does it enforce the 16-level cap on keys and blocks.
Requirements
py-xbc currently requires pyparsing and Python 3.7+.
Usage
py-xbc exports four functions:
loads_xbcparses a string.load_xbcopens a file and then parses a string.saves_xbcrenders to a string.save_xbcrenders to a string and writes the string to a file.
Format
XBC files consist of a series of statements, of which there are three kinds:
-
A key is a sequence of one or more bytes in the range
a-zA-Z0-9_-. They are namespaced with periods (.) and may be followed by an equals sign (=). Key statements are terminated by a semicolon (;), a linefeed, or a semicolon followed by a linefeed. -
A key/value statement is a key followed by an operator, followed in turn by one or more values. There are three operators:
- Assignment (
=) specifies an initial value. - Updates (
:=) overwrites whatever value was previously there. - Appends (
+=) appends one or more values.
There are two kinds of values: strings and arrays. Strings can be either 'bare' or quoted.
- Bare strings are a sequence of one or more bytes that are not in the
range
{}#=+:;,\n'". - Quoted strings are a sequence of bytes that begins with a single
quote (
') or a double quote (") and ends only with the same quote. Quotes cannot be escaped. - Arrays are a sequence of one or more values delimited by a comma
(
,).
- Assignment (
-
A block is a key followed by a pair of curly braces, inside which is one or more key or key/value statements.
Keys are composable. The following examples are equivalent:
foo {
bar {
fluff = 1
}
}
# is equivalent to
foo.bar.fluff = 1
# is equivalent to
foo.bar { fluff = 1 }
# is equivalent to
foo { bar.fluff = 1 }
Licence
py-xbc is published under the MIT license. See LICENSE.txt for more
information.
Metadata
Release files for py-xbc 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py-xbc-0.1.2.tar.gz | 11.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_xbc-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.7 kB
Release files / py-xbc-0.1.2.tar.gz
| Download URL | py-xbc-0.1.2.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
420ba7a7e33b635f4cd05aff5be052fb92504554e02278d1d31eb069cacb5c2d
|
|
BLAKE2b-256 checksum How to use checksums |
397c952ecae9bf7d761c8e6e912563bec715db96a861d0d9adaf6810065f7511
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / py_xbc-0.1.2-py3-none-any.whl
| Download URL | py_xbc-0.1.2-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1f12622c702c99c3f0f813c87b74e6d748106e6b34ad73a44c012715607d5b7e
|
|
BLAKE2b-256 checksum How to use checksums |
fc6a4c932ef1b39b09989ed33b5b398c4352c86822c8251d1092defc668ce9b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|