]> git.rkrishnan.org Git - tahoe-lafs/zfec.git/blob - zfec/setup.py
doc: TODO, copyright, version number regex, etc.
[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 # See README.txt for licensing information.
11
12 import os, re, sys
13
14 miscdeps=os.path.join(os.getcwd(), 'misc', 'dependencies')
15
16 try:
17     from ez_setup import use_setuptools
18 except ImportError:
19     pass
20 else:
21     if 'cygwin' in sys.platform.lower():
22         min_version='0.6c6'
23     else:
24         min_version='0.6a9'
25     download_base = "file:"+os.path.join('misc', 'dependencies')+os.path.sep
26     use_setuptools(min_version=min_version, download_delay=0, download_base=download_base, to_dir=miscdeps)
27
28 from setuptools import Extension, find_packages, setup
29
30 DEBUGMODE=("--debug" in sys.argv)
31
32 extra_compile_args=[]
33 extra_link_args=[]
34
35 extra_compile_args.append("-std=c99")
36
37 undef_macros=[]
38
39 if DEBUGMODE:
40     extra_compile_args.append("-O0")
41     extra_compile_args.append("-g")
42     extra_compile_args.append("-Wall")
43     extra_link_args.append("-g")
44     undef_macros.append('NDEBUG')
45
46 trove_classifiers=[
47     "Development Status :: 5 - Production/Stable",
48     "Environment :: Console",
49     "License :: OSI Approved :: GNU General Public License (GPL)", 
50     "License :: DFSG approved",
51     "License :: Other/Proprietary License",
52     "Intended Audience :: Developers", 
53     "Intended Audience :: End Users/Desktop",
54     "Intended Audience :: System Administrators",
55     "Operating System :: Microsoft",
56     "Operating System :: Microsoft :: Windows",
57     "Operating System :: Unix",
58     "Operating System :: POSIX :: Linux",
59     "Operating System :: POSIX",
60     "Operating System :: MacOS :: MacOS X",
61     "Operating System :: Microsoft :: Windows :: Windows NT/2000",
62     "Operating System :: OS Independent", 
63     "Natural Language :: English", 
64     "Programming Language :: C", 
65     "Programming Language :: Python", 
66     "Topic :: Utilities",
67     "Topic :: System :: Systems Administration",
68     "Topic :: System :: Filesystems",
69     "Topic :: System :: Distributed Computing",
70     "Topic :: Software Development :: Libraries",
71     "Topic :: Communications :: Usenet News",
72     "Topic :: System :: Archiving :: Backup", 
73     "Topic :: System :: Archiving :: Mirroring", 
74     "Topic :: System :: Archiving", 
75     ]
76
77 try:
78     (cin, cout, cerr,) = os.popen3("darcsver --quiet")
79     print cout.read()
80 except Exception, le:
81     pass
82 VERSIONFILE = "zfec/_version.py"
83 verstr = "unknown"
84 try:
85     verstrline = open(VERSIONFILE, "rt").read()
86 except EnvironmentError:
87     pass # Okay, there is no version file.
88 else:
89     VSRE = r"^verstr = ['\"]([^'\"]*)['\"]"
90     mo = re.search(VSRE, verstrline, re.M)
91     if mo:
92         verstr = mo.group(1)
93     else:
94         print "unable to find version in %s" % (VERSIONFILE,)
95         raise RuntimeError("if %s.py exists, it is required to be well-formed" % (VERSIONFILE,))
96
97 dependency_links=[os.path.join(miscdeps, t) for t in os.listdir(miscdeps) if t.endswith(".tar")]
98
99 setup(name='zfec',
100       version=verstr,
101       description='a fast erasure code with command-line, C, and Python interfaces',
102       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.',
103       author='Zooko O\'Whielacronx',
104       author_email='zooko@zooko.com',
105       url='http://allmydata.org/source/zfec',
106       license='GNU GPL',
107       dependency_links=dependency_links,
108       install_requires=["argparse >= 0.8", "pyutil >= 1.3.5"],
109       tests_require=["pyutil >= 1.3.5"],
110       packages=find_packages(),
111       include_package_data=True,
112       setup_requires=['setuptools_darcs >= 1.1.0',],
113       classifiers=trove_classifiers,
114       entry_points = { 'console_scripts': [ 'zfec = zfec.cmdline_zfec:main', 'zunfec = zfec.cmdline_zunfec:main' ] },
115       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),],
116       test_suite="zfec.test",
117       zip_safe=False, # I prefer unzipped for easier access.
118       )