Skip to content

Commit

Permalink
Update c-blosc (v1) to 1.21.5 (#500)
Browse files Browse the repository at this point in the history
* Update c-blosc (v1) to 1.21.5

Compile .S assembly files via setup.py
Fix Python 3.8 by not including minizip/crypt.h

* Add to release notes [skip ci]

* Update docs/release.rst

---------

Co-authored-by: Davis Bennett <davis.v.bennett@gmail.com>
  • Loading branch information
mkitti and d-v-b authored Dec 22, 2023
1 parent 44aae6a commit b429e4b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion c-blosc
Submodule c-blosc updated 432 files
6 changes: 6 additions & 0 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ Fix

* Fix skip of entry points backport tests
By :user:`Elliott Sales de Andrade <QuLogic>`, :issue:`487`.
* Fix Upgrade to Zstd 1.5.5 due to potential corruption.
By :user:`Mark Kittisopikul <mkitti>`, :issue:`429`

Maintenance
~~~~~~~~~~~
* Update c-blosc to 1.21.0 to 1.21.5, zstd from 1.4.8 to 1.5.5,
lz4 from 1.9.3 to 1.9.4, and zlib from 1.2.8 to to 1.2.13
By :user:`Mark Kittisopikul <mkitti>`, :issue:`500`


.. _release_0.12.1:

Expand Down
44 changes: 43 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from Cython.Distutils.build_ext import new_build_ext as build_ext
from setuptools import Extension, setup
from setuptools.errors import CCompilerError, ExecError, PlatformError
from distutils import ccompiler
from distutils.command.clean import clean

# determine CPU support for SSE2 and AVX2
cpu_info = cpuinfo.get_cpu_info()
Expand Down Expand Up @@ -71,6 +73,8 @@ def blosc_extension():
if os.path.isdir(d)]
include_dirs += [d for d in glob('c-blosc/internal-complibs/*/*/*')
if os.path.isdir(d)]
# remove minizip because Python.h 3.8 tries to include crypt.h
include_dirs = [d for d in include_dirs if 'minizip' not in d]
define_macros += [('HAVE_LZ4', 1),
# ('HAVE_SNAPPY', 1),
('HAVE_ZLIB', 1),
Expand All @@ -97,6 +101,15 @@ def blosc_extension():
else:
info('compiling Blosc extension without AVX2 support')

# include assembly files
if cpuinfo.platform.machine() == 'x86_64':
extra_objects = [
S[:-1] + 'o'
for S in glob("c-blosc/internal-complibs/zstd*/decompress/*amd64.S")
]
else:
extra_objects = []

sources = ['numcodecs/blosc.pyx']

# define extension module
Expand All @@ -106,6 +119,7 @@ def blosc_extension():
include_dirs=include_dirs,
define_macros=define_macros,
extra_compile_args=extra_compile_args,
extra_objects=extra_objects,
),
]

Expand Down Expand Up @@ -133,13 +147,23 @@ def zstd_extension():

sources = ['numcodecs/zstd.pyx']

# include assembly files
if cpuinfo.platform.machine() == 'x86_64':
extra_objects = [
S[:-1] + 'o'
for S in glob("c-blosc/internal-complibs/zstd*/decompress/*amd64.S")
]
else:
extra_objects = []

# define extension module
extensions = [
Extension('numcodecs.zstd',
sources=sources + zstd_sources,
include_dirs=include_dirs,
define_macros=define_macros,
extra_compile_args=extra_compile_args,
extra_objects=extra_objects,
),
]

Expand Down Expand Up @@ -298,6 +322,12 @@ class ve_build_ext(build_ext):

def run(self):
try:
if cpuinfo.platform.machine() == 'x86_64':
S_files = glob('c-blosc/internal-complibs/zstd*/decompress/*amd64.S')
compiler = ccompiler.new_compiler()
compiler.src_extensions.append('.S')
compiler.compile(S_files)

build_ext.run(self)
except PlatformError as e:
error(e)
Expand All @@ -311,14 +341,26 @@ def build_extension(self, ext):
raise BuildFailed()


class Sclean(clean):
# Clean up .o files created by .S files

def run(self):
if cpuinfo.platform.machine() == 'x86_64':
o_files = glob('c-blosc/internal-complibs/zstd*/decompress/*amd64.o')
for f in o_files:
os.remove(f)

clean.run(self)


def run_setup(with_extensions):

if with_extensions:
ext_modules = (blosc_extension() + zstd_extension() + lz4_extension() +
compat_extension() + shuffle_extension() + vlen_extension() +
fletcher_extension() + jenkins_extension())

cmdclass = dict(build_ext=ve_build_ext)
cmdclass = dict(build_ext=ve_build_ext, clean=Sclean)
else:
ext_modules = []
cmdclass = {}
Expand Down

0 comments on commit b429e4b

Please sign in to comment.