Update to 0.20.0

This commit is contained in:
Ben Boeckel 2025-08-28 21:19:25 -04:00
commit 7c091a3f8a
5 changed files with 7 additions and 178 deletions

1
.gitignore vendored
View file

@ -20,3 +20,4 @@
/vdirsyncer-0.18.0.tar.gz
/vdirsyncer-0.19.2.tar.gz
/vdirsyncer-0.19.3.tar.gz
/vdirsyncer-0.20.0.tar.gz

View file

@ -1,11 +0,0 @@
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,7 @@ requirements = [
# https://github.com/untitaker/python-atomicwrites/commit/4d12f23227b6a944ab1d99c507a69fdbc7c9ed6d # noqa
"atomicwrites>=0.1.7",
"aiohttp>=3.8.0,<4.0.0",
- "aiostream>=0.4.3,<0.5.0",
+ "aiostream>=0.4.3,<0.7.0",
]

View file

@ -1,161 +0,0 @@
diff --git a/.builds/tests-archlinux.yml b/.builds/tests-archlinux.yml
index b11fe30d2..494f6c73c 100644
--- a/.builds/tests-archlinux.yml
+++ b/.builds/tests-archlinux.yml
@@ -10,7 +10,6 @@ packages:
- python-installer
- python-setuptools-scm
# Runtime dependencies:
- - python-atomicwrites
- python-click
- python-click-log
- python-click-threading
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 7304056b9..6beb3a4ca 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -21,7 +21,6 @@ repos:
- types-setuptools
- types-docutils
- types-requests
- - types-atomicwrites
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.2.2'
hooks:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index b43a33de9..bc32cfda0 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -9,6 +9,11 @@ Package maintainers and users who have to manually update their installation
may want to subscribe to `GitHub's tag feed
<https://github.com/pimutils/vdirsyncer/tags.atom>`_.
+Version 0.19.4
+==============
+
+- Remove dependency on abandoned ``atomicwrites`` library.
+
Version 0.19.3
==============
diff --git a/setup.py b/setup.py
index 47f45a4cc..30cdc9c3b 100644
--- a/setup.py
+++ b/setup.py
@@ -16,8 +16,6 @@
"click>=5.0,<9.0",
"click-log>=0.3.0, <0.5.0",
"requests >=2.20.0",
- # https://github.com/untitaker/python-atomicwrites/commit/4d12f23227b6a944ab1d99c507a69fdbc7c9ed6d # noqa
- "atomicwrites>=0.1.7",
"aiohttp>=3.8.0,<4.0.0",
"aiostream>=0.4.3,<0.7.0",
]
diff --git a/vdirsyncer/cli/utils.py b/vdirsyncer/cli/utils.py
index 428a9c9a3..97f48edc2 100644
--- a/vdirsyncer/cli/utils.py
+++ b/vdirsyncer/cli/utils.py
@@ -10,7 +10,6 @@
import aiohttp
import click
-from atomicwrites import atomic_write
from .. import BUGTRACKER_HOME
from .. import DOCS_HOME
@@ -21,6 +20,7 @@
from ..sync.exceptions import StorageEmpty
from ..sync.exceptions import SyncConflict
from ..sync.status import SqliteStatus
+from ..utils import atomic_write
from ..utils import expand_path
from ..utils import get_storage_init_args
from . import cli_logger
diff --git a/vdirsyncer/storage/filesystem.py b/vdirsyncer/storage/filesystem.py
index ec0ab52e3..8785acc30 100644
--- a/vdirsyncer/storage/filesystem.py
+++ b/vdirsyncer/storage/filesystem.py
@@ -5,9 +5,8 @@
import os
import subprocess
-from atomicwrites import atomic_write
-
from .. import exceptions
+from ..utils import atomic_write
from ..utils import checkdir
from ..utils import expand_path
from ..utils import generate_href
diff --git a/vdirsyncer/storage/google.py b/vdirsyncer/storage/google.py
index 93b784872..ed496a06b 100644
--- a/vdirsyncer/storage/google.py
+++ b/vdirsyncer/storage/google.py
@@ -11,9 +11,9 @@
import aiohttp
import click
-from atomicwrites import atomic_write
from .. import exceptions
+from ..utils import atomic_write
from ..utils import checkdir
from ..utils import expand_path
from ..utils import open_graphical_browser
diff --git a/vdirsyncer/storage/singlefile.py b/vdirsyncer/storage/singlefile.py
index 982763295..41e7e330e 100644
--- a/vdirsyncer/storage/singlefile.py
+++ b/vdirsyncer/storage/singlefile.py
@@ -8,9 +8,8 @@
import os
from typing import Iterable
-from atomicwrites import atomic_write
-
from .. import exceptions
+from ..utils import atomic_write
from ..utils import checkfile
from ..utils import expand_path
from ..utils import get_etag_from_file
diff --git a/vdirsyncer/utils.py b/vdirsyncer/utils.py
index 2e0fd9ce4..657d2d6a5 100644
--- a/vdirsyncer/utils.py
+++ b/vdirsyncer/utils.py
@@ -1,8 +1,10 @@
from __future__ import annotations
+import contextlib
import functools
import os
import sys
+import tempfile
import uuid
from inspect import getfullargspec
from typing import Callable
@@ -220,3 +222,27 @@ def open_graphical_browser(url, new=0, autoraise=True):
return
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)

View file

@ -1 +1,2 @@
SHA512 (vdirsyncer-0.19.3.tar.gz) = 8651282302ad62b2bb6f7655429492dcff959cedc25e932d2e72deb2bb54406c6b5333fecdb14ae8c08ba3c20602856e8466198e24caee298fc9a08545fd3751
SHA512 (vdirsyncer-0.20.0.tar.gz) = 8499440ce8ba036d40f5bbff9d7cadb485be8bb2419d1fbad947f244259dabba9f2527ffff24298f697dd10e6ccd39155ea9547a480c584f64da0eadb993dad7

View file

@ -9,18 +9,14 @@
%global _docdir_fmt %{name}
Name: vdirsyncer
Version: 0.19.3
Release: 6%{?dist}
Version: 0.20.0
Release: 1%{?dist}
Summary: %{sum}
License: BSD-3-Clause
URL: https://github.com/pimutils/%{name}
Source0: %{pypi_source}
Patch0: aiostream-version-bump.patch
# https://github.com/pimutils/vdirsyncer/commit/8b063c39cb3e26a2beef5b6beed7e99c9e9641ac
Patch1: remove-atomicwrites-dep.patch
BuildArch: noarch
Obsoletes: python2-%{srcname} <= 0.12.1
@ -150,6 +146,9 @@ sh build.sh tests
%doc docs/_build/html docs/_build/text
%changelog
* Thu Aug 28 2025 Ben Boeckel <fedora@me.benboeckel.net> - 0.20.0-1
- Update to 0.20.0
* Mon Aug 18 2025 Ben Boeckel <fedora@me.benboeckel.net> - 0.19.3-6
- Remove atomicwrites dependency (see rhbz#2385436)