Added new files for drivers, forms and ports conversion routines.
[nivanova/samba-autobuild/.git] / source / python / setup.py.in
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 = ""
34 if os.environ.has_key("PYTHON_OBJS"):
35     samba_objs = os.environ.get("PYTHON_OBJS")
36
37 samba_cflags = ""
38 if os.environ.has_key("PYTHON_CFLAGS"):
39     samba_cflags = os.environ.get("PYTHON_CFLAGS")
40
41 samba_srcdir = ""
42 if os.environ.has_key("SRCDIR"):
43     samba_srcdir = os.environ.get("SRCDIR")
44
45 # These variables are filled in by configure
46
47 samba_libs = "@LIBS@"
48
49 # Convert libs and objs from space separated strings to lists of strings
50 # for distutils to digest.  Split "-l" prefix off library list.
51
52 obj_list = string.split(samba_objs)
53
54 lib_list = []
55
56 for lib in string.split(samba_libs):
57     lib_list.append(string.replace(lib, "-l", ""))
58
59 flags_list = string.split(samba_cflags)
60
61 # Invoke distutils.setup
62
63 setup(
64
65     # Overview information
66     
67     name = "Samba Python Extensions",
68     version = "0.1",
69     author = "Tim Potter",
70     author_email = "tpot@samba.org",
71     license = "GPL",
72
73     # Build info
74     
75     include_dirs = [samba_srcdir + '.', samba_srcdir + "include",
76                     samba_srcdir + "ubiqx", samba_srcdir + "smbwrapper",
77                     samba_srcdir + "popt", "/usr/kerberos/include",
78                     "/usr/local/include"],
79     
80     # Module list
81     
82     ext_modules = [
83
84     # SPOOLSS pipe module
85
86     Extension(name = "spoolss",
87               sources = [samba_srcdir + "python/py_spoolss.c",
88                          samba_srcdir + "python/py_common.c",
89                          samba_srcdir + "python/py_conv.c",
90                          samba_srcdir + "python/py_spoolss_forms.c",
91                          samba_srcdir + "python/py_spoolss_forms_conv.c",
92                          samba_srcdir + "python/py_spoolss_drivers.c",
93                          samba_srcdir + "python/py_spoolss_drivers_conv.c",
94                          samba_srcdir + "python/py_spoolss_printers.c",
95                          samba_srcdir + "python/py_spoolss_printers_conv.c",
96                          samba_srcdir + "python/py_spoolss_ports.c",
97                          samba_srcdir + "python/py_spoolss_ports_conv.c",
98                          ],
99               libraries = lib_list,
100               library_dirs = ["/usr/kerberos/lib"],
101               extra_objects = obj_list),
102
103     # LSA pipe module
104
105     Extension(name = "lsa",
106               sources = [samba_srcdir + "python/py_lsa.c",
107                          samba_srcdir + "python/py_common.c"],
108               libraries = lib_list,
109               library_dirs = ["/usr/kerberos/lib"],
110               extra_objects = obj_list),
111
112     # winbind client module
113
114     Extension(name = "winbind",
115               sources = [samba_srcdir + "python/py_winbind.c",
116                          samba_srcdir + "python/py_common.c"],
117               libraries = lib_list,
118               library_dirs = ["/usr/kerberos/lib"],
119               extra_objects = obj_list,
120               extra_compile_args = flags_list),
121     ]
122 )