Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 18, 2024
1 parent eaefd0b commit e9011ab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/ablog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
PKGDIR = os.path.abspath(os.path.dirname(__file__))
# Name used for the *.pot, *.po and *.mo files
MESSAGE_CATALOG_NAME = "sphinx"
_ = get_translation(MESSAGE_CATALOG_NAME) # NOQA
_ = get_translation(MESSAGE_CATALOG_NAME)


def get_html_templates_path():
Expand Down
12 changes: 2 additions & 10 deletions src/ablog/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,12 @@ def ablog_clean(website=None, doctrees=None, deep=False, **kwargs):
nothing = True
if glob.glob(os.path.join(website, "*")):
shutil.rmtree(website)
print(f"Removed {os.path.relpath(website)}.")
nothing = False
if deep and glob.glob(os.path.join(doctrees, "*")):
shutil.rmtree(doctrees)
print(f"Removed {os.path.relpath(doctrees)}.")
nothing = False
if nothing:
print("Nothing to clean.")
pass


@arg("--patterns", dest="patterns", default="*.rst;*.txt", help="patterns for triggering rebuilds")
Expand All @@ -268,8 +266,6 @@ def ablog_serve(website=None, port=8000, view=True, rebuild=False, patterns="*.r
Handler = server.SimpleHTTPRequestHandler
httpd = socketserver.TCPServer(("", port), Handler)
ip, port = httpd.socket.getsockname()
print(f"Serving HTTP on {ip}:{port}.")
print("Quit the server with Control-C.")
website = website or os.path.join(confdir, getattr(conf, "ablog_website", "_website"))
os.chdir(website)
if rebuild:
Expand Down Expand Up @@ -321,7 +317,6 @@ def ablog_post(filename, title=None, **kwargs):
with open(filename, "w", encoding="utf-8") as out:
post_text = POST_TEMPLATE.format(**pars)
out.write(post_text)
print(f"Blog post created: {filename}")


@arg(
Expand Down Expand Up @@ -397,7 +392,6 @@ def ablog_deploy(
website = website or os.path.join(confdir, getattr(conf, "ablog_builddir", "_website"))
tomove = glob.glob(os.path.join(website, "*"))
if not tomove:
print("Nothing to deploy, build first.")
return
if github_pages:
if repodir is None:
Expand Down Expand Up @@ -428,7 +422,6 @@ def ablog_deploy(
os.renames(fn, fnnew)

git_add.append(fnnew)
print(f"Moved {len(git_add)} files to {github_pages}.github.io")
os.chdir(repodir)
run("git add -f " + " ".join([f'"{os.path.relpath(p)}"' for p in git_add]), echo=True)
if not os.path.isfile(".nojekyll"):
Expand All @@ -437,7 +430,6 @@ def ablog_deploy(
# Check to see if anything has actually been committed
result = run("git diff --cached --name-status HEAD")
if not result.stdout:
print("Nothing changed from last deployment")
return
commit = f"git commit -m \"{message or 'Updates.'}\""
if push_force:
Expand All @@ -455,7 +447,7 @@ def ablog_deploy(
push += f" origin {github_branch}"
run(push, echo=True)
else:
print("No place to deploy.")
pass


def ablog_main():
Expand Down
2 changes: 1 addition & 1 deletion src/ablog/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

# Name used for the *.pot, *.po and *.mo files
MESSAGE_CATALOG_NAME = "sphinx"
_ = get_translation(MESSAGE_CATALOG_NAME) # NOQA
_ = get_translation(MESSAGE_CATALOG_NAME)


def _split(a):
Expand Down

0 comments on commit e9011ab

Please sign in to comment.