diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dc1159cf9bd7d91aeb299c664bb5fc4fe6e8d951..5cd7a69e7e3ff50cb2c5f3a84ac5262482e4526b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,7 +11,7 @@ stages: # stage: build # needs: [] # script: -# - dnf install -y meson ninja-build pytest python3-flake8 python3-mypy python3-markdown python3-jinja2 python3-toml python3-typogrify +# - dnf install -y meson ninja-build pytest python3-flake8 python3-mypy python3-markdown python3-jinja2 python3-tomli python3-typogrify # - meson _build . # - meson test -C _build # @@ -31,7 +31,7 @@ pytest: stage: check needs: [] script: - - dnf install -y pytest python3-markdown python3-jinja2 python3-pygments python3-toml python3-typogrify + - dnf install -y pytest python3-markdown python3-jinja2 python3-pygments python3-tomli python3-typogrify - pytest --verbose flake8: diff --git a/gidocgen/config.py b/gidocgen/config.py index 1e003163853a9be718a775fc68916d116c9685ce..82f8211bed66a67e75b74a8d04438e9ed6e9ef46 100644 --- a/gidocgen/config.py +++ b/gidocgen/config.py @@ -3,7 +3,7 @@ import os import re -import toml +import tomli from urllib.parse import urljoin @@ -19,8 +19,9 @@ class GIDocConfig: if self._config_file is not None: try: log.debug(f"Reading configuration file: {self._config_file}") - self._config = toml.load(self._config_file) - except toml.TomlDecodeError as err: + with open(self._config_file, "rb") as f: + self._config = tomli.load(f) + except tomli.TOMLDecodeError as err: log.error(f"Invalid configuration file: {self._config_file}: {err}") @property @@ -219,8 +220,9 @@ class GITemplateConfig: self._config = {} try: log.debug(f"Reading template configuration file: {self._config_file}") - self._config = toml.load(self._config_file) - except toml.TomlDecodeError as err: + with open(self._config_file, "rb") as f: + self._config = tomli.load(f) + except tomli.TOMLDecodeError as err: log.error(f"Invalid template configuration file: {self._config_file}: {err}") @property diff --git a/meson.build b/meson.build index 7df553624d74fbf96f9ee5630e2d96362bb3fab4..7584259e7612fab438b92bf4c33e9da9a0f5f679 100644 --- a/meson.build +++ b/meson.build @@ -13,7 +13,7 @@ py = import('python').find_installation('python3', 'markdown', 'markupsafe', 'pygments', - 'toml', + 'tomli', 'typogrify', ], ) diff --git a/pyproject.toml b/pyproject.toml index e3dedbffedabbafad3ae3e47a8a24d3a3bd8ed80..d2a6baf1df42c65a6f8ed979ed3af295c16c77fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ Markdown = "^3" MarkupSafe = "^1" Pygments = "^2" Jinja2 = "^2" -toml = "^0" +tomli = ">=1,<3" typogrify = "^2" [tool.poetry.dev-dependencies] diff --git a/setup.cfg b/setup.cfg index 7b1955e145f37eb2601edf81137d8d99e47ba96e..e9563a48197add504da559275176ec81e035d883 100644 --- a/setup.cfg +++ b/setup.cfg @@ -52,7 +52,7 @@ install_requires = MarkupSafe Pygments jinja2 - toml + tomli typogrify [options.entry_points]