python-fsutil 0.15.0__py3-none-any.whl → 0.16.1__py3-none-any.whl

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.
fsutil/io.py CHANGED
@@ -2,7 +2,6 @@ from __future__ import annotations
2
2
 
3
3
  import json
4
4
  import os
5
- import platform
6
5
  import tempfile
7
6
  from collections.abc import Generator
8
7
  from datetime import datetime
@@ -137,12 +136,12 @@ def _write_file_atomic(
137
136
  if append:
138
137
  content = read_file(path, encoding=encoding) + content
139
138
  dirpath, _ = split_filepath(path)
140
- auto_delete_temp_file = False if platform.system() == "Windows" else True
139
+ temp_path = None
141
140
  try:
142
141
  with tempfile.NamedTemporaryFile(
143
142
  mode=mode,
144
143
  dir=dirpath,
145
- delete=auto_delete_temp_file,
144
+ delete=False,
146
145
  # delete_on_close=False, # supported since Python >= 3.12
147
146
  encoding=encoding,
148
147
  ) as file:
@@ -150,10 +149,11 @@ def _write_file_atomic(
150
149
  file.flush()
151
150
  os.fsync(file.fileno())
152
151
  temp_path = file.name
153
- permissions = get_permissions(path) if exists(path) else None
154
- os.replace(temp_path, path)
155
- if permissions:
156
- set_permissions(path, permissions)
152
+ # file is now closed, safe to replace on Windows
153
+ permissions = get_permissions(path) if exists(path) else None
154
+ os.replace(temp_path, path)
155
+ if permissions:
156
+ set_permissions(path, permissions)
157
157
  except FileNotFoundError:
158
158
  # success - the NamedTemporaryFile has not been able
159
159
  # to remove the temp file on __exit__ because the temp file
fsutil/metadata.py CHANGED
@@ -4,4 +4,4 @@ __description__ = "high-level file-system operations for lazy devs."
4
4
  __email__ = "fabio.caccamo@gmail.com"
5
5
  __license__ = "MIT"
6
6
  __title__ = "python-fsutil"
7
- __version__ = "0.15.0"
7
+ __version__ = "0.16.1"
fsutil/operations.py CHANGED
@@ -517,6 +517,10 @@ def _search_paths(path: PathIn, pattern: str) -> list[str]:
517
517
  assert_dir(path)
518
518
  pathname = os.path.join(path, pattern)
519
519
  paths = glob.glob(pathname, recursive=True)
520
+ # normalize paths to use OS-specific separators
521
+ paths = [
522
+ os.path.relpath(os.path.normpath(path_result), path) for path_result in paths
523
+ ]
520
524
  return paths
521
525
 
522
526
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: python-fsutil
3
- Version: 0.15.0
3
+ Version: 0.16.1
4
4
  Summary: high-level file-system operations for lazy devs.
5
5
  Author-email: Fabio Caccamo <fabio.caccamo@gmail.com>
6
6
  Maintainer-email: Fabio Caccamo <fabio.caccamo@gmail.com>
@@ -46,6 +46,7 @@ Classifier: Programming Language :: Python :: 3.10
46
46
  Classifier: Programming Language :: Python :: 3.11
47
47
  Classifier: Programming Language :: Python :: 3.12
48
48
  Classifier: Programming Language :: Python :: 3.13
49
+ Classifier: Programming Language :: Python :: 3.14
49
50
  Classifier: Programming Language :: Python :: Implementation :: PyPy
50
51
  Classifier: Topic :: Desktop Environment :: File Managers
51
52
  Classifier: Topic :: Software Development :: Build Tools
@@ -54,6 +55,7 @@ Classifier: Topic :: System :: Filesystems
54
55
  Classifier: Topic :: Utilities
55
56
  Description-Content-Type: text/markdown
56
57
  License-File: LICENSE.txt
58
+ Dynamic: license-file
57
59
 
58
60
  [![](https://img.shields.io/pypi/pyversions/python-fsutil.svg?color=blue&logo=python&logoColor=white)](https://www.python.org/)
59
61
  [![](https://img.shields.io/pypi/v/python-fsutil.svg?color=blue&logo=pypi&logoColor=white)](https://pypi.org/project/python-fsutil/)
@@ -65,7 +67,6 @@ License-File: LICENSE.txt
65
67
  [![](https://img.shields.io/github/actions/workflow/status/fabiocaccamo/python-fsutil/test-package.yml?branch=main&label=build&logo=github)](https://github.com/fabiocaccamo/python-fsutil)
66
68
  [![](https://img.shields.io/codecov/c/gh/fabiocaccamo/python-fsutil?logo=codecov)](https://codecov.io/gh/fabiocaccamo/python-fsutil)
67
69
  [![](https://img.shields.io/codacy/grade/fc40788ae7d74d1fb34a38934113c4e5?logo=codacy)](https://www.codacy.com/app/fabiocaccamo/python-fsutil)
68
- [![](https://img.shields.io/codeclimate/maintainability/fabiocaccamo/python-fsutil?logo=code-climate)](https://codeclimate.com/github/fabiocaccamo/python-fsutil/)
69
70
  [![](https://img.shields.io/badge/code%20style-black-000000.svg?logo=python&logoColor=black)](https://github.com/psf/black)
70
71
  [![](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
71
72
 
@@ -825,8 +826,8 @@ pre-commit install --install-hooks
825
826
  # run tests using tox
826
827
  tox
827
828
 
828
- # or run tests using unittest
829
- python -m unittest
829
+ # or run tests using pytest
830
+ pytest
830
831
  ```
831
832
 
832
833
  ## License
@@ -838,7 +839,7 @@ Released under [MIT License](LICENSE.txt).
838
839
 
839
840
  - :star: Star this project on [GitHub](https://github.com/fabiocaccamo/python-fsutil)
840
841
  - :octocat: Follow me on [GitHub](https://github.com/fabiocaccamo)
841
- - :blue_heart: Follow me on [Twitter](https://twitter.com/fabiocaccamo)
842
+ - :blue_heart: Follow me on [Bluesky](https://bsky.app/profile/fabiocaccamo.bsky.social)
842
843
  - :moneybag: Sponsor me on [Github](https://github.com/sponsors/fabiocaccamo)
843
844
 
844
845
  ## See also
@@ -5,15 +5,15 @@ fsutil/checks.py,sha256=LZHz3GsihLlat8Lz-CqQngXDEZfAidmxf8veu_de96I,2807
5
5
  fsutil/converters.py,sha256=7YoaIg-_XuYzXo0IhjEAZUWasaIbPA67aAL5z_T3IRg,1013
6
6
  fsutil/deps.py,sha256=-7eswE7fgHCmILC6GSLbipbuXp_aB3UfmkNRRGaHfgA,336
7
7
  fsutil/info.py,sha256=yVoWPtAc_WOj0WVpRIGkq0TTj8xB6W4l-mVUKaB7Bu8,5333
8
- fsutil/io.py,sha256=0_Wl9h5I3K-osRXCb4Zv93EBB_HaQra-vSYiBnJc7Pc,6375
9
- fsutil/metadata.py,sha256=Z6w25f9dsKfMkA1iqXMsRaYTnrzhs1Dp-6zNoCGCfo0,266
10
- fsutil/operations.py,sha256=7UJzfjNRlD0AzcX-CBblULQ6eXd8TraiCdFufAW8_Mc,15234
8
+ fsutil/io.py,sha256=1AYC83lhwgNUFiT0BB-I0sDvncXAPopOtlYxzL0lEE4,6327
9
+ fsutil/metadata.py,sha256=EoL0z8zCATBEmBnt5PkNxVe_T2F613PqRjK0eHPOqvI,266
10
+ fsutil/operations.py,sha256=Itwgl-fONd6RWnlNKqHMvntDg4FKeP_cqrtmqInc8Fs,15392
11
11
  fsutil/paths.py,sha256=oxeJQgDJlU7a3xu9tThAhQw4LjxHQDjfmYkAcH6B784,5816
12
12
  fsutil/perms.py,sha256=Yw0R3w-Bx94bek2sY8FlJ0KI6LGFPpxEpQ3n2ULOmos,669
13
13
  fsutil/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  fsutil/types.py,sha256=scqjRct7dMNTmk_UgL1PMxRQktlnEMlSgvOy0MfqREg,111
15
- python_fsutil-0.15.0.dist-info/LICENSE.txt,sha256=IcPfOD_lonKcLMnPRhiWdQUPW_LYW-5TTDljwi3UXQg,1078
16
- python_fsutil-0.15.0.dist-info/METADATA,sha256=kIHXO_bx9bJBQMV-Mm2qBbT6vw9OkZ7Yq9BauNrevJs,24850
17
- python_fsutil-0.15.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
18
- python_fsutil-0.15.0.dist-info/top_level.txt,sha256=KGTSjNLPWmxnZt8BFMZQrpnhkO7DsKrYWoXK-Sf3wBQ,7
19
- python_fsutil-0.15.0.dist-info/RECORD,,
15
+ python_fsutil-0.16.1.dist-info/licenses/LICENSE.txt,sha256=IcPfOD_lonKcLMnPRhiWdQUPW_LYW-5TTDljwi3UXQg,1078
16
+ python_fsutil-0.16.1.dist-info/METADATA,sha256=zdVFuadNBZwBBsR0s_9kjqv302fzZgaEbDixgpGQjfA,24763
17
+ python_fsutil-0.16.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
18
+ python_fsutil-0.16.1.dist-info/top_level.txt,sha256=KGTSjNLPWmxnZt8BFMZQrpnhkO7DsKrYWoXK-Sf3wBQ,7
19
+ python_fsutil-0.16.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (82.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5