Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
repos:

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
rev: 7.0.0
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 24.3.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.1.0
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
rev: 7.3.0
hooks:
- id: flake8
19 changes: 6 additions & 13 deletions sphinx_gitstamp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,8 @@ def page_context_handler(app, pagename, templatename, context, doctree):
raise errors.ExtensionError("Can't fetch git history for %s." % file_path)
except ValueError:
# Datestamp can't be parsed.
app.info(
"%s: Can't parse datestamp () %s ) for gitstamp, output \
won't have last updated time."
% (pagename, updated)
)
app.info("%s: Can't parse datestamp () %s ) for gitstamp, output \
won't have last updated time." % (pagename, updated))
pass


Expand All @@ -79,23 +76,19 @@ def what_build_am_i(app):
try:
import git
except ImportError as e:
raise errors.ExtensionError(
f"""Unable to import gitpython. \
raise errors.ExtensionError(f"""Unable to import gitpython. \
Required to generate html. You may need to run: pip install gitpython.

The error was: {e}
"""
)
""")

try:
global g
g = git.Git(".")
except BaseException:
app.info(sys.exc_info()[0])
app.warn(
"gitstamp extension enabled, but no git repository found. No \
git datestamps will be generated."
)
app.warn("gitstamp extension enabled, but no git repository found. No \
git datestamps will be generated.")
else:
app.connect("html-page-context", page_context_handler)

Expand Down
Loading