Skip to content

Commit 2d74ccb

Browse files
Copilotjpfeuffer
andcommitted
Address code review feedback: improve path handling, encoding, and regex specificity
Co-authored-by: jpfeuffer <[email protected]>
1 parent 6b46e86 commit 2d74ccb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/install_pyopenms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010

1111
def get_version_from_conf():
1212
"""Extract version from docs/source/conf.py"""
13-
conf_path = Path(__file__).parent / "source" / "conf.py"
13+
conf_path = Path(__file__).parent.resolve() / "source" / "conf.py"
1414

15-
with open(conf_path, 'r') as f:
15+
with open(conf_path, 'r', encoding='utf-8') as f:
1616
content = f.read()
1717

18-
# Look for version = u'X.Y.Z' pattern
19-
match = re.search(r"version\s*=\s*u?['\"]([^'\"]+)['\"]", content)
18+
# Look for version = u'X.Y.Z' pattern (with word boundary to be more specific)
19+
match = re.search(r"\bversion\s*=\s*u?['\"]([^'\"]+)['\"]", content)
2020

2121
if match:
2222
version = match.group(1)

0 commit comments

Comments
 (0)