kisstdlib 0.0.6__tar.gz → 0.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/PKG-INFO +1 -1
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/os.py +23 -25
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib.egg-info/PKG-INFO +1 -1
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/pyproject.toml +1 -1
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/LICENSE.txt +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/README.md +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/__init__.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/argparse/__init__.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/argparse/better.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/failure.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/io/__init__.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/io/base.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/io/encoder.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/io/stdio.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/io/wrapper.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/logging.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/parsing.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/py.typed +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/pyrepr.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/sorted.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/tariter.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/time.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/util.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib.egg-info/SOURCES.txt +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib.egg-info/dependency_links.txt +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib.egg-info/entry_points.txt +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib.egg-info/requires.txt +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib.egg-info/top_level.txt +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib_bin/describe_dir.py +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/setup.cfg +0 -0
- {kisstdlib-0.0.6 → kisstdlib-0.0.7}/setup.py +0 -0
|
@@ -33,14 +33,9 @@ import stat as _stat
|
|
|
33
33
|
import sys as _sys
|
|
34
34
|
import typing as _t
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
try:
|
|
36
|
+
_posix = _sys.platform != "win32"
|
|
37
|
+
if _posix:
|
|
39
38
|
import fcntl as _fcntl
|
|
40
|
-
except ImportError:
|
|
41
|
-
pass
|
|
42
|
-
else:
|
|
43
|
-
_have_fcntl = True
|
|
44
39
|
|
|
45
40
|
|
|
46
41
|
def fsdecode_maybe(x: str | bytes) -> str:
|
|
@@ -266,7 +261,7 @@ def fsync_maybe(fd: int) -> None:
|
|
|
266
261
|
|
|
267
262
|
def fsync_path(path: str | bytes, flags: int = 0) -> None:
|
|
268
263
|
"""Run `os.fsync` on a given `path`."""
|
|
269
|
-
fd = _os.open(path, _os.O_RDWR | flags)
|
|
264
|
+
fd = _os.open(path, (_os.O_RDONLY | _os.O_CLOEXEC if _posix else _os.O_RDWR) | flags)
|
|
270
265
|
try:
|
|
271
266
|
_os.fsync(fd)
|
|
272
267
|
except OSError as exc:
|
|
@@ -305,8 +300,9 @@ class DeferredSync:
|
|
|
305
300
|
self.files = set()
|
|
306
301
|
|
|
307
302
|
if len(self.dirs) > 0:
|
|
308
|
-
|
|
309
|
-
|
|
303
|
+
if _posix:
|
|
304
|
+
for path in self.dirs:
|
|
305
|
+
fsync_path(path, _os.O_DIRECTORY)
|
|
310
306
|
self.dirs = set()
|
|
311
307
|
|
|
312
308
|
def finish(self) -> None:
|
|
@@ -339,12 +335,14 @@ def make_file(
|
|
|
339
335
|
_os.makedirs(dirname, exist_ok=True)
|
|
340
336
|
make_dst(dst_path)
|
|
341
337
|
|
|
342
|
-
if dsync is None:
|
|
343
|
-
fsync_path(dst_path)
|
|
344
|
-
fsync_path(dirname, _os.O_DIRECTORY)
|
|
345
|
-
else:
|
|
338
|
+
if dsync is not None:
|
|
346
339
|
dsync.files.add(dst_path)
|
|
347
340
|
dsync.dirs.add(dirname)
|
|
341
|
+
return
|
|
342
|
+
|
|
343
|
+
fsync_path(dst_path)
|
|
344
|
+
if _posix:
|
|
345
|
+
fsync_path(dirname, _os.O_DIRECTORY)
|
|
348
346
|
|
|
349
347
|
|
|
350
348
|
def atomic_make_file(
|
|
@@ -373,7 +371,12 @@ def atomic_make_file(
|
|
|
373
371
|
_os.makedirs(dirname, exist_ok=True)
|
|
374
372
|
make_dst(dst_part)
|
|
375
373
|
|
|
376
|
-
if
|
|
374
|
+
if dsync is not None:
|
|
375
|
+
dsync.replaces.append((dst_part, dst_path))
|
|
376
|
+
dsync.dirs.add(dirname)
|
|
377
|
+
return
|
|
378
|
+
|
|
379
|
+
if _posix:
|
|
377
380
|
dirfd = _os.open(dirname, _os.O_RDONLY | _os.O_DIRECTORY)
|
|
378
381
|
_fcntl.flock(dirfd, _fcntl.LOCK_EX)
|
|
379
382
|
|
|
@@ -382,17 +385,12 @@ def atomic_make_file(
|
|
|
382
385
|
if not allow_overwrites and _os.path.lexists(dst_path):
|
|
383
386
|
raise FileExistsError(_errno.EEXIST, _os.strerror(_errno.EEXIST), dst_path)
|
|
384
387
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
_os.fsync(dirfd)
|
|
390
|
-
else:
|
|
391
|
-
dsync.replaces.append((dst_part, dst_path))
|
|
392
|
-
if _have_fcntl:
|
|
393
|
-
dsync.dirs.add(dirname)
|
|
388
|
+
fsync_path(dst_part)
|
|
389
|
+
_os.replace(dst_part, dst_path)
|
|
390
|
+
if _posix:
|
|
391
|
+
_os.fsync(dirfd)
|
|
394
392
|
finally:
|
|
395
|
-
if
|
|
393
|
+
if _posix:
|
|
396
394
|
_fcntl.flock(dirfd, _fcntl.LOCK_UN)
|
|
397
395
|
_os.close(dirfd)
|
|
398
396
|
|
|
@@ -9,7 +9,7 @@ namespaces = true
|
|
|
9
9
|
"kisstdlib" = ["py.typed"]
|
|
10
10
|
[project]
|
|
11
11
|
name = "kisstdlib"
|
|
12
|
-
version = "0.0.
|
|
12
|
+
version = "0.0.7"
|
|
13
13
|
authors = [{ name = "Jan Malakhovski", email = "oxij@oxij.org" }]
|
|
14
14
|
description = "Keep It Simple STandarD LIBraries set for Python"
|
|
15
15
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|