if "-j" in make_option:
oExpr = re.compile("-j[0-9]+")
found = oExpr.search(make_option)
- opt_nb_proc = int(re.findall('\d+', found.group())[0])
+ opt_nb_proc = int(re.findall(r'\d+', found.group())[0])
new_make_option = make_option.replace(found.group(), "")
nbproc = -1
def get_pyconf_parameters(self):
if len(self.pyconf) == 0:
return []
- return re.findall("%\((?P<name>\S[^\)]*)", self.pyconf)
+ return re.findall(r"%\((?P<name>\S[^\)]*)", self.pyconf)
##
# Check if the file needs to be parsed.
"parameter: %s" % tsettings.file_subst, 3)
retcode = 1
- reexp = tsettings.delimiter_char.replace("$", "\$") + "{(?P<name>\S[^}]*)"
+ reexp = tsettings.delimiter_char.replace("$", r"\$") + r"{(?P<name>\S[^}]*)"
pathlen = len(tmpdir) + 1
for root, __, files in os.walk(tmpdir):
for fic in files:
import re
xpath_tokenizer_re = re.compile(
- "("
- "'[^']*'|\"[^\"]*\"|"
- "::|"
- "//?|"
- "\.\.|"
- "\(\)|"
- "[/.*:\[\]\(\)@=])|"
- "((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|"
- "\s+"
+ r"("
+ r"'[^']*'|\"[^\"]*\"|"
+ r"::|"
+ r"//?|"
+ r"\.\.|"
+ r"\(\)|"
+ r"[/.*:\[\]\(\)@=])|"
+ r"((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|"
+ r"\s+"
)
def xpath_tokenizer(pattern, namespaces=None):
if elem.get(key) == value:
yield elem
return select
- if signature == "-" and not re.match("\-?\d+$", predicate[0]):
+ if signature == "-" and not re.match(r"\-?\d+$", predicate[0]):
# [tag]
tag = predicate[0]
def select(context, result):
if elem.find(tag) is not None:
yield elem
return select
- if signature == "-='" and not re.match("\-?\d+$", predicate[0]):
+ if signature == "-='" and not re.match(r"\-?\d+$", predicate[0]):
# [tag='value']
tag = predicate[0]
value = predicate[-1]
elem = next(iterfind(elem, path, namespaces))
return elem.text or ""
except StopIteration:
- return default
\ No newline at end of file
+ return default
ValueError is raised if prefix is reserved or is invalid.
"""
- if re.match("ns\d+$", prefix):
+ if re.match(r"ns\d+$", prefix):
raise ValueError("Prefix format reserved for internal use")
for k, v in list(_namespace_map.items()):
if k == uri or v == prefix:
# Element, SubElement, ParseError, TreeBuilder, XMLParser
from _elementtree import *
except ImportError:
- pass
\ No newline at end of file
+ pass
return
# fix libtool by replacing CC="<compil>" with hack_libtool function
- hack_command='''sed -i "s%^CC=\\"\(.*\)\\"%hack_libtool() { \\n\\
+ hack_command=r'''sed -i "s%^CC=\\"\(.*\)\\"%hack_libtool() { \\n\\
if test \\"\$(echo \$@ | grep -E '\\\\\\-L/usr/lib(/../lib)?(64)? ')\\" == \\\"\\\" \\n\\
then\\n\\
cmd=\\"\\1 \$@\\"\\n\\
if sep==os.pathsep:
self.output.write('append-path %s %s\n' % (key, value))
else:
- self.output.write('append-path --delim=\%c %s %s\n' % (sep, key, value))
+ self.output.write(r'append-path --delim=\%c %s %s\n' % (sep, key, value))
def prepend_value(self, key, value, sep=os.pathsep):
"""prepend value to key using sep
if sep==os.pathsep:
self.output.write('prepend-path %s %s\n' % (key, value))
else:
- self.output.write('prepend-path --delim=\%c %s %s\n' % (sep, key, value))
+ self.output.write(r'prepend-path --delim=\%c %s %s\n' % (sep, key, value))
class BashFileEnviron(FileEnviron):
import src.debug as DBG
-log_macro_command_file_expression = "^[0-9]{8}_+[0-9]{6}_+.*\.xml$"
-log_all_command_file_expression = "^.*[0-9]{8}_+[0-9]{6}_+.*\.xml$"
+log_macro_command_file_expression = r"^[0-9]{8}_+[0-9]{6}_+.*\.xml$"
+log_all_command_file_expression = r"^.*[0-9]{8}_+[0-9]{6}_+.*\.xml$"
verbose = True # cvw TODO
CONFIG_FILENAME = "sat-config-" # trace product depends version(s)
PRODUCT_FILENAME = "sat-product-" # trace product compile config
-config_expression = "^config-\d+$"
+config_expression = r"^config-\d+$"
def get_product_config(config, product_name, with_install_dir=True):
"""Get the specific configuration of a product from the global configuration