Skip to content

Commit 277fb4a

Browse files
committed
Replace libsnappy with cramjam
Signed-off-by: Gábor Lipták <[email protected]>
1 parent 1e07464 commit 277fb4a

11 files changed

+41
-1303
lines changed

.github/workflows/pypy.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,26 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: [pypy2, pypy3]
14+
python-version: [pypy2.7, pypy3.9, "pypy3.10"]
1515

1616
name: ${{ matrix.python-version }}
1717

1818
steps:
1919
- uses: actions/checkout@v2
2020

2121
- name: Setup Python
22-
uses: actions/setup-python@v2
22+
uses: actions/setup-python@v5
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
architecture: x64
2626

2727
- name: Install test dependencies
28-
run: pip install cffi flake8 pytest wheel
29-
30-
- name: Install libsnappy-dev
31-
run: sudo apt-get install libsnappy-dev
28+
run: pip install flake8 pytest wheel
3229

3330
# Flake8 is already run in Source Distribution (sdist) workflow, so we don't run it here.
3431

3532
- name: Install python-snappy from source
36-
run: pip install -e .
33+
run: python setup.py develop
3734

3835
- name: Pytest
39-
run: pytest --verbose test_snappy.py test_snappy_cffi.py
36+
run: pytest --verbose test_snappy.py

.github/workflows/wheel.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v2
1717

1818
- name: Setup Python
19-
uses: actions/setup-python@v2
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: "3.10"
2222
architecture: x64
@@ -31,9 +31,6 @@ jobs:
3131
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
3232
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
3333
34-
- name: Install libsnappy-dev
35-
run: sudo apt-get install libsnappy-dev
36-
3734
- name: Generate source distribution
3835
run: python setup.py sdist
3936

@@ -87,7 +84,7 @@ jobs:
8784
- uses: actions/checkout@v2
8885

8986
- name: Setup Python
90-
uses: actions/setup-python@v2
87+
uses: actions/setup-python@v5
9188
with:
9289
python-version: "3.10"
9390
architecture: ${{ matrix.architecture }}
@@ -108,7 +105,8 @@ jobs:
108105
python -m pip install delvewheel==0.0.9
109106
110107
- name: Build wheels
111-
uses: joerick/[email protected]
108+
run: |
109+
python -m pip wheel -w ./wheelhouse .
112110
113111
- uses: actions/upload-artifact@v2
114112
with:

setup.py

+2-25
Original file line numberDiff line numberDiff line change
@@ -38,30 +38,9 @@
3838
More details about Snappy library: http://google.github.io/snappy
3939
"""
4040

41-
library_dirs, include_dirs = [], []
42-
if os.environ.get("CIBUILDWHEEL", False) and sys.version_info[:2] == (3, 9) and sys.platform =="darwin":
43-
library_dirs = ["/usr/local/lib/"]
44-
include_dirs = ["/usr/local/include/"]
45-
46-
47-
snappymodule = Extension('snappy._snappy',
48-
libraries=['snappy'],
49-
sources=['src/snappy/snappymodule.cc', 'src/snappy/crc32c.c'],
50-
library_dirs=library_dirs,
51-
include_dirs=include_dirs)
52-
53-
ext_modules = [snappymodule]
5441
packages = ['snappy']
55-
install_requires = []
56-
setup_requires = []
57-
cffi_modules = []
58-
59-
if 'PyPy' in sys.version:
60-
from setuptools import setup
61-
ext_modules = []
62-
install_requires = ['cffi>=1.15.0']
63-
setup_requires = ['cffi>=1.15.0']
64-
cffi_modules = ['./src/snappy/snappy_cffi_builder.py:ffi']
42+
install_requires = ['cramjam>=2.6.0', 'crc32c']
43+
setup_requires = ['cramjam>=2.6.0', 'crc32c']
6544

6645
setup(
6746
name='python-snappy',
@@ -93,10 +72,8 @@
9372
'Programming Language :: Python :: 3.9',
9473
'Programming Language :: Python :: 3.10'
9574
],
96-
ext_modules=ext_modules,
9775
packages=packages,
9876
install_requires=install_requires,
9977
setup_requires=setup_requires,
100-
cffi_modules=cffi_modules,
10178
package_dir={'': 'src'},
10279
)

src/snappy/crc32c.c

-130
This file was deleted.

src/snappy/crc32c.h

-95
This file was deleted.

0 commit comments

Comments
 (0)