Fix invalid version error with _get_version()-provided version (#5670)

* Make sure that the repository we check is in the location we expect

* Merge `redbot._version` into `redbot`

* Generate VersionInfo in _get_version()

This way, if VersionInfo.from_str() generates exception due to invalid
version, we catch it.
This commit is contained in:
jack1142
2022-04-06 00:48:03 +02:00
committed by GitHub
parent 88d2cb3976
commit bc9f34c04b
4 changed files with 56 additions and 51 deletions

View File

@@ -5,9 +5,9 @@ from setuptools import setup
# Since we're importing `redbot` package, we have to ensure that it's in sys.path.
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
from redbot._version import _get_version
from redbot import VersionInfo
version = _get_version(ignore_installed=True)
version, _ = VersionInfo._get_version(ignore_installed=True)
if os.getenv("TOX_RED", False) and sys.version_info >= (3, 10):
# We want to be able to test Python versions that we do not support yet.