From 26dfc0c533a226de7bc2b0e93f6cac6009247e6e Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Tue, 16 Oct 2018 14:01:08 -0500 Subject: [PATCH] radare2: fix update script to handle invocation from elsewhere It looks like `with Path:` is supposed to be a context-manager for changing directory but it doesn't seem to work and the only way I've found to make that work is if we made our own and annotated it. Instead just use nix search path to tell the expression where to find the file it looks for. Also re-use SCRIPT_DIR elsewhere instead of re-"computing" it. --- pkgs/development/tools/analysis/radare2/update.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/analysis/radare2/update.py b/pkgs/development/tools/analysis/radare2/update.py index 45920fd1e4b..684d70bc0bc 100755 --- a/pkgs/development/tools/analysis/radare2/update.py +++ b/pkgs/development/tools/analysis/radare2/update.py @@ -38,10 +38,9 @@ def get_radare2_rev() -> str: def get_cutter_version() -> str: version_expr = """ -(with import {}; (builtins.parseDrvName (qt5.callPackage ./cutter.nix {}).name).version) +(with import {}; (builtins.parseDrvName (qt5.callPackage {}).name).version) """ - with SCRIPT_DIR: - return sh("nix", "eval", "--raw", version_expr.strip()) + return sh("nix", "eval", "--raw", version_expr.strip(), "-I", "radare2={0}".format(SCRIPT_DIR)) def get_r2_cutter_rev() -> str: @@ -109,7 +108,7 @@ def main() -> None: "https://github.com/radare/radare2", ".", ) - nix_file = str(Path(__file__).parent.joinpath("default.nix")) + nix_file = str(SCRIPT_DIR.joinpath("default.nix")) radare2_info = get_repo_info(dirname, radare2_rev)