mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
replace the toml library with tomli
This commit is contained in:
parent
8d4982d440
commit
5e60a1dc86
10 changed files with 20 additions and 19 deletions
2
.github/workflows/mypy.yaml
vendored
2
.github/workflows/mypy.yaml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
|||
${{ runner.os }}-${{ env.cache-name }}-
|
||||
${{ runner.os }}-cache-pip-
|
||||
- name: Install deps
|
||||
run: pip3 install -U tornado pytest pytest-asyncio pytest-httpbin flaky structlog toml aiohttp httpx mypy
|
||||
run: pip3 install -U tornado pytest pytest-asyncio pytest-httpbin flaky structlog tomli aiohttp httpx mypy
|
||||
- name: Run mypy for --install-types
|
||||
run: PATH=$HOME/.local/bin:$PATH mypy nvchecker nvchecker_source tests
|
||||
continue-on-error: true
|
||||
|
|
2
.github/workflows/tests.yaml
vendored
2
.github/workflows/tests.yaml
vendored
|
@ -44,7 +44,7 @@ jobs:
|
|||
sudo apt update
|
||||
sudo apt install -y libcurl4-openssl-dev
|
||||
- name: Install Python deps
|
||||
run: pip install -U ${{ matrix.deps }} pytest pytest-asyncio pytest-httpbin flaky structlog toml appdirs lxml
|
||||
run: pip install -U ${{ matrix.deps }} pytest pytest-asyncio pytest-httpbin flaky structlog tomli appdirs lxml
|
||||
- name: Decrypt keys
|
||||
env:
|
||||
KEY: ${{ secrets.KEY }}
|
||||
|
|
|
@ -24,7 +24,7 @@ This is the version 2.0 branch. For the old version 1.x, please switch to the ``
|
|||
Dependency
|
||||
----------
|
||||
- Python 3.7+
|
||||
- Python library: structlog, toml, appdirs
|
||||
- Python library: structlog, tomli, appdirs
|
||||
- One of these Python library combinations (ordered by preference):
|
||||
|
||||
* tornado + pycurl
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
toml
|
||||
tomli
|
||||
structlog
|
||||
appdirs
|
||||
tornado>=6
|
||||
|
|
|
@ -18,7 +18,7 @@ This is the version 2.0 branch. For the old version 1.x, please switch to the ``
|
|||
Dependency
|
||||
----------
|
||||
- Python 3.7+
|
||||
- Python library: structlog, toml, appdirs
|
||||
- Python library: structlog, tomli, appdirs
|
||||
- One of these Python library combinations (ordered by preference):
|
||||
|
||||
* tornado + pycurl
|
||||
|
@ -907,5 +907,5 @@ Extending
|
|||
It's possible to extend the supported sources by writing
|
||||
plugins. See :doc:`plugin` for documentation.
|
||||
|
||||
.. _Pacman: https://wiki.archlinux.org/index.php/Pacman
|
||||
.. _Pacman: https://wiki.archlinux.org/title/Pacman
|
||||
.. _toml: https://toml.io/
|
||||
|
|
|
@ -21,7 +21,7 @@ import contextvars
|
|||
import json
|
||||
|
||||
import structlog
|
||||
import toml
|
||||
import tomli
|
||||
import appdirs
|
||||
|
||||
from .lib import nicelogger
|
||||
|
@ -156,8 +156,9 @@ def load_file(
|
|||
use_keymanager: bool,
|
||||
) -> Tuple[Entries, Options]:
|
||||
try:
|
||||
config = toml.load(file)
|
||||
except (OSError, toml.TomlDecodeError) as e:
|
||||
with open(file, 'rb') as f:
|
||||
config = tomli.load(f)
|
||||
except (OSError, tomli.TOMLDecodeError) as e:
|
||||
raise FileLoadError('version configuration file', file, e)
|
||||
|
||||
ver_files: Optional[Tuple[Path, Path]] = None
|
||||
|
|
|
@ -14,7 +14,7 @@ from pathlib import Path
|
|||
import contextvars
|
||||
import abc
|
||||
|
||||
import toml
|
||||
import tomli
|
||||
import structlog
|
||||
|
||||
from .httpclient import session
|
||||
|
@ -55,9 +55,9 @@ class KeyManager:
|
|||
) -> None:
|
||||
if file is not None:
|
||||
try:
|
||||
with file.open() as f:
|
||||
keys = toml.load(f)['keys']
|
||||
except (OSError, toml.TomlDecodeError) as e:
|
||||
with file.open('rb') as f:
|
||||
keys = tomli.load(f)['keys']
|
||||
except (OSError, tomli.TOMLDecodeError) as e:
|
||||
raise FileLoadError('keyfile', str(file), e)
|
||||
else:
|
||||
keys = {}
|
||||
|
|
2
setup.py
2
setup.py
|
@ -21,7 +21,7 @@ setup(
|
|||
zip_safe = True,
|
||||
|
||||
packages = find_namespace_packages(exclude=['tests', 'build*', 'docs*']),
|
||||
install_requires = ['setuptools; python_version<"3.8"', 'toml', 'structlog', 'appdirs', 'tornado>=6', 'pycurl'],
|
||||
install_requires = ['setuptools; python_version<"3.8"', 'tomli', 'structlog', 'appdirs', 'tornado>=6', 'pycurl'],
|
||||
extras_require = {
|
||||
'vercmp': ['pyalpm'],
|
||||
'pypi': ['packaging'],
|
||||
|
|
|
@ -6,7 +6,7 @@ import structlog
|
|||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import toml
|
||||
import tomli
|
||||
import pytest
|
||||
|
||||
from nvchecker import core
|
||||
|
@ -52,7 +52,7 @@ async def get_version():
|
|||
@pytest.fixture(scope="module")
|
||||
async def run_str():
|
||||
async def __call__(str):
|
||||
entries = toml.loads(str)
|
||||
entries = tomli.loads(str)
|
||||
newvers = await run(entries)
|
||||
return newvers.popitem()[1]
|
||||
|
||||
|
@ -61,19 +61,19 @@ async def run_str():
|
|||
@pytest.fixture(scope="module")
|
||||
async def run_str_multi():
|
||||
async def __call__(str):
|
||||
entries = toml.loads(str)
|
||||
entries = tomli.loads(str)
|
||||
newvers = await run(entries)
|
||||
return newvers
|
||||
|
||||
return __call__
|
||||
|
||||
loop = asyncio.new_event_loop()
|
||||
@pytest.fixture(scope="session")
|
||||
def event_loop(request):
|
||||
"""Override pytest-asyncio's event_loop fixture,
|
||||
Don't create an instance of the default event loop for each test case.
|
||||
We need the same ioloop across tests for the aiohttp support.
|
||||
"""
|
||||
loop = asyncio.get_event_loop()
|
||||
yield loop
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
|
|
|
@ -31,5 +31,5 @@ async def test_archpkg_provided_strip(get_version):
|
|||
"source": "archpkg",
|
||||
"provided": "libjsoncpp.so",
|
||||
"strip_release": True,
|
||||
}) == "24"
|
||||
}) == "25"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue