Skip to content

Version detection fails on Ubuntu (Mint) installation #100

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

Closed
mykmartin opened this issue Jan 10, 2024 · 4 comments
Closed

Version detection fails on Ubuntu (Mint) installation #100

mykmartin opened this issue Jan 10, 2024 · 4 comments

Comments

@mykmartin
Copy link

On Linux Mint (an Ubuntu derivative), the version string produced by postgres isn't parsed correctly by get_pg_version() in utils.py:

$ /usr/lib/postgresql/15/bin/postgres --version
postgres (PostgreSQL) 15.5 (Ubuntu 15.5-1.pgdg22.04+1)

$ python ./tests/test_simple.py 
Traceback (most recent call last):
  File "testgres/env/lib/python3.10/site-packages/testgres/utils.py", line 31, in __init__
    super().__init__(version)
  File "testgres/env/lib/python3.10/site-packages/packaging/version.py", line 200, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '15.5-1.pgdg22.04+1)'

There appears to be a fairly simple fix in get_pg_version(), line 185:

    # Remove "(Homebrew)" and "(Ubuntu <version>)" if present
    raw_ver = raw_ver.replace('(Homebrew)', '').strip()
    raw_ver = re.sub('\(Ubuntu[^)]*\)', '', raw_ver).strip()
demonolock pushed a commit that referenced this issue Jan 18, 2024
demonolock pushed a commit that referenced this issue Jan 18, 2024
demonolock pushed a commit that referenced this issue Jan 18, 2024
demonolock added a commit that referenced this issue Jan 18, 2024
@demonolock
Copy link
Contributor

Hi,
Thank you! The fix will be added to the next version 1.10.0

@mykmartin
Copy link
Author

Great, thanks!

@demonolock
Copy link
Contributor

The version 1.10.0 released, @mykmartin please check, is it work for you now?

@mykmartin
Copy link
Author

It does! Thanks for the notification :)

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

No branches or pull requests

2 participants