summaryrefslogtreecommitdiff
path: root/source3/python/setup.py
blob: bf62f3b877314ea5a0d508b844c73b5395af7f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# -*- mode: python -*-
#
# Unix SMB/CIFS implementation.
# Module packaging setup for Samba python extensions
#
# Copyright (C) Tim Potter, 2002
# Copyright (C) Martin Pool, 2002
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#   
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#   
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

from distutils.core import setup
from distutils.extension import Extension

import sys, string, os

# The Makefile passes in environment variable $PYTHON_OBJ as being the
# list of Samba objects.  This kind of goes against the distutils.cmd
# method of adding setup commands and will also confuse people who are
# familiar with the python Distutils module.

samba_objs = os.environ.get("PYTHON_OBJS", "")

samba_cflags = os.environ.get("PYTHON_CFLAGS", "")

samba_srcdir = os.environ.get("SRCDIR", "")

# These variables are filled in by configure

samba_libs = os.environ.get("LIBS", "")

# Convert libs and objs from space separated strings to lists of strings
# for distutils to digest.  Split "-l" prefix off library list.

obj_list = string.split(samba_objs)

lib_list = []

for lib in string.split(samba_libs):
    lib_list.append(string.replace(lib, "-l", ""))

flags_list = string.split(samba_cflags)

# Invoke distutils.setup

setup(

    # Overview information
    
    name = "Samba Python Extensions",
    version = "0.1",
    author = "Tim Potter",
    author_email = "tpot@samba.org",
    license = "GPL",

    # Get the "samba" directory of Python source.  At the moment this
    # just contains the __init__ file that makes it work as a
    # subpackage.  This is needed even though everything else is an
    # extension module.
    package_dir = {"samba": os.path.join(samba_srcdir, "python", "samba")},
    packages = ["samba"],
    
    # Module list
    ext_package = "samba", 
    ext_modules = [

    # SPOOLSS pipe module

    Extension(name = "spoolss",
              sources = [samba_srcdir + "python/py_spoolss.c",
                         samba_srcdir + "python/py_common.c",
                         samba_srcdir + "python/py_conv.c",
                         samba_srcdir + "python/py_ntsec.c",
                         samba_srcdir + "python/py_spoolss_forms.c",
                         samba_srcdir + "python/py_spoolss_forms_conv.c",
                         samba_srcdir + "python/py_spoolss_drivers.c",
                         samba_srcdir + "python/py_spoolss_drivers_conv.c",
                         samba_srcdir + "python/py_spoolss_printers.c",
                         samba_srcdir + "python/py_spoolss_printers_conv.c",
                         samba_srcdir + "python/py_spoolss_printerdata.c",
                         samba_srcdir + "python/py_spoolss_ports.c",
                         samba_srcdir + "python/py_spoolss_ports_conv.c",
                         samba_srcdir + "python/py_spoolss_jobs.c",
                         samba_srcdir + "python/py_spoolss_jobs_conv.c",
                         ],
              libraries = lib_list,
              library_dirs = ["/usr/kerberos/lib"],
              extra_compile_args = flags_list,
              extra_objects = obj_list),

    # LSA pipe module

    Extension(name = "lsa",
              sources = [samba_srcdir + "python/py_lsa.c",
                         samba_srcdir + "python/py_common.c",
                         samba_srcdir + "python/py_ntsec.c"],
              libraries = lib_list,
              library_dirs = ["/usr/kerberos/lib"],
              extra_compile_args = flags_list,
              extra_objects = obj_list),

    # SAMR pipe module

    Extension(name = "samr",
              sources = [samba_srcdir + "python/py_samr.c",
                         samba_srcdir + "python/py_samr_conv.c",
                         samba_srcdir + "python/py_common.c"],
              libraries = lib_list,
              library_dirs = ["/usr/kerberos/lib"],
              extra_compile_args = flags_list,
              extra_objects = obj_list),

    # winbind client module

    Extension(name = "winbind",
              sources = [samba_srcdir + "python/py_winbind.c",
                         samba_srcdir + "python/py_winbind_conv.c",
                         samba_srcdir + "python/py_conv.c",
                         samba_srcdir + "python/py_common.c"],
              libraries = lib_list,
              library_dirs = ["/usr/kerberos/lib"],
              extra_compile_args = flags_list,
              extra_objects = obj_list),

    # WINREG pipe module

    Extension(name = "winreg",
              sources = [samba_srcdir + "python/py_winreg.c",
                         samba_srcdir + "python/py_common.c"],
              libraries = lib_list,
              library_dirs = ["/usr/kerberos/lib"],
              extra_compile_args = flags_list,
              extra_objects = obj_list),

    # tdb module

    Extension(name = "tdb",
              sources = [samba_srcdir + "python/py_tdb.c"],
              libraries = lib_list,
              library_dirs = ["/usr/kerberos/lib"],
              extra_compile_args = flags_list,
              extra_objects = obj_list),

    # libsmb module

    Extension(name = "smb",
              sources = [samba_srcdir + "python/py_smb.c",
                         samba_srcdir + "python/py_common.c",
                         samba_srcdir + "python/py_ntsec.c"],
              libraries = lib_list,
              library_dirs = ["/usr/kerberos/lib"],
              extra_compile_args = flags_list,
              extra_objects = obj_list),

    # Moving to merge all individual extensions in to one big
    # extension.  This is to avoid the fact that each extension is 3MB
    # in size due to the lack of proper depedency management in Samba.

    Extension(name = "samba",
              sources = [samba_srcdir + "python/py_samba.c",
                         samba_srcdir + "python/py_common.c"],
              libraries = lib_list,
              library_dirs = ["/usr/kerberos/lib"],
              extra_compile_args = flags_list,
              extra_objects = obj_list),

    # tdbpack/unpack extensions.  Does not actually link to any Samba
    # code, although it implements a compatible data format.
    Extension(name = "tdbpack",
              sources = [os.path.join(samba_srcdir, "python", "py_tdbpack.c")]),
    ],
)