-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize lib to fit distribution conventions.
- Loading branch information
Daniel Kronovet
committed
Aug 28, 2017
1 parent
19083e1
commit 71e8357
Showing
13 changed files
with
61 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
build | ||
dist | ||
MANIFEST | ||
__pycache__ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
include *.py AUTHORS README.rst *.h MANIFEST.in LICENSE | ||
include *.py AUTHORS README.rst snappy/*.h MANIFEST.in LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from snappy import ( | ||
compress, | ||
uncompress, | ||
decompress, | ||
StreamCompressor, | ||
StreamDecompressor, | ||
stream_compress, | ||
stream_decompress, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from snappy import stream_compress, stream_decompress | ||
|
||
def cmdline_main(): | ||
"""This method is what is run when invoking snappy via the commandline. | ||
Try python -m snappy.cmd --help | ||
""" | ||
import sys | ||
if (len(sys.argv) < 2 or len(sys.argv) > 4 or "--help" in sys.argv or | ||
"-h" in sys.argv or sys.argv[1] not in ("-c", "-d")): | ||
print("Usage: python -m snappy.cmd <-c/-d> [src [dst]]") | ||
print(" -c compress") | ||
print(" -d decompress") | ||
print("output is stdout if dst is omitted or '-'") | ||
print("input is stdin if src and dst are omitted or src is '-'.") | ||
sys.exit(1) | ||
|
||
if len(sys.argv) >= 4 and sys.argv[3] != "-": | ||
dst = open(sys.argv[3], "wb") | ||
elif hasattr(sys.stdout, 'buffer'): | ||
dst = sys.stdout.buffer | ||
else: | ||
dst = sys.stdout | ||
|
||
if len(sys.argv) >= 3 and sys.argv[2] != "-": | ||
src = open(sys.argv[2], "rb") | ||
elif hasattr(sys.stdin, "buffer"): | ||
src = sys.stdin.buffer | ||
else: | ||
src = sys.stdin | ||
|
||
if sys.argv[1] == "-c": | ||
method = stream_compress | ||
else: | ||
method = stream_decompress | ||
|
||
method(src, dst) | ||
|
||
|
||
if __name__ == "__main__": | ||
cmdline_main() |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters