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:])
60 print "Unknown entry '%s' in $LIBS variable passed to setup.py" % lib
63 flags_list = string.split(samba_cflags)
65 # Invoke distutils.setup
69 # Overview information
71 name = "Samba Python Extensions",
73 author = "Tim Potter",
74 author_email = "tpot@samba.org",
77 # Get the "samba" directory of Python source. At the moment this
78 # just contains the __init__ file that makes it work as a
79 # subpackage. This is needed even though everything else is an
81 package_dir = {"samba": os.path.join(samba_srcdir, "python", "samba")},
85 ext_package = "samba",
90 Extension(name = "spoolss",
91 sources = [samba_srcdir + "python/py_spoolss.c",
92 samba_srcdir + "python/py_common.c",
93 samba_srcdir + "python/py_conv.c",
94 samba_srcdir + "python/py_ntsec.c",
95 samba_srcdir + "python/py_spoolss_common.c",
96 samba_srcdir + "python/py_spoolss_forms.c",
97 samba_srcdir + "python/py_spoolss_forms_conv.c",
98 samba_srcdir + "python/py_spoolss_drivers.c",
99 samba_srcdir + "python/py_spoolss_drivers_conv.c",
100 samba_srcdir + "python/py_spoolss_printers.c",
101 samba_srcdir + "python/py_spoolss_printers_conv.c",
102 samba_srcdir + "python/py_spoolss_printerdata.c",
103 samba_srcdir + "python/py_spoolss_ports.c",
104 samba_srcdir + "python/py_spoolss_ports_conv.c",
105 samba_srcdir + "python/py_spoolss_jobs.c",
106 samba_srcdir + "python/py_spoolss_jobs_conv.c",
108 libraries = libraries,
109 library_dirs = ["/usr/kerberos/lib"] + library_dirs,
110 extra_compile_args = flags_list,
111 extra_objects = obj_list),
115 Extension(name = "lsa",
116 sources = [samba_srcdir + "python/py_lsa.c",
117 samba_srcdir + "python/py_common.c",
118 samba_srcdir + "python/py_ntsec.c"],
119 libraries = libraries,
120 library_dirs = ["/usr/kerberos/lib"] + library_dirs,
121 extra_compile_args = flags_list,
122 extra_objects = obj_list),
126 Extension(name = "samr",
127 sources = [samba_srcdir + "python/py_samr.c",
128 samba_srcdir + "python/py_conv.c",
129 samba_srcdir + "python/py_samr_conv.c",
130 samba_srcdir + "python/py_common.c"],
131 libraries = libraries,
132 library_dirs = ["/usr/kerberos/lib"] + library_dirs,
133 extra_compile_args = flags_list,
134 extra_objects = obj_list),
136 # winbind client module
138 Extension(name = "winbind",
139 sources = [samba_srcdir + "python/py_winbind.c",
140 samba_srcdir + "python/py_winbind_conv.c",
141 samba_srcdir + "python/py_conv.c",
142 samba_srcdir + "python/py_common.c"],
143 libraries = libraries,
144 library_dirs = ["/usr/kerberos/lib"] + library_dirs,
145 extra_compile_args = flags_list,
146 extra_objects = obj_list),
150 Extension(name = "winreg",
151 sources = [samba_srcdir + "python/py_winreg.c",
152 samba_srcdir + "python/py_common.c"],
153 libraries = libraries,
154 library_dirs = ["/usr/kerberos/lib"] + library_dirs,
155 extra_compile_args = flags_list,
156 extra_objects = obj_list),
160 Extension(name = "srvsvc",
161 sources = [samba_srcdir + "python/py_srvsvc.c",
162 samba_srcdir + "python/py_conv.c",
163 samba_srcdir + "python/py_srvsvc_conv.c",
164 samba_srcdir + "python/py_common.c"],
165 libraries = libraries,
166 library_dirs = ["/usr/kerberos/lib"] + library_dirs,
167 extra_compile_args = flags_list,
168 extra_objects = obj_list),
172 Extension(name = "tdb",
173 sources = [samba_srcdir + "python/py_tdb.c"],
174 libraries = libraries,
175 library_dirs = ["/usr/kerberos/lib"] + library_dirs,
176 extra_compile_args = flags_list,
177 extra_objects = obj_list),
181 Extension(name = "smb",
182 sources = [samba_srcdir + "python/py_smb.c",
183 samba_srcdir + "python/py_common.c",
184 samba_srcdir + "python/py_ntsec.c"],
185 libraries = libraries,
186 library_dirs = ["/usr/kerberos/lib"] + library_dirs,
187 extra_compile_args = flags_list,
188 extra_objects = obj_list),
190 # tdbpack/unpack extensions. Does not actually link to any Samba
191 # code, although it implements a compatible data format.
193 Extension(name = "tdbpack",
194 sources = [os.path.join(samba_srcdir, "python", "py_tdbpack.c")],
195 extra_compile_args = ["-I."])