From 4b45acd0b6700e65ddea30bb77f29bd373f11e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=ADle=20Ekaterin=20Liszka?= Date: Sat, 13 Jan 2024 21:27:13 -0800 Subject: [PATCH] prepare for publication --- .gitignore | 1 + LICENSE => LICENSE.txt | 0 MAINFEST.IN | 1 + README.md | 2 +- pyproject.toml | 5 ++++- setup.py | 37 +++++++++++++++++++++++++++++++++++++ src/xbc/__init__.py | 28 +--------------------------- src/xbc/version.py | 1 + 8 files changed, 46 insertions(+), 29 deletions(-) rename LICENSE => LICENSE.txt (100%) create mode 100644 MAINFEST.IN create mode 100644 setup.py create mode 100644 src/xbc/version.py diff --git a/.gitignore b/.gitignore index b94aa11..6ff4408 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ __pycache__/ build/ dist/ *.egg-info/ +py-xbc-*/ diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt diff --git a/MAINFEST.IN b/MAINFEST.IN new file mode 100644 index 0000000..243be3e --- /dev/null +++ b/MAINFEST.IN @@ -0,0 +1 @@ +include tests/*.xbc \ No newline at end of file diff --git a/README.md b/README.md index 1987ec3..5706d5a 100644 --- a/README.md +++ b/README.md @@ -68,5 +68,5 @@ foo { bar.fluff = 1 } # Licence -`py-xbc` is published under the MIT license. See `LICENSE` for more +`py-xbc` is published under the MIT license. See `LICENSE.txt` for more information. diff --git a/pyproject.toml b/pyproject.toml index f58ea9f..59b7711 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = 'py-xbc' -version = '0.1.0' +dynamic = ['version'] authors = [ { name = 'Síle Ekaterin Liszka', email = 'sheila@vulpine.house' } ] @@ -35,6 +35,9 @@ Issues = 'https://gitea.treehouse.systems/VulpineAmethyst/py-xbc/issues' requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" +[tool.setuptools.dynamic] +version = {attr = "xbc.version.version"} + [tool.pytest.ini_options] addopts = [ "--import-mode=importlib", diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..a6cea8f --- /dev/null +++ b/setup.py @@ -0,0 +1,37 @@ + +import pathlib +import sys + +from setuptools import setup, find_packages + +here = pathlib.Path(__file__).parent.resolve() +src = here / 'src' + +sys.path.append(src.as_posix()) + +from xbc.version import version + +long_description = (here / "README.md").read_text(encoding="utf-8") + +setup( + name='py-xbc', + version=version, + description='A library for manipulating eXtra Boot Configuration (XBC) files', + long_description=long_description, + long_description_content_type='text/markdown', + url='https://gitea.treehouse.systems/VulpineAmethyst/py-xbc', + author='Síle Ekaterin Liszka', + author_email='sheila@vulpine.house', + keywords='xbc, configuration, bootconfig', + package_dir={'': 'src'}, + packages=find_packages(where='src'), + python_requires='>=3.7, <4', + install_requires=['pyparsing'], + extras_require={ + 'test': ['pytest'], + }, + project_urls={ + 'Bug Reports': 'https://gitea.treehouse.systems/VulpineAmethyst/py-xbc/issues', + 'Source': 'https://gitea.treehouse.systems/VulpineAmethyst/py-xbc', + } +) diff --git a/src/xbc/__init__.py b/src/xbc/__init__.py index 88cb383..f43baaf 100644 --- a/src/xbc/__init__.py +++ b/src/xbc/__init__.py @@ -19,33 +19,6 @@ # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -""" -This module provides utilities for reading and writing files in the -Linux kernel's bootconfig format. This is not a strictly-conformant -implementation. In particular, this implementation does not restrict -key/block depths and makes no attempt whatsoever to ensure output is -under 32,767 bytes as mandated by the Linux kernel implementation. - -XBC has three types of configuration: - -- Keys are sequences of one or more characters in the range - `[a-zA-Z0-9_-]`, namespaced with dots. They can be specified without a - value, allowing their presence to be a boolean. -- Key/value pairs have a key component, an operator, and one or more - values. Values have three flavours: - - Bare values are sequences of one or more characters that are not in - the range `{}#=+:;,\\n'" `. - - Quoted strings are bounded by either single or double quotes, and - cannot contain the quote being bounded. Escaped quotes (`\\'` and - `\\"`) are not supported. - - Arrays are bare values or strings delimited by commas. -- Blocks have a key component and a sequence of keys, key/value pairs, - or blocks. Keys within blocks are not mapped separately; `a.a` is - identical to `a { a }`, for example. - -XBC supports single-line comments using the pound sign (`#`). -""" - import re from collections.abc import Mapping, Sequence @@ -68,6 +41,7 @@ from pyparsing import ( ) from .utils import normalise +from .version import version as __version__ class Node: def __init__(self, *args, type=None): diff --git a/src/xbc/version.py b/src/xbc/version.py new file mode 100644 index 0000000..79e06c9 --- /dev/null +++ b/src/xbc/version.py @@ -0,0 +1 @@ +version = '0.1.0' \ No newline at end of file