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 # Convert libs and objs from space separated strings to lists of strings
45 # for distutils to digest. Split "-l" prefix off library list.
47 obj_list
= string
.split(samba_objs
)
51 for lib
in string
.split(samba_libs
):
52 lib_list
.append(string
.replace(lib
, "-l", ""))
54 flags_list
= string
.split(samba_cflags
)
56 # Invoke distutils.setup
60 # Overview information
62 name
= "Samba Python Extensions",
64 author
= "Tim Potter",
65 author_email
= "tpot@samba.org",
68 # Get the "samba" directory of Python source. At the moment this
69 # just contains the __init__ file that makes it work as a
70 # subpackage. This is needed even though everything else is an
72 package_dir
= {"samba": os
.path
.join(samba_srcdir
, "python", "samba")},
76 ext_package
= "samba",
81 Extension(name
= "spoolss",
82 sources
= [samba_srcdir
+ "python/py_spoolss.c",
83 samba_srcdir
+ "python/py_common.c",
84 samba_srcdir
+ "python/py_conv.c",
85 samba_srcdir
+ "python/py_ntsec.c",
86 samba_srcdir
+ "python/py_spoolss_common.c",
87 samba_srcdir
+ "python/py_spoolss_forms.c",
88 samba_srcdir
+ "python/py_spoolss_forms_conv.c",
89 samba_srcdir
+ "python/py_spoolss_drivers.c",
90 samba_srcdir
+ "python/py_spoolss_drivers_conv.c",
91 samba_srcdir
+ "python/py_spoolss_printers.c",
92 samba_srcdir
+ "python/py_spoolss_printers_conv.c",
93 samba_srcdir
+ "python/py_spoolss_printerdata.c",
94 samba_srcdir
+ "python/py_spoolss_ports.c",
95 samba_srcdir
+ "python/py_spoolss_ports_conv.c",
96 samba_srcdir
+ "python/py_spoolss_jobs.c",
97 samba_srcdir
+ "python/py_spoolss_jobs_conv.c",
100 library_dirs
= ["/usr/kerberos/lib"],
101 extra_compile_args
= flags_list
,
102 extra_objects
= obj_list
),
106 Extension(name
= "lsa",
107 sources
= [samba_srcdir
+ "python/py_lsa.c",
108 samba_srcdir
+ "python/py_common.c",
109 samba_srcdir
+ "python/py_ntsec.c"],
110 libraries
= lib_list
,
111 library_dirs
= ["/usr/kerberos/lib"],
112 extra_compile_args
= flags_list
,
113 extra_objects
= obj_list
),
117 Extension(name
= "samr",
118 sources
= [samba_srcdir
+ "python/py_samr.c",
119 samba_srcdir
+ "python/py_conv.c",
120 samba_srcdir
+ "python/py_samr_conv.c",
121 samba_srcdir
+ "python/py_common.c"],
122 libraries
= lib_list
,
123 library_dirs
= ["/usr/kerberos/lib"],
124 extra_compile_args
= flags_list
,
125 extra_objects
= obj_list
),
127 # winbind client module
129 Extension(name
= "winbind",
130 sources
= [samba_srcdir
+ "python/py_winbind.c",
131 samba_srcdir
+ "python/py_winbind_conv.c",
132 samba_srcdir
+ "python/py_conv.c",
133 samba_srcdir
+ "python/py_common.c"],
134 libraries
= lib_list
,
135 library_dirs
= ["/usr/kerberos/lib"],
136 extra_compile_args
= flags_list
,
137 extra_objects
= obj_list
),
141 Extension(name
= "winreg",
142 sources
= [samba_srcdir
+ "python/py_winreg.c",
143 samba_srcdir
+ "python/py_common.c"],
144 libraries
= lib_list
,
145 library_dirs
= ["/usr/kerberos/lib"],
146 extra_compile_args
= flags_list
,
147 extra_objects
= obj_list
),
151 Extension(name
= "srvsvc",
152 sources
= [samba_srcdir
+ "python/py_srvsvc.c",
153 samba_srcdir
+ "python/py_conv.c",
154 samba_srcdir
+ "python/py_srvsvc_conv.c",
155 samba_srcdir
+ "python/py_common.c"],
156 libraries
= lib_list
,
157 library_dirs
= ["/usr/kerberos/lib"],
158 extra_compile_args
= flags_list
,
159 extra_objects
= obj_list
),
163 Extension(name
= "tdb",
164 sources
= [samba_srcdir
+ "python/py_tdb.c"],
165 libraries
= lib_list
,
166 library_dirs
= ["/usr/kerberos/lib"],
167 extra_compile_args
= flags_list
,
168 extra_objects
= obj_list
),
172 Extension(name
= "smb",
173 sources
= [samba_srcdir
+ "python/py_smb.c",
174 samba_srcdir
+ "python/py_common.c",
175 samba_srcdir
+ "python/py_ntsec.c"],
176 libraries
= lib_list
,
177 library_dirs
= ["/usr/kerberos/lib"],
178 extra_compile_args
= flags_list
,
179 extra_objects
= obj_list
),
181 # tdbpack/unpack extensions. Does not actually link to any Samba
182 # code, although it implements a compatible data format.
184 Extension(name
= "tdbpack",
185 sources
= [os
.path
.join(samba_srcdir
, "python", "py_tdbpack.c")],
186 extra_compile_args
= ["-I."])