Skip to content

Commit b728241

Browse files
committed
v2.0.0
-------- 2022-06-03: - upgrade to pathlib python 3.11a0 version - upgrade to github actions @V3
1 parent 2c5e307 commit b728241

File tree

8 files changed

+31
-1992
lines changed

8 files changed

+31
-1992
lines changed

CHANGES.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ Changelog
77

88
v2.0.0
99
--------
10-
2022-06-03: upgrade to pathlib python 3.11a0 version
10+
2022-06-03:
11+
- upgrade to pathlib python 3.11a0 version
12+
- upgrade to github actions @v3
1113

1214
v1.3.9
1315
--------

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,9 @@ Changelog
471471

472472
v2.0.0
473473
--------
474-
2022-06-03: upgrade to pathlib python 3.11a0 version
474+
2022-06-03:
475+
- upgrade to pathlib python 3.11a0 version
476+
- upgrade to github actions @v3
475477

476478
v1.3.9
477479
--------

pathlib3x/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
__all__ = ["PurePath", "PurePosixPath", "PureWindowsPath", "Path", "PosixPath", "WindowsPath"]
2-
import sys
3-
if sys.version_info < (3, 10):
4-
import pathlib as pathlib_original
52
from .pathlib3x import *
63

74
from . import __init__conf__

pathlib3x/_typeshed.pyi.old

Lines changed: 0 additions & 109 deletions
This file was deleted.

pathlib3x/pathlib3x.py

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# stored under pathlib.py.txt for later, quicker comparison
55
import inspect
66
import shutil
7+
78
# /bitranox addon
89

910
# Original Pathlib imports
@@ -26,9 +27,6 @@
2627
# bitranox addon
2728
if sys.version_info < (3, 6):
2829
raise ImportError("pathlib3x is only compatible with Python 3.6 or newer")
29-
30-
if sys.version_info < (3, 10):
31-
from . import pathlib_original
3230
# /bitranox addon
3331

3432
__all__ = [
@@ -1067,38 +1065,35 @@ def absolute(self):
10671065
return self._from_parts([self.cwd()] + self._parts)
10681066

10691067
def resolve(self, strict=False):
1070-
if sys.version_info >= (3, 10):
1071-
"""
1072-
Make the path absolute, resolving all symlinks on the way and also
1073-
normalizing it.
1074-
"""
1068+
"""
1069+
Make the path absolute, resolving all symlinks on the way and also
1070+
normalizing it.
1071+
"""
10751072

1076-
def check_eloop(e):
1077-
winerror = getattr(e, "winerror", 0)
1078-
if e.errno == ELOOP or winerror == _WINERROR_CANT_RESOLVE_FILENAME:
1079-
raise RuntimeError("Symlink loop from %r" % e.filename)
1073+
def check_eloop(e):
1074+
winerror = getattr(e, "winerror", 0)
1075+
if e.errno == ELOOP or winerror == _WINERROR_CANT_RESOLVE_FILENAME:
1076+
raise RuntimeError("Symlink loop from %r" % e.filename)
1077+
1078+
try:
1079+
if sys.version_info >= (3, 10):
1080+
s = os.path.realpath(self, strict=strict)
1081+
else:
1082+
# bitranox - option strict will most probably not work correctly
1083+
s = os.path.realpath(self)
1084+
except OSError as e:
1085+
check_eloop(e)
1086+
raise
1087+
p = self._from_parts((s,))
10801088

1089+
# In non-strict mode, realpath() doesn't raise on symlink loops.
1090+
# Ensure we get an exception by calling stat()
1091+
if not strict:
10811092
try:
1082-
if sys.version_info >= (3, 10):
1083-
s = os.path.realpath(self, strict=strict)
1084-
else:
1085-
# bitranox - option strict will most probably not work correctly
1086-
s = os.path.realpath(self)
1093+
p.stat()
10871094
except OSError as e:
10881095
check_eloop(e)
1089-
raise
1090-
p = self._from_parts((s,))
1091-
1092-
# In non-strict mode, realpath() doesn't raise on symlink loops.
1093-
# Ensure we get an exception by calling stat()
1094-
if not strict:
1095-
try:
1096-
p.stat()
1097-
except OSError as e:
1098-
check_eloop(e)
1099-
return p
1100-
else:
1101-
return pathlib_original.Path(self).resolve(strict=strict)
1096+
return p
11021097

11031098
def stat(self, *, follow_symlinks=True):
11041099
"""

0 commit comments

Comments
 (0)