3
# Unix SMB/CIFS implementation.
4
# Module packaging setup for Samba python extensions
6
# Copyright (C) Tim Potter, 2002-2003
7
# Copyright (C) Martin Pool, 2002
9
# This program is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2 of the License, or
12
# (at your option) any later version.
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
19
# You should have received a copy of the GNU General Public License
20
# along with this program; if not, write to the Free Software
21
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
from distutils.core import setup
25
from distutils.extension import Extension
27
import sys, string, os
29
# The Makefile passes in environment variable $PYTHON_OBJ as being the
30
# list of Samba objects. This kind of goes against the distutils.cmd
31
# method of adding setup commands and will also confuse people who are
32
# familiar with the python Distutils module.
34
samba_objs = os.environ.get("PYTHON_OBJS", "")
36
samba_cflags = os.environ.get("PYTHON_CFLAGS", "")
38
samba_srcdir = os.environ.get("SRCDIR", "")
40
# These variables are filled in by configure
42
samba_libs = os.environ.get("LIBS", "")
44
obj_list = string.split(samba_objs)
46
# Unfortunately the samba_libs variable contains both shared libraries
47
# and linker flags. The python distutils doesn't like this so we have
48
# to split $samba_libs into a flags component and a library component.
53
for lib in string.split(samba_libs):
55
libraries.append(lib[2:])
58
library_dirs.append(lib[2:])
63
print "Unknown entry '%s' in $LIBS variable passed to setup.py" % lib
66
flags_list = string.split(samba_cflags)
68
# Invoke distutils.setup
72
# Overview information
74
name = "Samba Python Extensions",
76
author = "Tim Potter",
77
author_email = "tpot@samba.org",
80
# Get the "samba" directory of Python source. At the moment this
81
# just contains the __init__ file that makes it work as a
82
# subpackage. This is needed even though everything else is an
84
package_dir = {"samba": os.path.join(samba_srcdir, "python", "samba")},
88
ext_package = "samba",
93
Extension(name = "spoolss",
94
sources = [samba_srcdir + "python/py_spoolss.c",
95
samba_srcdir + "python/py_common.c",
96
samba_srcdir + "python/py_conv.c",
97
samba_srcdir + "python/py_ntsec.c",
98
samba_srcdir + "python/py_spoolss_common.c",
99
samba_srcdir + "python/py_spoolss_forms.c",
100
samba_srcdir + "python/py_spoolss_forms_conv.c",
101
samba_srcdir + "python/py_spoolss_drivers.c",
102
samba_srcdir + "python/py_spoolss_drivers_conv.c",
103
samba_srcdir + "python/py_spoolss_printers.c",
104
samba_srcdir + "python/py_spoolss_printers_conv.c",
105
samba_srcdir + "python/py_spoolss_printerdata.c",
106
samba_srcdir + "python/py_spoolss_ports.c",
107
samba_srcdir + "python/py_spoolss_ports_conv.c",
108
samba_srcdir + "python/py_spoolss_jobs.c",
109
samba_srcdir + "python/py_spoolss_jobs_conv.c",
111
libraries = libraries,
112
library_dirs = ["/usr/kerberos/lib"] + library_dirs,
113
extra_compile_args = flags_list,
114
extra_objects = obj_list),
118
Extension(name = "lsa",
119
sources = [samba_srcdir + "python/py_lsa.c",
120
samba_srcdir + "python/py_common.c",
121
samba_srcdir + "python/py_ntsec.c"],
122
libraries = libraries,
123
library_dirs = ["/usr/kerberos/lib"] + library_dirs,
124
extra_compile_args = flags_list,
125
extra_objects = obj_list),
129
Extension(name = "samr",
130
sources = [samba_srcdir + "python/py_samr.c",
131
samba_srcdir + "python/py_conv.c",
132
samba_srcdir + "python/py_samr_conv.c",
133
samba_srcdir + "python/py_common.c"],
134
libraries = libraries,
135
library_dirs = ["/usr/kerberos/lib"] + library_dirs,
136
extra_compile_args = flags_list,
137
extra_objects = obj_list),
139
# winbind client module
141
Extension(name = "winbind",
142
sources = [samba_srcdir + "python/py_winbind.c",
143
samba_srcdir + "python/py_winbind_conv.c",
144
samba_srcdir + "python/py_conv.c",
145
samba_srcdir + "python/py_common.c"],
146
libraries = libraries,
147
library_dirs = ["/usr/kerberos/lib"] + library_dirs,
148
extra_compile_args = flags_list,
149
extra_objects = obj_list),
153
Extension(name = "winreg",
154
sources = [samba_srcdir + "python/py_winreg.c",
155
samba_srcdir + "python/py_common.c"],
156
libraries = libraries,
157
library_dirs = ["/usr/kerberos/lib"] + library_dirs,
158
extra_compile_args = flags_list,
159
extra_objects = obj_list),
163
Extension(name = "srvsvc",
164
sources = [samba_srcdir + "python/py_srvsvc.c",
165
samba_srcdir + "python/py_conv.c",
166
samba_srcdir + "python/py_srvsvc_conv.c",
167
samba_srcdir + "python/py_common.c"],
168
libraries = libraries,
169
library_dirs = ["/usr/kerberos/lib"] + library_dirs,
170
extra_compile_args = flags_list,
171
extra_objects = obj_list),
175
Extension(name = "tdb",
176
sources = [samba_srcdir + "python/py_tdb.c"],
177
libraries = libraries,
178
library_dirs = ["/usr/kerberos/lib"] + library_dirs,
179
extra_compile_args = flags_list,
180
extra_objects = obj_list),
184
Extension(name = "smb",
185
sources = [samba_srcdir + "python/py_smb.c",
186
samba_srcdir + "python/py_common.c",
187
samba_srcdir + "python/py_ntsec.c"],
188
libraries = libraries,
189
library_dirs = ["/usr/kerberos/lib"] + library_dirs,
190
extra_compile_args = flags_list,
191
extra_objects = obj_list),
193
# tdbpack/unpack extensions. Does not actually link to any Samba
194
# code, although it implements a compatible data format.
196
Extension(name = "tdbpack",
197
sources = [os.path.join(samba_srcdir, "python", "py_tdbpack.c")],
198
extra_compile_args = ["-I."])