Skip to content

Commit

Permalink
Merge b4569cf into 91022de
Browse files Browse the repository at this point in the history
  • Loading branch information
abg committed Jan 28, 2019
2 parents 91022de + b4569cf commit fa910a8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion dbsake/cli/cmd/sieve.py
Expand Up @@ -11,6 +11,7 @@
import click

from dbsake.cli import dbsake
from dbsake.util import compression


@dbsake.command('sieve', options_metavar='[options]')
Expand All @@ -31,7 +32,7 @@
help="Specify input file to process instead of stdin")
@click.option('-z', '--compress-command',
metavar='<name>',
default='gzip -1',
default=compression.filetype_to_command('.gz'),
help="Specify compression command when --format=directory")
@click.option('-t', '--table',
metavar='<glob>',
Expand Down
8 changes: 4 additions & 4 deletions dbsake/util/compression.py
Expand Up @@ -226,10 +226,8 @@ def filetype_to_command(ext):

for name in candidates:
# resolve "canonical" binpath
cbin = pycompat.which(name)
if not cbin:
continue
return cbin + ' -dc'
if pycompat.which(name):
return name

raise OSError("Unable to find compression method for extension '%s'" %
(ext,))
Expand Down Expand Up @@ -266,6 +264,8 @@ def decompressed(stream, report_progress=False, sizehint=None, filetype=None):
stream = io.open(stream.fileno(), 'rb', closefd=False)
filetype = detect_filetype(stream)
command = filetype_to_command(filetype)
if command is not None:
command += ' -dc'
if report_progress and (sizehint or is_seekable(stream)):
streamsize = sizehint or os.fstat(stream.fileno()).st_size
widget = progress_bar(streamsize)
Expand Down
2 changes: 1 addition & 1 deletion test_requirements.txt
@@ -1,5 +1,5 @@
# test requirements go here
coverage==3.7.1
coverage
pytest
pytest-cov>=2.4.0,<2.6
flake8<3.0

0 comments on commit fa910a8

Please sign in to comment.