Skip to content

Commit 54b78e6

Browse files
committed
fix symlinks not being handled correctly
Signed-off-by: Zen <[email protected]>
1 parent 6f94978 commit 54b78e6

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "pycpio"
7-
version = "0.9.0"
7+
version = "0.9.1"
88
authors = [
99
{ name="Desultory", email="[email protected]" },
1010
]
@@ -16,7 +16,7 @@ classifiers = [
1616
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
1717
"Operating System :: OS Independent",
1818
]
19-
dependencies = ["zenlib >= 1.7.1"]
19+
dependencies = ["zenlib >= 1.7.3"]
2020

2121
[project.scripts]
2222
pycpio = "pycpio.main:main"

src/pycpio/cpio/data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def from_dir(path: Path, parent=None, relative=None, *args, **kwargs):
2121
"""
2222
Returns a list of CPIOData objects from a directory
2323
24-
If the path is a symlink, it will be resolved and the resolved path will be used.
24+
Resolves the path and checks if it is a directory.
2525
2626
If relative is set, the name will be relative to that path.
2727
The path will be unaltered, since it is used for header stats and data.
@@ -54,7 +54,7 @@ def from_dir(path: Path, parent=None, relative=None, *args, **kwargs):
5454
else:
5555
kwargs['name'] = str(child_path)
5656

57-
if child.is_dir():
57+
if child.is_dir() and not child.is_symlink():
5858
data.extend(CPIOData.from_dir(path=child_path, parent=parent, relative=relative, *args, **kwargs))
5959
else:
6060
data.append(CPIOData.from_path(path=child_path, relative=relative, *args, **kwargs))

src/pycpio/masks/modes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ def mode_bytes_from_path(file_path: Path) -> CPIOModes:
3939
"""
4040
Gets the mode type bytes from the given path.
4141
"""
42-
if file_path.is_dir():
43-
return CPIOModes.Dir.value
44-
elif file_path.is_symlink():
42+
if file_path.is_symlink():
4543
return CPIOModes.Symlink.value
44+
elif file_path.is_dir():
45+
return CPIOModes.Dir.value
4646
elif file_path.is_block_device():
4747
return CPIOModes.BlkDev.value
4848
elif file_path.is_char_device():

0 commit comments

Comments
 (0)