[PATCHv2 1-14/14] Re: Disabling Python Modules

Alexander Bokovoy ab at samba.org
Sat Jan 28 10:02:14 UTC 2017


On la, 28 tammi 2017, Ian Stakenvicius wrote:
> diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py
> index 057a017..b6bf079 100644
> --- a/buildtools/wafsamba/samba_python.py
> +++ b/buildtools/wafsamba/samba_python.py
> @@ -40,22 +40,31 @@ def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(2,4,2)):
>  
>  @conf
>  def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
> -    if conf.env["python_headers_checked"] == []:
> -        if conf.env['EXTRA_PYTHON']:
> -            conf.setenv('extrapython')
> -            _check_python_headers(conf, mandatory=True)
> -            conf.setenv('default')
> -
> -        _check_python_headers(conf, mandatory)
> -        conf.env["python_headers_checked"] = "yes"
> -
> -        if conf.env['EXTRA_PYTHON']:
> -            extraversion = conf.all_envs['extrapython']['PYTHON_VERSION']
> -            if extraversion == conf.env['PYTHON_VERSION']:
> -                raise Utils.WafError("extrapython %s is same as main python %s" % (
> -                    extraversion, conf.env['PYTHON_VERSION']))
> +    if not conf.env.disable_python:
> +        if conf.env["python_headers_checked"] == []:
> +            if conf.env['EXTRA_PYTHON']:
> +                conf.setenv('extrapython')
> +                _check_python_headers(conf, mandatory=True)
> +                conf.setenv('default')
> +
> +            _check_python_headers(conf, mandatory)
> +            conf.env["python_headers_checked"] = "yes"
> +
> +            if conf.env['EXTRA_PYTHON']:
> +                extraversion = conf.all_envs['extrapython']['PYTHON_VERSION']
> +                if extraversion == conf.env['PYTHON_VERSION']:
> +                    raise Utils.WafError("extrapython %s is same as main python %s" % (
> +                        extraversion, conf.env['PYTHON_VERSION']))
> +
> +        else:
> +            conf.msg("python headers", "using cache")
> +
>      else:
> -        conf.msg("python headers", "using cache")
> +        if mandatory:
> +            raise Utils.WafError("Cannot check for python headers when --disable-python specified")
> +
> +        conf.msg("python headers", "Check disabled due to --disable-python")
> +

Could you please turn the logic upside down here?
Instead of 

   if not conf.env.disable_python:
    -> re-indent code
   else:
    ....

please do 

   if conf.env.disable_python:
      ....
      return

   original code

This would further reduce the diff size and will not touch the original
code at all.

>  
>      # we don't want PYTHONDIR in config.h, as otherwise changing
>      # --prefix causes a complete rebuild
> @@ -77,6 +86,14 @@ def _check_python_headers(conf, mandatory):
>          conf.env['PYTHON_SO_ABI_FLAG'] = ''
>  
>  
> +def PYTHON_BUILD_IS_ENABLED(self):
> +    if self.CONFIG_SET('HAVE_PYTHON_H'):
> +        return True
> +    return False
CONFIG_SET already returns True or False, so this could be simplified
down to

   def PYTHON_BUILD_IS_ENABLED(self):
       return self.CONFIG_SET('HAVE_PYTHON_H')


