py-xbc


Namepy-xbc JSON
Version 0.1.2 PyPI version JSON
download
home_page
SummaryA library for manipulating eXtra BootConfig (XBC) files
upload_time2024-01-26 07:12:08
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords bootconfig xbc configuration
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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_xbc` parses a string.
- `load_xbc` opens a file and then parses a string.
- `saves_xbc` renders to a string.
- `save_xbc` renders 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
    (`,`).

- 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:

```xbc
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.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "py-xbc",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "bootconfig,xbc,configuration",
    "author": "",
    "author_email": "S\u00edle Ekaterin Liszka <sheila@vulpine.house>",
    "download_url": "https://files.pythonhosted.org/packages/39/7c/952ecae9bf7d761c8e6e912563bec715db96a861d0d9adaf6810065f7511/py-xbc-0.1.2.tar.gz",
    "platform": null,
    "description": "# py-xbc\n\n`py-xbc` is a pure-Python library for reading and writing files in the\neXtra BootConfig (XBC) file format specified by the Linux kernel. This\nis not a strictly-conforming implementation: in particular, this\nimplementation does not enforce the 32,767-byte ceiling on XBC files,\nnor does it enforce the 16-level cap on keys and blocks.\n\n# Requirements\n\n`py-xbc` currently requires `pyparsing` and Python 3.7+.\n\n# Usage\n\n`py-xbc` exports four functions:\n\n- `loads_xbc` parses a string.\n- `load_xbc` opens a file and then parses a string.\n- `saves_xbc` renders to a string.\n- `save_xbc` renders to a string and writes the string to a file.\n\n## Format\n\nXBC files consist of a series of statements, of which there are three\nkinds:\n\n- A key is a sequence of one or more bytes in the range `a-zA-Z0-9_-`.\n  They are namespaced with periods (`.`) and may be followed by an\n  equals sign (`=`). Key statements are terminated by a semicolon (`;`),\n  a linefeed, or a semicolon followed by a linefeed.\n\n- A key/value statement is a key followed by an operator, followed in\n  turn by one or more values. There are three operators:\n\n  - Assignment (`=`) specifies an initial value.\n  - Updates (`:=`) overwrites whatever value was previously there.\n  - Appends (`+=`) appends one or more values.\n\n  There are two kinds of values: strings and arrays. Strings can be\n  either 'bare' or quoted.\n\n  - Bare strings are a sequence of one or more bytes that are not in the\n    range `{}#=+:;,\\n'\" `.\n  - Quoted strings are a sequence of bytes that begins with a single\n    quote (`'`) or a double quote (`\"`) and ends only with the same\n    quote. Quotes cannot be escaped.\n  - Arrays are a sequence of one or more values delimited by a comma\n    (`,`).\n\n- A block is a key followed by a pair of curly braces, inside which is\n  one or more key or key/value statements.\n\nKeys are composable. The following examples are equivalent:\n\n```xbc\nfoo {\n    bar {\n        fluff = 1\n    }\n}\n# is equivalent to\nfoo.bar.fluff = 1\n# is equivalent to\nfoo.bar { fluff = 1 }\n# is equivalent to\nfoo { bar.fluff = 1 }\n```\n\n# Licence\n\n`py-xbc` is published under the MIT license. See `LICENSE.txt` for more\ninformation.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A library for manipulating eXtra BootConfig (XBC) files",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://gitea.treehouse.systems/VulpineAmethyst/py-xbc",
        "Issues": "https://gitea.treehouse.systems/VulpineAmethyst/py-xbc/issues"
    },
    "split_keywords": [
        "bootconfig",
        "xbc",
        "configuration"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fc6a4c932ef1b39b09989ed33b5b398c4352c86822c8251d1092defc668ce9b1",
                "md5": "0008b335acb88a071878c2b5c43fca6a",
                "sha256": "1f12622c702c99c3f0f813c87b74e6d748106e6b34ad73a44c012715607d5b7e"
            },
            "downloads": -1,
            "filename": "py_xbc-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0008b335acb88a071878c2b5c43fca6a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9064,
            "upload_time": "2024-01-26T07:12:06",
            "upload_time_iso_8601": "2024-01-26T07:12:06.851821Z",
            "url": "https://files.pythonhosted.org/packages/fc/6a/4c932ef1b39b09989ed33b5b398c4352c86822c8251d1092defc668ce9b1/py_xbc-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "397c952ecae9bf7d761c8e6e912563bec715db96a861d0d9adaf6810065f7511",
                "md5": "3d24eb79387395c803b3488e67b2ce99",
                "sha256": "420ba7a7e33b635f4cd05aff5be052fb92504554e02278d1d31eb069cacb5c2d"
            },
            "downloads": -1,
            "filename": "py-xbc-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "3d24eb79387395c803b3488e67b2ce99",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 11660,
            "upload_time": "2024-01-26T07:12:08",
            "upload_time_iso_8601": "2024-01-26T07:12:08.332765Z",
            "url": "https://files.pythonhosted.org/packages/39/7c/952ecae9bf7d761c8e6e912563bec715db96a861d0d9adaf6810065f7511/py-xbc-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-26 07:12:08",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "py-xbc"
}
        
Elapsed time: 0.19099s