source: trunk/setup.py

Last change on this file was 227653b, checked in by Ramakrishnan Muthukrishnan <ram@…>, 9 years ago

zfec: start using versioneer for version/release management

  • Property mode set to 100755
File size: 6.5 KB
Line 
1
2# zfec -- fast forward error correction library with Python interface
3#
4# copyright © 2007-2013 Zooko Wilcox-O'Hearn
5#
6# This file is part of zfec.
7#
8# See README.rst for licensing information.
9
10import glob, os, re, sys
11import setuptools
12import versioneer
13
14from setuptools import Extension, find_packages, setup
15
16if "--debug" in sys.argv:
17    DEBUGMODE=True
18    sys.argv.remove("--debug")
19else:
20    DEBUGMODE=False
21
22extra_compile_args=[]
23extra_link_args=[]
24
25extra_compile_args.append("-std=c99")
26
27define_macros=[]
28undef_macros=[]
29
30for arg in sys.argv:
31    if arg.startswith("--stride="):
32        stride = int(arg[len("--stride="):])
33        define_macros.append(('STRIDE', stride))
34        sys.argv.remove(arg)
35        break
36
37if DEBUGMODE:
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')
44
45trove_classifiers=[
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",
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
81PKG = "zfec"
82VERSIONFILE = os.path.join(PKG, "_version.py")
83
84setup_requires = []
85tests_require = []
86
87tests_require.append("pyutil >= 1.3.19")
88
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
92if 'darcsver' in sys.argv[1:]:
93    setup_requires.append('darcsver >= 1.0.0')
94
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
100
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
105if False:
106    setup_requires.append('setuptools_darcs >= 1.1.0')
107
108
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
112if 'trial' in sys.argv[1:]:
113    setup_requires.extend(['setuptools_trial >= 0.5'])
114
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.
117if "--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')
121
122# stdeb is required to build Debian dsc files.
123if "sdist_dsc" in sys.argv:
124    setup_requires.append('stdeb')
125
126data_fnames=[ 'COPYING.GPL', 'changelog', 'COPYING.TGPPL.rst', 'TODO', 'README.rst' ]
127
128# In case we are building for a .deb with stdeb's sdist_dsc command, we put the
129# docs in "share/doc/$PKG".
130doc_loc = "share/doc/" + PKG
131data_files = [(doc_loc, data_fnames)]
132
133readmetext = open('README.rst').read()
134if readmetext[:3] == '\xef\xbb\xbf':
135    # utf-8 "BOM"
136    readmetext = readmetext[3:]
137
138try:
139    readmetext = readmetext.decode('utf-8')
140except UnicodeDecodeError:
141    pass
142
143install_requires=["pyutil >= 1.3.19"]
144
145# argparse comes built into Python >= 2.7, and is provided by the "argparse"
146# distribution for earlier versions of Python.
147try:
148    import argparse
149    argparse # hush pyflakes
150except ImportError:
151    install_requires.append("argparse >= 0.8")
152
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.
156
157def _setup(longdescription):
158    setup(name=PKG,
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.
176          extras_require={
177            'ed25519=ba95497adf4db8e17f688c0979003c48c76897d60e2d2193f938b9ab62115f59':[],
178            },
179          version=versioneer.get_version(),
180          cmdclass=versioneer.get_cmdclass(),
181         )
182
183try:
184    _setup(readmetext)
185except UnicodeEncodeError:
186    _setup(repr(readmetext))
Note: See TracBrowser for help on using the repository browser.