3 # zfec -- fast forward error correction library with Python interface
5 # Copyright (C) 2007-2008 Allmydata, Inc.
6 # Author: Zooko Wilcox-O'Hearn
8 # This file is part of zfec.
10 # See README.txt for licensing information.
14 miscdeps=os.path.join(os.getcwd(), 'misc', 'dependencies')
17 from ez_setup import use_setuptools
21 # On cygwin there was a permissions error that was fixed in 0.6c6.
22 use_setuptools(min_version='0.6c6', download_delay=0, to_dir=miscdeps)
24 from setuptools import Extension, find_packages, setup
26 if "--debug" in sys.argv:
28 sys.argv.remove("--debug")
30 DEBUGMODE=("--debug" in sys.argv)
35 extra_compile_args.append("-std=c99")
41 if arg.startswith("--STRIDE="):
42 stride = int(arg[len("--stride="):])
43 define_macros.append(('STRIDE', stride))
50 extra_compile_args.append("-O0")
51 extra_compile_args.append("-g")
52 extra_compile_args.append("-Wall")
53 extra_link_args.append("-g")
54 undef_macros.append('NDEBUG')
57 "Development Status :: 5 - Production/Stable",
58 "Environment :: Console",
59 "License :: OSI Approved :: GNU General Public License (GPL)",
60 "License :: DFSG approved",
61 "License :: Other/Proprietary License",
62 "Intended Audience :: Developers",
63 "Intended Audience :: End Users/Desktop",
64 "Intended Audience :: System Administrators",
65 "Operating System :: Microsoft",
66 "Operating System :: Microsoft :: Windows",
67 "Operating System :: Unix",
68 "Operating System :: POSIX :: Linux",
69 "Operating System :: POSIX",
70 "Operating System :: MacOS :: MacOS X",
71 "Operating System :: Microsoft :: Windows :: Windows NT/2000",
72 "Operating System :: OS Independent",
73 "Natural Language :: English",
74 "Programming Language :: C",
75 "Programming Language :: Python",
77 "Topic :: System :: Systems Administration",
78 "Topic :: System :: Filesystems",
79 "Topic :: System :: Distributed Computing",
80 "Topic :: Software Development :: Libraries",
81 "Topic :: Communications :: Usenet News",
82 "Topic :: System :: Archiving :: Backup",
83 "Topic :: System :: Archiving :: Mirroring",
84 "Topic :: System :: Archiving",
88 VERSIONFILE = PKG+"/_version.py"
91 verstrline = open(VERSIONFILE, "rt").read()
92 except EnvironmentError:
93 pass # Okay, there is no version file.
95 VSRE = r"^verstr = ['\"]([^'\"]*)['\"]"
96 mo = re.search(VSRE, verstrline, re.M)
100 print "unable to find version in %s" % (VERSIONFILE,)
101 raise RuntimeError("if %s.py exists, it is required to be well-formed" % (VERSIONFILE,))
103 dependency_links=[os.path.join(miscdeps, t) for t in os.listdir(miscdeps) if t.endswith(".tar")]
106 # darcsver is needed only if you want "./setup.py darcsver" to write a new
107 # version stamp in zfec/_version.py, with a version number derived from
108 # darcs history. http://pypi.python.org/pypi/darcsver
109 if "darcsver" in sys.argv[1:]:
110 setup_requires.append('darcsver >= 1.0.0')
112 # setuptools_darcs is required to produce complete distributions (such as with
113 # "sdist" or "bdist_egg"), unless there is a zfec.egg-info/SOURCE.txt file
114 # present which contains a complete list of files that should be included.
115 # http://pypi.python.org/pypi/setuptools_darcs
116 setup_requires.append('setuptools_darcs >= 1.1.0')
118 data_fnames=[ 'COPYING.GPL', 'changelog', 'COPYING.TGPPL.html', 'TODO', 'README.txt' ]
120 # In case we are building for a .deb with stdeb's sdist_dsc command, we put the
121 # docs in "share/doc/python-$PKG".
122 doc_loc = "share/doc/python-" + PKG
123 data_files = [(doc_loc, data_fnames)]
127 description='a fast erasure codec which can be used with the command-line, C, Python, or Haskell',
128 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. The zfec package includes command-line tools, C API, Python API, and Haskell API',
129 author='Zooko O\'Whielacronx',
130 author_email='zooko@zooko.com',
131 url='http://allmydata.org/source/'+PKG,
133 dependency_links=dependency_links,
134 install_requires=["argparse >= 0.8", "pyutil >= 1.3.5"],
135 tests_require=["pyutil >= 1.3.5"],
136 packages=find_packages(),
137 include_package_data=True,
138 data_files=data_files,
139 setup_requires=setup_requires,
140 classifiers=trove_classifiers,
141 entry_points = { 'console_scripts': [ 'zfec = %s.cmdline_zfec:main' % PKG, 'zunfec = %s.cmdline_zunfec:main' % PKG ] },
142 ext_modules=[Extension(PKG+'._fec', [PKG+'/fec.c', PKG+'/_fecmodule.c',], extra_link_args=extra_link_args, extra_compile_args=extra_compile_args, undef_macros=undef_macros, define_macros=define_macros),],
143 test_suite=PKG+".test",
144 zip_safe=False, # I prefer unzipped for easier access.