diff --git a/.github/workflows/build-tests.yml b/.github/workflows/build-tests.yml new file mode 100644 index 0000000..4eebdac --- /dev/null +++ b/.github/workflows/build-tests.yml @@ -0,0 +1,15 @@ +name: Build Tests + +on: + pull_request: + branches: [dev, master, main] + workflow_dispatch: + +jobs: + build: + uses: OpenVoiceOS/gh-automations/.github/workflows/build-tests.yml@dev + secrets: inherit + with: + python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' + install_extras: 'test' + test_path: 'test' diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml deleted file mode 100644 index 7179ea6..0000000 --- a/.github/workflows/build_tests.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Run Build Tests -on: - push: - branches: - - master - - dev - pull_request: - branches: - - dev - paths-ignore: - - 'ovos_PHAL/version.py' - - 'test/**' - - 'examples/**' - - '.github/**' - - '.gitignore' - - 'LICENSE' - - 'CHANGELOG.md' - - 'MANIFEST.in' - - 'readme.md' - - 'scripts/**' - workflow_dispatch: - -jobs: - build_tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - ref: ${{ github.head_ref }} - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: 3.14 - - name: Install System Dependencies - run: | - sudo apt-get update - sudo apt install libasound2-dev - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Build Distribution Packages (bdist_wheel) - run: | - python setup.py bdist_wheel - - name: Install package - run: | - pip install .[extras,linux] diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..fd78ed0 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,17 @@ +name: Code Coverage + +on: + pull_request: + branches: [dev] + workflow_dispatch: + +jobs: + coverage: + uses: OpenVoiceOS/gh-automations/.github/workflows/coverage.yml@dev + secrets: inherit + with: + python_version: '3.11' + coverage_source: 'ovos_PHAL' + test_path: 'test/' + install_extras: '.[test]' + min_coverage: 0 diff --git a/.github/workflows/license_check.yml b/.github/workflows/license_check.yml new file mode 100644 index 0000000..8757eee --- /dev/null +++ b/.github/workflows/license_check.yml @@ -0,0 +1,11 @@ +name: License Check + +on: + pull_request: + branches: [dev] + workflow_dispatch: + +jobs: + license_check: + uses: OpenVoiceOS/gh-automations/.github/workflows/license-check.yml@dev + secrets: inherit diff --git a/.github/workflows/license_tests.yml b/.github/workflows/license_tests.yml deleted file mode 100644 index 3b94b34..0000000 --- a/.github/workflows/license_tests.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Run License Tests -on: - push: - branches: - - master - pull_request: - branches: - - dev - workflow_dispatch: - -jobs: - license_tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: 3.14 - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Install System Dependencies - run: | - sudo apt-get update - sudo apt install python3-dev swig libssl-dev - - name: Install core repo - run: | - pip install . - - name: Get explicit and transitive dependencies - run: | - pip freeze > requirements-all.txt - - name: Check python - id: license_check_report - uses: pilosus/action-pip-license-checker@v0.5.0 - with: - requirements: 'requirements-all.txt' - fail: 'Copyleft,Other,Error' - fails-only: true - exclude: '^(tqdm).*' - exclude-license: '^(Mozilla).*$' - - name: Print report - if: ${{ always() }} - run: echo "${{ steps.license_check_report.outputs.report }}" \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..aa45c3d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,14 @@ +name: Lint + +on: + pull_request: + branches: [dev, master, main] + workflow_dispatch: + +jobs: + lint: + uses: OpenVoiceOS/gh-automations/.github/workflows/lint.yml@dev + secrets: inherit + with: + ruff: true + pre_commit: false diff --git a/.github/workflows/opm-check.yml b/.github/workflows/opm-check.yml new file mode 100644 index 0000000..7545741 --- /dev/null +++ b/.github/workflows/opm-check.yml @@ -0,0 +1,14 @@ +name: OPM Plugin Check + +on: + pull_request: + branches: [dev, master, main] + workflow_dispatch: + +jobs: + opm_check: + uses: OpenVoiceOS/gh-automations/.github/workflows/opm-check.yml@dev + secrets: inherit + with: + python_version: '3.11' + plugin_type: 'auto' diff --git a/.github/workflows/pip_audit.yml b/.github/workflows/pip_audit.yml new file mode 100644 index 0000000..bb3ca4d --- /dev/null +++ b/.github/workflows/pip_audit.yml @@ -0,0 +1,11 @@ +name: PIP Audit + +on: + pull_request: + branches: [dev] + workflow_dispatch: + +jobs: + pip_audit: + uses: OpenVoiceOS/gh-automations/.github/workflows/pip-audit.yml@dev + secrets: inherit diff --git a/.github/workflows/publish_stable.yml b/.github/workflows/publish_stable.yml index b93db2d..33aec09 100644 --- a/.github/workflows/publish_stable.yml +++ b/.github/workflows/publish_stable.yml @@ -1,58 +1,23 @@ -name: Stable Release +name: Publish Stable Release + on: - push: - branches: [master] workflow_dispatch: + push: + branches: [master, main] + +permissions: + contents: write jobs: publish_stable: - uses: TigreGotico/gh-automations/.github/workflows/publish-stable.yml@master - secrets: inherit + if: github.actor != 'github-actions[bot]' + uses: OpenVoiceOS/gh-automations/.github/workflows/publish-stable.yml@dev + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + MATRIX_TOKEN: ${{ secrets.MATRIX_TOKEN }} with: - branch: 'master' version_file: 'ovos_PHAL/version.py' - setup_py: 'setup.py' + publish_pypi: true publish_release: true - - publish_pypi: - needs: publish_stable - if: success() # Ensure this job only runs if the previous job succeeds - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - ref: master - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: "3.11" - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: version - run: echo "::set-output name=version::$(python setup.py --version)" - id: version - - name: Build Distribution Packages - run: | - python setup.py sdist bdist_wheel - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{secrets.PYPI_TOKEN}} - - - sync_dev: - needs: publish_stable - if: success() # Ensure this job only runs if the previous job succeeds - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - ref: master - - name: Push master -> dev - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: dev + sync_dev: true + notify_matrix: true diff --git a/.github/workflows/release-preview.yml b/.github/workflows/release-preview.yml new file mode 100644 index 0000000..861d136 --- /dev/null +++ b/.github/workflows/release-preview.yml @@ -0,0 +1,14 @@ +name: Release Preview + +on: + pull_request: + branches: [dev] + workflow_dispatch: + +jobs: + release_preview: + uses: OpenVoiceOS/gh-automations/.github/workflows/release-preview.yml@dev + secrets: inherit + with: + package_name: 'ovos_PHAL' + version_file: 'ovos_PHAL/version.py' diff --git a/.github/workflows/release_workflow.yml b/.github/workflows/release_workflow.yml index fe122d8..4e3bf14 100644 --- a/.github/workflows/release_workflow.yml +++ b/.github/workflows/release_workflow.yml @@ -6,103 +6,23 @@ on: types: [closed] branches: [dev] +permissions: + contents: write + pull-requests: write + jobs: publish_alpha: - uses: TigreGotico/gh-automations/.github/workflows/publish-alpha.yml@master - secrets: inherit + if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' + uses: OpenVoiceOS/gh-automations/.github/workflows/publish-alpha.yml@dev + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + MATRIX_TOKEN: ${{ secrets.MATRIX_TOKEN }} with: branch: 'dev' version_file: 'ovos_PHAL/version.py' - setup_py: 'setup.py' update_changelog: true publish_prerelease: true - changelog_max_issues: 100 - - notify: - if: github.event.pull_request.merged == true - needs: publish_alpha - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - name: Send message to Matrix bots channel - id: matrix-chat-message - uses: fadenb/matrix-chat-message@v0.0.6 - with: - homeserver: 'matrix.org' - token: ${{ secrets.MATRIX_TOKEN }} - channel: '!WjxEKjjINpyBRPFgxl:krbel.duckdns.org' - message: | - new ${{ github.event.repository.name }} PR merged! https://github.com/${{ github.repository }}/pull/${{ github.event.number }} - - publish_pypi: - needs: publish_alpha - if: success() # Ensure this job only runs if the previous job succeeds - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - ref: dev - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: "3.11" - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: version - run: echo "::set-output name=version::$(python setup.py --version)" - id: version - - name: Build Distribution Packages - run: | - python setup.py sdist bdist_wheel - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{secrets.PYPI_TOKEN}} - - - propose_release: - needs: publish_alpha - if: success() # Ensure this job only runs if the previous job succeeds - runs-on: ubuntu-latest - steps: - - name: Checkout dev branch - uses: actions/checkout@v6 - with: - ref: dev - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.11' - - - name: Get version from setup.py - id: get_version - run: | - VERSION=$(python setup.py --version) - echo "VERSION=$VERSION" >> $GITHUB_ENV - - - name: Create and push new branch - run: | - git checkout -b release-${{ env.VERSION }} - git push origin release-${{ env.VERSION }} - - - name: Open Pull Request from dev to master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Variables - BRANCH_NAME="release-${{ env.VERSION }}" - BASE_BRANCH="master" - HEAD_BRANCH="release-${{ env.VERSION }}" - PR_TITLE="Release ${{ env.VERSION }}" - PR_BODY="Human review requested!" - - # Create a PR using GitHub API - curl -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: token $GITHUB_TOKEN" \ - -d "{\"title\":\"$PR_TITLE\",\"body\":\"$PR_BODY\",\"head\":\"$HEAD_BRANCH\",\"base\":\"$BASE_BRANCH\"}" \ - https://api.github.com/repos/${{ github.repository }}/pulls - + propose_release: true + changelog_max_issues: 50 + publish_pypi: true + notify_matrix: true diff --git a/.github/workflows/repo-health.yml b/.github/workflows/repo-health.yml new file mode 100644 index 0000000..bbb46bf --- /dev/null +++ b/.github/workflows/repo-health.yml @@ -0,0 +1,13 @@ +name: Repo Health + +on: + pull_request: + branches: [dev, master, main] + workflow_dispatch: + +jobs: + repo_health: + uses: OpenVoiceOS/gh-automations/.github/workflows/repo-health.yml@dev + secrets: inherit + with: + version_file: 'ovos_PHAL/version.py' diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml deleted file mode 100644 index c5e48b4..0000000 --- a/.github/workflows/unit_tests.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Run UnitTests -on: - pull_request: - branches: - - dev - paths-ignore: - - 'ovos_PHAL/version.py' - - 'requirements/**' - - 'examples/**' - - '.github/**' - - '.gitignore' - - 'LICENSE' - - 'CHANGELOG.md' - - 'MANIFEST.in' - - 'readme.md' - - 'scripts/**' - push: - branches: - - master - - dev - paths-ignore: - - 'ovos_PHAL/version.py' - - 'requirements/**' - - 'examples/**' - - '.github/**' - - '.gitignore' - - 'LICENSE' - - 'CHANGELOG.md' - - 'MANIFEST.in' - - 'readme.md' - - 'scripts/**' - workflow_dispatch: - -jobs: - unit_tests: - strategy: - max-parallel: 2 - matrix: - python-version: [ 3.7, 3.8, 3.9, "3.10" ] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - name: Set up python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - - name: Install System Dependencies - run: | - sudo apt-get update - sudo apt install python3-dev - python -m pip install build wheel - - name: Install core repo - run: | - pip install . - - name: Install test dependencies - run: | - pip install pytest pytest-timeout pytest-cov - - name: Run unittests - run: | - pytest --cov=ovos_PHAL --cov-report xml test/unittests - # NOTE: additional pytest invocations should also add the --cov-append flag - # or they will overwrite previous invocations' coverage reports - # (for an example, see OVOS Skill Manager's workflow) - - name: Upload coverage - env: - CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} - uses: codecov/codecov-action@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index a8ceb46..eb22aa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,41 +1,20 @@ # Changelog -## [0.2.12a5](https://github.com/OpenVoiceOS/ovos-PHAL/tree/0.2.12a5) (2026-03-01) +## [0.2.14a1](https://github.com/OpenVoiceOS/ovos-PHAL/tree/0.2.14a1) (2026-06-20) -[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL/compare/0.2.12a4...0.2.12a5) +[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL/compare/0.2.13a2...0.2.14a1) **Merged pull requests:** -- chore: drop deprecated dependencies [\#75](https://github.com/OpenVoiceOS/ovos-PHAL/pull/75) ([JarbasAl](https://github.com/JarbasAl)) +- fix: allow ovos-bus-client 2.x [\#90](https://github.com/OpenVoiceOS/ovos-PHAL/pull/90) ([JarbasAl](https://github.com/JarbasAl)) -## [0.2.12a4](https://github.com/OpenVoiceOS/ovos-PHAL/tree/0.2.12a4) (2025-12-19) +## [0.2.13a2](https://github.com/OpenVoiceOS/ovos-PHAL/tree/0.2.13a2) (2026-06-16) -[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL/compare/0.2.12a2...0.2.12a4) +[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL/compare/0.2.12...0.2.13a2) **Merged pull requests:** -- chore\(deps\): update dependency python to 3.14 [\#66](https://github.com/OpenVoiceOS/ovos-PHAL/pull/66) ([renovate[bot]](https://github.com/apps/renovate)) - -## [0.2.12a2](https://github.com/OpenVoiceOS/ovos-PHAL/tree/0.2.12a2) (2025-12-19) - -[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL/compare/0.2.12a3...0.2.12a2) - -## [0.2.12a3](https://github.com/OpenVoiceOS/ovos-PHAL/tree/0.2.12a3) (2025-12-19) - -[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL/compare/0.2.12a1...0.2.12a3) - -**Merged pull requests:** - -- chore\(deps\): update actions/setup-python action to v6 [\#71](https://github.com/OpenVoiceOS/ovos-PHAL/pull/71) ([renovate[bot]](https://github.com/apps/renovate)) -- chore\(deps\): update actions/checkout action to v6 [\#70](https://github.com/OpenVoiceOS/ovos-PHAL/pull/70) ([renovate[bot]](https://github.com/apps/renovate)) - -## [0.2.12a1](https://github.com/OpenVoiceOS/ovos-PHAL/tree/0.2.12a1) (2025-12-18) - -[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL/compare/0.2.11...0.2.12a1) - -**Merged pull requests:** - -- chore: Configure Renovate [\#65](https://github.com/OpenVoiceOS/ovos-PHAL/pull/65) ([renovate[bot]](https://github.com/apps/renovate)) +- chore: add missing shared CI workflows [\#88](https://github.com/OpenVoiceOS/ovos-PHAL/pull/88) ([JarbasAl](https://github.com/JarbasAl)) diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index cae0c89..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -recursive-include ovos_PHAL/ * -recursive-include requirements/ * -include CHANGELOG.md -include LICENSE \ No newline at end of file diff --git a/ovos_PHAL/version.py b/ovos_PHAL/version.py index f7ada12..8f758b9 100644 --- a/ovos_PHAL/version.py +++ b/ovos_PHAL/version.py @@ -1,6 +1,10 @@ # START_VERSION_BLOCK VERSION_MAJOR = 0 VERSION_MINOR = 2 -VERSION_BUILD = 12 -VERSION_ALPHA = 0 +VERSION_BUILD = 14 +VERSION_ALPHA = 1 # END_VERSION_BLOCK + +__version__ = f"{VERSION_MAJOR}.{VERSION_MINOR}.{VERSION_BUILD}" +if VERSION_ALPHA: + __version__ += f"a{VERSION_ALPHA}" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..82ee4b6 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,68 @@ +[build-system] +requires = ["setuptools>=61", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "ovos_PHAL" +dynamic = ["version"] +description = "Plugin based Hardware Abstraction Layer for OVOS" +readme = "README.md" +license = {text = "Apache-2.0"} +authors = [ + {name = "jarbasAi", email = "jarbasai@mailfence.com"} +] +keywords = ["ovos", "phal", "plugin"] +dependencies = [ + "ovos-utils>=0.0.38,<1.0.0", + "ovos_bus_client>=0.0.8,<3.0.0", + "ovos-config>=0.0.12,<3.0.0", + "ovos-plugin-manager>=0.0.25,<3.0.0" +] + +[project.optional-dependencies] +extras = [ + "ovos-phal-plugin-ipgeo>=0.1.1,<1.0.0", + "ovos-PHAL-plugin-connectivity-events>=0.1.0,<1.0.0", + "ovos-PHAL-plugin-oauth>=0.1.1,<1.0.0" +] +linux = [ + "ovos-phal-plugin-alsa>=0.1.0,<1.0.0", + "ovos-phal-plugin-system>=1.0.0,<2.0.0", + "ovos-PHAL-plugin-network-manager>=0.3.1,<2.0.0", + "ovos-PHAL-plugin-wallpaper-manager>=0.1.2,<1.0.0" +] +mac = [ + "ovos-phal-plugin-mac>=0.0.1,<1.0.0" +] +mk1 = [ + "ovos-PHAL-plugin-mk1>=0.1.2,<1.0.0" +] +mk2 = [ + "ovos-PHAL-plugin-hotkeys>=0.1.1,<1.0.0" +] +mk2dev = [ + "ovos-PHAL-plugin-mk2-fan-control>=0.0.1,<1.0.0" +] +test = [ + "pytest", + "pytest-cov" +] + +[project.urls] +Homepage = "https://github.com/OpenVoiceOS/ovos-PHAL" + +[project.scripts] +ovos_PHAL = "ovos_PHAL.__main__:main" +ovos_PHAL_admin = "ovos_PHAL.admin:main" + +[tool.setuptools.dynamic] +version = {attr = "ovos_PHAL.version.__version__"} + +[tool.setuptools.packages.find] +where = ["."] +include = ["ovos_PHAL*"] + +[tool.setuptools.package-data] +ovos_PHAL = [ + "*.json", +] diff --git a/requirements/extras.txt b/requirements/extras.txt deleted file mode 100644 index c199e85..0000000 --- a/requirements/extras.txt +++ /dev/null @@ -1,4 +0,0 @@ -ovos-phal-plugin-ipgeo>=0.1.1,<1.0.0 -ovos-PHAL-plugin-connectivity-events>=0.1.0,<1.0.0 -ovos-PHAL-plugin-oauth>=0.1.1,<1.0.0 -#ovos-PHAL-plugin-wifi-setup>=1.0.0,<2.0.0 diff --git a/requirements/linux.txt b/requirements/linux.txt deleted file mode 100644 index 7929a9f..0000000 --- a/requirements/linux.txt +++ /dev/null @@ -1,6 +0,0 @@ -ovos-phal-plugin-alsa>=0.1.0,<1.0.0 -ovos-phal-plugin-system>=1.0.0,<2.0.0 -ovos-PHAL-plugin-network-manager>=0.3.1,<2.0.0 - -# TODO - move to extras once it also supports mac/win -ovos-PHAL-plugin-wallpaper-manager>=0.1.2,<1.0.0 diff --git a/requirements/mac.txt b/requirements/mac.txt deleted file mode 100644 index 201e015..0000000 --- a/requirements/mac.txt +++ /dev/null @@ -1 +0,0 @@ -ovos-phal-plugin-mac>=0.0.1,<1.0.0 \ No newline at end of file diff --git a/requirements/mk1.txt b/requirements/mk1.txt deleted file mode 100644 index 9863b6b..0000000 --- a/requirements/mk1.txt +++ /dev/null @@ -1 +0,0 @@ -ovos-PHAL-plugin-mk1>=0.1.2,<1.0.0 diff --git a/requirements/mk2.txt b/requirements/mk2.txt deleted file mode 100644 index e523213..0000000 --- a/requirements/mk2.txt +++ /dev/null @@ -1 +0,0 @@ -ovos-PHAL-plugin-hotkeys>=0.1.1,<1.0.0 diff --git a/requirements/mk2dev.txt b/requirements/mk2dev.txt deleted file mode 100644 index 38b595b..0000000 --- a/requirements/mk2dev.txt +++ /dev/null @@ -1,2 +0,0 @@ -ovos-PHAL-plugin-mk2-fan-control>=0.0.1,<1.0.0 -#git+https://github.com/OVOSHatchery/ovos-PHAL-plugin-sj201-leds diff --git a/requirements/requirements.txt b/requirements/requirements.txt deleted file mode 100644 index 37b9240..0000000 --- a/requirements/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -ovos-utils>=0.0.38,<1.0.0 -ovos_bus_client>=0.0.8,<2.0.0 -ovos-config>=0.0.12,<3.0.0 -ovos-plugin-manager>=0.0.25,<3.0.0 diff --git a/setup.py b/setup.py deleted file mode 100644 index eb0fe1d..0000000 --- a/setup.py +++ /dev/null @@ -1,85 +0,0 @@ -import os -from setuptools import setup - -BASEDIR = os.path.abspath(os.path.dirname(__file__)) - - -def get_version(): - """ Find the version of the package""" - version = None - version_file = os.path.join(BASEDIR, 'ovos_PHAL', 'version.py') - major, minor, build, alpha = (None, None, None, None) - with open(version_file) as f: - for line in f: - if 'VERSION_MAJOR' in line: - major = line.split('=')[1].strip() - elif 'VERSION_MINOR' in line: - minor = line.split('=')[1].strip() - elif 'VERSION_BUILD' in line: - build = line.split('=')[1].strip() - elif 'VERSION_ALPHA' in line: - alpha = line.split('=')[1].strip() - - if ((major and minor and build and alpha) or - '# END_VERSION_BLOCK' in line): - break - version = f"{major}.{minor}.{build}" - if alpha and int(alpha) > 0: - version += f"a{alpha}" - return version - - -def package_files(directory): - paths = [] - for (path, directories, filenames) in os.walk(directory): - for filename in filenames: - paths.append(os.path.join('..', path, filename)) - return paths - - -def required(requirements_file): - """ Read requirements file and remove comments and empty lines. """ - with open(os.path.join(BASEDIR, requirements_file), 'r') as f: - requirements = f.read().splitlines() - if 'MYCROFT_LOOSE_REQUIREMENTS' in os.environ: - print('USING LOOSE REQUIREMENTS!') - requirements = [r.replace('==', '>=').replace('~=', '>=') for r in requirements] - return [pkg for pkg in requirements - if pkg.strip() and not pkg.startswith("#")] - - -long_description = "" -if os.path.isfile(os.path.join(BASEDIR, "README.md")): - with open(os.path.join(BASEDIR, "README.md"), "r") as f: - long_description = f.read() - - -setup( - name='ovos_PHAL', - version=get_version(), - packages=['ovos_PHAL'], - install_requires=required("requirements/requirements.txt"), - extras_require={ - "extras": required("requirements/extras.txt"), - "linux": required("requirements/linux.txt"), - "mac": required("requirements/mac.txt"), - "mk1": required("requirements/mk1.txt"), - "mk2": required("requirements/mk2.txt"), - "mk2dev": required("requirements/mk2dev.txt") - }, - package_data={'': package_files('ovos_PHAL')}, - url='https://github.com/OpenVoiceOS/ovos-PHAL', - description="Plugin based Hardware Abstraction Layer for OVOS", - long_description=long_description, - long_description_content_type="text/markdown", - license='apache-2.0', - author='jarbasAi', - author_email='jarbasai@mailfence.com', - include_package_data=True, - entry_points={ - 'console_scripts': [ - 'ovos_PHAL=ovos_PHAL.__main__:main', - 'ovos_PHAL_admin=ovos_PHAL.admin:main' - ] - } -)