Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve regex literals warning #263

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builder/actions/setup_cross_ci_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def _get_token_slots(env):

def _get_softhsm2_version(env):
output = _exec_softhsm2_util(env, '--version').output
match = re.match('([0-9+])\.([0-9]+).([0-9]+)', output)
match = re.match(r'([0-9+])\.([0-9]+).([0-9]+)', output)
return (int(match.group(1)), int(match.group(2)), int(match.group(3)))

################################################################################
8 changes: 4 additions & 4 deletions builder/core/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ def _compiler_version(cc):

for text in lines:
# Apple clang
m = re.match('Apple (LLVM|clang) version (\d+)', text)
m = re.match(r'Apple (LLVM|clang) version (\d+)', text)
if m:
return 'appleclang', m.group(2)
# LLVM clang
m = re.match('.*(LLVM|clang) version (\d+)', text)
m = re.match(r'.*(LLVM|clang) version (\d+)', text)
if m:
return 'clang', m.group(2)
# GCC 4.x
m = re.match('gcc .+ (4\.\d+)', text)
m = re.match(r'gcc .+ (4\.\d+)', text)
if m:
return 'gcc', m.group(1)
# GCC 5+
m = re.match('gcc .+ (\d+)\.', text)
m = re.match(r'gcc .+ (\d+)\.', text)
if m:
return 'gcc', m.group(1)
return None, None
Expand Down
2 changes: 1 addition & 1 deletion builder/imports/llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def install(self, env):
sudo = ['sudo'] if sudo else []

# Strip minor version info
version = env.toolchain.compiler_version.replace('\..+', '')
version = env.toolchain.compiler_version.replace(r'\..+', '')

script = tempfile.NamedTemporaryFile(delete=False)
script_path = script.name
Expand Down
4 changes: 2 additions & 2 deletions builder/imports/nodejs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import re


NVM = """\
NVM = r"""\
#!/usr/bin/env bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
Expand Down Expand Up @@ -126,7 +126,7 @@ def install_node_via_unofficial_build(self, env):
# Normaliz version format, please note 12.16.3 is the last version has x86 support
def normalize_version(v):
append_times = 0
while re.match('^([0-9]+\.){2}[0-9]+$', v) == None:
while re.match(r'^([0-9]+\.){2}[0-9]+$', v) == None:
# Only try append sub version twice
if append_times < 2:
v += ".0"
Expand Down
Loading