-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from ShadowXBoss696/staging
Draft 1
- Loading branch information
Showing
8 changed files
with
38 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1 @@ | ||
from fastboot.version import VERSION | ||
|
||
__all__ = ["__version__"] | ||
|
||
# Project Information | ||
__version__ = VERSION | ||
__author__ = ["Arpan Mahanty <arpan.mahanty.007@gmail.com>"] | ||
__license__ = "MIT" | ||
from ._version import __version__ as __version__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import fastboot | ||
|
||
if __name__ == "__main__": | ||
print("FastBoot " + fastboot.__version__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import importlib.metadata | ||
import pathlib | ||
import tomllib | ||
|
||
__version__: str | ||
|
||
# /// Internal logic ----------------------------------------------------------------------------- | ||
|
||
_build_script: pathlib.Path = pathlib.Path(__file__).parents[1] / "pyproject.toml" | ||
|
||
if _build_script.exists(): | ||
# We know we are running in development mode, as we have found the pyproject.toml file | ||
__version__ = tomllib.loads(_build_script.read_text())["tool"]["poetry"]["version"] | ||
|
||
else: | ||
# Load metadata from installed package information | ||
_pkg_name: str = __package__ or __name__.split(".", maxsplit=1)[0] | ||
__version__ = importlib.metadata.version(_pkg_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
import re | ||
|
||
import fastboot | ||
from fastboot import __version__ as version | ||
|
||
SEMANTIC_VERSION_REGEX = re.compile( | ||
SEMANTIC_VERSION_REGEX: re.Pattern[str] = re.compile( | ||
"^([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+)?$" | ||
) | ||
|
||
|
||
def test_version_info_present() -> None: | ||
assert fastboot.__version__ is not None, "Missing application version information" | ||
def test_version_info_available() -> None: | ||
# Checks if the version string is defined | ||
assert version is not None, "Missing application version information" | ||
|
||
|
||
def test_version_info_follows_semantic_version_spec() -> None: | ||
assert SEMANTIC_VERSION_REGEX.match( | ||
fastboot.__version__ | ||
), "Application version number does not follow the semantic version specification" | ||
# Checks if the version string follows semantic versioning | ||
follows_semver_spec: bool = SEMANTIC_VERSION_REGEX.match(version) is not None | ||
assert follows_semver_spec, "Application version number does not follow the semantic version specification" |