diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d0ed392..9fb71c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,24 +14,34 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip3 install poetry + - name: Bump version run: >- - bin/bump_version.py + poetry version patch - - name: Commit updated version.py + - name: Commit updated version. id: commit_updated run: | git config --global user.name 'github-actions' git config --global user.email 'bot@noreply.github.com' git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} - git add setup.py + git add pyproject.toml git commit -m "bump version" && git push || echo "No changes to commit" git log -n 1 --pretty=format:"%H" | tail -n 1 | awk '{print "::set-output name=sha::"$0}' - name: Get version id: get_version run: >- - bin/show_version.py + poetry version - name: Create GitHub release uses: actions/create-release@v1 @@ -47,26 +57,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install pypa/build - run: >- - python -m - pip install - build - --user - - name: Build a binary wheel and a source tarball run: >- - python -m - build - --sdist - --wheel - --outdir dist/ - . + poetry build - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@master @@ -136,10 +129,8 @@ jobs: - name: Build run: | - pip install pyinstaller - pip install -r requirements.txt - pip install . - pyinstaller -F -n meshtastic --collect-all meshtastic meshtastic/__main__.py + pip install poetry + bin/build-bin.sh - name: Add ubuntu to release uses: actions/upload-release-asset@v1 @@ -177,10 +168,8 @@ jobs: - name: Build run: | - pip install pyinstaller - pip install -r requirements.txt - pip install . - pyinstaller -F -n meshtastic --collect-all meshtastic meshtastic/__main__.py + pip install poetry + bin/build-bin.sh - name: Add windows to release uses: actions/upload-release-asset@v1 diff --git a/bin/build-bin.sh b/bin/build-bin.sh new file mode 100755 index 0000000..d85beb7 --- /dev/null +++ b/bin/build-bin.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +echo Building ubuntu binary +poetry install +source $(poetry env info --path)/bin/activate +pyinstaller -F -n meshtastic --collect-all meshtastic meshtastic/__main__.py + diff --git a/bin/bump_version.py b/bin/bump_version.py deleted file mode 100755 index 7279cdf..0000000 --- a/bin/bump_version.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -"""Bump the version number""" -import re - -version_filename = "setup.py" - -lines = None - -with open(version_filename, "r", encoding="utf-8") as f: - lines = f.readlines() - -with open(version_filename, "w", encoding="utf-8") as f: - for line in lines: - if line.lstrip().startswith("version="): - # get rid of quotes around the version - line = line.replace('"', "") - # get rid of trailing comma - line = line.replace(",", "") - # split on '=' - words = line.split("=") - # split the version into parts (by period) - v = words[1].split(".") - build_num = re.findall(r"\d+", v[2])[0] - new_build_num = str(int(build_num) + 1) - ver = f"{v[0]}.{v[1]}.{v[2].replace(build_num, new_build_num)}".replace( - "\n", "" - ) - f.write(f' version="{ver}",\n') - else: - f.write(line) diff --git a/bin/run-ci-local.sh b/bin/run-ci-local.sh index 69aa5ea..a446d0d 100755 --- a/bin/run-ci-local.sh +++ b/bin/run-ci-local.sh @@ -1,6 +1,11 @@ #!/bin/bash # This script lets you run github ci actions locally +# You need to have act installed. You can get it at https://nektosact.com/ + +# by default it simulates a push event +# other useful options +# -j build-and-publish-ubuntu # also: we only run one of the 4 matrix tests, because otherwise it absolutely hammers the CPU (so many containers and threads) -act -P ubuntu-latest=-self-hosted --matrix "python-version:3.8" \ No newline at end of file +act -P ubuntu-latest=-self-hosted --matrix "python-version:3.8" "$@" \ No newline at end of file diff --git a/bin/show_version.py b/bin/show_version.py deleted file mode 100755 index 8cfb092..0000000 --- a/bin/show_version.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env python -"""Show the version number""" - -version_filename = "setup.py" - -lines = None - -with open(version_filename, "r", encoding="utf-8") as f: - lines = f.readlines() - -for line in lines: - if line.lstrip().startswith("version="): - # get rid of quotes around the version - line2 = line.replace('"', "") - # get rid of the trailing comma - line2 = line2.replace(",", "") - # split on = - words = line2.split("=") - # Note: This format is for github actions - print(f"::set-output name=version::{words[1].strip()}") diff --git a/poetry.lock b/poetry.lock index 9ef9b64..e7286ba 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,5 +1,16 @@ # This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +[[package]] +name = "altgraph" +version = "0.17.4" +description = "Python graph (network) package" +optional = false +python-versions = "*" +files = [ + {file = "altgraph-0.17.4-py2.py3-none-any.whl", hash = "sha256:642743b4750de17e655e6711601b077bc6598dbfa3ba5fa2b2a35ce12b508dff"}, + {file = "altgraph-0.17.4.tar.gz", hash = "sha256:1b5afbb98f6c4dcadb2e2ae6ab9fa994bbb8c1d75f4fa96d340f9437ae454406"}, +] + [[package]] name = "astroid" version = "3.2.2" @@ -465,6 +476,20 @@ files = [ [package.extras] colors = ["colorama (>=0.4.6)"] +[[package]] +name = "macholib" +version = "1.16.3" +description = "Mach-O header analysis and editing" +optional = false +python-versions = "*" +files = [ + {file = "macholib-1.16.3-py2.py3-none-any.whl", hash = "sha256:0e315d7583d38b8c77e815b1ecbdbf504a8258d8b3e17b61165c6feb60d18f2c"}, + {file = "macholib-1.16.3.tar.gz", hash = "sha256:07ae9e15e8e4cd9a788013d81f5908b3609aa76f9b1421bae9c4d7606ec86a30"}, +] + +[package.dependencies] +altgraph = ">=0.17" + [[package]] name = "mako" version = "1.3.5" @@ -681,6 +706,17 @@ files = [ mako = "*" markdown = ">=3.0" +[[package]] +name = "pefile" +version = "2023.2.7" +description = "Python PE parsing module" +optional = false +python-versions = ">=3.6.0" +files = [ + {file = "pefile-2023.2.7-py3-none-any.whl", hash = "sha256:da185cd2af68c08a6cd4481f7325ed600a88f6a813bad9dea07ab3ef73d8d8d6"}, + {file = "pefile-2023.2.7.tar.gz", hash = "sha256:82e6114004b3d6911c77c3953e3838654b04511b8b66e8583db70c65998017dc"}, +] + [[package]] name = "pexpect" version = "4.9.0" @@ -768,6 +804,57 @@ files = [ {file = "pycodestyle-2.12.0.tar.gz", hash = "sha256:442f950141b4f43df752dd303511ffded3a04c2b6fb7f65980574f0c31e6e79c"}, ] +[[package]] +name = "pyinstaller" +version = "6.8.0" +description = "PyInstaller bundles a Python application and all its dependencies into a single package." +optional = false +python-versions = "<3.13,>=3.8" +files = [ + {file = "pyinstaller-6.8.0-py3-none-macosx_10_13_universal2.whl", hash = "sha256:5ff6bc2784c1026f8e2f04aa3760cbed41408e108a9d4cf1dd52ee8351a3f6e1"}, + {file = "pyinstaller-6.8.0-py3-none-manylinux2014_aarch64.whl", hash = "sha256:39ac424d2ee2457d2ab11a5091436e75a0cccae207d460d180aa1fcbbafdd528"}, + {file = "pyinstaller-6.8.0-py3-none-manylinux2014_i686.whl", hash = "sha256:355832a3acc7de90a255ecacd4b9f9e166a547a79c8905d49f14e3a75c1acdb9"}, + {file = "pyinstaller-6.8.0-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:6303c7a009f47e6a96ef65aed49f41e36ece8d079b9193ca92fe807403e5fe80"}, + {file = "pyinstaller-6.8.0-py3-none-manylinux2014_s390x.whl", hash = "sha256:2b71509468c811968c0b5decb5bbe85b6292ea52d7b1f26313d2aabb673fa9a5"}, + {file = "pyinstaller-6.8.0-py3-none-manylinux2014_x86_64.whl", hash = "sha256:ff31c5b99e05a4384bbe2071df67ec8b2b347640a375eae9b40218be2f1754c6"}, + {file = "pyinstaller-6.8.0-py3-none-musllinux_1_1_aarch64.whl", hash = "sha256:000c36b13fe4cd8d0d8c2bc855b1ddcf39867b5adf389e6b5ca45b25fa3e619d"}, + {file = "pyinstaller-6.8.0-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:fe0af018d7d5077180e3144ada89a4da5df8d07716eb7e9482834a56dc57a4e8"}, + {file = "pyinstaller-6.8.0-py3-none-win32.whl", hash = "sha256:d257f6645c7334cbd66f38a4fac62c3ad614cc46302b2b5d9f8cc48c563bce0e"}, + {file = "pyinstaller-6.8.0-py3-none-win_amd64.whl", hash = "sha256:81cccfa9b16699b457f4788c5cc119b50f3cd4d0db924955f15c33f2ad27a50d"}, + {file = "pyinstaller-6.8.0-py3-none-win_arm64.whl", hash = "sha256:1c3060a263758cf7f0144ab4c016097b20451b2469d468763414665db1bb743d"}, + {file = "pyinstaller-6.8.0.tar.gz", hash = "sha256:3f4b6520f4423fe19bcc2fd63ab7238851ae2bdcbc98f25bc5d2f97cc62012e9"}, +] + +[package.dependencies] +altgraph = "*" +importlib-metadata = {version = ">=4.6", markers = "python_version < \"3.10\""} +macholib = {version = ">=1.8", markers = "sys_platform == \"darwin\""} +packaging = ">=22.0" +pefile = {version = ">=2022.5.30", markers = "sys_platform == \"win32\""} +pyinstaller-hooks-contrib = ">=2024.6" +pywin32-ctypes = {version = ">=0.2.1", markers = "sys_platform == \"win32\""} +setuptools = ">=42.0.0" + +[package.extras] +completion = ["argcomplete"] +hook-testing = ["execnet (>=1.5.0)", "psutil", "pytest (>=2.7.3)"] + +[[package]] +name = "pyinstaller-hooks-contrib" +version = "2024.7" +description = "Community maintained hooks for PyInstaller" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pyinstaller_hooks_contrib-2024.7-py2.py3-none-any.whl", hash = "sha256:8bf0775771fbaf96bcd2f4dfd6f7ae6c1dd1b1efe254c7e50477b3c08e7841d8"}, + {file = "pyinstaller_hooks_contrib-2024.7.tar.gz", hash = "sha256:fd5f37dcf99bece184e40642af88be16a9b89613ecb958a8bd1136634fc9fac5"}, +] + +[package.dependencies] +importlib-metadata = {version = ">=4.6", markers = "python_version < \"3.10\""} +packaging = ">=22.0" +setuptools = ">=42.0.0" + [[package]] name = "pylint" version = "3.2.3" @@ -975,6 +1062,17 @@ pytest = ">=4.6" [package.extras] testing = ["fields", "hunter", "process-tests", "pytest-xdist", "virtualenv"] +[[package]] +name = "pywin32-ctypes" +version = "0.2.2" +description = "A (partial) reimplementation of pywin32 using ctypes/cffi" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pywin32-ctypes-0.2.2.tar.gz", hash = "sha256:3426e063bdd5fd4df74a14fa3cf80a0b42845a87e1d1e81f6549f9daec593a60"}, + {file = "pywin32_ctypes-0.2.2-py3-none-any.whl", hash = "sha256:bf490a1a709baf35d688fe0ecf980ed4de11d2b3e37b51e5442587a75d9957e7"}, +] + [[package]] name = "pyyaml" version = "6.0.1" @@ -1055,6 +1153,21 @@ urllib3 = ">=1.21.1,<3" socks = ["PySocks (>=1.5.6,!=1.5.7)"] use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] +[[package]] +name = "setuptools" +version = "70.1.0" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "setuptools-70.1.0-py3-none-any.whl", hash = "sha256:d9b8b771455a97c8a9f3ab3448ebe0b29b5e105f1228bba41028be116985a267"}, + {file = "setuptools-70.1.0.tar.gz", hash = "sha256:01a1e793faa5bd89abc851fa15d0a0db26f160890c7102cd8dce643e886b47f5"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "importlib-metadata", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "jaraco.test", "mypy (==1.10.0)", "packaging (>=23.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.1)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy", "pytest-perf", "pytest-ruff (>=0.3.2)", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] + [[package]] name = "sortedcontainers" version = "2.4.0" @@ -1448,4 +1561,4 @@ tunnel = [] [metadata] lock-version = "2.0" python-versions = "^3.8,<3.13" -content-hash = "372f4891aa67c5e358a8e3122f332ec17f0f36143dfcd314acf4de5b26f2a888" +content-hash = "2ee78b53bdbdb0d560d2092d28d4379ec0ca18377e9d698f152d708318f9ca23" diff --git a/pyproject.toml b/pyproject.toml index c49d8be..94cbcd2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "meshtastic" -version = "2.3.7" +version = "2.3.11" description = "Python API & client shell for talking to Meshtastic devices" authors = ["Meshtastic Developers "] license = "GPL-3.0-only" @@ -38,6 +38,7 @@ pdoc3 = "^0.10.0" autopep8 = "^2.1.0" pylint = "^3.2.3" pytap2 = "^2.3.0" +pyinstaller = "^6.8.0" [tool.poetry.extras] tunnel = ["pytap2"]