Python's setup.py does not need to be munged by configure.in -- it is
[samba.git] / source / python / setup.py
1 # -*- mode: python -*-
2 #
3 # Unix SMB/CIFS implementation.
4 # Module packaging setup for Samba python extensions
5 #
6 # Copyright (C) Tim Potter, 2002
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #   
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #   
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #
22
23 from distutils.core import setup
24 from distutils.extension import Extension
25
26 import sys, string, os
27
28 # The Makefile passes in environment variable $PYTHON_OBJ as being the
29 # list of Samba objects.  This kind of goes against the distutils.cmd
30 # method of adding setup commands and will also confuse people who are
31 # familiar with the python Distutils module.
32
33 samba_objs = os.environ.get("PYTHON_OBJS", "")
34
35 samba_cflags = os.environ.get("PYTHON_CFLAGS", "")
36
37 samba_srcdir = os.environ.get("SRCDIR", "")
38
39 # These variables are filled in by configure
40
41 samba_libs = os.environ.get("LIBS", "")
42
43 # Convert libs and objs from space separated strings to lists of strings
44 # for distutils to digest.  Split "-l" prefix off library list.
45
46 obj_list = string.split(samba_objs)
47
48 lib_list = []
49
50 for lib in string.split(samba_libs):
51     lib_list.append(string.replace(lib, "-l", ""))
52
53 flags_list = string.split(samba_cflags)
54
55 # Invoke distutils.setup
56
57 setup(
58
59     # Overview information
60     
61     name = "Samba Python Extensions",
62     version = "0.1",
63     author = "Tim Potter",
64     author_email = "tpot@samba.org",
65     license = "GPL",
66
67     # Build info
68     
69     include_dirs = [samba_srcdir + '.', samba_srcdir + "include",
70                     samba_srcdir + "ubiqx", samba_srcdir + "smbwrapper",
71                     samba_srcdir + "popt", "/usr/kerberos/include",
72                     "/usr/local/include"],
73     
74     # Module list
75     
76     ext_modules = [
77
78     # SPOOLSS pipe module
79
80     Extension(name = "spoolss",
81               sources = [samba_srcdir + "python/py_spoolss.c",
82                          samba_srcdir + "python/py_common.c",
83                          samba_srcdir + "python/py_conv.c",
84                          samba_srcdir + "python/py_ntsec.c",
85                          samba_srcdir + "python/py_spoolss_forms.c",
86                          samba_srcdir + "python/py_spoolss_forms_conv.c",
87                          samba_srcdir + "python/py_spoolss_drivers.c",
88                          samba_srcdir + "python/py_spoolss_drivers_conv.c",
89                          samba_srcdir + "python/py_spoolss_printers.c",
90                          samba_srcdir + "python/py_spoolss_printers_conv.c",
91                          samba_srcdir + "python/py_spoolss_printerdata.c",
92                          samba_srcdir + "python/py_spoolss_ports.c",
93                          samba_srcdir + "python/py_spoolss_ports_conv.c",
94                          samba_srcdir + "python/py_spoolss_jobs.c",
95                          samba_srcdir + "python/py_spoolss_jobs_conv.c",
96                          ],
97               libraries = lib_list,
98               library_dirs = ["/usr/kerberos/lib"],
99               extra_objects = obj_list),
100
101     # LSA pipe module
102
103     Extension(name = "lsa",
104               sources = [samba_srcdir + "python/py_lsa.c",
105                          samba_srcdir + "python/py_common.c",
106                          samba_srcdir + "python/py_ntsec.c"],
107               libraries = lib_list,
108               library_dirs = ["/usr/kerberos/lib"],
109               extra_objects = obj_list),
110
111     # SAMR pipe module
112
113     Extension(name = "samr",
114               sources = [samba_srcdir + "python/py_samr.c",
115                          samba_srcdir + "python/py_samr_conv.c",
116                          samba_srcdir + "python/py_common.c"],
117               libraries = lib_list,
118               library_dirs = ["/usr/kerberos/lib"],
119               extra_objects = obj_list),
120
121     # winbind client module
122
123     Extension(name = "winbind",
124               sources = [samba_srcdir + "python/py_winbind.c",
125                          samba_srcdir + "python/py_common.c"],
126               libraries = lib_list,
127               library_dirs = ["/usr/kerberos/lib"],
128               extra_objects = obj_list,
129               extra_compile_args = flags_list),
130
131     # WINREG pipe module
132
133     Extension(name = "winreg",
134               sources = [samba_srcdir + "python/py_winreg.c",
135                          samba_srcdir + "python/py_common.c"],
136               libraries = lib_list,
137               library_dirs = ["/usr/kerberos/lib"],
138               extra_objects = obj_list),
139
140     # tdb module
141
142     Extension(name = "tdb",
143               sources = [samba_srcdir + "python/py_tdb.c"],
144               libraries = lib_list,
145               library_dirs = ["/usr/kerberos/lib"],
146               extra_objects = obj_list),
147
148     # libsmb module
149
150     Extension(name = "smb",
151               sources = [samba_srcdir + "python/py_smb.c",
152                          samba_srcdir + "python/py_common.c"],
153               libraries = lib_list,
154               library_dirs = ["/usr/kerberos/lib"],
155               extra_objects = obj_list),
156
157     # Moving to merge all individual extensions in to one big
158     # extension.  This is to avoid the fact that each extension is 3MB
159     # in size due to the lack of proper depedency management in Samba.
160
161     Extension(name = "samba",
162               sources = [samba_srcdir + "python/py_samba.c",
163                          samba_srcdir + "python/py_common.c"],
164               libraries = lib_list,
165               library_dirs = ["/usr/kerberos/lib"],
166               extra_objects = obj_list),
167     ],
168 )