Skip to content

Commit

Permalink
Remove deprecation warning (#131)
Browse files Browse the repository at this point in the history
* Remove usage of _filter_files

According to the logs this function is deprecated and also filtering of
files can have an impact to some projects. By default it's not possible
to add dot directories, dot files or the folder templates to the
documentation.

INFO    -  DeprecationWarning: warning_filter doesn't do anything since MkDocs 1.2 and will be removed soon. All messages on the `mkdocs` logger get counted automatically.
             File "xxx/.venv/lib/python3.9/site-packages/mkdocs_multirepo_plugin/util.py", line 10, in <module>
               from mkdocs.utils import warning_filter
             File "xxx/.venv/lib/python3.9/site-packages/mkdocs/utils/__init__.py", line 453, in __getattr__
               warnings.warn(

* Remove usage of warning_filter

According to the logs this function is deprecated (a NOP).

* Update CHANGELOG.md

* Update pyproject.toml

* Update CHANGELOG.md

Co-authored-by: Joseph Doiron <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Joseph Doiron <[email protected]>

* Update pyproject.toml

Co-authored-by: Joseph Doiron <[email protected]>

* CHANGELOG.md aktualisieren

Co-authored-by: Joseph Doiron <[email protected]>

* Update CHANGELOG.md as requested

---------

Co-authored-by: Michael Foerderer (F29233) <[email protected]>
Co-authored-by: Joseph Doiron <[email protected]>
  • Loading branch information
3 people authored Jan 19, 2024
1 parent 5f5da14 commit 3ce1085
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 16 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## 0.7 (Not Releases)
## 0.7.0

### Prs in Release

- [Fix section case](https://github.com/jdoiro3/mkdocs-multirepo-plugin/pull/124)
- [Remove deprecation warning](https://github.com/jdoiro3/mkdocs-multirepo-plugin/pull/131)

## 0.6.3

Expand Down
11 changes: 1 addition & 10 deletions mkdocs_multirepo_plugin/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import Callable, Dict, List, Optional, Tuple, Union

from mkdocs.config import Config
from mkdocs.structure.files import File, Files, _filter_paths, _sort_files
from mkdocs.structure.files import File, Files, _sort_files
from mkdocs.utils import yaml_load
from slugify import slugify

Expand Down Expand Up @@ -433,25 +433,16 @@ async def batch_import(
def get_files(config: Config, repo: DocsRepo) -> Files:
"""Walk the `docs_dir` and return a Files collection."""
files = []
exclude = [".*", "/templates"]

for source_dir, dirnames, filenames in os.walk(repo.location, followlinks=True):
relative_dir = os.path.relpath(source_dir, repo.temp_dir)

for dirname in list(dirnames):
path = os.path.normpath(os.path.join(relative_dir, dirname))
# Skip any excluded directories
if _filter_paths(basename=dirname, path=path, is_dir=True, exclude=exclude):
dirnames.remove(dirname)
dirnames.sort()

for filename in _sort_files(filenames):
path = os.path.normpath(os.path.join(relative_dir, filename))
# Skip any excluded files
if _filter_paths(
basename=filename, path=path, is_dir=False, exclude=exclude
):
continue
# Skip README.md if an index file also exists in dir
if filename == "README.md" and "index.md" in filenames:
log.warning(
Expand Down
4 changes: 1 addition & 3 deletions mkdocs_multirepo_plugin/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
from sys import platform, version_info
from typing import Any, Dict

from mkdocs.utils import warning_filter

# used for getting Git version
GitVersion = namedtuple("GitVersion", "major minor")
LINUX_LIKE_PLATFORMS = ["linux", "linux2", "darwin"]

# This is a global variable imported by other modules
log = logging.getLogger("mkdocs.plugins." + __name__)
log.addFilter(warning_filter)


class ImportDocsException(Exception):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mkdocs-multirepo-plugin"
version = "0.6.3"
version = "0.7.0"
description = "Build documentation in multiple repos into one site."
authors = ["jdoiro3 <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 3ce1085

Please sign in to comment.