forked from github.com/blag
Compare commits
18 Commits
2.2.0
...
delete_ext
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
618327adf5 | ||
|
|
f9f27953c6 | ||
|
|
55e2f41b88 | ||
|
|
8c61614295 | ||
|
|
c364087eab | ||
|
|
a06947d762 | ||
|
|
12a7fb9568 | ||
|
|
caf6217221 | ||
|
|
744dadb1a5 | ||
|
|
7defacd3f6 | ||
|
|
c1d741a56c | ||
|
|
056ddbdbcb | ||
|
|
9b0bd2814a | ||
|
|
8f287c5b8d | ||
|
|
9168720ede | ||
|
|
94ad898a86 | ||
|
|
ff3f8101ad | ||
|
|
8c0e69b2f4 |
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## [2.2.1] -- 2023-11-11
|
||||
|
||||
* fixed `suggests` to blag-doc
|
||||
|
||||
## [2.2.0] -- 2023-11-05
|
||||
|
||||
* switched from flake8 to ruff
|
||||
|
||||
26
blag/blag.py
26
blag/blag.py
@@ -218,6 +218,7 @@ def build(args: argparse.Namespace) -> None:
|
||||
"""
|
||||
os.makedirs(f"{args.output_dir}", exist_ok=True)
|
||||
convertibles = []
|
||||
known_targets = []
|
||||
for root, dirnames, filenames in os.walk(args.input_dir):
|
||||
for filename in filenames:
|
||||
rel_src = os.path.relpath(
|
||||
@@ -229,15 +230,22 @@ def build(args: argparse.Namespace) -> None:
|
||||
rel_dst = rel_src
|
||||
rel_dst = rel_dst[:-3] + ".html"
|
||||
convertibles.append((rel_src, rel_dst))
|
||||
known_targets.append(
|
||||
os.path.abspath(f"{args.output_dir}/{rel_dst}")
|
||||
)
|
||||
else:
|
||||
shutil.copy(
|
||||
f"{args.input_dir}/{rel_src}",
|
||||
f"{args.output_dir}/{rel_src}",
|
||||
)
|
||||
known_targets.append(
|
||||
os.path.abspath(f"{args.output_dir}/{rel_src}")
|
||||
)
|
||||
for dirname in dirnames:
|
||||
# all directories are copied into the output directory
|
||||
path = os.path.relpath(f"{root}/{dirname}", start=args.input_dir)
|
||||
os.makedirs(f"{args.output_dir}/{path}", exist_ok=True)
|
||||
known_targets.append(os.path.abspath(f"{args.output_dir}/{path}"))
|
||||
|
||||
# copy static files over
|
||||
logger.info("Copying static files.")
|
||||
@@ -273,6 +281,24 @@ def build(args: argparse.Namespace) -> None:
|
||||
article_template,
|
||||
)
|
||||
|
||||
# clean up files that should not be there
|
||||
for root, dirnames, filenames in os.walk(args.output_dir):
|
||||
for filename in filenames:
|
||||
dst = os.path.abspath(f"{root}/{filename}")
|
||||
if dst not in known_targets:
|
||||
logger.info(f"deleting {dst}")
|
||||
os.remove(dst)
|
||||
else:
|
||||
known_targets.remove(dst)
|
||||
for dirname in dirnames:
|
||||
dst = os.path.abspath(f"{root}/{dirname}")
|
||||
if dst not in known_targets:
|
||||
logger.info(f"deleting {dst}")
|
||||
shutil.rmtree(dst)
|
||||
else:
|
||||
known_targets.remove(dst)
|
||||
logger.debug(known_targets)
|
||||
|
||||
generate_feed(
|
||||
articles,
|
||||
args.output_dir,
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"""Version information for the blag package."""
|
||||
|
||||
__VERSION__ = "2.2.0"
|
||||
__VERSION__ = "2.2.1"
|
||||
|
||||
6
debian/changelog
vendored
6
debian/changelog
vendored
@@ -1,3 +1,9 @@
|
||||
blag (2.2.1) unstable; urgency=medium
|
||||
|
||||
* fixed suggests field to blag-doc (Closes: #1055769)
|
||||
|
||||
-- Bastian Venthur <venthur@debian.org> Sat, 11 Nov 2023 10:57:06 +0100
|
||||
|
||||
blag (2.2.0) unstable; urgency=medium
|
||||
|
||||
* switched from flake8 to ruff
|
||||
|
||||
2
debian/control
vendored
2
debian/control
vendored
@@ -31,7 +31,7 @@ Depends:
|
||||
${python3:Depends},
|
||||
${misc:Depends},
|
||||
Suggests:
|
||||
python-blag-doc,
|
||||
blag-doc,
|
||||
Description: Blog-aware, static site generator
|
||||
Blag is a blog-aware, static site generator, written in Python. It supports
|
||||
the following features:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
build==1.0.3
|
||||
mkdocs==1.5.3
|
||||
mkdocs-material==9.4.6
|
||||
mkdocs-material==9.4.8
|
||||
mkdocstrings[python]==0.23.0
|
||||
twine==4.0.2
|
||||
wheel==0.41.2
|
||||
wheel==0.41.3
|
||||
pytest==7.4.3
|
||||
pytest-cov==4.1.0
|
||||
ruff==0.1.3
|
||||
ruff==0.1.5
|
||||
mypy==1.6.1
|
||||
types-markdown==3.5.0.0
|
||||
types-markdown==3.5.0.1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
markdown==3.5
|
||||
markdown==3.5.1
|
||||
feedgenerator==2.1.0
|
||||
jinja2==3.1.2
|
||||
pygments==2.16.1
|
||||
|
||||
@@ -312,6 +312,22 @@ foo bar
|
||||
assert os.path.exists(f"{args.output_dir}/tags/bar.html")
|
||||
|
||||
|
||||
def test_remove_extra_files(args):
|
||||
"""Test that extra files are removed."""
|
||||
# create a file and directory in output dir that have no corresponding
|
||||
# source
|
||||
file_path = f'{args.output_dir}/a'
|
||||
dir_path = f'{args.output_dir}/b'
|
||||
fh = open(file_path, 'w')
|
||||
fh.close()
|
||||
os.mkdir(dir_path)
|
||||
|
||||
blag.build(args)
|
||||
|
||||
assert not os.path.exists(file_path)
|
||||
assert not os.path.exists(dir_path)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"template",
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user