diff --git a/bin/maint/create_histor.py b/bin/maint/create_histor.py index 8f3f66ead0b7d9d6f08280b0ae031eb76b5aed5c..df750948bd174da09de2dc0715183de44d37456b 100755 --- a/bin/maint/create_histor.py +++ b/bin/maint/create_histor.py @@ -19,7 +19,7 @@ import os import re import time from optparse import OptionParser -from subprocess import PIPE, Popen +from subprocess import check_output from api_roundup import build_histor from aslint.i18n import _ @@ -29,9 +29,9 @@ from aslint.string_utils import convert def read_issue_list(fname): """Read the issues numbers from 'fname'""" - ignore = re.compile('#.*$', re.M) + ignore = re.compile("#.*$", re.M) expr = re.compile("([0-9]+)") - with open(fname, 'r') as fobj: + with open(fname, "r") as fobj: lines = fobj.read().splitlines() # remove twins by keeping the order issues_list = [] @@ -43,12 +43,11 @@ def read_issue_list(fname): issues_list.append(i) else: logger.warn(_("already seen: %s"), i) - issues = ' '.join(issues_list).split() + issues = " ".join(issues_list).split() try: issues = [int(i) for i in issues] except ValueError: - logger.error(_("only issue numbers expected, strings must be " - "commented using '#'")) + logger.error(_("only issue numbers expected, strings must be " "commented using '#'")) raise return issues @@ -57,47 +56,61 @@ def build_header(tag, repopath, edsm=False): """return a header with the version number""" # do not check tag for edsm if edsm: - header = os.linesep.join([ + header = os.linesep.join( + [ + "==================================================================", + "Version %(tag)s, intégration du %(date)s", + "==================================================================", + ] + ) + return header % {"tag": tag, "date": time.strftime("%d/%m/%Y")} + header = os.linesep.join( + [ "==================================================================", - "Version %(tag)s, intégration du %(date)s", + "Version %(tag)s (révision %(node)s) du %(date)s", "==================================================================", - ]) - return header % {'tag': tag, 'date': time.strftime("%d/%m/%Y")} - header = os.linesep.join([ - "==================================================================", - "Version %(tag)s (révision %(node)s) du %(date)s", - "==================================================================", - ]) - rev = 'tag(%s)' % tag - - cmd = ['hg', 'log', '-R', repopath, '--rev', rev, - '--template', "{node|short}\n{date|isodate}\n"] - out = convert(Popen(cmd, stdout=PIPE).communicate()[0]) + ] + ) try: - node, date = out.splitlines() + cmd = ["git", "-C", repopath, "log", "-1", "--format=%h", tag] + node = check_output(cmd, text=True).strip() + cmd = ["git", "-C", repopath, "tag", "-l", "--format=%(taggerdate:iso)", tag] + date = check_output(cmd, text=True).strip() except ValueError: - logger.error(_("unexpected output, perhaps you are not in the " - "repository: tag '%s' not found"), tag) + logger.error( + _(f"unexpected output, perhaps you are not in the repository: tag '{tag}' not found") + ) raise RuntimeError - return header % {'tag': tag, 'node': node, 'date': date} + return header % {"tag": tag, "node": node, "date": date} def major_text(tag, repopath): """return the text for a major version""" - content = os.linesep.join([ - "", - "Stabilisation de la version %(tag)s de Code_Aster", - "", - "- Étiquette %(tag)s posée sur la révision %(node)s.", - "- Étiquette %(name)s posée sur la révision %(node)s.", - "", - "Les mises à jour %(short)s (dans la branche %(branch)s) seront des ", - "versions de %(maint)s.", - "", - ]) - cmd = ['hg', 'log', '-R', repopath, '--rev', 'tag(%s)' % tag, - '--template', "{node|short} {branch} {tags}\n"] - out = convert(Popen(cmd, stdout=PIPE).communicate()[0]) + content = os.linesep.join( + [ + "", + "Stabilisation de la version %(tag)s de Code_Aster", + "", + "- Étiquette %(tag)s posée sur la révision %(node)s.", + "- Étiquette %(name)s posée sur la révision %(node)s.", + "", + "Les mises à jour %(short)s (dans la branche %(branch)s) seront des ", + "versions de %(maint)s.", + "", + ] + ) + cmd = [ + "hg", + "log", + "-R", + repopath, + "--rev", + "tag(%s)" % tag, + "--template", + "{node|short} {branch} {tags}\n", + ] + # out = convert(Popen(cmd, stdout=PIPE).communicate()[0]) + raise TypeError("todo: git") try: # node, branch, itag, name = out.split() values = out.split() @@ -108,20 +121,24 @@ def major_text(tag, repopath): except ValueError: pass name = values.pop(0) - if branch == 'default': + if branch == "default": name = "testing" except ValueError: - logger.error(_("unexpected output, perhaps you are not in the " - "repository: tag and version name not found for '%s'"), - tag) + logger.error( + _( + "unexpected output, perhaps you are not in the " + "repository: tag and version name not found for '%s'" + ), + tag, + ) raise RuntimeError - infos = {'tag': tag, 'node': node, 'name': name, 'branch': branch} - infos['short'] = '.'.join(tag.split('.')[:2]) + '.*' + infos = {"tag": tag, "node": node, "name": name, "branch": branch} + infos["short"] = ".".join(tag.split(".")[:2]) + ".*" # XXX voir texte pour oldstable, et stable sur default ? - if branch == 'default': - infos['maint'] = "maintenance corrective et évolutive" + if branch == "default": + infos["maint"] = "maintenance corrective et évolutive" else: - infos['maint'] = "maintenance corrective uniquement" + infos["maint"] = "maintenance corrective uniquement" return content % infos @@ -136,8 +153,7 @@ def check_issue_list(items): return True -def create_histor(rex, tag, repo, major, edsm=False, - lmsg='last', format='text', req_status=None): +def create_histor(rex, tag, repo, major, edsm=False, lmsg="last", format="text", req_status=None): """Main function""" text = [] if tag: @@ -148,34 +164,42 @@ def create_histor(rex, tag, repo, major, edsm=False, else: if rex and check_issue_list(rex): logger.debug(_("getting REX changelog")) - text.append(convert(build_histor(rex, format, lmsg, - req_status=req_status))) + text.append(convert(build_histor(rex, format, lmsg, req_status=req_status))) return os.linesep.join(text) -if __name__ == '__main__': +if __name__ == "__main__": # command arguments parser parser = OptionParser(usage=__doc__) - parser.add_option('-g', '--debug', action='callback', callback=setlevel, - help="add debug informations") - parser.add_option('--rex', action='store', metavar='FILE', - help="file of the issues solved in REX") - parser.add_option('--status', action='store', default='valide_EDA', - help="required status of REX issues (default: " - "valide_EDA). Use None to disable the checking.") - parser.add_option('--tag', action='store', - help="tag of the version") - parser.add_option('--repo', action='store', default=".", - help="path to the src repository (default: current directory)") - parser.add_option('--major', action='store_true', - help="create a file for a major version") - parser.add_option('--edsm', action='store_true', - help="create an histor for Salome-Meca") - parser.add_option('--all', action='store_true', - help="insert all the messages for each issues") - parser.add_option('--format', action='store', default='text', - help="output format of the changelog: " - "text (default), html, fsq") + parser.add_option( + "-g", "--debug", action="callback", callback=setlevel, help="add debug informations" + ) + parser.add_option( + "--rex", action="store", metavar="FILE", help="file of the issues solved in REX" + ) + parser.add_option( + "--status", + action="store", + default="valide_EDA", + help="required status of REX issues (default: " + "valide_EDA). Use None to disable the checking.", + ) + parser.add_option("--tag", action="store", help="tag of the version") + parser.add_option( + "--repo", + action="store", + default=".", + help="path to the src repository (default: current directory)", + ) + parser.add_option("--major", action="store_true", help="create a file for a major version") + parser.add_option("--edsm", action="store_true", help="create an histor for Salome-Meca") + parser.add_option("--all", action="store_true", help="insert all the messages for each issues") + parser.add_option( + "--format", + action="store", + default="text", + help="output format of the changelog: " "text (default), html, fsq", + ) opts, args = parser.parse_args() if opts.tag is None: logger.warn("no header will be inserted") @@ -183,11 +207,18 @@ if __name__ == '__main__': if len(args) != 0: logger.info(_("add issues: {0}").format(args)) rex.extend(args) - lmsg = 'all' if opts.all else 'last' + lmsg = "all" if opts.all else "last" bitb = [] - if 'None' in opts.status: + if "None" in opts.status: opts.status = None - text = create_histor(rex, opts.tag, opts.repo, opts.major, - edsm=opts.edsm, lmsg=lmsg, - format=opts.format, req_status=opts.status) + text = create_histor( + rex, + opts.tag, + opts.repo, + opts.major, + edsm=opts.edsm, + lmsg=lmsg, + format=opts.format, + req_status=opts.status, + ) print(text) diff --git a/bin/maint/list_issue.py b/bin/maint/list_issue.py index c434bd7629f3efe78dc9029969e366e16e37fa8c..a1a6048a5dcba176f139d285508e900af65008e4 100755 --- a/bin/maint/list_issue.py +++ b/bin/maint/list_issue.py @@ -11,7 +11,6 @@ REV1 is excluded, REV2 is included. from optparse import OptionParser -from subprocess import PIPE, Popen from aslint.i18n import _ from aslint.logger import logger, setlevel diff --git a/bin/maint/show_tags.py b/bin/maint/show_tags.py deleted file mode 100755 index fff41351dbb56a0746dac1dbb4c2096a7f880275..0000000000000000000000000000000000000000 --- a/bin/maint/show_tags.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python3 -# coding: utf-8 - -""" - %prog [options] [repository_path] - -Show the last current tag and compute the next one -""" - -import os.path as osp -import re -import time -from functools import partial -from optparse import OptionParser -from subprocess import PIPE, Popen - -from aslint.logger import logger, setlevel -from aslint.string_utils import convert - -FMTTAG = "([0-9]+)\.([0-9]+)\.([0-9]+)" - - -def next_tag(repo, branch=".", offset=0, verbose=False): - """Return the tag of the next minor version""" - cmd = [ - "hg", - "log", - "-R", - repo, - "--rev", - "last(tag() and branch(%s))" % branch, - "--template", - "{tags}\n", - ] - logger.debug("Command: {0}".format(cmd)) - tag = convert(Popen(cmd, stdout=PIPE).communicate()[0]).strip() - if not tag: - raise ValueError( - "No tag found in this branch. This may happen on a " - "newly created branch. Define OLD and TAG yourself!" - ) - mat = re.search(FMTTAG, tag) - if not mat: - raise ValueError("invalid tag: %r" % tag) - tag = re.findall(FMTTAG, tag) - branch, major, minor = tag[0] - old = "%s.%s.%s" % (branch, major, int(minor) + offset) - ntag = "%s.%s.%s" % (branch, major, int(minor) + offset + 1) - if verbose: - logger.info("OLD=%s", old) - logger.info("TAG=%s", ntag) - return ntag - - -if __name__ == "__main__": - # command arguments parser - parser = OptionParser(usage=__doc__) - parser.add_option( - "-g", "--debug", action="callback", callback=setlevel, help="add debug informations" - ) - parser.add_option( - "--offset", - action="store", - default=0, - type=int, - help="offset patch level (-1 to get the previous tags)", - ) - parser.add_option( - "--branch", action="store", default=".", help="branch to be used to search tags." - ) - opts, args = parser.parse_args() - repo = "." - if len(args) > 0: - repo = args[0] - if len(args) > 1: - parser.error("at most one argument is required") - next_tag(repo, opts.branch, opts.offset, verbose=True) diff --git a/lib/aslint/base_checkers.py b/lib/aslint/base_checkers.py index 7c9a5b7169daa42d57859e5dc09630ca77f4c676..128bb440ef5b5909918fca418ed81586f641cea0 100644 --- a/lib/aslint/base_checkers.py +++ b/lib/aslint/base_checkers.py @@ -438,9 +438,6 @@ class CheckContext(object): return True if self.brchk(ctg.branch): return True - # in 'asterxx' branch, use same checkers as for 'default' - if ctg.branch.startswith("asterxx") and self.brchk("default"): - return True # 'main' and 'default' if ctg.branch in ("main", "default") and (self.brchk("main") or self.brchk("default")): return True @@ -568,12 +565,7 @@ class CheckList(object): def get_type(self, types): """Return a sub-Checklist of the given types""" - types = tuple( - force_list(types) - + [ - HiddenMsg, - ] - ) + types = tuple(force_list(types) + [HiddenMsg]) return CheckList([msg for msg in self if issubclass(msg, types)]) def on_content(self, apply_to=None): @@ -835,11 +827,7 @@ class Context(object): """Store contextual values attached to a Report""" - __slots__ = ( - "repository", - "submission", - "username", - ) + __slots__ = ("repository", "submission", "username") def __init__(self): """Initialization""" diff --git a/lib/aslint/check_global.py b/lib/aslint/check_global.py index f9e7e52dfc6889637edd15835d053b7dfc5d32b4..f5afcba74be36cc3d48c5e1cb394ac389ea62e31 100644 --- a/lib/aslint/check_global.py +++ b/lib/aslint/check_global.py @@ -50,35 +50,6 @@ class ErrorMessages(DirnameCat, GenericMsg): return result -class Supv002aRequirement(DirnameCat, GenericMsg): - - """Requirements missed to check spelling of messages (supv002a will fail) - The testcase supv002a checks the spelling of error messages. - It requires ``aspell`` and the dictionnaries - ``<DEVTOOLS>/share/spell/code_aster_dict.aspell.per`` and - ``code_aster_cata.aspell.per``. - """ - - id = "W9004" - fmt = "%(id)s: %(label)s" - apply_ctxt = CheckContext(branch="v15") - - def search(self, srcdir): - """Check pre-requisites for supv002a""" - share = osp.join(ASCFG.get("devtools_root"), "share", "spell") - fdict = osp.join(share, "code_aster_dict.aspell.per") - if not osp.isfile(fdict): - return [": french dictionnary is missing: %s" % fdict] - fdict = osp.join(share, "code_aster_cata.aspell.per") - if not osp.isfile(fdict): - return [": dictionnary of keywords is missing: %s (see help)" % fdict] - try: - check_call(["aspell", "--version"], stdout=PIPE) - except (CalledProcessError, FileNotFoundError): - return [": 'aspell' not found, not in $PATH"] - return [] - - CHECK_LIST = checkers_from_context(globals(), TextMsg) diff --git a/lib/aslint/common_checkers.py b/lib/aslint/common_checkers.py index 9d04e53a50b3558b31a3a5466a4c9ff332376d53..fe7ba726550d8643eecf02ea7bb2d193dff4409c 100644 --- a/lib/aslint/common_checkers.py +++ b/lib/aslint/common_checkers.py @@ -198,7 +198,6 @@ def check_encoding(text, encoding): class InvalidEndOfLine(FileContentCat, GenericMsg): - r"""Invalid end of line, expecting '\n' not '\r\n'""" id = "C8502" fmt = "%(id)s: %(label)s" @@ -324,7 +323,7 @@ class EDFCopyright(TextMsgNotFound): Example: - Copyright 2008 Company ABC - - Copyright 2008-2019 EDF R&D www.code-aster.org + - Copyright 2008-2023 EDF R&D www.code-aster.org """ # id must be defined in subclasses @@ -364,7 +363,6 @@ class EncodingDeclNotFound(TextMsgNotFound): class InvalidCharacter(GenericMsg): - r"""Invalid character, unexpected tabulation '\t' Tabulation character is not allowed.""" # id must be defined in subclasses @@ -382,7 +380,7 @@ class ReformatPy(GenericMsg): """Reformat Python source with black.""" fixme = "black %(filenames)s" - apply_ctxt = CheckContext(branch="default", opts=CheckContext.FormatOpt) + apply_ctxt = CheckContext(opts=CheckContext.FormatOpt) _check = have_program("black") def search(self, filename): @@ -410,7 +408,7 @@ class ReformatFort(GenericMsg): """Reformat Fortran source with fprettify""" fixme = "fprettify %(filenames)s" - apply_ctxt = CheckContext(branch="default", opts=CheckContext.FormatOpt) + apply_ctxt = CheckContext(opts=CheckContext.FormatOpt) _check = have_program("fprettify") def search(self, filename): @@ -442,7 +440,7 @@ class ReformatC(GenericMsg): """Reformat C/C++ source with clang-format""" fixme = "clang-format -i %(filenames)s" - apply_ctxt = CheckContext(branch="default", opts=CheckContext.FormatOpt) + apply_ctxt = CheckContext(opts=CheckContext.FormatOpt) _check = have_program("clang-format") def search(self, filename): diff --git a/lib/aslint/other/c_checkers.py b/lib/aslint/other/c_checkers.py index 464e021eb03d832c49f074349f0a28b4c39bbed3..3803632a704eaa5fe29dca8e088313a022b59ad0 100644 --- a/lib/aslint/other/c_checkers.py +++ b/lib/aslint/other/c_checkers.py @@ -40,7 +40,7 @@ class EDFCopyright(FileContentCat, COMM.EDFCopyright): Example: - Copyright 2008 Company ABC - - Copyright 2008-2013 EDF R&D www.code-aster.org + - Copyright 2008-2023 EDF R&D www.code-aster.org """ id = "C3003" @@ -54,7 +54,6 @@ class ExternalCopyright(FileContentCat, COMM.ExternalCopyright): class InvalidCharacter(FileContentCat, COMM.InvalidCharacter): - r"""Invalid character, unexpected tabulation '\t' Tabulation character is not allowed.""" id = "C3005" @@ -68,7 +67,6 @@ class UniqueIncludePython(FileContentCat, TextMsg): """ id = "C3401" - apply_ctxt = CheckContext(branch="main") search = search_msg("^ *(?P<main># *include +['\"]Python\.h['\"])") diff --git a/lib/aslint/test/test_checkers.py b/lib/aslint/test/test_checkers.py index 1d46c7352850d007e3332cc5fb40408e396a1d71..1e42b89f5a6934ad8461ba8ed7c7f9e3fabb4489 100644 --- a/lib/aslint/test/test_checkers.py +++ b/lib/aslint/test/test_checkers.py @@ -63,68 +63,9 @@ class UnsupportedExtension(FilenameCat, GenericMsg): class InvalidFilename(FilenameCat, TextMsgNotFound): - """Invalid filename for a testcase - Filenames matching 'aaaaNNNm.*' are expected. - See C9002 message for the allowed extensions. - """ - - id = "C2015" - fmt = "%(id)s: %(label)s" - apply_ctxt = CheckContext(reponame=("src", "validation"), branch="v14") - - def search(self, txt): - """Check for unauthorized filenames.""" - # most of names are: aaaaNNNm - # - some have only 2 numbers, - # - aspic/ascouf need 5 letters, - # - mac3c needs the '3' - _expr = re.compile( - r"/(?P<root>[a-z3]{3,5}[0-9]{2,3}[a-z]{1})" r"(?P<ext>\.(" + "|".join(REG_EXT) + "))$" - ) - found = _expr.findall(txt) - # accept .mfront files too - if not found and osp.splitext(txt)[1] == ".mfront": - found = [txt] - return found - - -class InvalidFilenameTestsData(FilenameCat, TextMsgNotFound): - - """Invalid filename for a testcase - Filenames matching 'aaaaNNNm.*' or 'aaaaNNNm_*.*' are expected. - See C9002 message for the allowed extensions. - """ - - id = "C2019" - fmt = "%(id)s: %(label)s" - apply_ctxt = CheckContext(reponame=("data",), branch="v14") - - def search(self, txt): - """Check for unauthorized filenames.""" - # most of names are: aaaaNNNm - # - some have only 2 numbers, - # - aspic/ascouf need 5 letters, - # - mac3c needs the '3' - _expr1 = re.compile( - r"/(?P<root>[a-z3]{3,5}[0-9]{2,3}[a-z]{1})" r"(?P<ext>\.(" + "|".join(REG_EXT) + "))$" - ) - _expr2 = re.compile( - r"/(?P<root>[a-z3]{3,5}[0-9]{2,3}[a-z]{1}" - r"_\w{1,16})" - r"(?P<ext>\.(" + "|".join(REG_EXT) + "))$" - ) - found = _expr1.findall(txt) or _expr2.findall(txt) - # accept .mfront files too - if not found and osp.splitext(txt)[1] == ".mfront": - found = [txt] - return found - - -class InvalidFilenameXX(FilenameCat, TextMsgNotFound): - """Invalid filename for a testcase Filenames matching 'aaaaNNNm.*', 'aaaaNNNm_*.comm', 'aaaaNNNm_*.py', - 'xx*.export', 'xx*.py' or 'NNN.med' are expected. + 'subdir/*.py' or 'NNN.med' are expected. See C9002 message for the allowed extensions. """ @@ -137,15 +78,14 @@ class InvalidFilenameXX(FilenameCat, TextMsgNotFound): # - some have only 2 numbers, # - mac3c needs the '3' # accept aaaaNNNm + a suffix starting with '_' - # accept 'xx*' _expr1 = re.compile( - r"/(?P<root>[a-z3]{3,16}[0-9]{2,3}[a-z]{1})" r"(?P<ext>\.(" + "|".join(REG_EXT) + "))$" + r"/(?P<root>[a-z3]{3,16}[0-9]{2,3}[a-z]{1})(?P<ext>\.(" + "|".join(REG_EXT) + "))$" ) _expr2 = re.compile( - r"/(?P<root>[a-z3]{3,16}[0-9]{2,3}[a-z]{1}" r"_\w{1,16})" r"(?P<ext>\.(comm|py))$" + r"/(?P<root>[a-z3]{3,16}[0-9]{2,3}[a-z]{1}_\w{1,16})(?P<ext>\.(comm|py))$" ) - _expr3 = re.compile(r"/(?P<root>xx\w+)" r"(?P<ext>(|\.(" + "|".join(REG_EXT) + ")))$") - _expr4 = re.compile(r"/(?P<root>[0-9]+)" r"(?P<ext>\.med)$") + _expr3 = re.compile(r"/(?P<root>[a-z3]{3,16}[0-9]{2,3}[a-z]{1})/") + _expr4 = re.compile(r"/(?P<root>[0-9]+)(?P<ext>\.med)$") found = ( _expr1.findall(txt) or _expr2.findall(txt) or _expr3.findall(txt) or _expr4.findall(txt) ) @@ -263,7 +203,7 @@ class CommonFilesSrcValidation(DirnameCat, GenericMsg): files are installed into the same destination directory.""" id = "C2021" - apply_ctxt = CheckContext(reponame=["src", "validation"], branch="default") + apply_ctxt = CheckContext(reponame=["src", "validation"]) def search(self, txt): """Check if files exist in src and validation""" @@ -568,9 +508,7 @@ class InvalidKeywordValue(FileContentCat, GenericMsg): id = "W2012" _invalid = [("NIV_PUB_WEB", "['\"]INTRANET['\"]")] - _expr = [ - re.compile("(?P<kwd>%s) *= *(?P<value>%s)" % (kwd, val), re.M) for kwd, val in _invalid - ] + _expr = [re.compile(f"(?P<kwd>{kwd}) *= *(?P<value>{val})", re.M) for kwd, val in _invalid] _recom = re.compile("^ *#.*$", re.M) apply_ctxt = CheckContext(reponame=["src"]) @@ -590,9 +528,7 @@ class InvalidKeywordValueError(FileContentCat, GenericMsg): id = "C2014" _invalid = [("UNITE", "15")] - _expr = [ - re.compile("(?P<kwd>%s) *= *(?P<value>%s)" % (kwd, val), re.M) for kwd, val in _invalid - ] + _expr = [re.compile(f"(?P<kwd>{kwd}) *= *(?P<value>{val})", re.M) for kwd, val in _invalid] _recom = re.compile("^ *#.*$", re.M) def search(self, txt): @@ -657,16 +593,16 @@ class RequiredKeyword(FileContentCat, GenericMsg): CODE.""" apply_to = COMM_EXT - apply_ctxt = CheckContext(reponame=["src"]) + apply_ctxt = CheckContext(reponame=["src"], branch="main") id = "C2011" _debut = re.compile("^DEBUT", re.M) _debcod = re.compile(r"^DEBUT *\([^\#\)]*CODE *= *_F\(", re.M) _deberr = r"""'CODE=_F(...)'""" _pours = re.compile("^POURSUITE", re.M) - _poucod = re.compile(r"^POURSUITE *\([^\#]*CODE *= *[\'\"]OUI", re.M) - _pouerr = r"""'CODE='OUI''""" - _init = re.compile(r"^code_aster\.init", re.M) - _inittst = re.compile(r"^code_aster\.init *\([^\#\)]*\-\-test", re.M) + _poucod = re.compile(r"^POURSUITE *\([^\#]*CODE *= *_F\(", re.M) + _poucodalt = re.compile(r"^POURSUITE *\([^\#]*CODE *= *[\'\"]OUI", re.M) + _init = re.compile(r"^CA\.init", re.M) + _inittst = re.compile(r"^CA\.init *\([^\#\)]*\-\-test", re.M) _initerr = r"""'--test'""" def search(self, txt): @@ -674,13 +610,13 @@ class RequiredKeyword(FileContentCat, GenericMsg): err = [] if self._init.search(txt): if not self._inittst.search(txt): - err.append(": %s not found in 'code_aster.init'" % self._initerr) + err.append(": %s not found in 'CA.init'" % self._initerr) elif self._debut.search(txt): if not self._debcod.search(txt): err.append(": %s not found in DEBUT" % self._deberr) elif self._pours.search(txt): - if not self._poucod.search(txt): - err.append(": %s not found in POURSUITE" % self._pouerr) + if not (self._poucod.search(txt) or self._poucodalt.search(txt)): + err.append(": %s not found in POURSUITE" % self._deberr) else: # pure python file pass