diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6cc7f4d2..5a9cbb7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: runs-on: windows-latest strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v2 @@ -51,7 +51,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v2 @@ -70,15 +70,20 @@ jobs: if: matrix.os == 'macos-latest' run: brew install python py3cairo pygobject3 pango + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: 1.22 + - name: Install fonts (non-Windows) if: matrix.os != 'windows-latest' run: | - GO111MODULE=on GOBIN=$HOME/.local/bin go get github.com/Crosse/font-install@v1.4.1 - $HOME/.local/bin/font-install "https://osdn.net/frs/redir.php?m=gigenet&f=mix-mplus-ipa%2F58720%2Fmigu-1p-20130430.zip" + go install github.com/Crosse/font-install@latest + font-install "https://github.com/itouhiro/mixfont-mplus-ipa/releases/download/v2020.0307/migu-1p-20200307.zip" shell: bash - name: Install fonts (Windows) if: matrix.os == 'windows-latest' - run: ./.github/scripts/install-fonts.ps1 'https://osdn.net/frs/redir.php?m=gigenet&f=mix-mplus-ipa%2F58720%2Fmigu-1p-20130430.zip' + run: ./.github/scripts/install-fonts.ps1 'https://github.com/itouhiro/mixfont-mplus-ipa/releases/download/v2020.0307/migu-1p-20200307.zip' shell: pwsh - name: Cache Python @@ -104,10 +109,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python 3.12 uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: 3.12 - name: Install pypa/build run: >- @@ -126,11 +131,11 @@ jobs: . - name: Publish distribution 📦 to Test PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1.9 with: password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + repository-url: https://test.pypi.org/legacy/ - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1.9 with: password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..ef3350b3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,54 @@ +[project] +name = "pyonfx" +description = "An easy way to create KFX (Karaoke Effects) and complex typesetting using the ASS format (Advanced Substation Alpha)." +authors = [ + { name = "Antonio Strippoli", email = "clarantonio98@gmail.com" }, +] +license = { file = "LICENSE" } +readme = "README.md" +requires-python = ">=3.9" +dependencies = [ + "pyquaternion", + "pywin32; platform_system=='Windows'", + "pycairo; platform_system=='Linux' or platform_system=='Darwin'", + "PyGObject; platform_system=='Linux' or platform_system=='Darwin'", +] +classifiers=[ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", +] +dynamic = ["version"] +keywords = ["typesetting", "ass", "subtitle", "aegisub", "karaoke", "kfx", "advanced-substation-alpha", "karaoke-effect"] + +[project.urls] +Documentation = "https://pyonfx.rtfd.io/" +Source = "https://github.com/CoffeeStraw/PyonFX/" +Tracker = "https://github.com/CoffeeStraw/PyonFX/issues/" + +[project.optional-dependencies] +dev = [ + "black", + "pytest", + "pytest-check", + "sphinx>=5.0.0", + "sphinx_panels", + "sphinx_rtd_theme", + "sphinxcontrib-napoleon", +] + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.dynamic] +version = { attr = "pyonfx.__init__.__version__" } + +[tool.setuptools.packages.find] +include = ["pyonfx*"] \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index c69b63b6..00000000 --- a/setup.py +++ /dev/null @@ -1,76 +0,0 @@ -import os -import re -import setuptools - -here = os.path.abspath(os.path.dirname(__file__)) - - -def read(*parts): - with open(os.path.join(here, *parts), "r") as fp: - return fp.read() - - -def find_version(*file_paths): - version_file = read(*file_paths) - version_match = re.search(r"^__version__ = [\'\"](.+)[\'\"]", version_file, re.M) - if version_match: - return version_match.group(1) - raise RuntimeError("Unable to find version string.") - - -def get_requirements(): - requirements = ["pyquaternion"] - - if os.environ.get("READTHEDOCS") != "True": - requirements.extend( - [ - 'pywin32; sys_platform == "win32"', - 'pycairo; sys_platform == "linux" or sys_platform == "darwin"', - 'PyGObject; sys_platform == "linux" or sys_platform == "darwin"', - ] - ) - - return requirements - - -setuptools.setup( - name="pyonfx", - url="https://github.com/CoffeeStraw/PyonFX/", - project_urls={ - "Documentation": "http://pyonfx.rtfd.io/", - "Source": "https://github.com/CoffeeStraw/PyonFX/", - "Tracker": "https://github.com/CoffeeStraw/PyonFX/issues/", - }, - author="Antonio Strippoli", - author_email="clarantonio98@gmail.com", - description="An easy way to create KFX (Karaoke Effects) and complex typesetting using the ASS format (Advanced Substation Alpha).", - long_description=open("README.md", encoding="utf-8").read(), - long_description_content_type="text/markdown", - version=find_version("pyonfx", "__init__.py"), - packages=["pyonfx"], - python_requires=">=3.7", - install_requires=get_requirements(), - extras_require={ - "dev": [ - "black", - "pytest", - "pytest-check", - "sphinx_panels", - "sphinx_rtd_theme", - "sphinxcontrib-napoleon", - ] - }, - keywords="typesetting ass subtitle aegisub karaoke kfx advanced-substation-alpha karaoke-effect", - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", - ], - license="GNU LGPL 3.0 or later", -) diff --git a/tests/test_convert.py b/tests/test_convert.py index 8facce45..3e51e008 100644 --- a/tests/test_convert.py +++ b/tests/test_convert.py @@ -239,7 +239,7 @@ def test_text_to_shape(): if sys.platform == "win32": assert shape == Shape( - "m 14.938 23.422 b 13.031 22.562 11.156 22.125 9.328 22.125 7.219 22.125 6.156 22.734 6.156 23.984 6.156 24.578 6.391 25.031 6.844 25.359 7.312 25.672 8.109 25.922 9.25 26.078 11.797 26.422 13.625 27.078 14.719 28.047 15.828 29 16.375 30.328 16.375 32 16.375 33.625 15.734 34.922 14.453 35.891 13.172 36.844 11.375 37.328 9.078 37.328 6.312 37.328 3.844 36.75 1.688 35.609 l 2.547 32.234 b 4.5 33.359 6.594 33.922 8.844 33.922 10.844 33.922 11.828 33.266 11.828 31.922 11.828 31.312 11.625 30.844 11.219 30.516 10.797 30.203 10 29.938 8.812 29.766 6.234 29.328 4.422 28.641 3.375 27.734 2.297 26.797 1.75 25.516 1.75 23.906 1.781 22.312 2.406 21.047 3.641 20.125 4.891 19.203 6.703 18.75 9.078 18.75 11.469 18.75 13.703 19.188 15.797 20.062 l 14.938 23.422 m 24.672 19.094 l 24.672 29.766 b 24.672 31.297 24.875 32.344 25.312 32.906 25.734 33.469 26.453 33.75 27.484 33.75 28.5 33.75 29.422 33.25 30.25 32.219 31.062 31.203 31.484 30 31.484 28.625 l 31.484 19.094 35.953 19.094 35.953 36.984 31.797 36.984 31.688 34.469 31.625 34.469 b 30.938 35.375 30.078 36.062 29.078 36.578 28.062 37.078 27.016 37.328 25.938 37.328 24 37.328 22.562 36.781 21.641 35.656 20.719 34.547 20.266 32.734 20.266 30.203 l 20.266 19.094 24.672 19.094" + "m 14.938 23.422 b 13 22.562 11.141 22.125 9.328 22.125 7.234 22.141 6.188 22.766 6.156 23.984 6.156 24.828 6.688 25.422 7.734 25.766 8.156 25.891 8.656 25.984 9.25 26.078 12.922 26.609 15.156 27.812 15.969 29.688 16.234 30.359 16.375 31.125 16.375 32 16.375 34.25 15.266 35.797 13.047 36.672 11.922 37.109 10.594 37.328 9.078 37.328 6.312 37.328 3.844 36.75 1.688 35.609 l 2.547 32.234 b 4.5 33.359 6.594 33.922 8.844 33.922 10.812 33.906 11.812 33.234 11.828 31.922 11.828 31.141 11.484 30.594 10.766 30.281 10.312 30.078 9.656 29.906 8.812 29.766 5.094 29.172 2.859 27.906 2.094 25.969 1.875 25.359 1.75 24.672 1.75 23.906 1.75 21.656 2.906 20.141 5.234 19.328 6.328 18.953 7.609 18.75 9.078 18.75 11.484 18.75 13.734 19.188 15.797 20.062 l 14.938 23.422 m 24.672 19.094 l 24.672 29.766 b 24.672 31.797 25.109 33.047 26.016 33.469 26.406 33.656 26.891 33.75 27.484 33.75 28.641 33.75 29.641 33.141 30.484 31.891 31.172 30.906 31.516 29.812 31.516 28.625 l 31.516 19.094 35.984 19.094 35.984 36.984 31.797 36.984 31.688 34.469 31.625 34.469 b 30.359 36.125 28.719 37.062 26.703 37.297 26.422 37.312 26.172 37.328 25.938 37.328 23.188 37.328 21.453 36.188 20.75 33.891 20.422 32.906 20.266 31.672 20.266 30.203 l 20.266 19.094 24.672 19.094" ) elif sys.platform == "linux" or sys.platform == "darwin": i = 0