Compare commits

...

18 Commits

Author SHA1 Message Date
Bastian Venthur
618327adf5 reformatted 2023-11-12 17:24:48 +01:00
Bastian Venthur
f9f27953c6 Merge branch 'master' into delete_extra_files 2023-11-12 17:23:48 +01:00
Bastian Venthur
55e2f41b88 correct release 2023-11-11 11:01:28 +01:00
Bastian Venthur
8c61614295 fixed suggests to blag-doc, bumped version 2023-11-11 10:59:07 +01:00
Bastian Venthur
c364087eab Merge pull request #158 from venthur/dependabot/pip/mkdocs-material-9.4.8
Bump mkdocs-material from 9.4.6 to 9.4.8
2023-11-11 10:58:02 +01:00
Bastian Venthur
a06947d762 Merge pull request #161 from venthur/dependabot/pip/ruff-0.1.5
Bump ruff from 0.1.3 to 0.1.5
2023-11-11 10:57:49 +01:00
dependabot[bot]
12a7fb9568 Bump ruff from 0.1.3 to 0.1.5
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.1.3 to 0.1.5.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/v0.1.3...v0.1.5)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-11 09:55:13 +00:00
dependabot[bot]
caf6217221 Bump mkdocs-material from 9.4.6 to 9.4.8
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.4.6 to 9.4.8.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.4.6...9.4.8)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-11 09:55:02 +00:00
Bastian Venthur
744dadb1a5 Merge pull request #159 from venthur/dependabot/pip/types-markdown-3.5.0.1
Bump types-markdown from 3.5.0.0 to 3.5.0.1
2023-11-11 10:54:41 +01:00
Bastian Venthur
7defacd3f6 Merge pull request #153 from venthur/dependabot/pip/wheel-0.41.3
Bump wheel from 0.41.2 to 0.41.3
2023-11-11 10:54:23 +01:00
Bastian Venthur
c1d741a56c Merge pull request #157 from venthur/dependabot/pip/markdown-3.5.1
Bump markdown from 3.5 to 3.5.1
2023-11-11 10:53:59 +01:00
dependabot[bot]
056ddbdbcb Bump types-markdown from 3.5.0.0 to 3.5.0.1
Bumps [types-markdown](https://github.com/python/typeshed) from 3.5.0.0 to 3.5.0.1.
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-markdown
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-06 14:42:44 +00:00
dependabot[bot]
9b0bd2814a Bump markdown from 3.5 to 3.5.1
Bumps [markdown](https://github.com/Python-Markdown/markdown) from 3.5 to 3.5.1.
- [Release notes](https://github.com/Python-Markdown/markdown/releases)
- [Changelog](https://github.com/Python-Markdown/markdown/blob/master/docs/changelog.md)
- [Commits](https://github.com/Python-Markdown/markdown/compare/3.5...3.5.1)

---
updated-dependencies:
- dependency-name: markdown
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-06 14:42:36 +00:00
dependabot[bot]
8f287c5b8d Bump wheel from 0.41.2 to 0.41.3
Bumps [wheel](https://github.com/pypa/wheel) from 0.41.2 to 0.41.3.
- [Release notes](https://github.com/pypa/wheel/releases)
- [Changelog](https://github.com/pypa/wheel/blob/main/docs/news.rst)
- [Commits](https://github.com/pypa/wheel/compare/0.41.2...0.41.3)

---
updated-dependencies:
- dependency-name: wheel
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-05 16:03:50 +00:00
Bastian Venthur
9168720ede Merge branch 'master' into delete_extra_files 2022-08-07 21:12:35 +02:00
Bastian Venthur
94ad898a86 added logger messanges on deletion 2022-08-07 21:10:51 +02:00
Bastian Venthur
ff3f8101ad added test 2022-08-06 22:29:48 +02:00
Bastian Venthur
8c0e69b2f4 Delete files that should not be in dest-dir 2022-08-06 21:55:09 +02:00
8 changed files with 59 additions and 7 deletions

View File

@@ -1,5 +1,9 @@
# Changelog # Changelog
## [2.2.1] -- 2023-11-11
* fixed `suggests` to blag-doc
## [2.2.0] -- 2023-11-05 ## [2.2.0] -- 2023-11-05
* switched from flake8 to ruff * switched from flake8 to ruff

View File

@@ -218,6 +218,7 @@ def build(args: argparse.Namespace) -> None:
""" """
os.makedirs(f"{args.output_dir}", exist_ok=True) os.makedirs(f"{args.output_dir}", exist_ok=True)
convertibles = [] convertibles = []
known_targets = []
for root, dirnames, filenames in os.walk(args.input_dir): for root, dirnames, filenames in os.walk(args.input_dir):
for filename in filenames: for filename in filenames:
rel_src = os.path.relpath( rel_src = os.path.relpath(
@@ -229,15 +230,22 @@ def build(args: argparse.Namespace) -> None:
rel_dst = rel_src rel_dst = rel_src
rel_dst = rel_dst[:-3] + ".html" rel_dst = rel_dst[:-3] + ".html"
convertibles.append((rel_src, rel_dst)) convertibles.append((rel_src, rel_dst))
known_targets.append(
os.path.abspath(f"{args.output_dir}/{rel_dst}")
)
else: else:
shutil.copy( shutil.copy(
f"{args.input_dir}/{rel_src}", f"{args.input_dir}/{rel_src}",
f"{args.output_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: for dirname in dirnames:
# all directories are copied into the output directory # all directories are copied into the output directory
path = os.path.relpath(f"{root}/{dirname}", start=args.input_dir) path = os.path.relpath(f"{root}/{dirname}", start=args.input_dir)
os.makedirs(f"{args.output_dir}/{path}", exist_ok=True) 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 # copy static files over
logger.info("Copying static files.") logger.info("Copying static files.")
@@ -273,6 +281,24 @@ def build(args: argparse.Namespace) -> None:
article_template, 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( generate_feed(
articles, articles,
args.output_dir, args.output_dir,

View File

@@ -1,3 +1,3 @@
"""Version information for the blag package.""" """Version information for the blag package."""
__VERSION__ = "2.2.0" __VERSION__ = "2.2.1"

6
debian/changelog vendored
View File

@@ -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 blag (2.2.0) unstable; urgency=medium
* switched from flake8 to ruff * switched from flake8 to ruff

2
debian/control vendored
View File

@@ -31,7 +31,7 @@ Depends:
${python3:Depends}, ${python3:Depends},
${misc:Depends}, ${misc:Depends},
Suggests: Suggests:
python-blag-doc, blag-doc,
Description: Blog-aware, static site generator Description: Blog-aware, static site generator
Blag is a blog-aware, static site generator, written in Python. It supports Blag is a blog-aware, static site generator, written in Python. It supports
the following features: the following features:

View File

@@ -1,11 +1,11 @@
build==1.0.3 build==1.0.3
mkdocs==1.5.3 mkdocs==1.5.3
mkdocs-material==9.4.6 mkdocs-material==9.4.8
mkdocstrings[python]==0.23.0 mkdocstrings[python]==0.23.0
twine==4.0.2 twine==4.0.2
wheel==0.41.2 wheel==0.41.3
pytest==7.4.3 pytest==7.4.3
pytest-cov==4.1.0 pytest-cov==4.1.0
ruff==0.1.3 ruff==0.1.5
mypy==1.6.1 mypy==1.6.1
types-markdown==3.5.0.0 types-markdown==3.5.0.1

View File

@@ -1,4 +1,4 @@
markdown==3.5 markdown==3.5.1
feedgenerator==2.1.0 feedgenerator==2.1.0
jinja2==3.1.2 jinja2==3.1.2
pygments==2.16.1 pygments==2.16.1

View File

@@ -312,6 +312,22 @@ foo bar
assert os.path.exists(f"{args.output_dir}/tags/bar.html") 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( @pytest.mark.parametrize(
"template", "template",
[ [