Skip to content

Commit

Permalink
build: Remove bld.gen_python_environments()
Browse files Browse the repository at this point in the history
This was part of --extra-python support.

Signed-off-by: Andrew Bartlett <[email protected]>
Reviewed-by: Garming Sam <[email protected]>
  • Loading branch information
abartlet committed Mar 21, 2019
1 parent 270d04e commit fdb6305
Show file tree
Hide file tree
Showing 28 changed files with 523 additions and 567 deletions.
15 changes: 7 additions & 8 deletions auth/credentials/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ bld.SAMBA_SUBSYSTEM('CREDENTIALS_NTLM',
source='credentials_ntlm.c',
deps='samba-credentials')

for env in bld.gen_python_environments():
pytalloc_util = bld.pyembed_libname('pytalloc-util')
pyparam_util = bld.pyembed_libname('pyparam_util')
pytalloc_util = bld.pyembed_libname('pytalloc-util')
pyparam_util = bld.pyembed_libname('pyparam_util')

bld.SAMBA_PYTHON('pycredentials',
source='pycredentials.c',
public_deps='samba-credentials cmdline-credentials %s %s CREDENTIALS_KRB5 CREDENTIALS_SECRETS' % (pytalloc_util, pyparam_util),
realname='samba/credentials.so'
)
bld.SAMBA_PYTHON('pycredentials',
source='pycredentials.c',
public_deps='samba-credentials cmdline-credentials %s %s CREDENTIALS_KRB5 CREDENTIALS_SECRETS' % (pytalloc_util, pyparam_util),
realname='samba/credentials.so'
)
10 changes: 0 additions & 10 deletions buildtools/wafsamba/samba_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,3 @@ def pyembed_libname(bld, name):
Build.BuildContext.pyembed_libname = pyembed_libname


def gen_python_environments(bld, extra_env_vars=()):
"""Generate all Python environments
To be used in a for loop. Normally, the loop body will be executed once.
When --extra-python is used, the body will additionaly be executed
with the extra-python environment active.
"""
yield
Build.BuildContext.gen_python_environments = gen_python_environments
9 changes: 4 additions & 5 deletions lib/crypto/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ bld.SAMBA_SUBSYSTEM('TORTURE_LIBCRYPTO',
deps='LIBCRYPTO'
)

