Skip to content

Commit e417411

Browse files
OliLayspirsch
andauthored
fix: Do not resolve paths as this resolves symlinks (#101)
* fix: Do not `resolve` paths as this resolves symlinks * pin package versions, use absolute path, fix formatting/linting * fix `requirements.txt` * fix format * fix * bump version * fix comment Co-authored-by: Simon Pirsch <95348275+spirsch@users.noreply.github.com> * fix comment no 2 Co-authored-by: Simon Pirsch <95348275+spirsch@users.noreply.github.com> --------- Co-authored-by: Simon Pirsch <95348275+spirsch@users.noreply.github.com>
1 parent 878d792 commit e417411

File tree

12 files changed

+17
-17
lines changed

12 files changed

+17
-17
lines changed

homcc/client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
"""HOMCC client: homcc"""
66

7-
__version__: str = "1.0.1"
7+
__version__: str = "1.0.2"

homcc/client/compilation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def extract_dependencies(line: str) -> List[str]:
260260
split: List[str] = line.split(":") # remove preprocessor output targets specified via -MT
261261
dependency_line: str = split[1] if len(split) == 2 else split[0] # e.g. ignore "foo.o bar.o:"
262262
return [
263-
str(Path(dependency).resolve()) # normalize paths, e.g. convert /usr/bin/../lib/ to /usr/lib/
263+
str(Path(dependency).absolute()) # Always work with absolute paths
264264
for dependency in dependency_line.rstrip("\\").split() # remove line break char "\"
265265
]
266266

@@ -269,7 +269,7 @@ def extract_dependencies(line: str) -> List[str]:
269269
dependency
270270
for line in dependency_result.splitlines()
271271
for dependency in extract_dependencies(line)
272-
if not dependency.startswith(EXCLUDED_DEPENDENCY_PREFIXES) # check sendability
272+
if not str(Path(dependency).resolve()).startswith(EXCLUDED_DEPENDENCY_PREFIXES) # check sendability
273273
}
274274

275275

homcc/common/arguments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ def map(self, instance_path: str, mapped_cwd: str) -> Arguments:
498498
if arg.startswith(path_arg):
499499
path: str = next(it) if arg == path_arg else arg[len(path_arg) :]
500500

501-
real_path: str = os.path.realpath(path)
501+
real_path: str = str(Path(path).resolve())
502502
if real_path.startswith(EXCLUDED_DEPENDENCY_PREFIXES):
503503
arg = f"{path_arg}{real_path}"
504504
else:

homcc/server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
"""HOMCC server: homccd"""
66

7-
__version__: str = "1.0.1"
7+
__version__: str = "1.0.2"

homcc/server/cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ def _evict_oldest(self):
6363
oldest_path.unlink(missing_ok=False)
6464
except FileNotFoundError:
6565
logger.error(
66-
"""Tried to evict cache entry with hash '%s', but corresponding cache file at '%s' did not exist.
67-
This may lead to an invalid cache size calculation.""",
66+
"""Tried to evict cache entry with hash '%s', but corresponding cache file at '%s' did not exist.
67+
This may lead to an invalid cache size calculation.""",
6868
oldest_hash,
6969
oldest_path,
7070
)

homcc/server/parsing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ def from_config_section(cls, files: List[str], homccd_config: SectionProxy) -> S
198198
address=address,
199199
log_level=log_level,
200200
verbose=verbose,
201-
max_dependency_cache_size_bytes=None
202-
if max_dependency_cache_size is None
203-
else size_string_to_bytes(max_dependency_cache_size),
201+
max_dependency_cache_size_bytes=(
202+
None if max_dependency_cache_size is None else size_string_to_bytes(max_dependency_cache_size)
203+
),
204204
)
205205

206206
def __str__(self):

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ python-lzo==1.12 # see https://packages.ubuntu.com/jammy/python3-lzo
22
sysv_ipc==1.0.0 # see https://packages.ubuntu.com/jammy/python3-sysv-ipc
33

44
# test, CI, package, formatting, linting, ...
5-
black
5+
black==22.6.0
66
isort[colors]
77
mypy==0.990
8-
pylint
8+
pylint==2.14.4
99
PySide2~=5.15
1010
pytest
1111
pytest-asyncio

tests/client/client_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Covered under the included MIT License:
33
# https://github.com/celonis/homcc/blob/main/LICENSE
44

5-
""" Tests for client/client.py"""
5+
"""Tests for client/client.py"""
66

77
import os
88
import threading

tests/client/compilation_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Covered under the included MIT License:
33
# https://github.com/celonis/homcc/blob/main/LICENSE
44

5-
""" Tests for client/compilation.py"""
5+
"""Tests for client/compilation.py"""
66
import os
77
import subprocess
88
from pathlib import Path

tests/client/parsing_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Covered under the included MIT License:
33
# https://github.com/celonis/homcc/blob/main/LICENSE
44

5-
""" Tests for client/parsing.py"""
5+
"""Tests for client/parsing.py"""
66
import os
77
import subprocess
88
from pathlib import Path

0 commit comments

Comments
 (0)