Skip to content

Commit

Permalink
Due to difficulty making plantuml produce exact same output between d…
Browse files Browse the repository at this point in the history
…ifference OS's, strip out svg elements when comparing html output
  • Loading branch information
robtaylor committed Oct 2, 2024
1 parent 04e01dc commit 597f1f2
Show file tree
Hide file tree
Showing 14 changed files with 574 additions and 385 deletions.
5 changes: 3 additions & 2 deletions .pylint.ini
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ disable=
logging-fstring-interpolation,
unnecessary-dunder-call,
deprecated-module,
deprecated-argument,

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down Expand Up @@ -418,5 +419,5 @@ known-third-party=enchant
[EXCEPTIONS]

# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
# "builtin.Exception"
overgeneral-exceptions=builtin.Exception
6 changes: 3 additions & 3 deletions .verchew.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ version = GNU Make

[Python]

cli = python
cli = python3
version = 3.9 || 3.10 || 3.11 || 3.12

[Poetry]

cli = poetry
version = 1.7
version = 1.7 || 1.8

[Graphviz]

cli = dot
cli_version_arg = -V
version = 9 || 10
version = 9 || 10 || 11 || 12
optional = true
message = This is only needed to generate UML diagrams for documentation.
31 changes: 15 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,26 @@ DEPENDENCIES := $(VIRTUAL_ENV)/.poetry-$(shell bin/checksum pyproject.toml poetr
install: $(DEPENDENCIES) .cache

$(DEPENDENCIES): poetry.lock
@ rm -rf ~/Library/Preferences/pypoetry
@ poetry config virtualenvs.in-project true
poetry config virtualenvs.in-project true
poetry install
@ touch $@
touch $@

ifndef CI
poetry.lock: pyproject.toml
poetry lock --no-update
@ touch $@
touch $@
endif

.cache:
@ mkdir -p .cache
mkdir -p .cache

# CHECKS ######################################################################

.PHONY: format
format: install
poetry run isort $(PACKAGES)
poetry run black $(PACKAGES)
@ echo
echo

.PHONY: check
check: install format ## Run formaters, linters, and static analysis
Expand Down Expand Up @@ -96,7 +95,7 @@ test: test-all ## Run unit and integration tests
test-unit: install
poetry run pytest $(PACKAGE) $(PYTEST_OPTIONS)
ifndef DISABLE_COVERAGE
@ echo
echo
poetry run coveragespace update unit
endif

Expand All @@ -107,7 +106,7 @@ test-int: test-all
test-all: install
TEST_INTEGRATION=true poetry run pytest $(PACKAGES) $(PYTEST_OPTIONS)
ifndef DISABLE_COVERAGE
@ echo
echo
poetry run coveragespace update overall
endif

Expand All @@ -132,16 +131,16 @@ docs: mkdocs uml ## Generate documentation and UML
.PHONY: mkdocs
mkdocs: install $(MKDOCS_INDEX)
$(MKDOCS_INDEX): docs/requirements.txt mkdocs.yml docs/*.md
@ mkdir -p docs/about
@ cd docs && ln -sf ../README.md index.md
@ cd docs/about && ln -sf ../../CHANGELOG.md changelog.md
@ cd docs/about && ln -sf ../../CONTRIBUTING.md contributing.md
@ cd docs/about && ln -sf ../../LICENSE.md license.md
mkdir -p docs/about
cd docs && ln -sf ../README.md index.md
cd docs/about && ln -sf ../../CHANGELOG.md changelog.md
cd docs/about && ln -sf ../../CONTRIBUTING.md contributing.md
cd docs/about && ln -sf ../../LICENSE.md license.md
poetry run mkdocs build --clean --strict

docs/requirements.txt: poetry.lock
@ poetry run pip list --format=freeze | grep mkdocs > $@
@ poetry run pip list --format=freeze | grep Pygments >> $@
poetry run pip list --format=freeze | grep mkdocs > $@
poetry run pip list --format=freeze | grep Pygments >> $@

.PHONY: uml
uml: install docs/*.png
Expand Down Expand Up @@ -262,6 +261,6 @@ clean-all: clean

.PHONY: help
help: install
@ grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.DEFAULT_GOAL := help
2 changes: 1 addition & 1 deletion bin/checksum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import hashlib
Expand Down
2 changes: 1 addition & 1 deletion bin/verchew
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# The MIT License (MIT)
Expand Down
9 changes: 5 additions & 4 deletions doorstop/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ def run_export(args, cwd, error, catch=True, auto=False, _tree=None):
ext = utilities.get_ext(args, error, ".yml", ".csv", whole_tree=whole_tree)

# Get the tree or document
document = None

with utilities.capture(catch=catch) as success:
exporter.check(ext)
tree = _tree or _get_tree(args, cwd, load=whole_tree)
Expand Down Expand Up @@ -547,6 +549,7 @@ def run_publish(args, cwd, error, catch=True):
ext = utilities.get_ext(args, error, ".txt", ".html", whole_tree)

# Get the tree or document
document = None
with utilities.capture(catch=catch) as success:
publisher.check(ext)
tree = _get_tree(args, cwd, load=whole_tree)
Expand Down Expand Up @@ -665,12 +668,10 @@ def _iter_items(args, tree, error):
if item:
yield item
elif document:
for item in document:
yield item
yield from document
else:
for document in tree:
for item in document:
yield item
yield from document


def _export_import(args, cwd, error, document, ext):
Expand Down
6 changes: 3 additions & 3 deletions doorstop/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ def main(args=None): # pylint: disable=R0915
log.error(exc)
success = False
except KeyboardInterrupt:
log.debug("command cancelled")
log.debug(f"command cancelled: {args}")
success = False
if success:
log.debug("command succeeded")
log.debug("command succeeded: {args}")
else:
log.debug("command failed")
log.debug(f"command failed: {args}")
sys.exit(1)


Expand Down
3 changes: 1 addition & 2 deletions doorstop/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ def read_lines(path, encoding="utf-8"):
"""
log.trace("reading lines from '{}'...".format(path)) # type: ignore
with open(path, "r", encoding=encoding) as stream:
for line in stream:
yield line
yield from stream


def read_text(path):
Expand Down
4 changes: 4 additions & 0 deletions doorstop/core/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ def launch(path, tool=None):
args = ["start", path]
elif os.name == "posix":
args = ["xdg-open", path]
else:
raise DoorstopError(
"unknown operating system, unable to determine launch command"
)

# Launch the editor
try:
Expand Down
Loading

0 comments on commit 597f1f2

Please sign in to comment.