-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Refactor license retrieval to use Conan's Git helper #20447
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
base: main
Are you sure you want to change the base?
Conversation
Replaced the external `gitpython` library with Conan's built-in `Git` helper for repository operations. Simplified and improved the license retrieval logic while maintaining existing functionality, ensuring better integration and reduced dependency overhead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (2)
conanfile.py:219
- The _format_git_url method is missing a 'self' parameter or should be declared as a static method using the @staticmethod decorator since it is called via self._format_git_url.
def _format_git_url(url):
conanfile.py:258
- The 'break' statement terminates the candidate tag loop after the first checkout even if no license file is found; consider removing or repositioning it so that subsequent candidate tags can be tried.
break
) | ||
|
||
# Clone the repository into a temporary directory. | ||
with tempfile.TemporaryDirectory() as clone_directory: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to import the 'tempfile' module at the top of the file to support the usage of tempfile.TemporaryDirectory.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
return file.read() | ||
|
||
git.checkout(commit=tag) | ||
except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Catching a broad Exception in the git.checkout call may hide important errors; consider catching a more specific exception (or using GitCommandError if applicable) to avoid masking issues.
except Exception: | |
except GitCommandError: |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
Description
Replaced the external
gitpython
library with Conan's built-inGit
helper for repository operations. Simplified and improved the license retrieval logic while maintaining existing functionality, ensuring better integration and reduced dependency overhead.Type of change
How Has This Been Tested?
Test Configuration:
Checklist: