diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dee5a0e..4404c6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,5 @@ -name: ci +--- +name: Test bmaptool on: push: @@ -10,25 +11,31 @@ jobs: test: runs-on: ubuntu-latest strategy: - fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10"] - + python-version: + - "3.8" + - "3.9" + - "3.10" steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - # Installs compression deps - sudo apt-get install -y pbzip2 pigz lzop liblz4-tool libgpgme11-dev - # Installs poetry - curl -sSL https://install.python-poetry.org | python3 - - poetry install -n - - name: Run tests - run: poetry run python -m unittest -bv + - uses: actions/checkout@v4 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + sudo apt-get install -y pbzip2 pigz lzop liblz4-tool libgpgme11-dev + python -m pip install --upgrade pip + pip install build + - name: Build package + run: | + python -m build + - name: Install package + run: | + pip install -e .[dev] + - name: Run tests + run: | + python -m unittest -vb lint: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index a52a40d..1b91bd9 100644 --- a/.gitignore +++ b/.gitignore @@ -58,6 +58,7 @@ docs/_build/ # virtualenv venv/ +.venv/ ENV/ #vscode diff --git a/README.md b/README.md index d700c14..bc50247 100644 --- a/README.md +++ b/README.md @@ -357,6 +357,28 @@ $ cat /sys/module/zfs/parameters/zfs_dmu_offset_next_sync More details can be found [in the OpenZFS documentation](https://openzfs.github.io/openzfs-docs/Performance%20and%20Tuning/Module%20Parameters.html). +## Hacking + +`bmaptool` uses `hatch` to build python packages. If you would like to make +changes to the project, first create a new virtual environment and activate it: + +```bash +python3 -m venv .venv +. .venv/bin/activate +``` + +Next install the project in editable mode with development dependencies: + +```bash +pip install -m .[dev] +``` + +Finally, to run tests use `unittest`: + +```bash +python3 -m unittest -bv +``` + ## Project and maintainer The bmaptool project implements bmap-related tools and API modules. The diff --git a/poetry.lock b/poetry.lock deleted file mode 100644 index cf5ee9d..0000000 --- a/poetry.lock +++ /dev/null @@ -1,158 +0,0 @@ -# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. - -[[package]] -name = "black" -version = "22.12.0" -description = "The uncompromising code formatter." -optional = false -python-versions = ">=3.7" -files = [ - {file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"}, - {file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"}, - {file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"}, - {file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"}, - {file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"}, - {file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"}, - {file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"}, - {file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"}, - {file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"}, - {file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"}, - {file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"}, - {file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"}, -] - -[package.dependencies] -click = ">=8.0.0" -mypy-extensions = ">=0.4.3" -pathspec = ">=0.9.0" -platformdirs = ">=2" -tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} -typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} - -[package.extras] -colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)"] -jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] -uvloop = ["uvloop (>=0.15.2)"] - -[[package]] -name = "click" -version = "8.1.7" -description = "Composable command line interface toolkit" -optional = false -python-versions = ">=3.7" -files = [ - {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, - {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"}, -] - -[package.dependencies] -colorama = {version = "*", markers = "platform_system == \"Windows\""} - -[[package]] -name = "colorama" -version = "0.4.6" -description = "Cross-platform colored terminal text." -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -files = [ - {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, - {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, -] - -[[package]] -name = "gpg" -version = "1.10.0" -description = "Python bindings for GPGME GnuPG cryptography library" -optional = false -python-versions = "*" -files = [ - {file = "gpg-1.10.0.tar.gz", hash = "sha256:349214a866c84aa548bc35ed14eccd2ec9085b3958d5753a63a19a71a1f523ca"}, -] - -[[package]] -name = "mypy-extensions" -version = "1.0.0" -description = "Type system extensions for programs checked with the mypy type checker." -optional = false -python-versions = ">=3.5" -files = [ - {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, - {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, -] - -[[package]] -name = "nose" -version = "1.3.7" -description = "nose extends unittest to make testing easier" -optional = false -python-versions = "*" -files = [ - {file = "nose-1.3.7-py2-none-any.whl", hash = "sha256:dadcddc0aefbf99eea214e0f1232b94f2fa9bd98fa8353711dacb112bfcbbb2a"}, - {file = "nose-1.3.7-py3-none-any.whl", hash = "sha256:9ff7c6cc443f8c51994b34a667bbcf45afd6d945be7477b52e97516fd17c53ac"}, - {file = "nose-1.3.7.tar.gz", hash = "sha256:f1bffef9cbc82628f6e7d7b40d7e255aefaa1adb6a1b1d26c69a8b79e6208a98"}, -] - -[[package]] -name = "pathspec" -version = "0.12.1" -description = "Utility library for gitignore style pattern matching of file paths." -optional = false -python-versions = ">=3.8" -files = [ - {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, - {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, -] - -[[package]] -name = "platformdirs" -version = "4.2.0" -description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -optional = false -python-versions = ">=3.8" -files = [ - {file = "platformdirs-4.2.0-py3-none-any.whl", hash = "sha256:0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068"}, - {file = "platformdirs-4.2.0.tar.gz", hash = "sha256:ef0cc731df711022c174543cb70a9b5bd22e5a9337c8624ef2c2ceb8ddad8768"}, -] - -[package.extras] -docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] - -[[package]] -name = "six" -version = "1.16.0" -description = "Python 2 and 3 compatibility utilities" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" -files = [ - {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, - {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, -] - -[[package]] -name = "tomli" -version = "2.0.1" -description = "A lil' TOML parser" -optional = false -python-versions = ">=3.7" -files = [ - {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, - {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, -] - -[[package]] -name = "typing-extensions" -version = "4.10.0" -description = "Backported and Experimental Type Hints for Python 3.8+" -optional = false -python-versions = ">=3.8" -files = [ - {file = "typing_extensions-4.10.0-py3-none-any.whl", hash = "sha256:69b1a937c3a517342112fb4c6df7e72fc39a38e7891a5730ed4985b5214b5475"}, - {file = "typing_extensions-4.10.0.tar.gz", hash = "sha256:b0abd7c89e8fb96f98db18d86106ff1d90ab692004eb746cf6eda2682f91b3cb"}, -] - -[metadata] -lock-version = "2.0" -python-versions = "^3.8" -content-hash = "e892d27f419030bdc590bf9e398c5feed6218e1ced34a948d1d5986e8f99ab1d" diff --git a/pyproject.toml b/pyproject.toml index 194054f..9e5133c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,22 +1,48 @@ -[tool.poetry] +[project] name = "bmaptool" -version = "3.7.0" -license = "GPL-2.0-only" description = "BMAP tools" -authors = ["Trevor Woerner "] +dynamic = ["version"] +dependencies = [ + "six >= 1.16.0", + "gpg >= 1.10.0", +] +required-python = ">= 3.8" +authors = [ + {name = "Joshua Watt", email = "JPEWhacker@gmail.com"}, + {name = "Trevor Woerner", email = "twoerner@gmail.com"}, + {name = "Tim Orling", email = "ticotimo@gmail.com"}, -[tool.poetry.dependencies] -python = "^3.8" -six = "^1.16.0" -gpg = "^1.10.0" +] +readme = "README.md" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Topic :: Software Development :: Build Tools", + "Topic :: Software Development :: Embedded Systems", + "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", +] -[tool.poetry.dev-dependencies] -black = "^22.3.0" -nose = "^1.3.7" +[project.optional-dependencies] +dev = [ + "black >= 22.3.0", + "nose >= 1.3.7", +] -[tool.poetry.scripts] +[project.urls] +Homepage = "https://github.com/yoctoproject/bmaptool" +Repository = "https://github.com/yoctoproject/bmaptool.git" +Issues = "https://github.com/yoctoproject/bmaptool/issues" + +[project.scripts] bmaptool = "bmaptool.CLI:main" [build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.version] +path = "src/bmaptool/CLI.py" diff --git a/requirements-test.txt b/requirements-test.txt deleted file mode 100644 index f83802d..0000000 --- a/requirements-test.txt +++ /dev/null @@ -1,4 +0,0 @@ -six -nose -backports.tempfile ; python_version < '3.2' -mock ; python_version < '3.3' diff --git a/setup.py b/setup.py deleted file mode 100644 index 2409b60..0000000 --- a/setup.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python - -import re -from setuptools import setup, find_packages - - -def get_version(): - """Fetch the project version number from the 'bmaptool' file.""" - with open("bmaptool/CLI.py", "r") as fobj: - for line in fobj: - matchobj = re.match(r'^VERSION = "(\d+.\d+)"$', line) - if matchobj: - return matchobj.group(1) - - return None - - -setup( - name="bmaptool", - description="Tools to generate block map (AKA bmap) and copy images " "using bmap", - author="Artem Bityutskiy", - author_email="artem.bityutskiy@linux.intel.com", - maintainer="Trevor Woerner", - maintainer_email="twoerner@gmail.com", - version=get_version(), - entry_points={ - "console_scripts": ["bmaptool=bmaptool.CLI:main"], - }, - packages=find_packages(exclude=["test*"]), - license="GPLv2", - long_description="Tools to generate block map (AKA bmap) and flash " - "images using bmap. bmaptool is a generic tool for " - "creating the block map (bmap) for a file, and copying " - "files using the block map. The idea is that large file " - "containing unused blocks, like raw system image files, " - "can be copied or flashed a lot faster with bmaptool " - 'than with traditional tools like "dd" or "cp". See ' - "source.tizen.org/documentation/reference/bmaptool for " - "more information.", - classifiers=[ - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - ], -)