Skip to content

Commit

Permalink
remove regex warnings (#8592)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed Mar 4, 2021
1 parent 1c4cd6a commit a0d81b3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion conans/client/build/msbuild.py
Expand Up @@ -252,7 +252,7 @@ def get_version(settings):
try:
out = version_runner(command, shell=True)
version_line = decode_text(out).split("\n")[-1]
prog = re.compile("(\d+\.){2,3}\d+")
prog = re.compile(r"(\d+\.){2,3}\d+")
result = prog.match(version_line).group()
return Version(result)
except Exception as e:
Expand Down
10 changes: 5 additions & 5 deletions conans/client/conf/detect.py
Expand Up @@ -6,7 +6,7 @@

from conans.client.conf.compiler_id import UNKNOWN_COMPILER, LLVM_GCC, detect_compiler_id
from conans.client.output import Color
from conans.client.tools import detected_os, detected_architecture, OSInfo
from conans.client.tools import detected_os, detected_architecture
from conans.client.tools.win import latest_visual_studio_version_installed
from conans.model.version import Version
from conans.util.conan_v2_mode import CONAN_V2_MODE_ENVVAR
Expand Down Expand Up @@ -41,7 +41,7 @@ def _gcc_compiler(output, compiler_exe="gcc"):
if ret != 0:
return None
compiler = "gcc"
installed_version = re.search("([0-9]+(\.[0-9])?)", out).group()
installed_version = re.search(r"([0-9]+(\.[0-9])?)", out).group()
# Since GCC 7.1, -dumpversion return the major version number
# only ("7"). We must use -dumpfullversion to get the full version
# number ("7.1.1").
Expand All @@ -61,7 +61,7 @@ def _clang_compiler(output, compiler_exe="clang"):
compiler = "apple-clang"
elif "clang version" in out:
compiler = "clang"
installed_version = re.search("([0-9]+\.[0-9])", out).group()
installed_version = re.search(r"([0-9]+\.[0-9])", out).group()
if installed_version:
output.success("Found %s %s" % (compiler, installed_version))
return compiler, installed_version
Expand All @@ -73,11 +73,11 @@ def _sun_cc_compiler(output, compiler_exe="cc"):
try:
_, out = detect_runner('%s -V' % compiler_exe)
compiler = "sun-cc"
installed_version = re.search("Sun C.*([0-9]+\.[0-9]+)", out)
installed_version = re.search(r"Sun C.*([0-9]+\.[0-9]+)", out)
if installed_version:
installed_version = installed_version.group(1)
else:
installed_version = re.search("([0-9]+\.[0-9]+)", out).group()
installed_version = re.search(r"([0-9]+\.[0-9]+)", out).group()
if installed_version:
output.success("Found %s %s" % (compiler, installed_version))
return compiler, installed_version
Expand Down
8 changes: 5 additions & 3 deletions conans/client/tools/scm.py
Expand Up @@ -109,9 +109,11 @@ def get_url_with_credentials(self, url):
return url

scp_regex = re.compile("^(?P<user>[a-zA-Z0-9_]+)@(?P<domain>[a-zA-Z0-9._-]+):(?P<url>.*)$")
url_user_pass_regex = re.compile("^(?P<scheme>file|http|https|git|ssh):\/\/(?P<user>\w+):(?P<password>\w+)@(?P<url>.*)$")
url_user_regex = re.compile("^(?P<scheme>file|http|https|git|ssh):\/\/(?P<user>\w+)@(?P<url>.*)$")
url_basic_regex = re.compile("^(?P<scheme>file|http|https|git|ssh):\/\/(?P<url>.*)$")
url_user_pass_regex = re.compile(
r"^(?P<scheme>file|http|https|git|ssh)://(?P<user>\w+):(?P<password>\w+)@(?P<url>.*)$")
url_user_regex = re.compile(
r"^(?P<scheme>file|http|https|git|ssh)://(?P<user>\w+)@(?P<url>.*)$")
url_basic_regex = re.compile(r"^(?P<scheme>file|http|https|git|ssh)://(?P<url>.*)$")

url_patterns = [
(scp_regex, self._handle_scp_pattern),
Expand Down

0 comments on commit a0d81b3

Please sign in to comment.