diff options
author | Will Dietz <w@wdtz.org> | 2018-10-16 14:01:08 -0500 |
---|---|---|
committer | Will Dietz <w@wdtz.org> | 2018-10-16 14:05:01 -0500 |
commit | 26dfc0c533a226de7bc2b0e93f6cac6009247e6e (patch) | |
tree | 7c4f613029b5d89db9c6812024963809c33de345 | |
parent | 6fdc1655649076262a93cddd4cb389457a0287e4 (diff) |
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.
-rwxr-xr-x | pkgs/development/tools/analysis/radare2/update.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/pkgs/development/tools/analysis/radare2/update.py b/pkgs/development/tools/analysis/radare2/update.py index 45920fd1e4bfe..684d70bc0bc4c 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 <nixpkgs> {}; (builtins.parseDrvName (qt5.callPackage ./cutter.nix {}).name).version) +(with import <nixpkgs> {}; (builtins.parseDrvName (qt5.callPackage <radare2/cutter.nix> {}).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) |