Skip to content

Commit

Permalink
Add version placeholder for cases when kataloger package can't be found
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmpr committed Jul 30, 2024
1 parent ca99fb3 commit e7231e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ kataloger = "kataloger.__main__:main"
"Changelog" = "https://github.com/dzmpr/kataloger/releases"

[tool.pytest.ini_options]
pythonpath = "src/"
pythonpath = "src"
testpaths = "tests"

[tool.ruff]
line-length = 120
Expand Down
8 changes: 6 additions & 2 deletions src/kataloger/cli/argument_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from argparse import ArgumentParser
from importlib.metadata import version
from importlib.metadata import PackageNotFoundError, version
from pathlib import Path
from typing import List, Optional

Expand Down Expand Up @@ -76,7 +76,11 @@ def parse_arguments(*args: str) -> KatalogerArguments:
def _get_kataloger_version() -> str:
if __name__ == "__main__":
return "indev"
return version(package_name)

try:
return version(package_name)
except PackageNotFoundError:
return "unknown"


def _get_catalogs(path_strings: List[str]) -> Optional[List[Catalog]]:
Expand Down

0 comments on commit e7231e1

Please sign in to comment.