Lines 4-34
Link Here
|
4 |
# |
4 |
# |
5 |
|
5 |
|
6 |
import platform |
6 |
import platform |
|
|
7 |
import sysconfig |
7 |
|
8 |
|
8 |
try: |
9 |
try: |
9 |
import distutils |
10 |
from setuptools import Extension, setup |
10 |
from distutils import sysconfig |
11 |
except Exception as e: |
11 |
from distutils.command.install import install |
12 |
raise SystemExit("Setuptools problem", e) |
12 |
from distutils.core import setup, Extension |
|
|
13 |
except: |
14 |
raise SystemExit("Distutils problem") |
15 |
|
13 |
|
16 |
install.sub_commands = [x for x in install.sub_commands if 'egg' not in x[0]] |
|
|
17 |
|
14 |
|
18 |
prefix = sysconfig.PREFIX |
15 |
prefix = sysconfig.get_config_var('base') |
19 |
inc_dirs = [prefix + "/include", "Modules/_sqlite"] |
16 |
inc_dirs = [prefix + "/include", "Modules/_sqlite"] |
20 |
lib_dirs = [prefix + "/lib"] |
17 |
lib_dirs = [prefix + "/lib"] |
21 |
libs = ["sqlite3"] |
18 |
libs = ["sqlite3"] |
22 |
macros = [('MODULE_NAME', '"sqlite3"')] |
19 |
macros = [('MODULE_NAME', '"sqlite3"')] |
23 |
sqlite_srcs = [ |
20 |
sqlite_srcs = [ |
24 |
'_sqlite/connection.c', |
21 |
'_sqlite/connection.c', |
25 |
'_sqlite/cursor.c', |
22 |
'_sqlite/cursor.c', |
26 |
'_sqlite/microprotocols.c', |
23 |
'_sqlite/microprotocols.c', |
27 |
'_sqlite/module.c', |
24 |
'_sqlite/module.c', |
28 |
'_sqlite/prepare_protocol.c', |
25 |
'_sqlite/prepare_protocol.c', |
29 |
'_sqlite/row.c', |
26 |
'_sqlite/row.c', |
30 |
'_sqlite/statement.c', |
27 |
'_sqlite/statement.c', |
31 |
'_sqlite/util.c'] |
28 |
'_sqlite/util.c' |
|
|
29 |
] |
32 |
|
30 |
|
33 |
major, minor = map(int, platform.python_version_tuple()[:2]) |
31 |
major, minor = map(int, platform.python_version_tuple()[:2]) |
34 |
|
32 |
|
Lines 44-56
try:
Link Here
|
44 |
except AttributeError: |
42 |
except AttributeError: |
45 |
macros.append(('SQLITE_OMIT_LOAD_EXTENSION', '1')) |
43 |
macros.append(('SQLITE_OMIT_LOAD_EXTENSION', '1')) |
46 |
|
44 |
|
47 |
setup(name = "sqlite3", |
45 |
setup( |
48 |
description = "SQLite 3 extension to Python", |
46 |
ext_modules=[ |
49 |
|
47 |
Extension( |
50 |
ext_modules = [Extension('_sqlite3', sqlite_srcs, |
48 |
"_sqlite3", |
51 |
include_dirs = inc_dirs, |
49 |
sources = sqlite_srcs, |
52 |
libraries = libs, |
50 |
include_dirs = inc_dirs, |
53 |
library_dirs = lib_dirs, |
51 |
libraries = libs, |
54 |
runtime_library_dirs = lib_dirs, |
52 |
runtime_library_dirs = lib_dirs, |
55 |
define_macros = macros)] |
53 |
define_macros = macros |
56 |
) |
54 |
) |
|
|
55 |
] |
56 |
) |
57 |
- |
|
|