Skip to content

Commit

Permalink
Resolve regex literals warning (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyMusatkin committed Dec 7, 2023
1 parent 74ab83e commit 96d8c2f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sanity-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
strategy:
fail-fast: false
matrix:
host: [ubuntu-20.04, macos-11, macos-12, windows-2022]
host: [ubuntu-22.04, macos-11, macos-12, windows-2022]
needs: package
runs-on: ${{ matrix.host }}
steps:
Expand Down
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

0 comments on commit 96d8c2f

Please sign in to comment.