Initialize Kmod.mod_dir to None in __cinit__().
[python-kmod.git] / setup.py
1 # Copyright (C) 2012 Red Hat, Inc. All rights reserved.
2 #               2012 W. Trevor King
3 #
4 # This copyrighted material is made available to anyone wishing to use,
5 # modify, copy, or redistribute it subject to the terms and conditions
6 # of the GNU Lesser General Public License v.2.1.
7 #
8 # You should have received a copy of the GNU Lesser General Public License
9 # along with this program; if not, write to the Free Software Foundation,
10 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
11
12 from distutils.core import setup
13 from distutils.extension import Extension as _Extension
14 import os as _os
15 import sys as _sys
16
17 from Cython.Distutils import build_ext as _build_ext
18
19
20 package_name = 'kmod'
21
22 # read version from local kmod/version.py without pulling in
23 # kmod/__init__.py
24 _sys.path.insert(0, package_name)
25 from version import __version__
26
27
28 _this_dir = _os.path.dirname(__file__)
29
30 ext_modules = []
31 for filename in sorted(_os.listdir(package_name)):
32     basename,extension = _os.path.splitext(filename)
33     if extension == '.pyx':
34         ext_modules.append(
35             _Extension(
36                 '{}.{}'.format(package_name, basename),
37                 [_os.path.join(package_name, filename)],
38                 libraries=['kmod'],
39                 ))
40
41 setup(
42     name=package_name,
43     version=__version__,
44     description='Python binding for kmod',
45     packages=[package_name],
46     provides=[package_name],
47     cmdclass = {'build_ext': _build_ext},
48     ext_modules=ext_modules,
49     )