Skip to content

Commit

Permalink
Merge pull request #287 from broadinstitute/sy-diamond-update
Browse files Browse the repository at this point in the history
Update diamond conda version to 0.7.10
  • Loading branch information
yesimon committed May 3, 2016
2 parents 5a40596 + 658800c commit 6a76353
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 3 additions & 5 deletions tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def _patch(self, path, patch):

@property
def _package_installed(self):
result = util.misc.run_and_print(["conda", "list", "-f", "-c", "-p", self.env_path, "--json", self.package], silent=True, check=True, env=self.conda_env)
result = util.misc.run_and_print(["conda", "list", "-f", "-c", "-p", self.env_path, "--json", self.package], silent=True, env=self.conda_env)
if result.returncode == 0:
command_output = result.stdout.decode("UTF-8")
data = json.loads(self._string_from_start_of_json(command_output))
Expand Down Expand Up @@ -381,7 +381,7 @@ def get_installed_version(self):
run_cmd = ["conda", "list", "-c", "--json", "-f", "-p", self.env_path, self.package]


result = util.misc.run_and_print(run_cmd, silent=True, check=True, env=self.conda_env)
result = util.misc.run_and_print(run_cmd, silent=True, env=self.conda_env)
if result.returncode == 0:
try:
command_output = result.stdout.decode("UTF-8")
Expand All @@ -407,7 +407,6 @@ def uninstall_package(self):
result = util.misc.run_and_print(
run_cmd,
silent=True,
check=True,
env=self.conda_env)

if result.returncode == 0:
Expand Down Expand Up @@ -435,7 +434,7 @@ def install_package(self):
python_version = "python=" + python_version if python_version else ""
run_cmd.extend([python_version])

result = util.misc.run_and_print(run_cmd, silent=True, check=True, env=self.conda_env)
result = util.misc.run_and_print(run_cmd, silent=True, env=self.conda_env)
try:
command_output = result.stdout.decode("UTF-8")
data = json.loads(self._string_from_start_of_json(command_output))
Expand All @@ -454,7 +453,6 @@ def install_package(self):
self._package_str
],
silent=True,
check=True,
env=self.conda_env,
)

Expand Down
5 changes: 4 additions & 1 deletion tools/diamond.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

URL = 'https://github.com/bbuchfink/diamond/archive/b576a5c03177603554f4627ae367f7bcbc6b8dcb.zip'
TOOL_VERSION = '0.7.9'
CONDA_VERSION = tools.CondaPackageVersion('0.7.10', 'boost1.60_1')
DIAMOND_COMMIT_DIR = 'diamond-b576a5c03177603554f4627ae367f7bcbc6b8dcb'
DIAMOND_DIR = 'diamond-{}'.format(TOOL_VERSION)

Expand All @@ -27,7 +28,9 @@ class Diamond(tools.Tool):

def __init__(self, install_methods=None):
if not install_methods:
install_methods = [DownloadAndBuildDiamond(URL, os.path.join(DIAMOND_DIR, 'bin', 'diamond'))]
install_methods = [
tools.CondaPackage("diamond", version=CONDA_VERSION),
DownloadAndBuildDiamond(URL, os.path.join(DIAMOND_DIR, 'bin', 'diamond'))]
super().__init__(install_methods=install_methods)

def version(self):
Expand Down
5 changes: 5 additions & 0 deletions util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def run(args, stdin=None, stdout=None, stderr=None, shell=False,
error = ''
if check and returncode != 0:
print(output.decode("utf-8"))
print(error.decode("utf-8"))
try:
raise subprocess.CalledProcessError(
returncode, args, output, error)
Expand Down Expand Up @@ -213,6 +214,10 @@ def run_and_print(args, stdout=None, stderr=None,
log.log(loglevel, result.stdout.decode('utf-8'))
else:
print(e.output.decode('utf-8'))
try:
print(e.stderr.decode('utf-8'))
except TypeError:
pass
sys.stdout.flush()
raise(e)
else:
Expand Down

0 comments on commit 6a76353

Please sign in to comment.