-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
72 lines (64 loc) · 1.94 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
from setuptools import setup, Extension
# Get the relative zopflipng source location
def get_zopflipng_source(items):
return list(map(lambda item: "zopfli/src/" + item, items))
# zopflipng sources
zopflipng_src = get_zopflipng_source([
'zopfli/blocksplitter.c',
'zopfli/cache.c',
'zopfli/deflate.c',
'zopfli/gzip_container.c',
'zopfli/hash.c',
'zopfli/katajainen.c',
'zopfli/lz77.c',
'zopfli/squeeze.c',
'zopfli/tree.c',
'zopfli/util.c',
'zopfli/zlib_container.c',
'zopfli/zopfli_lib.c',
'zopflipng/lodepng/lodepng_util.cpp',
'zopflipng/lodepng/lodepng.cpp',
'zopflipng/zopflipng_lib.cc'
])
# include header file
include_file = get_zopflipng_source([
'zopfli/blocksplitter.h',
'zopfli/cache.h',
'zopfli/deflate.h',
'zopfli/gzip_container.h',
'zopfli/hash.h',
'zopfli/katajainen.h',
'zopfli/lz77.h',
'zopfli/squeeze.h',
'zopfli/symbols.h',
'zopfli/tree.h',
'zopfli/util.h',
'zopfli/zlib_container.h',
'zopfli/zopfli.h',
'zopflipng/lodepng/lodepng_util.h',
'zopflipng/lodepng/lodepng.h',
'zopflipng/zopflipng_lib.h'
])
# python wrapper
zopflipng_src.extend([
'src/py_zopflipng.cc'
])
# define module
module_zopflipng = Extension('zopflipng._clib',
language="c++",
sources=zopflipng_src,
include_file=include_file, )
setup(name='zopflipng',
version='1.0.2',
description='Zopflipng wrapper for python,used for lossless compression of PNG',
author ='hhoy',
license='Apache',
author_email='[email protected]',
url="https://github.com/hhoy/python-zopflipng.git",
long_description_content_type='text/markdown',
long_description=open('README.md', encoding='utf-8').read(),
ext_modules=[module_zopflipng],
include_package_data=True,
package_dir={'': 'src'},
packages =['zopflipng'],
platforms="any")