コード例 #1
0
def CHECK_PERL_MANPAGE(conf, msg=None, section=None):
    '''work out what extension perl uses for manpages'''

    if msg is None:
        if section:
            msg = "perl man%s extension" % section
        else:
            msg = "perl manpage generation"

    conf.check_message_1(msg)

    dir = find_config_dir(conf)

    bdir = os.path.join(dir, 'testbuild')
    if not os.path.exists(bdir):
        os.makedirs(bdir)

    dest = open(os.path.join(bdir, 'Makefile.PL'), 'w')
    dest.write("""
use ExtUtils::MakeMaker;
WriteMakefile(
    'NAME'    => 'WafTest',
    'EXE_FILES' => [ 'WafTest' ]
);
""")
    dest.close()
    back = os.path.abspath('.')
    os.chdir(bdir)
    proc = Utils.pproc.Popen(['perl', 'Makefile.PL'],
                             stdout=Utils.pproc.PIPE,
                             stderr=Utils.pproc.PIPE)
    (out, err) = proc.communicate()
    os.chdir(back)

    ret = (proc.returncode == 0)
    if not ret:
        conf.check_message_2('not found', color='YELLOW')
        return

    if section:
        f = open(os.path.join(bdir,'Makefile'), 'r')
        man = f.read()
        f.close()
        m = re.search('MAN%sEXT\s+=\s+(\w+)' % section, man)
        if not m:
            conf.check_message_2('not found', color='YELLOW')
            return
        ext = m.group(1)
        conf.check_message_2(ext)
        return ext

    conf.check_message_2('ok')
    return True
コード例 #2
0
def CHECK_PERL_MANPAGE(conf, msg=None, section=None):
    '''work out what extension perl uses for manpages'''

    if msg is None:
        if section:
            msg = "perl man%s extension" % section
        else:
            msg = "perl manpage generation"

    conf.check_message_1(msg)

    dir = find_config_dir(conf)

    bdir = os.path.join(dir, 'testbuild')
    if not os.path.exists(bdir):
        os.makedirs(bdir)

    dest = open(os.path.join(bdir, 'Makefile.PL'), 'w')
    dest.write("""
use ExtUtils::MakeMaker;
WriteMakefile(
    'NAME'	=> 'WafTest',
    'EXE_FILES' => [ 'WafTest' ]
);
""")
    dest.close()
    back = os.path.abspath('.')
    os.chdir(bdir)
    proc = Utils.pproc.Popen(['perl', 'Makefile.PL'],
                             stdout=Utils.pproc.PIPE,
                             stderr=Utils.pproc.PIPE)
    (out, err) = proc.communicate()
    os.chdir(back)

    ret = (proc.returncode == 0)
    if not ret:
        conf.check_message_2('not found', color='YELLOW')
        return

    if section:
        f = open(os.path.join(bdir,'Makefile'), 'r')
        man = f.read()
        f.close()
        m = re.search('MAN%sEXT\s+=\s+(\w+)' % section, man)
        if not m:
            conf.check_message_2('not found', color='YELLOW')
            return
        ext = m.group(1)
        conf.check_message_2(ext)
        return ext

    conf.check_message_2('ok')
    return True
コード例 #3
0
ファイル: samba_autoconf.py プロジェクト: ekohl/samba
def COMPOUND_START(conf, msg):
    '''start a compound test'''
    def null_check_message_1(self,*k,**kw):
        return
    def null_check_message_2(self,*k,**kw):
        return

    v = getattr(conf.env, 'in_compound', [])
    if v != [] and v != 0:
        conf.env.in_compound = v + 1
        return
    conf.check_message_1(msg)
    conf.saved_check_message_1 = conf.check_message_1
    conf.check_message_1 = null_check_message_1
    conf.saved_check_message_2 = conf.check_message_2
    conf.check_message_2 = null_check_message_2
    conf.env.in_compound = 1
コード例 #4
0
def COMPOUND_START(conf, msg):
    '''start a compound test'''
    def null_check_message_1(self,*k,**kw):
        return
    def null_check_message_2(self,*k,**kw):
        return

    v = getattr(conf.env, 'in_compound', [])
    if v != [] and v != 0:
        conf.env.in_compound = v + 1
        return
    conf.check_message_1(msg)
    conf.saved_check_message_1 = conf.check_message_1
    conf.check_message_1 = null_check_message_1
    conf.saved_check_message_2 = conf.check_message_2
    conf.check_message_2 = null_check_message_2
    conf.env.in_compound = 1