Skip to content

Commit e454aaa

Browse files
pdgendtnashif
authored andcommitted
scripts: ci: check_compliance: Pass path representation to magic
On windows the Magic.from_file method fails to convert a PathLike to its representation. Pass using os.fspath. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
1 parent e48569e commit e454aaa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/ci/check_compliance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,7 @@ def run(self):
16131613

16141614
for file in get_files(filter="d"):
16151615
full_path = GIT_TOP / file
1616-
mime_type = magic.from_file(full_path, mime=True)
1616+
mime_type = magic.from_file(os.fspath(full_path), mime=True)
16171617

16181618
if not mime_type.startswith("image/"):
16191619
continue
@@ -1801,7 +1801,7 @@ def _test_indent(txt: str):
18011801
return -1
18021802

18031803
def check_file(self, file, fp):
1804-
mime_type = magic.from_file(file, mime=True)
1804+
mime_type = magic.from_file(os.fspath(file), mime=True)
18051805

18061806
if not mime_type.startswith("text/"):
18071807
return
@@ -1973,7 +1973,7 @@ def run(self):
19731973

19741974
for file in get_files(filter="d"):
19751975
full_path = GIT_TOP / file
1976-
mime_type = m.from_file(full_path)
1976+
mime_type = m.from_file(os.fspath(full_path))
19771977

19781978
if not mime_type.startswith("text/"):
19791979
continue

0 commit comments

Comments
 (0)