예제 #1
0
def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(2,4,2)):
    # enable tool to build python extensions
    if conf.env.HAVE_PYTHON_H:
        conf.check_python_version(version)
        return

    interpreters = []

    if conf.env['EXTRA_PYTHON']:
        conf.all_envs['extrapython'] = conf.env.copy()
        conf.setenv('extrapython')
        conf.env['PYTHON'] = conf.env['EXTRA_PYTHON']
        conf.env['IS_EXTRA_PYTHON'] = 'yes'
        conf.find_program('python', var='PYTHON', mandatory=True)
        conf.check_tool('python')
        try:
            conf.check_python_version((3, 3, 0))
        except Exception:
            Logs.warn('extra-python needs to be Python 3.3 or later')
            raise
        interpreters.append(conf.env['PYTHON'])
        conf.setenv('default')

    conf.find_program('python', var='PYTHON', mandatory=mandatory)
    conf.check_tool('python')
    path_python = conf.find_program('python')
    conf.env.PYTHON_SPECIFIED = (conf.env.PYTHON != path_python)
    conf.check_python_version(version)

    interpreters.append(conf.env['PYTHON'])
    conf.env.python_interpreters = interpreters
예제 #2
0
def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
    if conf.env.disable_python:
        if mandatory:
            raise Utils.WafError("Cannot check for python headers when "
                                 "--disable-python specified")

        conf.msg("python headers", "Check disabled due to --disable-python")
        # we don't want PYTHONDIR in config.h, as otherwise changing
        # --prefix causes a complete rebuild
        del(conf.env.defines['PYTHONDIR'])
        del(conf.env.defines['PYTHONARCHDIR'])
        return

    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")

    # we don't want PYTHONDIR in config.h, as otherwise changing
    # --prefix causes a complete rebuild
    del(conf.env.defines['PYTHONDIR'])
    del(conf.env.defines['PYTHONARCHDIR'])
예제 #3
0
def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
    if conf.env.disable_python:
        if mandatory:
            raise Utils.WafError("Cannot check for python headers when "
                                 "--disable-python specified")

        conf.msg("python headers", "Check disabled due to --disable-python")
        # we don't want PYTHONDIR in config.h, as otherwise changing
        # --prefix causes a complete rebuild
        del (conf.env.defines['PYTHONDIR'])
        del (conf.env.defines['PYTHONARCHDIR'])
        return

    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")

    # we don't want PYTHONDIR in config.h, as otherwise changing
    # --prefix causes a complete rebuild
    del (conf.env.defines['PYTHONDIR'])
    del (conf.env.defines['PYTHONARCHDIR'])
예제 #4
0
def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(2, 4, 2)):
    # enable tool to build python extensions
    if conf.env.HAVE_PYTHON_H:
        conf.check_python_version(version)
        return

    interpreters = []

    if conf.env['EXTRA_PYTHON']:
        conf.all_envs['extrapython'] = conf.env.copy()
        conf.setenv('extrapython')
        conf.env['PYTHON'] = conf.env['EXTRA_PYTHON']
        conf.env['IS_EXTRA_PYTHON'] = 'yes'
        conf.find_program('python', var='PYTHON', mandatory=True)
        conf.check_tool('python')
        try:
            conf.check_python_version((3, 3, 0))
        except Exception:
            Logs.warn('extra-python needs to be Python 3.3 or later')
            raise
        interpreters.append(conf.env['PYTHON'])
        conf.setenv('default')

    conf.find_program('python', var='PYTHON', mandatory=mandatory)
    conf.check_tool('python')
    path_python = conf.find_program('python')
    conf.env.PYTHON_SPECIFIED = (conf.env.PYTHON != path_python)
    conf.check_python_version(version)

    interpreters.append(conf.env['PYTHON'])
    conf.env.python_interpreters = interpreters
예제 #5
0
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']))
    else:
        conf.msg("python headers", "using cache")