Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for setuptools_scm

- name: Log reason (manual run only)
if: github.event_name == 'workflow_dispatch'
Expand All @@ -28,23 +30,33 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.13

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential pkg-config zlib1g-dev libtool autotools-dev

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools>=61.0
python -m pip install -r requirements.txt
python -m pip install opentype-sanitizer

- name: Download OTS source
run: |
python setup.py download --version=9.2.0 --sha256=1a1e50cd7ecea27c4ef04c5b1491c21e75555f35bf91e27103ede04ddd11e053

- name: Lint with flake8
run: flake8 . --show-source --statistics

- name: Lint with cpplint
run: cpplint --filter=-build/includesubdir,-readability/casting,-build/include --recursive .
run: cpplint --filter=-build/includesubdir,-readability/casting,-build/include --recursive src/_pyots/

- name: Build and install
run: |
python setup.py install
python -m pip install -v .

- name: Test with pytest
run: |
Expand Down
36 changes: 36 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
[build-system]
requires = ["setuptools>=61", "wheel", "setuptools_scm[toml]>=3.4", "ninja", "meson"]
build-backend = "setuptools.build_meta"

[project]
name = "pyots"
description = "Python wrapper for ot-sanitizer"
readme = "README.md"
license = "BSD-3-Clause"
authors = [
{name = "Adobe Type team & friends", email = "afdko@adobe.com"}
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Software Development :: Testing",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
]
requires-python = ">=3.9"
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/adobe-type-tools/pyots"

[tool.setuptools]
package-dir = {"" = "src"}
zip-safe = false

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools_scm]

[tool.pytest.ini_options]
testpaths = [
Expand Down
49 changes: 14 additions & 35 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
from build import SRC_DIR, OTS_SRC_DIR
from distutils.dir_util import mkpath, remove_tree
from distutils import log
import io
import os
import re
from setuptools import setup, find_packages, Extension, Command
from pathlib import Path
from setuptools import setup, Extension, Command
from setuptools.command import build_py
from setuptools.command.egg_info import egg_info
import subprocess
import sys

PY = sys.executable

# Define paths (previously imported from build.py)
try:
ROOT = Path(__file__).parent.resolve()
except NameError:
# Fallback for when __file__ is not defined
ROOT = Path.cwd()
SRC_DIR = ROOT / "src"
OTS_SRC_DIR = SRC_DIR / "ots"

BUILD_DIR = OTS_SRC_DIR / "build" / "meson"
BUILD_SUB_DIR = BUILD_DIR / "subprojects"
SRC_SUB_DIR = OTS_SRC_DIR / "subprojects"
Expand Down Expand Up @@ -47,7 +56,7 @@ def _get_extra_objects():
# xo.append(BUILD_SUB_DIR / f"woff2-{WOFF2_TAG}" / "libwoff2_decoder.a")
# xo.append(BUILD_SUB_DIR / f"woff2-{WOFF2_TAG}" / "libwoff2_common.a")

return [str(p) for p in xo]
return [str(p.relative_to(ROOT)) for p in xo]


def _get_include_dirs():
Expand All @@ -69,7 +78,7 @@ def _get_include_dirs():
# woff2
ip.append(SRC_SUB_DIR / f"woff2-{WOFF2_TAG}" / "include")

return [str(p) for p in ip]
return [str(p.relative_to(ROOT)) for p in ip]


def _get_sources():
Expand All @@ -87,7 +96,7 @@ def _get_sources():
sp.append(SRC_SUB_DIR / f"woff2-{WOFF2_TAG}" / "src" / "woff2_dec.cc")
sp.append(SRC_SUB_DIR / f"woff2-{WOFF2_TAG}" / "src" / "woff2_out.cc")

return [str(p) for p in sp]
return [str(p.relative_to(ROOT)) for p in sp]


class BuildStaticLibs(Command):
Expand Down Expand Up @@ -271,37 +280,7 @@ def run(self):
sources=_get_sources(),
)

with io.open("README.md", encoding="utf-8") as readme:
long_description = readme.read()

classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Topic :: Software Development :: Testing',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX :: Linux',
]

setup(
author='Adobe Type team & friends',
author_email='afdko@adobe.com',
cmdclass=custom_commands,
classifiers=classifiers,
description='Python wrapper for ot-sanitizer',
ext_modules=[pyots_mod],
long_description_content_type='text/markdown',
long_description=long_description,
name='pyots',
packages=find_packages('src'),
package_dir={'': 'src'},
python_requires='>=3.9',
url='https://github.com/adobe-type-tools/pyots',
use_scm_version=True,
setup_requires=['setuptools_scm'],
zip_safe=False,
)