4343 "docs/" ,
4444 "examples/" ,
4545 "compatibility/" ,
46- "lib/python/base_cli /" ,
46+ f "lib/python/{ IMPORT_NAME } /" ,
4747 "scripts/" ,
4848 "tests/" ,
4949 "base_cli.egg-info/" ,
50- "lib/python/base_cli .egg-info/" ,
50+ f "lib/python/{ IMPORT_NAME } .egg-info/" ,
5151)
5252
5353
@@ -64,24 +64,14 @@ def read_expected_version() -> str:
6464 return lines [0 ].strip ()
6565
6666
67- def expected_package_files () -> set [ str ]:
67+ def expected_package_hashes () -> dict [ str , str ]:
6868 package_root = Path (__file__ ).resolve ().parents [1 ] / "lib" / "python" / IMPORT_NAME
6969 if not package_root .is_dir ():
7070 fail (f"package source directory does not exist: { package_root } " )
7171 return {
72- path .relative_to (package_root ).as_posix ()
73- for path in package_root .rglob ("*" )
74- if path .is_file () and "__pycache__" not in path .parts and path .suffix != ".pyc"
75- }
76-
77-
78- def expected_package_hashes () -> dict [str , str ]:
79- package_root = Path (__file__ ).resolve ().parents [1 ] / "lib" / "python" / IMPORT_NAME
80- return {
81- relative .as_posix (): hashlib .sha256 (path .read_bytes ()).hexdigest ()
72+ path .relative_to (package_root ).as_posix (): hashlib .sha256 (path .read_bytes ()).hexdigest ()
8273 for path in package_root .rglob ("*" )
8374 if path .is_file () and "__pycache__" not in path .parts and path .suffix != ".pyc"
84- for relative in [path .relative_to (package_root )]
8575 }
8676
8777
@@ -234,7 +224,7 @@ def validate_sdist(path: Path, expected_version: str, package_hashes: dict[str,
234224 relative = name [len (root_prefix ) :]
235225 if relative not in ALLOWED_SDIST_FILES and not relative .startswith (ALLOWED_SDIST_PREFIXES ):
236226 fail (f"{ path .name } contains non-allowlisted archive member { relative !r} " )
237- package_prefix = "lib/python/base_cli /"
227+ package_prefix = f "lib/python/{ IMPORT_NAME } /"
238228 if relative .startswith (package_prefix ):
239229 package_relative = relative [len (package_prefix ) :]
240230 payload = archive .extractfile (member )
0 commit comments