summaryrefslogtreecommitdiff
path: root/setup.py
blob: 8e304cf496343fc88ce996d460d7b8a481e11f42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env python

import os, sys
from distutils.core import setup
from distutils.extension import Extension

__version__ = "1.1.8"

sqlite = "sqlite3"
sources = ["_sqlite.c", "encode.c", "port/strsep.c"]
macros = []

if sys.platform in ("linux-i386", "linux2"): # most Linux
    include_dirs = ['/usr/include/sqlite']
    library_dirs = []
    libraries = [sqlite]
    runtime_library_dirs = []
    extra_objects = []
elif sys.platform in ("freebsd4", "freebsd5", "openbsd2", "cygwin", "darwin"):
    if sys.platform == "darwin":
        LOCALBASE = os.environ.get("LOCALBASE", "/opt/local")
    else:
        LOCALBASE = os.environ.get("LOCALBASE", "/usr/local")
    include_dirs = ['%s/include' % LOCALBASE]
    library_dirs = ['%s/lib/' % LOCALBASE]
    libraries = [sqlite]
    runtime_library_dirs = []
    extra_objects = []
elif sys.platform == "win32":
    include_dirs = [r'..\sqlite']
    library_dirs = [r'..\sqlite']
    libraries = [sqlite]
    runtime_library_dirs = []
    extra_objects = []
elif os.name == "posix": # most Unixish platforms
    include_dirs = ['/usr/local/include']
    library_dirs = ['/usr/local/lib']
    libraries = [sqlite]
    # On some platorms, this can be used to find the shared libraries
    # at runtime, if they are in a non-standard location. Doesn't
    # work for Linux gcc.
    ## runtime_library_dirs = library_dirs
    runtime_library_dirs = []
    # This can be used on Linux to force use of static sqlite lib
    ## extra_objects = ['/usr/lib/sqlite/libsqlite.a']
    extra_objects = []
else:
    raise "UnknownPlatform", "sys.platform=%s, os.name=%s" % \
          (sys.platform, os.name)

long_description = \
"""Python interface to SQLite

pysqlite is an interface to the SQLite database server for Python. It aims to be
fully compliant with Python database API version 2.0 while also exploiting the
unique features of SQLite.

"""

def main():
    py_modules = ["sqlite.main"]

    # patch distutils if it can't cope with the "classifiers" keyword
    if sys.version < '2.2.3':
        from distutils.dist import DistributionMetadata
        DistributionMetadata.classifiers = None
        DistributionMetadata.download_url = None

    setup ( # Distribution meta-data
            name = "pysqlite",
            version = __version__,
            description = "An interface to SQLite",
            long_description=long_description,
            author = "PySQLite developers",
            author_email = "pysqlite-devel@lists.sourceforge.net",
            license = "Python license",
            platforms = "ALL",
            url = "http://pysqlite.sourceforge.net/",

            # Description of the modules and packages in the distribution
            py_modules = py_modules,

            ext_modules = [Extension( name='_sqlite',
                                      sources=sources,
                                      include_dirs=include_dirs,
                                      library_dirs=library_dirs,
                                      runtime_library_dirs=runtime_library_dirs,
                                      libraries=libraries,
                                      extra_objects=extra_objects,
                                      define_macros=macros
                                      )],
            classifiers = [
            "Development Status :: 5 - Production/Stable",
            "Intended Audience :: Developers",
            "License :: OSI Approved :: MIT License",
            "Operating System :: Microsoft :: Windows :: Windows NT/2000",
            "Operating System :: POSIX",
            "Programming Language :: C",
            "Programming Language :: Python",
            "Topic :: Database :: Database Engines/Servers",
            "Topic :: Database :: Front-Ends"]
            )

if __name__ == "__main__":
    main()