Deprecated lightmediascanner svn.
[lms] / python-lightmediascanner / setup.py
1 import sys
2 import os
3
4 from ez_setup import use_setuptools
5 use_setuptools('0.6c3')
6
7 from setuptools import setup, find_packages, Extension
8 import commands
9
10 from Cython.Distutils import build_ext
11
12
13 def pkgconfig(*packages, **kw):
14     flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
15     pkgs = ' '.join(packages)
16     cmdline = 'pkg-config --libs --cflags %s' % pkgs
17
18     status, output = commands.getstatusoutput(cmdline)
19     if status != 0:
20         raise ValueError("could not find pkg-config module: %s" % pkgs)
21
22     for token in output.split():
23         kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])
24     return kw
25
26
27 module = Extension('lightmediascanner.c_lightmediascanner',
28                    sources=['lightmediascanner/lightmediascanner.c_lightmediascanner.pyx',
29                             ],
30                    depends=['include/lightmediascanner/c_lightmediascanner.pxd',
31                             ],
32                    **pkgconfig('"lightmediascanner >= 0.1.0"'))
33
34
35 trove_classifiers = [
36     "Development Status :: 3 - Alpha",
37     "Intended Audience :: Developers",
38     "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
39     "Operating System :: MacOS :: MacOS X",
40     "Operating System :: POSIX",
41     "Programming Language :: C",
42     "Programming Language :: Python",
43     "Topic :: Software Development :: Libraries :: Python Modules",
44     ]
45
46
47 long_description = """\
48 Python bindings for Light Media Scanner.
49
50 Lightweight media scanner meant to be used in not-so-powerful devices,
51 like embedded systems or old machines.
52
53 Provides an optimized way to recursively scan directories, handling
54 the parser in a child process, avoiding breaks of the main process
55 when parsers break (quite common with such bad libs and tags).
56
57 Parsers are plugins in the form of shared objects, so it's easy to add
58 new without having to recompiling the scanner.
59
60 The scanner will use SQLite3 to store file-mtime association, avoiding
61 parsing files that are already up-to-date. This SQLite connection and
62 the file id within the master table 'files' are handled to plugins for
63 relationship with other tables.
64 """
65
66
67 class lms_build_ext(build_ext):
68     def finalize_options(self):
69         build_ext.finalize_options(self)
70         self.include_dirs.insert(0, 'include')
71         self.pyrex_include_dirs.extend(self.include_dirs)
72
73
74 setup(name='python-lightmediascanner',
75       version='0.1.0',
76       license='LGPL',
77       author='Gustavo Sverzut Barbieri',
78       author_email='gustavo.barbieri@openbossa.org',
79       description='Python bindings for Light Media Scanner',
80       long_description=long_description,
81       keywords='wrapper binding media scanner',
82       classifiers=trove_classifiers,
83       packages=find_packages(),
84       ext_modules=[module],
85       zip_safe=False,
86       cmdclass={'build_ext': lms_build_ext,},
87       )