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

fix: support multiple args in self.requires method #4

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions src/conan_check_updates/conan.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def version_str() -> str:
_REQUIRES_ATTRIBUTES = ("requires", "build_requires", "tool_requires", "test_requires")


def dequote(s: str) -> str:
def _dequote(s: str) -> str:
"""If a string has single or double quotes around it, remove them."""
min_length = 2
if (len(s) >= min_length and s[0] == s[-1]) and s.startswith(("'", '"')):
Expand All @@ -196,7 +196,8 @@ def inspect_requirements_conanfile_py(conanfile: Path) -> List[ConanReference]:
res = re.search(r"self\.(?:tool_)*requires\((.*)\)", line)
if res:
args = res.group(1)
ref = dequote(args)
arg = args.partition(",")[0].strip() # get first argument -> reference string
ref = _dequote(arg)
if len(ref) > 0:
refs.append(ref)
return list(map(ConanReference.parse, refs))
Expand Down
2 changes: 1 addition & 1 deletion tests/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ class Example(ConanFile):
def requirements(self):
self.requires("openssl/3.2.0")
self.requires('nanodbc/2.13.0') # fmt:off
self.requires("ms-gsl/3.1.0")
self.requires("ms-gsl/3.1.0", "private")
self.tool_requires("cmake/3.27.7")
# self.requires("quill/3.6.0")
Loading