2 # zfec -- fast forward error correction library with Python interface
4 # copyright © 2007-2013 Zooko Wilcox-O'Hearn
6 # This file is part of zfec.
8 # See README.rst for licensing information.
10 import glob, os, re, sys
14 from setuptools import Extension, find_packages, setup
16 if "--debug" in sys.argv:
18 sys.argv.remove("--debug")
25 extra_compile_args.append("-std=c99")
31 if arg.startswith("--stride="):
32 stride = int(arg[len("--stride="):])
33 define_macros.append(('STRIDE', stride))
38 extra_compile_args.append("-O0")
39 extra_compile_args.append("-g")
40 extra_compile_args.append("-Wall")
41 extra_compile_args.append("-Wextra")
42 extra_link_args.append("-g")
43 undef_macros.append('NDEBUG')
46 "Development Status :: 5 - Production/Stable",
47 "Environment :: Console",
48 "License :: OSI Approved :: GNU General Public License (GPL)", # See README.rst for alternative licensing.
49 "License :: DFSG approved",
50 "License :: Other/Proprietary License",
51 "Intended Audience :: Developers",
52 "Intended Audience :: End Users/Desktop",
53 "Intended Audience :: System Administrators",
54 "Operating System :: Microsoft",
55 "Operating System :: Microsoft :: Windows",
56 "Operating System :: Unix",
57 "Operating System :: POSIX :: Linux",
58 "Operating System :: POSIX",
59 "Operating System :: MacOS :: MacOS X",
60 "Operating System :: Microsoft :: Windows :: Windows NT/2000",
61 "Operating System :: OS Independent",
62 "Natural Language :: English",
63 "Programming Language :: C",
64 "Programming Language :: Python",
65 "Programming Language :: Python :: 2",
66 "Programming Language :: Python :: 2.4",
67 "Programming Language :: Python :: 2.5",
68 "Programming Language :: Python :: 2.6",
69 "Programming Language :: Python :: 2.7",
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",
82 VERSIONFILE = os.path.join(PKG, "_version.py")
87 tests_require.append("pyutil >= 1.3.19")
89 # darcsver is needed only if you want "./setup.py darcsver" to write a new
90 # version stamp in pyutil/_version.py, with a version number derived from
91 # darcs history. http://pypi.python.org/pypi/darcsver
92 if 'darcsver' in sys.argv[1:]:
93 setup_requires.append('darcsver >= 1.0.0')
95 # setuptools_darcs is required to produce complete distributions (such
96 # as with "sdist" or "bdist_egg"), unless there is a
97 # zfec.egg-info/SOURCE.txt file present which contains a complete
98 # list of files that should be included.
99 # http://pypi.python.org/pypi/setuptools_darcs
101 # However, requiring it runs afoul of a bug in Distribute, which was
102 # shipped in Ubuntu Lucid, so for now you have to manually install it
103 # before building sdists or eggs:
104 # http://bitbucket.org/tarek/distribute/issue/55/revision-control-plugin-automatically-installed-as-a-build-dependency-is-not-present-when-another-build-dependency-is-being
106 setup_requires.append('setuptools_darcs >= 1.1.0')
109 # setuptools_trial is needed if you want "./setup.py trial" or
110 # "./setup.py test" to execute the tests.
111 # http://pypi.python.org/pypi/setuptools_trial
112 if 'trial' in sys.argv[1:]:
113 setup_requires.extend(['setuptools_trial >= 0.5'])
115 # trialcoverage is required if you want the "trial" unit test runner to have a
116 # "--reporter=bwverbose-coverage" option which produces code-coverage results.
117 if "--reporter=bwverbose-coverage" in sys.argv:
118 tests_require.append('trialcoverage >= 0.3.3')
119 tests_require.append('twisted >= 2.4.0')
120 tests_require.append('setuptools_trial >= 0.5')
122 # stdeb is required to build Debian dsc files.
123 if "sdist_dsc" in sys.argv:
124 setup_requires.append('stdeb')
126 data_fnames=[ 'COPYING.GPL', 'changelog', 'COPYING.TGPPL.rst', 'TODO', 'README.rst' ]
128 # In case we are building for a .deb with stdeb's sdist_dsc command, we put the
129 # docs in "share/doc/$PKG".
130 doc_loc = "share/doc/" + PKG
131 data_files = [(doc_loc, data_fnames)]
133 readmetext = open('README.rst').read()
134 if readmetext[:3] == '\xef\xbb\xbf':
136 readmetext = readmetext[3:]
139 readmetext = readmetext.decode('utf-8')
140 except UnicodeDecodeError:
143 install_requires=["pyutil >= 1.3.19"]
145 # argparse comes built into Python >= 2.7, and is provided by the "argparse"
146 # distribution for earlier versions of Python.
149 argparse # hush pyflakes
151 install_requires.append("argparse >= 0.8")
153 # distutils in Python 2.4 has a bug in that it tries to encode the long
154 # description into ascii. We detect the resulting exception and try again
155 # after squashing the long description (lossily) into ascii.
157 def _setup(longdescription):
159 description='a fast erasure codec which can be used with the command-line, C, Python, or Haskell',
160 long_description=longdescription,
161 author='Zooko O\'Whielacronx',
162 author_email='zooko@zooko.com',
163 url='https://tahoe-lafs.org/trac/'+PKG,
164 license='GNU GPL', # See README.rst for alternative licensing.
165 install_requires=install_requires,
166 tests_require=tests_require,
167 packages=find_packages(),
168 include_package_data=True,
169 data_files=data_files,
170 setup_requires=setup_requires,
171 classifiers=trove_classifiers,
172 entry_points = { 'console_scripts': [ 'zfec = %s.cmdline_zfec:main' % PKG, 'zunfec = %s.cmdline_zunfec:main' % PKG ] },
173 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),],
174 test_suite=PKG+".test",
175 zip_safe=False, # I prefer unzipped for easier access.
177 'ed25519=ba95497adf4db8e17f688c0979003c48c76897d60e2d2193f938b9ab62115f59':[],
179 version=versioneer.get_version(),
180 cmdclass=versioneer.get_cmdclass(),
185 except UnicodeEncodeError:
186 _setup(repr(readmetext))