Skip to content

Commit 5f5982b

Browse files
committed
Use os.path.normpath
1 parent 0f8482a commit 5f5982b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

flit_core/flit_core/config.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -603,17 +603,19 @@ def read_pep621_metadata(proj, path) -> LoadedConfig:
603603
raise ConfigError(
604604
"[project.license] should specify file or text, not both"
605605
)
606-
license_f = license_tbl['file']
606+
license_f = osp.normpath(license_tbl['file'])
607607
if isabs_ish(license_f):
608608
raise ConfigError(
609-
f"License file path ({license_f}) cannot be an absolute path"
609+
f"License file path ({license_tbl['file']}) cannot be an absolute path"
610610
)
611-
if ".." in license_f:
611+
if license_f.startswith('..' + os.sep):
612612
raise ConfigError(
613-
f"License file path ({license_f}) cannot contain '..'"
613+
f"License file path ({license_tbl['file']}) cannot contain '..'"
614614
)
615-
if not (path.parent / license_f).is_file():
616-
raise ConfigError(f"License file {license_f} does not exist")
615+
license_p = path.parent / license_f
616+
if not license_p.is_file():
617+
raise ConfigError(f"License file {license_tbl['file']} does not exist")
618+
license_f = str(license_p.relative_to(path.parent)).replace(osp.sep, "/")
617619
license_files.add(license_f)
618620
elif 'text' in license_tbl:
619621
pass

0 commit comments

Comments
 (0)