diff options
Diffstat (limited to 'pydis_site/utils')
-rw-r--r-- | pydis_site/utils/__init__.py | 3 | ||||
-rw-r--r-- | pydis_site/utils/resources.py | 10 | ||||
-rw-r--r-- | pydis_site/utils/utils.py | 10 |
3 files changed, 13 insertions, 10 deletions
diff --git a/pydis_site/utils/__init__.py b/pydis_site/utils/__init__.py new file mode 100644 index 00000000..bb91b3d8 --- /dev/null +++ b/pydis_site/utils/__init__.py @@ -0,0 +1,3 @@ +from .utils import get_git_sha + +__all__ = ['get_git_sha'] diff --git a/pydis_site/utils/resources.py b/pydis_site/utils/resources.py index d36c4b77..637fd785 100644 --- a/pydis_site/utils/resources.py +++ b/pydis_site/utils/resources.py @@ -4,13 +4,8 @@ import glob import typing from dataclasses import dataclass -import git import yaml -# Git SHA -repo = git.Repo(search_parent_directories=True) -GIT_SHA = repo.head.object.hexsha - @dataclass class URL: @@ -94,8 +89,3 @@ def load_categories(order: typing.List[str]) -> typing.List[Category]: categories.append(Category.construct_from_directory(direc)) return categories - - -def get_git_sha() -> str: - """Get the Git SHA for this repo.""" - return GIT_SHA diff --git a/pydis_site/utils/utils.py b/pydis_site/utils/utils.py new file mode 100644 index 00000000..2033ea19 --- /dev/null +++ b/pydis_site/utils/utils.py @@ -0,0 +1,10 @@ +import git + +# Git SHA +repo = git.Repo(search_parent_directories=True) +GIT_SHA = repo.head.object.hexsha + + +def get_git_sha() -> str: + """Get the Git SHA for this repo.""" + return GIT_SHA |