From 892eb6b83904e2bbb4c1b8fddacf3afebca6059d Mon Sep 17 00:00:00 2001 From: Justin Bollinger Date: Sun, 1 Feb 2026 22:41:42 -0500 Subject: [PATCH] Revert ancestor asset lookup --- README.md | 3 +-- hate_crack/main.py | 19 ------------------- tests/test_asset_path_separation.py | 15 --------------- 3 files changed, 1 insertion(+), 36 deletions(-) diff --git a/README.md b/README.md index 795c418..f391744 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,6 @@ hate_crack The tool will automatically search for these assets in: - Directory specified by `hcatPath` in `config.json` when it points to the hate_crack checkout that contains the assets -- Ancestors of the installed package directory (e.g., the uv tool root that still contains the original `hashcat-utils`/`princeprocessor` directories) - Current working directory and parent directory - `~/hate_crack`, `~/hate-crack`, or `~/.hate_crack` @@ -123,7 +122,7 @@ cd /path/to/hate_crack hate_crack ``` -If assets live somewhere else, make sure `config.json` uses that directory for `"hcatPath"` before running. +To keep `uv tool install .` happy, point `hcatPath` in `config.json` at the directory that contains `config.json`, `hashcat-utils/`, and `princeprocessor/` before running the installed command. **Note:** The `hcatPath` in `config.json` is for the hashcat binary location (optional if hashcat is in PATH), not for hate_crack assets. diff --git a/hate_crack/main.py b/hate_crack/main.py index 1d70744..1507a1d 100755 --- a/hate_crack/main.py +++ b/hate_crack/main.py @@ -81,20 +81,6 @@ def _has_hate_crack_assets(path): ) -def _find_assets_in_ancestors(start_path): - current = os.path.abspath(start_path) - seen = set() - while current not in seen: - if _has_hate_crack_assets(current): - return current - seen.add(current) - parent = os.path.abspath(os.path.join(current, os.pardir)) - if parent == current: - break - current = parent - return None - - def _resolve_hate_path(package_path, config_dict=None): # Try to use hcatPath from config.json if it's set and contains assets if config_dict and config_dict.get('hcatPath'): @@ -102,11 +88,6 @@ def _resolve_hate_path(package_path, config_dict=None): if _has_hate_crack_assets(assets_path): return assets_path - # When installed via uv, the assets live above the package directory in the tool root. - ancestor_assets = _find_assets_in_ancestors(package_path) - if ancestor_assets: - return ancestor_assets - # Check current working directory and parent (look for repo directory) cwd = os.getcwd() for candidate in [cwd, os.path.abspath(os.path.join(cwd, os.pardir))]: diff --git a/tests/test_asset_path_separation.py b/tests/test_asset_path_separation.py index 012c754..3f976f1 100644 --- a/tests/test_asset_path_separation.py +++ b/tests/test_asset_path_separation.py @@ -103,18 +103,3 @@ def test_readme_documents_correct_usage(): # Should NOT suggest putting hashcat-utils in hashcat directory # (This is a documentation test to prevent confusing users) - -def test_resolve_hate_path_prefers_package_ancestors(tmp_path): - """Ensure package installs discover assets by walking up to the tool root.""" - from hate_crack.main import _resolve_hate_path - - assets_root = tmp_path / "hate_crack_root" - assets_root.mkdir() - (assets_root / "hashcat-utils").mkdir() - (assets_root / "config.json.example").write_text("{}") - - package_path = assets_root / "lib" / "python3.14" / "site-packages" / "hate_crack" - package_path.mkdir(parents=True) - - resolved = _resolve_hate_path(str(package_path), config_dict={}) - assert resolved == str(assets_root)