]> git.rkrishnan.org Git - tahoe-lafs/zfec.git/blob - zfec/setup.py
zfec: dual-license under GPL and TGPPL
[tahoe-lafs/zfec.git] / zfec / setup.py
1 #!/usr/bin/env python
2
3 # zfec -- fast forward error correction library with Python interface
4
5 # Copyright (C) 2007 Allmydata, Inc.
6 # Author: Zooko Wilcox-O'Hearn
7
8 # This file is part of zfec.
9 #
10 # This program is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by the Free
12 # Software Foundation; either version 2 of the License, or (at your option)
13 # any later version, with the added permission that, if you become obligated
14 # to release a derived work under this licence (as per section 2.b), you may
15 # delay the fulfillment of this obligation for up to 12 months.  If you are
16 # obligated to release code under section 2.b of this licence, you are
17 # obligated to release it under these same terms, including the 12-month grace
18 # period clause.  See the COPYING file for details.
19 #
20 # If you would like to inquire about a commercial relationship with Allmydata,
21 # Inc., please contact partnerships@allmydata.com and visit
22 # http://allmydata.com/.
23
24 import sys
25
26 try:
27     from ez_setup import use_setuptools
28 except ImportError:
29     pass
30 else:
31     if 'cygwin' in sys.platform.lower():
32         min_version='0.6c6'
33     else:
34         min_version='0.6a9'
35     use_setuptools(min_version=min_version, download_delay=0)
36
37 from setuptools import Extension, setup
38
39 DEBUGMODE=("--debug" in sys.argv)
40
41 extra_compile_args=[]
42 extra_link_args=[]
43
44 extra_compile_args.append("-std=c99")
45
46 undef_macros=[]
47
48 if DEBUGMODE:
49     extra_compile_args.append("-O0")
50     extra_compile_args.append("-g")
51     extra_compile_args.append("-Wall")
52     extra_link_args.append("-g")
53     undef_macros.append('NDEBUG')
54
55 trove_classifiers=[
56     "Development Status :: 5 - Production/Stable",
57     "Environment :: Console",
58     "License :: OSI Approved :: GNU General Public License (GPL)", 
59     "License :: DFSG approved",
60     "License :: Other/Proprietary License",
61     "Intended Audience :: Developers", 
62     "Intended Audience :: End Users/Desktop",
63     "Intended Audience :: System Administrators",
64     "Operating System :: Microsoft",
65     "Operating System :: Microsoft :: Windows",
66     "Operating System :: Unix",
67     "Operating System :: POSIX :: Linux",
68     "Operating System :: POSIX",
69     "Operating System :: MacOS :: MacOS X",
70     "Operating System :: Microsoft :: Windows :: Windows NT/2000",
71     "Operating System :: OS Independent", 
72     "Natural Language :: English", 
73     "Programming Language :: C", 
74     "Programming Language :: Python", 
75     "Topic :: Utilities",
76     "Topic :: System :: Systems Administration",
77     "Topic :: System :: Filesystems",
78     "Topic :: System :: Distributed Computing",
79     "Topic :: Software Development :: Libraries",
80     "Topic :: Communications :: Usenet News",
81     "Topic :: System :: Archiving :: Backup", 
82     "Topic :: System :: Archiving :: Mirroring", 
83     "Topic :: System :: Archiving", 
84     ]
85
86 try:
87     import os
88     (cin, cout, cerr,) = os.popen3("darcsver --quiet")
89     print cout.read()
90 except Exception, le:
91     pass
92 import re
93 VERSIONFILE = "zfec/_version.py"
94 verstr = "unknown"
95 VSRE = re.compile("^verstr = ['\"]([^'\"]*)['\"]", re.M)
96 try:
97     verstrline = open(VERSIONFILE, "rt").read()
98 except EnvironmentError:
99     pass # Okay, there is no version file.
100 else:
101     mo = VSRE.search(verstrline)
102     if mo:
103         verstr = mo.group(1)
104     else:
105         print "unable to find version in %s" % (VERSIONFILE,)
106         raise RuntimeError("if %s.py exists, it is required to be well-formed" % (VERSIONFILE,))
107
108 setup(name='zfec',
109       version=verstr,
110       description='a fast erasure code with command-line, C, and Python interfaces',
111       long_description='Fast, portable, programmable erasure coding a.k.a. "forward error correction": the generation of redundant blocks of information such that if some blocks are lost then the original data can be recovered from the remaining blocks.',
112       author='Zooko O\'Whielacronx',
113       author_email='zooko@zooko.com',
114       url='http://allmydata.org/source/zfec',
115       license='GNU GPL',
116       install_requires=["argparse >= 0.8", "pyutil >= 1.3.5",],
117       include_package_data=True,
118       setup_requires=['setuptools_darcs >= 1.1.0',],
119       classifiers=trove_classifiers,
120       entry_points = { 'console_scripts': [ 'zfec = zfec.cmdline_zfec:main', 'zunfec = zfec.cmdline_zunfec:main' ] },
121       ext_modules=[Extension('zfec._fec', ['zfec/fec.c', 'zfec/_fecmodule.c',], extra_link_args=extra_link_args, extra_compile_args=extra_compile_args, undef_macros=undef_macros),],
122       test_suite="zfec.test",
123       zip_safe=False, # I prefer unzipped for easier access.
124       )