mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-10 13:54:17 +00:00
Merge branch 'master' of github.com:deadc0de6/dotdrop
This commit is contained in:
@@ -26,7 +26,11 @@ import io
|
|||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from ruamel.yaml import YAML as yaml
|
from ruamel.yaml import YAML as yaml
|
||||||
import toml
|
try:
|
||||||
|
import tomllib
|
||||||
|
except ImportError:
|
||||||
|
import tomli as tomllib
|
||||||
|
import tomli_w
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from dotdrop.version import __version__ as VERSION
|
from dotdrop.version import __version__ as VERSION
|
||||||
@@ -1345,7 +1349,7 @@ class CfgYaml:
|
|||||||
"""load from toml"""
|
"""load from toml"""
|
||||||
with open(path, 'r', encoding='utf8') as file:
|
with open(path, 'r', encoding='utf8') as file:
|
||||||
data = file.read()
|
data = file.read()
|
||||||
content = toml.loads(data)
|
content = tomllib.loads(data)
|
||||||
# handle inexistent dotfiles/profiles
|
# handle inexistent dotfiles/profiles
|
||||||
# since toml doesn't have a nul/nil/null/none
|
# since toml doesn't have a nul/nil/null/none
|
||||||
if cls.key_dotfiles not in content:
|
if cls.key_dotfiles not in content:
|
||||||
@@ -1375,7 +1379,7 @@ class CfgYaml:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def __toml_dump(cls, content, file):
|
def __toml_dump(cls, content, file):
|
||||||
"""dump to toml"""
|
"""dump to toml"""
|
||||||
toml.dump(content, file)
|
file.write(tomli_w.dumps(content))
|
||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
# templating
|
# templating
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import filecmp
|
|||||||
import itertools
|
import itertools
|
||||||
import shutil
|
import shutil
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
import requests
|
import requests
|
||||||
from packaging import version
|
from packaging import version
|
||||||
|
|
||||||
@@ -393,12 +394,22 @@ def dependencies_met():
|
|||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
raise UnmetDependency(err) from exc
|
raise UnmetDependency(err) from exc
|
||||||
|
|
||||||
# toml
|
# tomli
|
||||||
name = 'toml'
|
if sys.version_info < (3, 11):
|
||||||
|
name = 'tomli'
|
||||||
|
err = f'missing python module \"{name}\"'
|
||||||
|
try:
|
||||||
|
import tomli
|
||||||
|
assert tomli
|
||||||
|
except ImportError as exc:
|
||||||
|
raise UnmetDependency(err) from exc
|
||||||
|
|
||||||
|
# tomli_w
|
||||||
|
name = 'tomli_w'
|
||||||
err = f'missing python module \"{name}\"'
|
err = f'missing python module \"{name}\"'
|
||||||
try:
|
try:
|
||||||
import toml
|
import tomli_w
|
||||||
assert toml
|
assert tomli_w
|
||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
raise UnmetDependency(err) from exc
|
raise UnmetDependency(err) from exc
|
||||||
|
|
||||||
|
|||||||
2
packages/arch-dotdrop-git/PKGBUILD
vendored
2
packages/arch-dotdrop-git/PKGBUILD
vendored
@@ -9,7 +9,7 @@ arch=('any')
|
|||||||
url="https://github.com/deadc0de6/dotdrop"
|
url="https://github.com/deadc0de6/dotdrop"
|
||||||
license=('GPL')
|
license=('GPL')
|
||||||
groups=()
|
groups=()
|
||||||
depends=('python' 'python-setuptools' 'python-jinja' 'python-docopt' 'python-ruamel-yaml' 'python-magic' 'python-requests' 'python-packaging' 'python-toml' 'python-distro')
|
depends=('python' 'python-setuptools' 'python-jinja' 'python-docopt' 'python-ruamel-yaml' 'python-magic' 'python-requests' 'python-packaging' 'python-tomli-w' 'python-distro')
|
||||||
makedepends=('git')
|
makedepends=('git')
|
||||||
provides=(dotdrop)
|
provides=(dotdrop)
|
||||||
conflicts=(dotdrop)
|
conflicts=(dotdrop)
|
||||||
|
|||||||
2
packages/arch-dotdrop/PKGBUILD
vendored
2
packages/arch-dotdrop/PKGBUILD
vendored
@@ -8,7 +8,7 @@ arch=('any')
|
|||||||
url="https://github.com/deadc0de6/dotdrop"
|
url="https://github.com/deadc0de6/dotdrop"
|
||||||
license=('GPL')
|
license=('GPL')
|
||||||
groups=()
|
groups=()
|
||||||
depends=('python' 'python-setuptools' 'python-jinja' 'python-docopt' 'python-ruamel-yaml' 'python-magic' 'python-requests' 'python-packaging' 'python-toml' 'python-distro')
|
depends=('python' 'python-setuptools' 'python-jinja' 'python-docopt' 'python-ruamel-yaml' 'python-magic' 'python-requests' 'python-packaging' 'python-tomli-w' 'python-distro')
|
||||||
makedepends=('git')
|
makedepends=('git')
|
||||||
source=("git+https://github.com/deadc0de6/dotdrop.git#tag=v${pkgver}")
|
source=("git+https://github.com/deadc0de6/dotdrop.git#tag=v${pkgver}")
|
||||||
md5sums=('SKIP')
|
md5sums=('SKIP')
|
||||||
|
|||||||
3
requirements.txt
vendored
3
requirements.txt
vendored
@@ -4,5 +4,6 @@ ruamel.yaml; python_version > '3.5'
|
|||||||
python-magic; python_version > '3.5'
|
python-magic; python_version > '3.5'
|
||||||
packaging; python_version > '3.5'
|
packaging; python_version > '3.5'
|
||||||
requests; python_version > '3.5'
|
requests; python_version > '3.5'
|
||||||
toml; python_version > '3.5'
|
tomli; python_version > '3.5' and python_version < '3.11'
|
||||||
|
tomli_w; python_version > '3.5'
|
||||||
distro; python_version > '3.5'
|
distro; python_version > '3.5'
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ convert yaml config file to toml
|
|||||||
import sys
|
import sys
|
||||||
# pip3 install ruamel.yaml
|
# pip3 install ruamel.yaml
|
||||||
from ruamel.yaml import YAML as yaml
|
from ruamel.yaml import YAML as yaml
|
||||||
# pip3 install toml
|
# pip3 install tomli_w
|
||||||
import toml
|
import tomli_w
|
||||||
|
|
||||||
|
|
||||||
def yaml_load(path):
|
def yaml_load(path):
|
||||||
@@ -42,7 +42,7 @@ def replace_none(content):
|
|||||||
|
|
||||||
def toml_dump(content):
|
def toml_dump(content):
|
||||||
"""dump toml to stdout"""
|
"""dump toml to stdout"""
|
||||||
return toml.dumps(content)
|
return tomli_w.dumps(content)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=C0103
|
# pylint: disable=C0103
|
||||||
|
|||||||
3
setup.py
3
setup.py
@@ -50,7 +50,8 @@ setup(
|
|||||||
install_requires=[
|
install_requires=[
|
||||||
'docopt', 'Jinja2', 'ruamel.yaml',
|
'docopt', 'Jinja2', 'ruamel.yaml',
|
||||||
'python-magic', 'packaging', 'requests',
|
'python-magic', 'packaging', 'requests',
|
||||||
'toml', 'distro'],
|
'tomli; python_version < "3.11"',
|
||||||
|
'tomli_w', 'distro'],
|
||||||
|
|
||||||
extras_require={
|
extras_require={
|
||||||
'dev': ['check-manifest'],
|
'dev': ['check-manifest'],
|
||||||
|
|||||||
Reference in New Issue
Block a user