for env in bld.gen_python_environments():
bld.SAMBA_PYTHON('python_crypto',
source='py_crypto.c',
deps='LIBCRYPTO',
realname='samba/crypto.so'
bld.SAMBA_PYTHON('python_crypto',
source='py_crypto.c',
deps='LIBCRYPTO',
realname='samba/crypto.so'
)
13 changes: 6 additions & 7 deletions lib/ldb-samba/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ bld.SAMBA_SUBSYSTEM('ldbwrap',
deps='ldb samba-util ldbsamba samba-hostconfig'
)

for env in bld.gen_python_environments():
pyparam_util = bld.pyembed_libname('pyparam_util')
pyldb_util = bld.pyembed_libname('pyldb-util')
pyauth = 'pyauth'
bld.SAMBA_PYTHON('python_samba__ldb', 'pyldb.c',
deps='ldbsamba %s ldbwrap %s %s' % (pyparam_util, pyldb_util, pyauth),
realname='samba/_ldb.so')
pyparam_util = bld.pyembed_libname('pyparam_util')
pyldb_util = bld.pyembed_libname('pyldb-util')
pyauth = 'pyauth'
bld.SAMBA_PYTHON('python_samba__ldb', 'pyldb.c',
deps='ldbsamba %s ldbwrap %s %s' % (pyparam_util, pyldb_util, pyauth),
realname='samba/_ldb.so')

bld.SAMBA_MODULE('ldbsamba_extensions',
source='samba_extensions.c',
Expand Down
49 changes: 23 additions & 26 deletions lib/ldb/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -234,37 +234,34 @@ def build(bld):

if bld.PYTHON_BUILD_IS_ENABLED():
if not bld.CONFIG_SET('USING_SYSTEM_PYLDB_UTIL'):
for env in bld.gen_python_environments(['PKGCONFIGDIR']):

name = bld.pyembed_libname('pyldb-util')
bld.SAMBA_LIBRARY(name,
deps='replace ldb',
source='pyldb_util.c',
public_headers=('' if private_library else 'pyldb.h'),
public_headers_install=not private_library,
vnum=VERSION,
private_library=private_library,
pc_files='pyldb-util.pc',
pyembed=True,
enabled=bld.PYTHON_BUILD_IS_ENABLED(),
abi_directory='ABI',
abi_match='pyldb_*')

if not bld.CONFIG_SET('USING_SYSTEM_LDB'):
bld.SAMBA_PYTHON('pyldb', 'pyldb.c',
deps='replace ldb ' + name,
realname='ldb.so',
cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
name = bld.pyembed_libname('pyldb-util')
bld.SAMBA_LIBRARY(name,
deps='replace ldb',
source='pyldb_util.c',
public_headers=('' if private_library else 'pyldb.h'),
public_headers_install=not private_library,
vnum=VERSION,
private_library=private_library,
pc_files='pyldb-util.pc',
pyembed=True,
enabled=bld.PYTHON_BUILD_IS_ENABLED(),
abi_directory='ABI',
abi_match='pyldb_*')

if not bld.CONFIG_SET('USING_SYSTEM_LDB'):
bld.SAMBA_PYTHON('pyldb', 'pyldb.c',
deps='replace ldb ' + name,
realname='ldb.so',
cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)

# Do only install this file as part of the Samba build if we do not
# use the system libldb!
if not bld.CONFIG_SET('USING_SYSTEM_PYLDB_UTIL'):
for env in bld.gen_python_environments(['PKGCONFIGDIR']):
bld.SAMBA_SCRIPT('_ldb_text.py',
pattern='_ldb_text.py',
installdir='python')
bld.SAMBA_SCRIPT('_ldb_text.py',
pattern='_ldb_text.py',
installdir='python')

bld.INSTALL_FILES('${PYTHONARCHDIR}', '_ldb_text.py')
bld.INSTALL_FILES('${PYTHONARCHDIR}', '_ldb_text.py')

if not bld.CONFIG_SET('USING_SYSTEM_LDB'):
if bld.is_install:
Expand Down
29 changes: 14 additions & 15 deletions lib/talloc/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,9 @@ def build(bld):
manpages='man/talloc.3')

if not bld.CONFIG_SET('USING_SYSTEM_PYTALLOC_UTIL'):
for env in bld.gen_python_environments(['PKGCONFIGDIR']):
name = bld.pyembed_libname('pytalloc-util')
name = bld.pyembed_libname('pytalloc-util')

bld.SAMBA_LIBRARY(name,
bld.SAMBA_LIBRARY(name,
source='pytalloc_util.c',
public_deps='talloc',
pyembed=True,
Expand All @@ -149,18 +148,18 @@ def build(bld):
pc_files='pytalloc-util.pc',
enabled=bld.PYTHON_BUILD_IS_ENABLED()
)
bld.SAMBA_PYTHON('pytalloc',
'pytalloc.c',
deps='talloc ' + name,
enabled=bld.PYTHON_BUILD_IS_ENABLED(),
realname='talloc.so')

bld.SAMBA_PYTHON('test_pytalloc',
'test_pytalloc.c',
deps=name,
enabled=bld.PYTHON_BUILD_IS_ENABLED(),
realname='_test_pytalloc.so',
install=False)
bld.SAMBA_PYTHON('pytalloc',
'pytalloc.c',
deps='talloc ' + name,
enabled=bld.PYTHON_BUILD_IS_ENABLED(),
realname='talloc.so')

bld.SAMBA_PYTHON('test_pytalloc',
'test_pytalloc.c',
deps=name,
enabled=bld.PYTHON_BUILD_IS_ENABLED(),
realname='_test_pytalloc.so',
install=False)


def test(ctx):
Expand Down
24 changes: 11 additions & 13 deletions lib/tdb/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,19 @@ def build(bld):
includes='include', install=False)

if not bld.CONFIG_SET('USING_SYSTEM_PYTDB'):
for env in bld.gen_python_environments(['PKGCONFIGDIR']):
bld.SAMBA_PYTHON('pytdb',
'pytdb.c',
deps='tdb',
enabled=not bld.env.disable_python,
realname='tdb.so',
cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
bld.SAMBA_PYTHON('pytdb',
'pytdb.c',
deps='tdb',
enabled=not bld.env.disable_python,
realname='tdb.so',
cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)

if not bld.env.disable_python:
for env in bld.gen_python_environments(['PKGCONFIGDIR']):
bld.SAMBA_SCRIPT('_tdb_text.py',
pattern='_tdb_text.py',
installdir='python')

bld.INSTALL_FILES('${PYTHONARCHDIR}', '_tdb_text.py')
bld.SAMBA_SCRIPT('_tdb_text.py',
pattern='_tdb_text.py',
installdir='python')

bld.INSTALL_FILES('${PYTHONARCHDIR}', '_tdb_text.py')

def testonly(ctx):
'''run tdb testsuite'''
Expand Down
13 changes: 6 additions & 7 deletions lib/tevent/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,14 @@ def build(bld):
private_library=private_library)

if not bld.CONFIG_SET('USING_SYSTEM_PYTEVENT') and not bld.env.disable_python:
for env in bld.gen_python_environments(['PKGCONFIGDIR']):
bld.SAMBA_PYTHON('_tevent',
'pytevent.c',
deps='tevent',
realname='_tevent.so',
cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
bld.SAMBA_PYTHON('_tevent',
'pytevent.c',
deps='tevent',
realname='_tevent.so',
cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)


bld.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'tevent.py', flat=False)
bld.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'tevent.py', flat=False)

# install out various python scripts for use by make test
bld.SAMBA_SCRIPT('tevent_python',
Expand Down
3 changes: 1 addition & 2 deletions libcli/nbt/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ bld.SAMBA_BINARY('nmblookup' + bld.env.suffix4,
install=False
)

for env in bld.gen_python_environments():
bld.SAMBA_PYTHON('python_netbios',
bld.SAMBA_PYTHON('python_netbios',
source='pynbt.c',
public_deps='cli-nbt DYNCONFIG samba-hostconfig',
realname='samba/netbios.so'
Expand Down
13 changes: 6 additions & 7 deletions libcli/security/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ bld.SAMBA_LIBRARY('samba-security',
deps='talloc ndr NDR_SECURITY'
)

for env in bld.gen_python_environments():
pytalloc_util = bld.pyembed_libname('pytalloc-util')
bld.SAMBA_PYTHON('pysecurity',
source='pysecurity.c',
deps='samba-security %s' % pytalloc_util,
realname='samba/security.so'
)
pytalloc_util = bld.pyembed_libname('pytalloc-util')
bld.SAMBA_PYTHON('pysecurity',
source='pysecurity.c',
deps='samba-security %s' % pytalloc_util,
realname='samba/security.so'
)
5 changes: 2 additions & 3 deletions libcli/util/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ bld.SAMBA_GENERATOR('werror_generated',
rule='${PYTHON} ${SRC[0].abspath(env)} ${SRC[1].abspath(env)} ${TGT[0].abspath(env)} ${TGT[1].abspath(env)} ${TGT[2].abspath(env)}'
)

for env in bld.gen_python_environments():
bld.SAMBA_PYTHON('python_ntstatus',
bld.SAMBA_PYTHON('python_ntstatus',
source='py_ntstatus.c',
deps='samba-errors',
realname='samba/ntstatus.so'
)

bld.SAMBA_PYTHON('python_werror',
bld.SAMBA_PYTHON('python_werror',
source='py_werror.c',
deps='samba-errors',
realname='samba/werror.so'
Expand Down
11 changes: 5 additions & 6 deletions libgpo/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ bld.SAMBA3_LIBRARY('gpext',
deps='talloc ads TOKEN_UTIL auth gpo',
private_library=True)

for env in bld.gen_python_environments():
pyparam_util = bld.pyembed_libname('pyparam_util')
pyrpc_util = bld.pyembed_libname('pyrpc_util')
bld.SAMBA3_PYTHON('python_samba_libgpo', 'pygpo.c',
deps='%s gpext talloc ads TOKEN_UTIL auth %s' % (pyparam_util, pyrpc_util),
realname='samba/gpo.so')
pyparam_util = bld.pyembed_libname('pyparam_util')
pyrpc_util = bld.pyembed_libname('pyrpc_util')
bld.SAMBA3_PYTHON('python_samba_libgpo', 'pygpo.c',
deps='%s gpext talloc ads TOKEN_UTIL auth %s' % (pyparam_util, pyrpc_util),
realname='samba/gpo.so')
48 changes: 23 additions & 25 deletions python/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -44,42 +44,40 @@ def configure(conf):
def build(bld):


for env in bld.gen_python_environments():
pytalloc_util = bld.pyembed_libname('pytalloc-util')
pyparam_util = bld.pyembed_libname('pyparam_util')
libpython = bld.pyembed_libname('LIBPYTHON')
pyrpc_util = bld.pyembed_libname('pyrpc_util')
samba_python = bld.pyembed_libname('samba_python')
bld.SAMBA_LIBRARY(samba_python,
pytalloc_util = bld.pyembed_libname('pytalloc-util')
pyparam_util = bld.pyembed_libname('pyparam_util')
libpython = bld.pyembed_libname('LIBPYTHON')
pyrpc_util = bld.pyembed_libname('pyrpc_util')
samba_python = bld.pyembed_libname('samba_python')
bld.SAMBA_LIBRARY(samba_python,
source=[],
deps='%s %s %s' % (libpython, pytalloc_util, pyrpc_util),
grouping_library=True,
private_library=True,
pyembed=True,
enabled=bld.PYTHON_BUILD_IS_ENABLED())
bld.SAMBA_PYTHON('python_glue',
source='pyglue.c',
deps='''
bld.SAMBA_PYTHON('python_glue',
source='pyglue.c',
deps='''
%s
samba-util
netif
%s
''' % (pyparam_util, pytalloc_util),
realname='samba/_glue.so')
realname='samba/_glue.so')

bld.SAMBA_SUBSYSTEM(libpython,
source='modules.c',
public_deps='',
init_function_sentinel='{NULL,NULL}',
deps='talloc',
pyext=True,
enabled=bld.PYTHON_BUILD_IS_ENABLED())
bld.SAMBA_SUBSYSTEM(libpython,
source='modules.c',
public_deps='',
init_function_sentinel='{NULL,NULL}',
deps='talloc',
pyext=True,
enabled=bld.PYTHON_BUILD_IS_ENABLED())

if bld.PYTHON_BUILD_IS_ENABLED():
for env in bld.gen_python_environments():
# install out various python scripts for use by make test
bld.SAMBA_SCRIPT('samba_python_files',
pattern='samba/**/*.py',
installdir='python')

bld.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'samba/**/*.py', flat=False)
# install out various python scripts for use by make test
bld.SAMBA_SCRIPT('samba_python_files',
pattern='samba/**/*.py',
installdir='python')

bld.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'samba/**/*.py', flat=False)
5 changes: 2 additions & 3 deletions source3/param/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ bld.SAMBA_GENERATOR('s3_param_proto_h',
group='build_source',
rule='${PYTHON} ${SRC[0].abspath(env)} --file ${SRC[1].abspath(env)} --output ${TGT} --mode=S3PROTO')

for env in bld.gen_python_environments():
pytalloc_util = bld.pyembed_libname('pytalloc-util')
bld.SAMBA3_PYTHON('pys3param',
pytalloc_util = bld.pyembed_libname('pytalloc-util')
bld.SAMBA3_PYTHON('pys3param',
source='pyparam.c',
deps='smbconf',
public_deps=' '.join(['samba-hostconfig', pytalloc_util, 'talloc']),
Expand Down
7 changes: 3 additions & 4 deletions source3/passdb/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ bld.SAMBA3_MODULE('pdb_samba_dsdb',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('pdb_samba_dsdb') and bld.AD_DC_BUILD_IS_ENABLED(),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('pdb_samba_dsdb') and bld.AD_DC_BUILD_IS_ENABLED())

for env in bld.gen_python_environments():
pyrpc_util = bld.pyembed_libname('pyrpc_util')
pytalloc_util = bld.pyembed_libname('pytalloc-util')
bld.SAMBA3_PYTHON('pypassdb',
pyrpc_util = bld.pyembed_libname('pyrpc_util')
pytalloc_util = bld.pyembed_libname('pytalloc-util')
bld.SAMBA3_PYTHON('pypassdb',
source='py_passdb.c',
deps='pdb',
public_deps=' '.join(['samba-util', 'tdb', 'talloc', pyrpc_util, pytalloc_util]),
Expand Down
Loading

0 comments on commit fdb6305

Please sign in to comment.