Skip to content

Commit

Permalink
Replace libsnappy with cramjam
Browse files Browse the repository at this point in the history
Signed-off-by: Gábor Lipták <gliptak@gmail.com>
  • Loading branch information
gliptak committed Feb 6, 2024
1 parent 1e07464 commit 277fb4a
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 1,303 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/pypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,26 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [pypy2, pypy3]
python-version: [pypy2.7, pypy3.9, "pypy3.10"]

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

steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install test dependencies
run: pip install cffi flake8 pytest wheel

- name: Install libsnappy-dev
run: sudo apt-get install libsnappy-dev
run: pip install flake8 pytest wheel

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

- name: Install python-snappy from source
run: pip install -e .
run: python setup.py develop

- name: Pytest
run: pytest --verbose test_snappy.py test_snappy_cffi.py
run: pytest --verbose test_snappy.py
10 changes: 4 additions & 6 deletions .github/workflows/wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: x64
Expand All @@ -31,9 +31,6 @@ jobs:
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install libsnappy-dev
run: sudo apt-get install libsnappy-dev

- name: Generate source distribution
run: python setup.py sdist

Expand Down Expand Up @@ -87,7 +84,7 @@ jobs:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: ${{ matrix.architecture }}
Expand All @@ -108,7 +105,8 @@ jobs:
python -m pip install delvewheel==0.0.9
- name: Build wheels
uses: joerick/cibuildwheel@v2.1.3
run: |
python -m pip wheel -w ./wheelhouse .
- uses: actions/upload-artifact@v2
with:
Expand Down
27 changes: 2 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,9 @@
More details about Snappy library: http://google.github.io/snappy
"""

library_dirs, include_dirs = [], []
if os.environ.get("CIBUILDWHEEL", False) and sys.version_info[:2] == (3, 9) and sys.platform =="darwin":
library_dirs = ["/usr/local/lib/"]
include_dirs = ["/usr/local/include/"]


snappymodule = Extension('snappy._snappy',
libraries=['snappy'],
sources=['src/snappy/snappymodule.cc', 'src/snappy/crc32c.c'],
library_dirs=library_dirs,
include_dirs=include_dirs)

ext_modules = [snappymodule]
packages = ['snappy']
install_requires = []
setup_requires = []
cffi_modules = []

if 'PyPy' in sys.version:
from setuptools import setup
ext_modules = []
install_requires = ['cffi>=1.15.0']
setup_requires = ['cffi>=1.15.0']
cffi_modules = ['./src/snappy/snappy_cffi_builder.py:ffi']
install_requires = ['cramjam>=2.6.0', 'crc32c']
setup_requires = ['cramjam>=2.6.0', 'crc32c']

setup(
name='python-snappy',
Expand Down Expand Up @@ -93,10 +72,8 @@
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10'
],
ext_modules=ext_modules,
packages=packages,
install_requires=install_requires,
setup_requires=setup_requires,
cffi_modules=cffi_modules,
package_dir={'': 'src'},
)
130 changes: 0 additions & 130 deletions src/snappy/crc32c.c

This file was deleted.

95 changes: 0 additions & 95 deletions src/snappy/crc32c.h

This file was deleted.

Loading

0 comments on commit 277fb4a

Please sign in to comment.