Skip to content

Commit 82bf339

Browse files
authored
Merge pull request #56 from dougalsutherland/py3-fixes
fix imports for python 3
2 parents 01ff70b + 502a2de commit 82bf339

5 files changed

Lines changed: 17 additions & 13 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ build
33
dist
44
MANIFEST
55
__pycache__
6-
6+
*.so
7+
*.egg-info

setup.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525

2626
import sys
27-
from distutils.core import setup, Extension
27+
try:
28+
from setuptools import setup, Extension
29+
except ImportError:
30+
from distutils.core import setup, Extension
2831

2932
version = '0.5.2'
3033
long_description = """
@@ -73,7 +76,7 @@
7376
'Programming Language :: Python :: 3.5',
7477
'Programming Language :: Python :: 3.6',
7578
],
76-
ext_modules = ext_modules,
77-
packages = packages,
78-
install_requires = install_requires
79+
ext_modules=ext_modules,
80+
packages=packages,
81+
install_requires=install_requires
7982
)

snappy/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from snappy import (
1+
from .snappy import (
22
compress,
33
decompress,
44
uncompress,
@@ -8,4 +8,4 @@
88
StreamDecompressor,
99
UncompressError,
1010
isValidCompressed,
11-
)
11+
)

snappy/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from snappy import stream_compress, stream_decompress
1+
from .snappy import stream_compress, stream_decompress
22

33
def cmdline_main():
44
"""This method is what is run when invoking snappy via the commandline.
@@ -37,4 +37,4 @@ def cmdline_main():
3737

3838

3939
if __name__ == "__main__":
40-
cmdline_main()
40+
cmdline_main()

snappy/snappy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
import struct
4545

4646
try:
47-
from _snappy import UncompressError, compress, decompress, \
48-
isValidCompressed, uncompress, _crc32c
47+
from ._snappy import UncompressError, compress, decompress, \
48+
isValidCompressed, uncompress, _crc32c
4949
except ImportError:
50-
from snappy_cffi import UncompressError, compress, decompress, \
51-
isValidCompressed, uncompress, _crc32c
50+
from .snappy_cffi import UncompressError, compress, decompress, \
51+
isValidCompressed, uncompress, _crc32c
5252

5353
_CHUNK_MAX = 65536
5454
_STREAM_TO_STREAM_BLOCK_SIZE = _CHUNK_MAX

0 commit comments

Comments
 (0)