-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
115 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
[build-system] | ||
requires = [ | ||
# First version of setuptools to support pyproject.toml configuration | ||
"setuptools>=61.0.0", | ||
"wheel", | ||
# Must be kept in sync with `project.dependencies` | ||
"cffi>=1.0.0", | ||
"pkgconfig>=1.5", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "pyvips" | ||
authors = [ | ||
{name = "John Cupitt", email = "[email protected]"}, | ||
] | ||
description = "binding for the libvips image processing library" | ||
readme = "README.rst" | ||
keywords = [ | ||
"image processing", | ||
] | ||
license = {text = "MIT"} | ||
requires-python = ">=3.3" | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Environment :: Console", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"Topic :: Multimedia :: Graphics", | ||
"Topic :: Multimedia :: Graphics :: Graphics Conversion", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.3", | ||
"Programming Language :: Python :: 3.4", | ||
"Programming Language :: Python :: 3.5", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
] | ||
dependencies = [ | ||
# Must be kept in sync with `build-system.requires` | ||
"cffi>=1.0.0", | ||
] | ||
dynamic = [ | ||
"version", | ||
] | ||
|
||
[project.urls] | ||
changelog = "https://github.com/libvips/pyvips/blob/master/CHANGELOG.rst" | ||
documentation = "https://libvips.github.io/pyvips/" | ||
funding = "https://opencollective.com/libvips" | ||
homepage = "https://github.com/libvips/pyvips" | ||
issues = "https://github.com/libvips/pyvips/issues" | ||
source = "https://github.com/libvips/pyvips" | ||
|
||
[tool.setuptools] | ||
# We try to compile as part of install, so we can't run in a ZIP | ||
zip-safe = false | ||
include-package-data = false | ||
|
||
[tool.setuptools.dynamic] | ||
version = {attr = "pyvips.version.__version__"} | ||
|
||
[tool.setuptools.packages.find] | ||
exclude = [ | ||
"doc*", | ||
"examples*", | ||
"tests*", | ||
] | ||
|
||
[project.optional-dependencies] | ||
# All the following are used for our own testing | ||
tox = ["tox"] | ||
test = [ | ||
"pytest", | ||
"pyperf", | ||
] | ||
sdist = ["build"] | ||
doc = [ | ||
"sphinx", | ||
"sphinx_rtd_theme", | ||
] | ||
|
||
[tool.pytest.ini_options] | ||
norecursedirs = ["tests/helpers"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# this is execfile()d into setup.py imported into __init__.py | ||
# this is used in pyproject.toml and imported into __init__.py | ||
__version__ = '2.2.3' | ||
|
||
__all__ = ['__version__'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,22 @@ | ||
"""a binding for the libvips image processing library | ||
See: | ||
https://github.com/libvips/pyvips | ||
""" | ||
|
||
# flake8: noqa | ||
|
||
import sys | ||
from codecs import open | ||
from os import path | ||
|
||
from setuptools import setup, find_packages | ||
from distutils import log | ||
|
||
here = path.abspath(path.dirname(__file__)) | ||
|
||
info = {} | ||
with open(path.join(here, 'pyvips', 'version.py'), encoding='utf-8') as f: | ||
exec(f.read(), info) | ||
|
||
with open(path.join(here, 'README.rst'), encoding='utf-8') as f: | ||
long_description = f.read() | ||
|
||
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers | ||
pyvips_classifiers = [ | ||
'Development Status :: 5 - Production/Stable', | ||
'Environment :: Console', | ||
'Intended Audience :: Developers', | ||
'Intended Audience :: Science/Research', | ||
'Topic :: Multimedia :: Graphics', | ||
'Topic :: Multimedia :: Graphics :: Graphics Conversion', | ||
'License :: OSI Approved :: MIT License', | ||
'Programming Language :: Python :: 3' | ||
'Programming Language :: Python :: 3 :: Only', | ||
'Programming Language :: Python :: 3.3', | ||
'Programming Language :: Python :: 3.4', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: 3.11', | ||
'Programming Language :: Python :: 3.12', | ||
'Programming Language :: Python :: Implementation :: CPython', | ||
'Programming Language :: Python :: Implementation :: PyPy', | ||
] | ||
|
||
setup_deps = [ | ||
'cffi>=1.0.0', | ||
] | ||
|
||
install_deps = [ | ||
'cffi>=1.0.0', | ||
] | ||
|
||
test_deps = [ | ||
'cffi>=1.0.0', | ||
'pytest', | ||
'pyperf', | ||
] | ||
|
||
extras = { | ||
'test': test_deps, | ||
'doc': ['sphinx', 'sphinx_rtd_theme'], | ||
} | ||
|
||
pyvips_packages = find_packages(exclude=['docs', 'tests', 'examples']) | ||
|
||
sys.path.append(path.join(here, 'pyvips')) | ||
|
||
def setup_API(): | ||
setup( | ||
name='pyvips', | ||
version=info['__version__'], | ||
description='binding for the libvips image processing library, API mode', | ||
long_description=long_description, | ||
url='https://github.com/libvips/pyvips', | ||
author='John Cupitt', | ||
author_email='[email protected]', | ||
license='MIT', | ||
classifiers=pyvips_classifiers, | ||
keywords='image processing', | ||
|
||
packages=pyvips_packages, | ||
setup_requires=setup_deps + ['pkgconfig>=1.5'], | ||
cffi_modules=['pyvips/pyvips_build.py:ffibuilder'], | ||
install_requires=install_deps + ['pkgconfig>=1.5'], | ||
tests_require=test_deps, | ||
extras_require=extras, | ||
|
||
# we will try to compile as part of install, so we can't run in a zip | ||
zip_safe=False, | ||
) | ||
from os import path | ||
from setuptools import setup | ||
|
||
def setup_ABI(): | ||
setup( | ||
name='pyvips', | ||
version=info['__version__'], | ||
description='binding for the libvips image processing library, ABI mode', | ||
long_description=long_description, | ||
url='https://github.com/libvips/pyvips', | ||
author='John Cupitt', | ||
author_email='[email protected]', | ||
license='MIT', | ||
classifiers=pyvips_classifiers, | ||
keywords='image processing', | ||
base_dir = path.dirname(__file__) | ||
src_dir = path.join(base_dir, 'pyvips') | ||
|
||
packages=pyvips_packages, | ||
setup_requires=setup_deps, | ||
install_requires=install_deps, | ||
tests_require=test_deps, | ||
extras_require=extras, | ||
) | ||
# When executing the setup.py, we need to be able to import ourselves, this | ||
# means that we need to add the pyvips/ directory to the sys.path. | ||
sys.path.insert(0, src_dir) | ||
|
||
# try to install in API mode first, then if that fails, fall back to ABI | ||
# Try to install in API mode first, then if that fails, fall back to ABI | ||
|
||
# API mode requires a working C compiler plus all the libvips headers whereas | ||
# ABI only needs the libvips shared library to be on the system | ||
|
||
try: | ||
setup_API() | ||
setup(cffi_modules=['pyvips/pyvips_build.py:ffibuilder']) | ||
except Exception as e: | ||
log.warn('Falling back to ABI mode. Details: {0}'.format(e)) | ||
setup_ABI() | ||
print('Falling back to ABI mode. Details: {0}'.format(e)) | ||
setup() |