Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 62 lines (53 sloc) 2.321 kb
ac702db @marineam Complete Nagcat's new setup.py script.
marineam authored
1 #!/usr/bin/env python
2
3 import os
4 import stat
5 from glob import glob
6 from distutils import log
f5abc5a @marineam New Cython based Nagios object file parser.
marineam authored
7 from distutils.core import setup
8 from distutils.extension import Extension
ac702db @marineam Complete Nagcat's new setup.py script.
marineam authored
9 from distutils.command.build_py import build_py as du_build_py
f5abc5a @marineam New Cython based Nagios object file parser.
marineam authored
10 from twisted.python.dist import getPackages
11
ac702db @marineam Complete Nagcat's new setup.py script.
marineam authored
12 # distutils doesn't provide a way to make some package data executable
13 # but nagcat requires a test script for unit testing, so hack time.
14 package_scripts = ["python/nagcat/unittests/queries/simple_subprocess"]
15
16 class build_py(du_build_py):
17
18 def copy_file(self, infile, outfile, **kwargs):
19 du_build_py.copy_file(self, infile, outfile, **kwargs)
20
21 # Ripped out of install_scripts, might as well be consistent.
22 if os.name == 'posix' and infile in package_scripts:
23 if self.dry_run:
24 log.info("changing mode of %s", outfile)
25 else:
26 mode = ((os.stat(outfile)[stat.ST_MODE]) | 0555) & 07777
27 log.info("changing mode of %s to %o", outfile, mode)
28 os.chmod(outfile, mode)
29
30 setup_args = dict(
f5abc5a @marineam New Cython based Nagios object file parser.
marineam authored
31 name = "nagcat",
32 author = "Michael Marineau",
1ddff53 Fix email addresses.
Mike Cooper authored
33 author_email = "marineam@google.com",
ac702db @marineam Complete Nagcat's new setup.py script.
marineam authored
34 url = "http://code.google.com/p/nagcat/",
f5abc5a @marineam New Cython based Nagios object file parser.
marineam authored
35 license = "Apache 2.0",
36 packages = getPackages("python/nagcat") +
37 getPackages("python/snapy") +
38 getPackages("python/twirrdy"),
ac702db @marineam Complete Nagcat's new setup.py script.
marineam authored
39 package_data = {'nagcat': ["plugins/dropin.cache",
40 "unittests/trend_data*",
17e14c7 @marineam Install test ssl certs
marineam authored
41 "unittests/ssl/*",
ac702db @marineam Complete Nagcat's new setup.py script.
marineam authored
42 "unittests/queries/oracle_package.sql",
43 "unittests/queries/simple_subprocess"],
44 'snapy': ["netsnmp/unittests/snmpd.conf"]},
f5abc5a @marineam New Cython based Nagios object file parser.
marineam authored
45 package_dir = {'': "python"},
ac702db @marineam Complete Nagcat's new setup.py script.
marineam authored
46 scripts = glob("bin/*"),
47 data_files = [('share/doc/nagcat', ["README", "LICENSE"]),
48 ('share/doc/nagcat/docs', glob("docs/*.*"))],
49 cmdclass = {'build_py': build_py},
f5abc5a @marineam New Cython based Nagios object file parser.
marineam authored
50 )
ac702db @marineam Complete Nagcat's new setup.py script.
marineam authored
51
52 # Nagcat works without Cython so make it optional
53 try:
54 from Cython.Distutils import build_ext
55 setup_args['ext_modules'] = [Extension("nagcat._object_parser_c",
56 ["python/nagcat/_object_parser_c.pyx"])]
57 setup_args['cmdclass']['build_ext'] = build_ext
58 except ImportError:
59 pass
60
61 setup(**setup_args)
Something went wrong with that request. Please try again.