From 992d0392852cccb23e2420ff9e16307c930eabd2 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 14 Mar 2023 15:14:47 -0500 Subject: [PATCH] refactor: make hash generation match standalone method --- src/viv/viv.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/viv/viv.py b/src/viv/viv.py index 8216051..7a6ea18 100755 --- a/src/viv/viv.py +++ b/src/viv/viv.py @@ -333,14 +333,15 @@ def get_hash(spec: Tuple[str, ...] | List[str], track_exe: bool = False) -> str: Returns: sha256 representation of dependencies for vivenv """ - pkg_hash = hashlib.sha256() - pkg_hash.update(str(spec).encode()) - # generate unique venvs for unique python exe's - if track_exe: - pkg_hash.update(str(Path(sys.executable).resolve()).encode()) + sha256 = hashlib.sha256() + sha256.update( + ( + str(spec) + (str(Path(sys.executable).resolve()) if track_exe else "N/A") + ).encode() + ) - return pkg_hash.hexdigest() + return sha256.hexdigest() class ViVenv: