forked from jd-boyd/python-lzo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
85 lines (71 loc) · 2.54 KB
/
setup.py
File metadata and controls
85 lines (71 loc) · 2.54 KB
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
#! /usr/bin/env python
# vi:ts=4:et
import os, sys
import distutils
from distutils.core import setup
from distutils.extension import Extension
from distutils.util import split_quoted
include_dirs = []
define_macros = []
library_dirs = []
libraries = []
runtime_library_dirs = []
extra_objects = []
extra_compile_args = []
extra_link_args = []
if sys.platform == "win32":
# Windows users have to configure the LZO_DIR path parameter to match
# their LZO source installation. The path set here is just an example
# and thus unlikely to match your installation.
LZO_DIR = r"c:\src\lzo-1.08"
if not os.path.exists(LZO_DIR):
raise Exception("please set LZO_DIR to where the lzo source lives")
include_dirs.append(os.path.join(LZO_DIR, "include"))
extra_objects.append(os.path.join(LZO_DIR, "lzo.lib"))
else:
libraries = ["lzo2"]
include_dirs.append("/usr/include/lzo")
##library_dirs.append("/usr/local/lib")
##runtime_library_dirs.append("/usr/local/lib")
# Add extra compile flag for MacOS X
if sys.platform[:-1] == "darwin":
extra_link_args.append("-flat_namespace")
###############################################################################
def get_kw(**kw): return kw
ext = Extension(
name="lzo",
sources=["lzomodule.c"],
include_dirs=include_dirs,
define_macros=define_macros,
library_dirs=library_dirs,
libraries=libraries,
runtime_library_dirs=runtime_library_dirs,
extra_objects=extra_objects,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
)
##print ext.__dict__; sys.exit(1)
setup_args = get_kw(
name="python-lzo",
version="1.08",
description="Python bindings for the LZO data compression library",
author="Markus F.X.J. Oberhumer",
author_email="markus@oberhumer.com",
maintainer="Joshua D. Boyd",
maintainer_email="jdboyd@jdboyd.net",
url="https://github.com/jd-boyd/python-lzo",
licence="GNU General Public License (GPL)",
ext_modules=[ext],
long_description="""
This module provides Python bindings for the LZO data compression library.
LZO is a portable lossless data compression library written in ANSI C.
It offers pretty fast compression and *very* fast decompression.
Decompression requires no memory.
In addition there are slower compression levels achieving a quite
competitive compression ratio while still decompressing at
this very high speed.""",
)
##print distutils.__version__
if distutils.__version__ >= "1.0.2":
setup_args["platforms"] = "All"
apply(setup, (), setup_args)