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