Skip to content

Commit

Permalink
Merge pull request #86 from datalad/gh-85
Browse files Browse the repository at this point in the history
Use `ar` & `tar` instead of `dpkg -x`
  • Loading branch information
yarikoptic authored Aug 31, 2021
2 parents 826a617 + 570fd0a commit 655b0f7
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/datalad_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2076,20 +2076,26 @@ def install_deb(
install_dir: Optional[Path] = None,
extra_args: Optional[List[str]] = None,
) -> Path:
cmd: List[Union[str, os.PathLike]] = ["dpkg"]
if extra_args is not None:
cmd.extend(extra_args)
if install_dir is None:
cmd: List[Union[str, os.PathLike]] = ["dpkg"]
if extra_args is not None:
cmd.extend(extra_args)
cmd.append("-i")
cmd.append(debpath)
manager.sudo(*cmd)
return Path("/usr/bin")
else:
if extra_args:
log.warning("Not using dpkg; ignoring --extra-args")
assert os.path.isabs(debpath)
install_dir.mkdir(parents=True, exist_ok=True)
cmd.append("-x")
cmd.append(debpath)
cmd.append(install_dir)
runcmd(*cmd)
install_dir = install_dir.resolve()
with tempfile.TemporaryDirectory() as tmpdir:
oldpwd = os.getcwd()
os.chdir(tmpdir)
runcmd("ar", "-x", debpath)
runcmd("tar", "-C", install_dir, "-xzf", "data.tar.gz")
os.chdir(oldpwd)
manager.addpath(install_dir / bin_path)
return install_dir / bin_path

Expand Down

0 comments on commit 655b0f7

Please sign in to comment.