This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
88 lines (79 loc) · 2.36 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import json
import platform
from setuptools import setup, find_packages, Extension
import sys
if platform.system() == "Windows":
library_dirs = [
'ext/libtiff_4_0_7/wn_lib',
'ext/jpeg-9d/wn_lib',
'ext/zlib-1.2.11/wn_lib'
]
include_dirs = [
'ext/libtiff_4_0_7/include',
'ext/jpeg-9d/include',
'ext/zlib-1.2.11/include'
]
extra_link_args=['-static']
else:
library_dirs = []
include_dirs = []
extra_link_args=[]
class LazyPyBind11IncludeDirWrapper(object):
def __init__(self, user=False):
self.user = user
def __str__(self):
import pybind11
return pybind11.get_include(self.user)
tiff_extention_module = Extension(
'pylibtiff.ext.tiff_file',
library_dirs=library_dirs,
libraries=['tiff', 'jpeg', 'z'],
sources=[
'src/ext/utils.cpp',
'src/ext/tiff_reader.cpp',
'src/ext/tiff_writer.cpp',
'src/ext/tiff_file.cpp'
],
include_dirs=[
LazyPyBind11IncludeDirWrapper(),
LazyPyBind11IncludeDirWrapper(user=True),
*include_dirs
],
extra_compile_args=['-std=c++14'],
extra_link_args=extra_link_args,
language='c++',
)
with open('./info.json', 'r') as fh:
info = json.load(fh)
setup(
name='pylibtiff',
version=info['version'],
author='D. Vischi',
author_email='dario.vischi@fmi.ch',
classifiers=[
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
packages=find_packages('src', exclude=['tests']),
package_dir={'': 'src'},
# read additional package data from MANIFEST.in
# not compatible with package_data
include_package_data=False,
# install files which are within the package,
# but e.g. not within a module (a folder including an __init__.py file)
package_data={
'pylibtiff': []
},
# scripts=['bin/script.py'],
url='https://github.com/fractal-napari-plugins-collection/pylibtiff/',
license='MIT',
description='libtiff wrapper for Python.',
long_description=open('README.md').read(),
ext_modules=[tiff_extention_module],
install_requires=[
"numpy >= 1.14.0",
"pybind11 >= 2.2.3",
],
test_suite='tests',
)