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: correct Linux distro version in systeminfo prompt #239

Merged
merged 3 commits into from
Nov 1, 2024

Conversation

0xbrayo
Copy link
Collaborator

@0xbrayo 0xbrayo commented Nov 1, 2024

Important

Corrects Linux OS version retrieval in prompt_systeminfo() by using get_system_distro_version() instead of platform.uname().release.

  • Behavior:
    • Corrects the method to obtain Linux OS version in prompt_systeminfo() by replacing platform.uname().release with get_system_distro_version().
  • Functions:
    • Adds get_system_distro_version() to extract the Linux distribution version from /etc/os-release using regex.

This description was created by Ellipsis for f57e55a. It will automatically update as commits are pushed.

@0xbrayo
Copy link
Collaborator Author

0xbrayo commented Nov 1, 2024

Closes #238

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Reviewed everything up to f57e55a in 56 seconds

More details
  • Looked at 32 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_W5IyvzV3QkjJzNxM


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

gptme/prompts.py Outdated
@@ -247,6 +247,18 @@ def get_system_distro() -> str:
return "Linux"


def get_system_distro_version() -> str:
"""Get the system distribution version."""
regex = re.compile(r"^BUILD_ID=\"?([^\"]+)\"?")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern should match VERSION_ID instead of BUILD_ID to correctly extract the system distribution version from /etc/os-release.

Suggested change
regex = re.compile(r"^BUILD_ID=\"?([^\"]+)\"?")
regex = re.compile(r"^VERSION_ID=\"?([^\"]+)\"?")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On arch it's BUILD_ID. But even co-pilot suggested the same thing. Let me check on fedora.

gptme/prompts.py Outdated
@@ -247,6 +247,18 @@ def get_system_distro() -> str:
return "Linux"


def get_system_distro_version() -> str:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would merge this with get_system_distro and make it return a tuple[str, str]

@ErikBjare
Copy link
Owner

Just learned about platform.freedesktop_os_release() which returns the contents of /etc/os-release as a dict

gptme/prompts.py Outdated Show resolved Hide resolved
@ErikBjare ErikBjare changed the title fix: correct BUILD_VERSION fix: correct Linux distro version in systeminfo prompt Nov 1, 2024
@ErikBjare ErikBjare merged commit 3221145 into ErikBjare:master Nov 1, 2024
4 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants