mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
atomicwrites: remove dependency on abandoned library
This commit is contained in:
parent
12a06917db
commit
8b063c39cb
9 changed files with 35 additions and 10 deletions
|
|
@ -10,7 +10,6 @@ packages:
|
||||||
- python-installer
|
- python-installer
|
||||||
- python-setuptools-scm
|
- python-setuptools-scm
|
||||||
# Runtime dependencies:
|
# Runtime dependencies:
|
||||||
- python-atomicwrites
|
|
||||||
- python-click
|
- python-click
|
||||||
- python-click-log
|
- python-click-log
|
||||||
- python-click-threading
|
- python-click-threading
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ repos:
|
||||||
- types-setuptools
|
- types-setuptools
|
||||||
- types-docutils
|
- types-docutils
|
||||||
- types-requests
|
- types-requests
|
||||||
- types-atomicwrites
|
|
||||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||||
rev: 'v0.2.2'
|
rev: 'v0.2.2'
|
||||||
hooks:
|
hooks:
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,11 @@ Package maintainers and users who have to manually update their installation
|
||||||
may want to subscribe to `GitHub's tag feed
|
may want to subscribe to `GitHub's tag feed
|
||||||
<https://github.com/pimutils/vdirsyncer/tags.atom>`_.
|
<https://github.com/pimutils/vdirsyncer/tags.atom>`_.
|
||||||
|
|
||||||
|
Version 0.19.4
|
||||||
|
==============
|
||||||
|
|
||||||
|
- Remove dependency on abandoned ``atomicwrites`` library.
|
||||||
|
|
||||||
Version 0.19.3
|
Version 0.19.3
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -16,8 +16,6 @@ requirements = [
|
||||||
"click>=5.0,<9.0",
|
"click>=5.0,<9.0",
|
||||||
"click-log>=0.3.0, <0.5.0",
|
"click-log>=0.3.0, <0.5.0",
|
||||||
"requests >=2.20.0",
|
"requests >=2.20.0",
|
||||||
# https://github.com/untitaker/python-atomicwrites/commit/4d12f23227b6a944ab1d99c507a69fdbc7c9ed6d # noqa
|
|
||||||
"atomicwrites>=0.1.7",
|
|
||||||
"aiohttp>=3.8.2,<4.0.0",
|
"aiohttp>=3.8.2,<4.0.0",
|
||||||
"aiostream>=0.4.3,<0.5.0",
|
"aiostream>=0.4.3,<0.5.0",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ from typing import Any
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import click
|
import click
|
||||||
from atomicwrites import atomic_write
|
|
||||||
|
|
||||||
from .. import BUGTRACKER_HOME
|
from .. import BUGTRACKER_HOME
|
||||||
from .. import DOCS_HOME
|
from .. import DOCS_HOME
|
||||||
|
|
@ -21,6 +20,7 @@ from ..sync.exceptions import PartialSync
|
||||||
from ..sync.exceptions import StorageEmpty
|
from ..sync.exceptions import StorageEmpty
|
||||||
from ..sync.exceptions import SyncConflict
|
from ..sync.exceptions import SyncConflict
|
||||||
from ..sync.status import SqliteStatus
|
from ..sync.status import SqliteStatus
|
||||||
|
from ..utils import atomic_write
|
||||||
from ..utils import expand_path
|
from ..utils import expand_path
|
||||||
from ..utils import get_storage_init_args
|
from ..utils import get_storage_init_args
|
||||||
from . import cli_logger
|
from . import cli_logger
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,8 @@ import logging
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from atomicwrites import atomic_write
|
|
||||||
|
|
||||||
from .. import exceptions
|
from .. import exceptions
|
||||||
|
from ..utils import atomic_write
|
||||||
from ..utils import checkdir
|
from ..utils import checkdir
|
||||||
from ..utils import expand_path
|
from ..utils import expand_path
|
||||||
from ..utils import generate_href
|
from ..utils import generate_href
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ from threading import Thread
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import click
|
import click
|
||||||
from atomicwrites import atomic_write
|
|
||||||
|
|
||||||
from .. import exceptions
|
from .. import exceptions
|
||||||
|
from ..utils import atomic_write
|
||||||
from ..utils import checkdir
|
from ..utils import checkdir
|
||||||
from ..utils import expand_path
|
from ..utils import expand_path
|
||||||
from ..utils import open_graphical_browser
|
from ..utils import open_graphical_browser
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,8 @@ import logging
|
||||||
import os
|
import os
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
|
|
||||||
from atomicwrites import atomic_write
|
|
||||||
|
|
||||||
from .. import exceptions
|
from .. import exceptions
|
||||||
|
from ..utils import atomic_write
|
||||||
from ..utils import checkfile
|
from ..utils import checkfile
|
||||||
from ..utils import expand_path
|
from ..utils import expand_path
|
||||||
from ..utils import get_etag_from_file
|
from ..utils import get_etag_from_file
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import contextlib
|
||||||
import functools
|
import functools
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
import uuid
|
import uuid
|
||||||
from inspect import getfullargspec
|
from inspect import getfullargspec
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
@ -220,3 +222,27 @@ def open_graphical_browser(url, new=0, autoraise=True):
|
||||||
return
|
return
|
||||||
|
|
||||||
raise RuntimeError("No graphical browser found. Please open the URL " "manually.")
|
raise RuntimeError("No graphical browser found. Please open the URL " "manually.")
|
||||||
|
|
||||||
|
|
||||||
|
@contextlib.contextmanager
|
||||||
|
def atomic_write(dest, mode="wb", overwrite=False):
|
||||||
|
if "w" not in mode:
|
||||||
|
raise RuntimeError("`atomic_write` requires write access")
|
||||||
|
|
||||||
|
fd, src = tempfile.mkstemp(prefix=os.path.basename(dest), dir=os.path.dirname(dest))
|
||||||
|
file = os.fdopen(fd, mode=mode)
|
||||||
|
|
||||||
|
try:
|
||||||
|
yield file
|
||||||
|
except Exception:
|
||||||
|
os.unlink(src)
|
||||||
|
raise
|
||||||
|
else:
|
||||||
|
file.flush()
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
if overwrite:
|
||||||
|
os.rename(src, dest)
|
||||||
|
else:
|
||||||
|
os.link(src, dest)
|
||||||
|
os.unlink(src)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue