git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit26dfc0c533a226de7bc2b0e93f6cac6009247e6e authorWill Dietz <w@wdtz.org> dateTue 16 Oct 2018, 14:01 (8 years ago) parent6fdc165
1 file changed+3−4
pkgs/development/tools/analysis/radare2/update.py+3−4
pkgs/development/tools/analysis/radare2/update.py+3−4
@@ -38,10 +38,9 @@ def get_radare2_rev() -> str:
3838
3939def get_cutter_version() -> str:
4040 version_expr = """
41−(with import <nixpkgs> {}; (builtins.parseDrvName (qt5.callPackage ./cutter.nix {}).name).version)
41+(with import <nixpkgs> {}; (builtins.parseDrvName (qt5.callPackage <radare2/cutter.nix> {}).name).version)
4242"""
43− with SCRIPT_DIR:
44− return sh("nix", "eval", "--raw", version_expr.strip())
43+ return sh("nix", "eval", "--raw", version_expr.strip(), "-I", "radare2={0}".format(SCRIPT_DIR))
4544
4645
4746def get_r2_cutter_rev() -> str:
@@ -109,7 +108,7 @@ def main() -> None:
109108 "https://github.com/radare/radare2",
110109 ".",
111110 )
112− nix_file = str(Path(__file__).parent.joinpath("default.nix"))
111+ nix_file = str(SCRIPT_DIR.joinpath("default.nix"))
113112
114113 radare2_info = get_repo_info(dirname, radare2_rev)
115114