Skip to content

Commit

Permalink
snappy in extra_require and --codecs
Browse files Browse the repository at this point in the history
--HG--
branch : snappy
  • Loading branch information
tebeka committed Dec 11, 2012
1 parent db50e8a commit c24dfa7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 10 additions & 2 deletions fastavro/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@ def main(argv=None):

parser = ArgumentParser(
description='iter over avro file, emit records as JSON')
parser.add_argument('file', help='file(s) to parse', nargs='+')
parser.add_argument('file', help='file(s) to parse', nargs='*')
parser.add_argument('--schema', help='dump schema instead of records',
action='store_true', default=False)
parser.add_argument('--codecs', help='print supported codecs',
action='store_true', default='false')
parser.add_argument('--version', action='version',
version='fastavro {0}'.format(avro.__version__))
args = parser.parse_args(argv[1:])

for filename in args.file:
if args.codecs:
import fastavro
print('\n'.join(sorted(fastavro._reader.BLOCK_READERS)))
raise SystemExit

files = args.file or ['-']
for filename in files:
if filename == '-':
fo = sys.stdin
else:
Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,8 @@ def build_extension(self, ext):
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
],
install_requires=install_requires
install_requires=install_requires,
extras_require = {
'snappy': ['python-snappy'],
},
)

0 comments on commit c24dfa7

Please sign in to comment.