Skip to content

Commit

Permalink
dev-util/rocminfo: Fix "SyntaxWarning: invalid escape sequence" with …
Browse files Browse the repository at this point in the history
…python 3.12+

Upstream bug: ROCm/rocminfo#69

Signed-off-by: Sv. Lockal <lockalsash@gmail.com>
  • Loading branch information
AngryLoki committed Mar 24, 2024
1 parent 60156c3 commit af484b3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
34 changes: 34 additions & 0 deletions dev-util/rocminfo/files/rocminfo-6.0.0-python-3-12-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Fix "SyntaxWarning: invalid escape sequence" SyntaxWarning in python 3.12+
Bug: https://github.com/ROCm/rocminfo/issues/69
--- a/rocm_agent_enumerator
+++ b/rocm_agent_enumerator
@@ -92,7 +92,7 @@ def getGCNISA(line, match_from_beginning = False):
return result.group(0)
return None

-@staticVars(search_name=re.compile("gfx[0-9a-fA-F]+(:[-+:\w]+)?"))
+@staticVars(search_name=re.compile(r"gfx[0-9a-fA-F]+(:[-+:\w]+)?"))
def getGCNArchName(line):
result = getGCNArchName.search_name.search(line)

@@ -149,9 +149,9 @@ def readFromROCMINFO(search_arch_name = False):

# search AMDGCN gfx ISA
if search_arch_name is True:
- line_search_term = re.compile("\A\s+Name:\s+(amdgcn-amd-amdhsa--gfx\d+)")
+ line_search_term = re.compile(r"\A\s+Name:\s+(amdgcn-amd-amdhsa--gfx\d+)")
else:
- line_search_term = re.compile("\A\s+Name:\s+(gfx\d+)")
+ line_search_term = re.compile(r"\A\s+Name:\s+(gfx\d+)")
for line in rocminfo_output:
if line_search_term.match(line) is not None:
if search_arch_name is True:
@@ -172,7 +172,7 @@ def readFromLSPCI():
except:
lspci_output = []

- target_search_term = re.compile("1002:\w+")
+ target_search_term = re.compile(r"1002:\w+")
for line in lspci_output:
search_result = target_search_term.search(line)
if search_result is not None:
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 1999-2023 Gentoo Authors
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
Expand All @@ -22,13 +22,14 @@ SLOT="0/$(ver_cut 1-2)"
RDEPEND=">=dev-libs/rocr-runtime-${PV}"
DEPEND="${RDEPEND}"

#PATCHES=(
# "${FILESDIR}/${PN}-5.5.1-detect-builtin-amdgpu.patch"
#)
PATCHES=(
"${FILESDIR}/${PN}-6.0.0-python-3-12-support.patch"
)

src_prepare() {
sed -e "/CPACK_RESOURCE_FILE_LICENSE/d" -i CMakeLists.txt || die
sed -e "/num_change_since_prev_pkg(/cset(NUM_COMMITS 0)" -i cmake_modules/utils.cmake || die # Fix QA issue on "git not found"
sed -e "/num_change_since_prev_pkg(/cset(NUM_COMMITS 0)"
-i cmake_modules/utils.cmake || die # Fix QA issue on "git not found"
cmake_src_prepare
}

Expand Down

0 comments on commit af484b3

Please sign in to comment.