> +
> +Build.BuildContext.PYTHON_BUILD_IS_ENABLED = PYTHON_BUILD_IS_ENABLED
> +
> +
>  def SAMBA_PYTHON(bld, name,
>                   source='',
>                   deps='',
> @@ -91,6 +108,9 @@ def SAMBA_PYTHON(bld, name,
>                   enabled=True):
>      '''build a python extension for Samba'''
>  
> +    if not bld.PYTHON_BUILD_IS_ENABLED():
> +        enabled = False
> +
As PYTHON_BUILD_IS_ENABLED already returns True or False, this could be
written as

   enabled = bld.PYTHON_BUILD_IS_ENABLED()


>      if bld.env['IS_EXTRA_PYTHON']:
>          name = 'extra-' + name
>  
> @@ -138,7 +158,10 @@ Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON
>  
>  
>  def pyembed_libname(bld, name, extrapython=False):
> -    return name + bld.env['PYTHON_SO_ABI_FLAG']
> +    if bld.env['PYTHON_SO_ABI_FLAG']:
> +        return name + bld.env['PYTHON_SO_ABI_FLAG']
> +    else:
> +        return name
>  
>  Build.BuildContext.pyembed_libname = pyembed_libname
>  
> diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
> index 8802e5a..c5c0081 100644
> --- a/buildtools/wafsamba/wscript
> +++ b/buildtools/wafsamba/wscript
> @@ -196,6 +196,10 @@ def set_options(opt):
>                     help='tag release in git at the same time',
>                     type='string', action='store', dest='TAG_RELEASE')
>  
> +    opt.add_option('--disable-python',
> +                    help='do not generate python modules',
> +                    action='store_true', dest='disable_python', default=False)
> +
>      opt.add_option('--extra-python', type=str,
>                      help=("build selected libraries for the specified "
>                            "additional version of Python "
> @@ -279,6 +283,8 @@ def configure(conf):
>      conf.env.AUTOCONF_HOST  = Options.options.AUTOCONF_HOST
>      conf.env.AUTOCONF_PROGRAM_PREFIX = Options.options.AUTOCONF_PROGRAM_PREFIX
>  
> +    conf.env.disable_python = Options.options.disable_python
> +
>      conf.env.EXTRA_PYTHON = Options.options.EXTRA_PYTHON
>  
>      if (conf.env.AUTOCONF_HOST and
> diff --git a/lib/ldb/wscript b/lib/ldb/wscript
> index 7f05db3..83b9ca2 100644
> --- a/lib/ldb/wscript
> +++ b/lib/ldb/wscript
> @@ -46,7 +46,8 @@ def configure(conf):
>      conf.find_program('xsltproc', var='XSLTPROC')
>      conf.check_tool('python')
>      conf.check_python_version((2,4,2))
> -    conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True)
> +    if not conf.env.disable_python:
> +        conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True)
>  
>      # where does the default LIBDIR end up? in conf.env somewhere?
>      #
> @@ -55,10 +56,16 @@ def configure(conf):
>      conf.env.standalone_ldb = conf.IN_LAUNCH_DIR()
>  
>      if not conf.env.standalone_ldb:
> -        if conf.CHECK_BUNDLED_SYSTEM_PKG('pyldb-util', minversion=VERSION,
> +        if conf.env.disable_python:
> +            if conf.CHECK_BUNDLED_SYSTEM_PKG('ldb', minversion=VERSION,
> +                                         onlyif='talloc tdb tevent',
> +                                         implied_deps='replace talloc tdb tevent'):
> +                conf.define('USING_SYSTEM_LDB', 1)
> +        else:
> +            if conf.CHECK_BUNDLED_SYSTEM_PKG('pyldb-util', minversion=VERSION,
>                                       onlyif='talloc tdb tevent',
>                                       implied_deps='replace talloc tdb tevent ldb'):
> -            conf.define('USING_SYSTEM_PYLDB_UTIL', 1)
> +                conf.define('USING_SYSTEM_PYLDB_UTIL', 1)
>              if conf.CHECK_BUNDLED_SYSTEM_PKG('ldb', minversion=VERSION,
>                                           onlyif='talloc tdb tevent pyldb-util',
>                                           implied_deps='replace talloc tdb tevent'):
> @@ -120,11 +127,10 @@ def build(bld):
>          bld.env.PACKAGE_VERSION = VERSION
>          bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
>  
> -    if not bld.env.disable_python:
> -        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,
> +    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='ldb',
>                                    source='pyldb_util.c',
>                                    public_headers=('' if private_library else 'pyldb.h'),
> @@ -133,15 +139,17 @@ def build(bld):
>                                    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'):
> +            if not bld.CONFIG_SET('USING_SYSTEM_LDB'):
>                      bld.SAMBA_PYTHON('pyldb', 'pyldb.c',
>                                       deps='ldb ' + name,
>                                       realname='ldb.so',
>                                       cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
>  
> +        if bld.PYTHON_BUILD_IS_ENABLED():
>              for env in bld.gen_python_environments(['PKGCONFIGDIR']):
>                  bld.SAMBA_SCRIPT('_ldb_text.py',
>                                   pattern='_ldb_text.py',
> diff --git a/lib/talloc/wscript b/lib/talloc/wscript
> index 41f3be7..69c708d 100644
> --- a/lib/talloc/wscript
> +++ b/lib/talloc/wscript
> @@ -48,7 +48,8 @@ def configure(conf):
>          if conf.CHECK_BUNDLED_SYSTEM_PKG('talloc', minversion=VERSION,
>                                       implied_deps='replace'):
>              conf.define('USING_SYSTEM_TALLOC', 1)
> -        if conf.CHECK_BUNDLED_SYSTEM_PKG('pytalloc-util', minversion=VERSION,
> +        if not conf.env.disable_python and \
> +            conf.CHECK_BUNDLED_SYSTEM_PKG('pytalloc-util', minversion=VERSION,
>                                       implied_deps='talloc replace'):
>              conf.define('USING_SYSTEM_PYTALLOC_UTIL', 1)
>  
> @@ -122,7 +123,7 @@ def build(bld):
>                            private_library=private_library,
>                            manpages='man/talloc.3')
>  
> -    if not bld.CONFIG_SET('USING_SYSTEM_PYTALLOC_UTIL') and not bld.env.disable_python:
> +    if not bld.CONFIG_SET('USING_SYSTEM_PYTALLOC_UTIL'):
>          for env in bld.gen_python_environments(['PKGCONFIGDIR']):
>              name = bld.pyembed_libname('pytalloc-util')
>  
> @@ -136,18 +137,19 @@ def build(bld):
>                  abi_match='pytalloc_* _pytalloc_*',
>                  private_library=private_library,
>                  public_headers=('' if private_library else 'pytalloc.h'),
> -                pc_files='pytalloc-util.pc'
> +                pc_files='pytalloc-util.pc',
> +                enabled=bld.PYTHON_BUILD_IS_ENABLED()
>                  )
>              bld.SAMBA_PYTHON('pytalloc',
>                              'pytalloc.c',
>                              deps='talloc ' + name,
> -                            enabled=True,
> +                            enabled=bld.PYTHON_BUILD_IS_ENABLED(),
>                              realname='talloc.so')
>  
>              bld.SAMBA_PYTHON('test_pytalloc',
>                              'test_pytalloc.c',
>                              deps='pytalloc',
> -                            enabled=True,
> +                            enabled=bld.PYTHON_BUILD_IS_ENABLED(),
>                              realname='_test_pytalloc.so',
>                              install=False)
>  
> diff --git a/lib/tdb/wscript b/lib/tdb/wscript
> index 34058e4..0d682eb 100644
> --- a/lib/tdb/wscript
> +++ b/lib/tdb/wscript
> @@ -60,10 +60,6 @@ def set_options(opt):
>                     help=("Disable the use of pthread robust mutexes"),
>                     action="store_true", dest='disable_tdb_mutex_locking',
>                     default=False)
> -    if opt.IN_LAUNCH_DIR():
> -        opt.add_option('--disable-python',
> -                       help=("disable the pytdb module"),
> -                       action="store_true", dest='disable_python', default=False)
>  
>  
>  def configure(conf):
> @@ -82,11 +78,10 @@ def configure(conf):
>                                       implied_deps='replace'):
>              conf.define('USING_SYSTEM_TDB', 1)
>              conf.env.building_tdb = False
> -            if conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytdb', 'tdb', minversion=VERSION):
> +            if not conf.env.disable_python and \
> +                conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytdb', 'tdb', minversion=VERSION):
>                  conf.define('USING_SYSTEM_PYTDB', 1)
>  
> -    conf.env.disable_python = getattr(Options.options, 'disable_python', False)
> -
>      if (conf.CONFIG_SET('HAVE_ROBUST_MUTEXES') and
>          conf.env.building_tdb and
>          not conf.env.disable_tdb_mutex_locking):
> diff --git a/lib/tevent/wscript b/lib/tevent/wscript
> index 580ca4d..f160d6a 100644
> --- a/lib/tevent/wscript
> +++ b/lib/tevent/wscript
> @@ -38,7 +38,8 @@ def configure(conf):
>          if conf.CHECK_BUNDLED_SYSTEM_PKG('tevent', minversion=VERSION,
>                                       onlyif='talloc', implied_deps='replace talloc'):
>              conf.define('USING_SYSTEM_TEVENT', 1)
> -            if conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytevent', 'tevent', minversion=VERSION):
> +            if not conf.env.disable_python and \
> +                conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytevent', 'tevent', minversion=VERSION):
>                  conf.define('USING_SYSTEM_PYTEVENT', 1)
>  
>      if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'):
> diff --git a/python/wscript_build b/python/wscript_build
> index 5ab0d7d..85a983e 100644
> --- a/python/wscript_build
> +++ b/python/wscript_build
> @@ -5,7 +5,8 @@ bld.SAMBA_LIBRARY('samba_python',
>  	deps='LIBPYTHON pytalloc-util pyrpc_util',
>  	grouping_library=True,
>  	private_library=True,
> -	pyembed=True)
> +	pyembed=True,
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED())
>  
>  bld.SAMBA_SUBSYSTEM('LIBPYTHON',
>  	source='modules.c',
> @@ -13,7 +14,7 @@ bld.SAMBA_SUBSYSTEM('LIBPYTHON',
>  	init_function_sentinel='{NULL,NULL}',
>  	deps='talloc',
>  	pyext=True,
> -	)
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED())
>  
>  
>  bld.SAMBA_PYTHON('python_glue',
> @@ -22,7 +23,8 @@ bld.SAMBA_PYTHON('python_glue',
>  	realname='samba/_glue.so'
>  	)
>  
> -for env in bld.gen_python_environments():
> +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',
Here it seems that indentation for the inner loop is broken as you
increased the depth (if->for->body against for->body) but did not indent
the body of the loop

> diff --git a/source4/lib/policy/wscript_build b/source4/lib/policy/wscript_build
> index b8ba638..f7c5909 100644
> --- a/source4/lib/policy/wscript_build
> +++ b/source4/lib/policy/wscript_build
> @@ -6,7 +6,8 @@ bld.SAMBA_LIBRARY('samba-policy',
>  	public_deps='ldb samba-net',
>  	vnum='0.0.1',
>  	pyembed=True,
> -	public_headers='policy.h'
> +	public_headers='policy.h',
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED()
>  	)
>  
>  bld.SAMBA_PYTHON('py_policy',
> diff --git a/source4/libnet/wscript_build b/source4/libnet/wscript_build
> index 1274a82..f29da29 100644
> --- a/source4/libnet/wscript_build
> +++ b/source4/libnet/wscript_build
> @@ -4,7 +4,8 @@ bld.SAMBA_LIBRARY('samba-net',
>  	source='libnet.c libnet_passwd.c libnet_time.c libnet_rpc.c libnet_join.c libnet_site.c libnet_become_dc.c libnet_unbecome_dc.c libnet_vampire.c libnet_samdump.c libnet_samsync_ldb.c libnet_user.c libnet_group.c libnet_share.c libnet_lookup.c libnet_domain.c userinfo.c groupinfo.c userman.c groupman.c prereq_domain.c libnet_samsync.c',
>  	autoproto='libnet_proto.h',
>  	public_deps='samba-credentials dcerpc dcerpc-samr RPC_NDR_LSA RPC_NDR_SRVSVC RPC_NDR_DRSUAPI cli_composite LIBCLI_RESOLVE LIBCLI_FINDDCS cli_cldap LIBCLI_FINDDCS gensec_schannel LIBCLI_AUTH ndr smbpasswdparser PROVISION LIBCLI_SAMSYNC LIBTSOCKET',
> -	private_library=True
> +	private_library=True,
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED()
>  	)
>  
>  
> diff --git a/source4/librpc/wscript_build b/source4/librpc/wscript_build
> index 60404f8..6bbf341 100644
> --- a/source4/librpc/wscript_build
> +++ b/source4/librpc/wscript_build
> @@ -178,6 +178,7 @@ bld.SAMBA_SUBSYSTEM('pyrpc_util',
>  	source='rpc/pyrpc_util.c',
>  	public_deps='pytalloc-util pyparam_util dcerpc MESSAGING',
>  	pyext=True,
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED(),
>  	)
>  
>  
> @@ -393,9 +394,10 @@ bld.SAMBA_PYTHON('python_dcerpc_smb_acl',
>  	realname='samba/dcerpc/smb_acl.so'
>  	)
>  
> -bld.SAMBA_SCRIPT('python_dcerpc_init',
> +if bld.PYTHON_BUILD_IS_ENABLED():
> +    bld.SAMBA_SCRIPT('python_dcerpc_init',
>                   pattern='rpc/dcerpc.py',
>                   installdir='python/samba/dcerpc',
>                   installname='__init__.py')
>  
> -bld.INSTALL_FILES('${PYTHONARCHDIR}/samba/dcerpc', 'rpc/dcerpc.py', destname='__init__.py')
> +    bld.INSTALL_FILES('${PYTHONARCHDIR}/samba/dcerpc', 'rpc/dcerpc.py', destname='__init__.py')
> diff --git a/source4/param/wscript_build b/source4/param/wscript_build
> index 2ad753b..8de5fb5 100644
> --- a/source4/param/wscript_build
> +++ b/source4/param/wscript_build
> @@ -4,6 +4,7 @@ bld.SAMBA_SUBSYSTEM('PROVISION',
>  	source='provision.c pyparam.c',
>  	deps='LIBPYTHON pyparam_util ldb pytalloc-util pyldb-util',
>  	pyext=True,
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED(),
>  	)
>  
>  
> @@ -51,6 +52,7 @@ bld.SAMBA_SUBSYSTEM('pyparam_util',
>  	source='pyparam_util.c',
>  	deps='LIBPYTHON samba-hostconfig pytalloc-util',
>  	pyext=True,
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED(),
>  	)
>  
>  bld.SAMBA_LIBRARY('shares',
> diff --git a/source4/torture/drs/wscript_build b/source4/torture/drs/wscript_build
> index cfdd8a2..67bf034 100644
> --- a/source4/torture/drs/wscript_build
> +++ b/source4/torture/drs/wscript_build
> @@ -6,6 +6,7 @@ bld.SAMBA_MODULE('TORTURE_DRS',
>  	subsystem='smbtorture',
>  	init_function='torture_drs_init',
>  	deps='samba-util ldb POPT_SAMBA samba-errors torture ldbsamba talloc dcerpc ndr NDR_DRSUAPI gensec samba-hostconfig RPC_NDR_DRSUAPI DSDB_MODULE_HELPERS asn1util samdb NDR_DRSBLOBS samba-credentials samdb-common LIBCLI_RESOLVE LP_RESOLVE torturemain',
> -	internal_module=True
> +	internal_module=True,
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED()
>  	)
>  
> diff --git a/source4/torture/local/wscript_build b/source4/torture/local/wscript_build
> index 3a12b6b..087b842 100644
> --- a/source4/torture/local/wscript_build
> +++ b/source4/torture/local/wscript_build
> @@ -32,5 +32,6 @@ bld.SAMBA_MODULE('TORTURE_LOCAL',
>  	subsystem='smbtorture',
>  	init_function='torture_local_init',
>  	deps=TORTURE_LOCAL_DEPS,
> -	internal_module=True
> +	internal_module=True,
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED()
>  	)
> diff --git a/source4/torture/wscript_build b/source4/torture/wscript_build
> index c065eaa..fe06629 100644
> --- a/source4/torture/wscript_build
> +++ b/source4/torture/wscript_build
> @@ -14,7 +14,8 @@ bld.SAMBA_MODULE('TORTURE_BASIC',
>  	deps='LIBCLI_SMB popt POPT_CREDENTIALS TORTURE_UTIL smbclient-raw TORTURE_RAW',
>  	internal_module=True,
>  	autoproto='basic/proto.h',
> -	init_function='torture_base_init'
> +	init_function='torture_base_init',
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED()
>  	)
>  
>  
> @@ -24,7 +25,8 @@ bld.SAMBA_MODULE('TORTURE_RAW',
>  	subsystem='smbtorture',
>  	init_function='torture_raw_init',
>  	deps='LIBCLI_SMB LIBCLI_LSA LIBCLI_SMB_COMPOSITE popt POPT_CREDENTIALS TORTURE_UTIL',
> -	internal_module=True
> +	internal_module=True,
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED()
>  	)
>  
>  bld.RECURSE('smb2')
> @@ -67,7 +69,8 @@ bld.SAMBA_SUBSYSTEM('TORTURE_NDR',
>                    ndr/charset.c
>  		  ''',
>  	autoproto='ndr/proto.h',
> -	deps='torture krb5samba'
> +	deps='torture krb5samba',
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED()
>  	)
>  
>  torture_rpc_backupkey = ''
> @@ -181,7 +184,8 @@ bld.SAMBA_MODULE('torture_rpc',
>                        RPC_NDR_BACKUPKEY
>                        RPC_NDR_WINSPOOL
>                        ''' + ntvfs_specific['deps'],
> -                 internal_module=True)
> +                 internal_module=True,
> +                 enabled=bld.PYTHON_BUILD_IS_ENABLED())
>  
>  bld.RECURSE('drs')
>  bld.RECURSE('dns')
> @@ -192,7 +196,8 @@ bld.SAMBA_MODULE('TORTURE_RAP',
>  	subsystem='smbtorture',
>  	init_function='torture_rap_init',
>  	deps='TORTURE_UTIL LIBCLI_SMB NDR_RAP LIBCLI_RAP',
> -	internal_module=True
> +	internal_module=True,
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED()
>  	)
>  
>  bld.SAMBA_MODULE('TORTURE_DFS',
> @@ -252,7 +257,8 @@ bld.SAMBA_MODULE('TORTURE_NBT',
>  	subsystem='smbtorture',
>  	init_function='torture_nbt_init',
>  	deps='LIBCLI_SMB cli-nbt LIBCLI_DGRAM LIBCLI_WREPL torture_rpc',
> -	internal_module=True
> +	internal_module=True,
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED()
>  	)
>  
>  
> @@ -262,7 +268,8 @@ bld.SAMBA_MODULE('TORTURE_NET',
>  	subsystem='smbtorture',
>  	init_function='torture_net_init',
>  	deps='samba-net popt POPT_CREDENTIALS torture_rpc PROVISION',
> -	internal_module=True
> +	internal_module=True,
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED()
>  	)
>  
>  
> @@ -272,7 +279,8 @@ bld.SAMBA_MODULE('TORTURE_NTP',
>  	subsystem='smbtorture',
>  	init_function='torture_ntp_init',
>  	deps='popt POPT_CREDENTIALS torture_rpc',
> -	internal_module=True
> +	internal_module=True,
> +	enabled=bld.PYTHON_BUILD_IS_ENABLED()
>  	)
>  
>  bld.SAMBA_MODULE('TORTURE_VFS',
> @@ -290,6 +298,7 @@ bld.SAMBA_SUBSYSTEM('torturemain',
>                      source='smbtorture.c torture.c shell.c',
>                      subsystem_name='smbtorture',
>                      deps='torture popt POPT_SAMBA POPT_CREDENTIALS dcerpc LIBCLI_SMB SMBREADLINE ' + TORTURE_MODULES,
> +                    enabled=bld.PYTHON_BUILD_IS_ENABLED()
>                      )
>  
>  bld.SAMBA_BINARY('smbtorture',
> @@ -297,7 +306,8 @@ bld.SAMBA_BINARY('smbtorture',
>                   manpages='man/smbtorture.1',
>                   private_headers='smbtorture.h',
>                   deps='torturemain torture popt POPT_SAMBA POPT_CREDENTIALS dcerpc LIBCLI_SMB SMBREADLINE ' + TORTURE_MODULES,
> -                 pyembed=True
> +                 pyembed=True,
> +                 enabled=bld.PYTHON_BUILD_IS_ENABLED()
>                   )
>  
>  bld.SAMBA_BINARY('gentest',
> diff --git a/wscript b/wscript
> index 9168db1..1fa61f7 100644
> --- a/wscript
> +++ b/wscript
> @@ -105,8 +105,12 @@ def configure(conf):
>      conf.SAMBA_CHECK_PERL(mandatory=True)
>      conf.find_program('xsltproc', var='XSLTPROC')
>  
> +    if conf.env.disable_python:
> +        if not conf.env.without_ad_dc:
> +            raise Utils.WafError('ADDC requires python')
> +
>      conf.SAMBA_CHECK_PYTHON(mandatory=True, version=(2, 6, 0))
> -    conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True)
> +    conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=(not conf.env.disable_python))
>  
>      if sys.platform == 'darwin' and not conf.env['HAVE_ENVIRON_DECL']:
>          # Mac OSX needs to have this and it's also needed that the python is compiled with this


-- 
/ Alexander Bokovoy



More information about the samba-technical mailing list