diff --git a/.github/workflows/publish_to_pypi.yml b/.github/workflows/publish_to_pypi.yml new file mode 100644 index 0000000..4552f19 --- /dev/null +++ b/.github/workflows/publish_to_pypi.yml @@ -0,0 +1,38 @@ +name: Upload FotoKilof Package to PyPI when a Release is Created + +on: + release: + types: [published] + +jobs: + publish-to-pypi: + name: Publish Package to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/FotoKilof + permissions: + contents: write + id-token: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: "Install build" + run: pip install build + + - name: Build package + run: python -m build + + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + - name: Upload artifact signatures to GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: gh release upload '${{ github.pypi }}' dist/** --repo '${{ github.repository }}' \ No newline at end of file diff --git a/fotokilof/gui.py b/fotokilof/gui.py index dbaa3dd..eb8711d 100644 --- a/fotokilof/gui.py +++ b/fotokilof/gui.py @@ -31,11 +31,13 @@ import platform import re from PIL import Image -import pyperclipimg if platform.system() != "Windows": import subprocess +if platform.system() in ("Linux", "Darwin", "Windows"): + import pyperclipimg + module_logger = logging.getLogger(__name__) diff --git a/pyproject.toml b/pyproject.toml index 317aa34..2205045 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ dependencies = [ "ttkbootstrap", "wand", "pywin32; platform_system=='Windows'", - "pyperclipimg", + "pyperclipimg; platform_system=='Linux' or platform_system=='Darwin' or platform_system=='Windows'", ] classifiers=[ "Development Status :: 5 - Production/Stable",