]> git.rkrishnan.org Git - tahoe-lafs/zfec.git/blob - zfec/setup.py
zfec: setup: don't spew a traceback if darcsver isn't installed
[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 from ez_setup import use_setuptools
25 import sys
26 if 'cygwin' in sys.platform.lower():
27     min_version='0.6c6'
28 else:
29     min_version='0.6a9'
30 use_setuptools(min_version=min_version, download_delay=0)
31
32 from setuptools import Extension, find_packages, setup
33
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     "Intended Audience :: Developers", 
56     "Intended Audience :: End Users/Desktop",
57     "Intended Audience :: System Administrators",
58     "Operating System :: Microsoft",
59     "Operating System :: Microsoft :: Windows",
60     "Operating System :: Unix",
61     "Operating System :: POSIX :: Linux",
62     "Operating System :: POSIX",
63     "Operating System :: MacOS :: MacOS X",
64     "Operating System :: Microsoft :: Windows :: Windows NT/2000",
65     "Operating System :: OS Independent", 
66     "Natural Language :: English", 
67     "Programming Language :: C", 
68     "Programming Language :: Python", 
69     "Topic :: Utilities",
70     "Topic :: System :: Systems Administration",
71     "Topic :: System :: Filesystems",
72     "Topic :: System :: Distributed Computing",
73     "Topic :: Software Development :: Libraries",
74     "Topic :: Communications :: Usenet News",
75     "Topic :: System :: Archiving :: Backup", 
76     "Topic :: System :: Archiving :: Mirroring", 
77     "Topic :: System :: Archiving", 
78     ]
79
80 try:
81     import os
82     (cin, cout, cerr,) = os.popen3("darcsver")
83     print cout.read()
84 except Exception, le:
85     pass
86 import re
87 VERSIONFILE = "zfec/_version.py"
88 verstr = "unknown"
89 VSRE = re.compile("^verstr = ['\"]([^'\"]*)['\"]", re.M)
90 try:
91     verstrline = open(VERSIONFILE, "rt").read()
92 except EnvironmentError:
93     pass # Okay, there is no version file.
94 else:
95     mo = VSRE.search(verstrline)
96     if mo:
97         verstr = mo.group(1)
98     else:
99         print "unable to find version in %s" % (VERSIONFILE,)
100         raise RuntimeError("if %s.py exists, it is required to be well-formed" % (VERSIONFILE,))
101
102 setup(name='zfec',
103       version=verstr,
104       description='a fast erasure code with command-line, C, and Python interfaces',
105       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.',
106       author='Zooko O\'Whielacronx',
107       author_email='zooko@zooko.com',
108       url='http://allmydata.org/source/zfec',
109       license='GNU GPL',
110       install_requires=["argparse >= 0.8", "pyutil >= 1.3.5",],
111       packages=find_packages(),
112       include_package_data=True,
113       setup_requires=['setuptools_darcs >= 1.0.3',],
114       classifiers=trove_classifiers,
115       entry_points = { 'console_scripts': [ 'zfec = zfec.cmdline_zfec:main', 'zunfec = zfec.cmdline_zunfec:main' ] },
116       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),],
117       test_suite="zfec.test",
118       zip_safe=False, # I prefer unzipped for easier access.
119       )