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.
Files changed (31) hide show
  1. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/PKG-INFO +1 -1
  2. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/os.py +23 -25
  3. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib.egg-info/PKG-INFO +1 -1
  4. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/pyproject.toml +1 -1
  5. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/LICENSE.txt +0 -0
  6. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/README.md +0 -0
  7. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/__init__.py +0 -0
  8. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/argparse/__init__.py +0 -0
  9. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/argparse/better.py +0 -0
  10. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/failure.py +0 -0
  11. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/io/__init__.py +0 -0
  12. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/io/base.py +0 -0
  13. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/io/encoder.py +0 -0
  14. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/io/stdio.py +0 -0
  15. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/io/wrapper.py +0 -0
  16. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/logging.py +0 -0
  17. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/parsing.py +0 -0
  18. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/py.typed +0 -0
  19. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/pyrepr.py +0 -0
  20. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/sorted.py +0 -0
  21. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/tariter.py +0 -0
  22. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/time.py +0 -0
  23. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib/util.py +0 -0
  24. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib.egg-info/SOURCES.txt +0 -0
  25. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib.egg-info/dependency_links.txt +0 -0
  26. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib.egg-info/entry_points.txt +0 -0
  27. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib.egg-info/requires.txt +0 -0
  28. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib.egg-info/top_level.txt +0 -0
  29. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/kisstdlib_bin/describe_dir.py +0 -0
  30. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/setup.cfg +0 -0
  31. {kisstdlib-0.0.6 → kisstdlib-0.0.7}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kisstdlib
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: Keep It Simple STandarD LIBraries set for Python
5
5
  Author-email: Jan Malakhovski <oxij@oxij.org>
6
6
  Project-URL: Homepage, https://oxij.org/software/kisstdlib/
@@ -33,14 +33,9 @@ import stat as _stat
33
33
  import sys as _sys
34
34
  import typing as _t
35
35
 
36
-
37
- _have_fcntl = False
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
- for path in self.dirs:
309
- fsync_path(path, _os.O_DIRECTORY)
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 _have_fcntl:
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
- if dsync is None:
386
- fsync_path(dst_part)
387
- _os.replace(dst_part, dst_path)
388
- if _have_fcntl:
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 _have_fcntl:
393
+ if _posix:
396
394
  _fcntl.flock(dirfd, _fcntl.LOCK_UN)
397
395
  _os.close(dirfd)
398
396
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kisstdlib
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: Keep It Simple STandarD LIBraries set for Python
5
5
  Author-email: Jan Malakhovski <oxij@oxij.org>
6
6
  Project-URL: Homepage, https://oxij.org/software/kisstdlib/
@@ -9,7 +9,7 @@ namespaces = true
9
9
  "kisstdlib" = ["py.typed"]
10
10
  [project]
11
11
  name = "kisstdlib"
12
- version = "0.0.6"
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