Skip to content

Commit

Permalink
Merge pull request #987 from avalentino/feature/system-blosc2
Browse files Browse the repository at this point in the history
Allow to use of system blosc2 to build pytables
  • Loading branch information
avalentino committed Dec 30, 2022
2 parents 5830444 + bbcdde1 commit a166e66
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 5 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -45,3 +45,39 @@ jobs:
ptrepack -h
ptdump -h
pttree -h
build_cblosc:
name: Sdist with cblosc2
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Set up Python
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
channels: conda-forge
channel-priority: strict
- name: Install dependencies
run: |
conda install setuptools pip wheel build packaging py-cpuinfo numpy cython numexpr bzip2 hdf5 lzo 'typing_extensions<4.2' c-blosc2
- name: Source distribution
run: |
python -m build --sdist
- name: Installation
run: |
pip install -v dist/*.tar.gz --no-deps
- name: 'Run test'
run: |
cd .. && python -m tables.tests.test_all -v
pt2to3 -h
ptrepack -h
ptdump -h
pttree -h
17 changes: 12 additions & 5 deletions setup.py
Expand Up @@ -262,18 +262,25 @@ def run(self):

debug = "--debug" in sys.argv

blosc2_inc, blosc2_lib = get_blosc2_directories()

# Global variables
lib_dirs = [blosc2_lib]
inc_dirs = [Path("hdf5-blosc/src"), Path("hdf5-blosc2/src"), blosc2_inc]
lib_dirs = []
inc_dirs = [Path("hdf5-blosc/src"), Path("hdf5-blosc2/src")]
optional_libs = []
copy_libs = []

default_header_dirs = None
default_library_dirs = None
default_runtime_dirs = None

blosc2_inc = blosc2_lib = None
if os.environ.get("PYTABLES_NO_BLOSC2_WHEEL", None) is None:
try:
blosc2_inc, blosc2_lib = get_blosc2_directories()
lib_dirs.append(blosc2_lib)
inc_dirs.append(blosc2_inc)
except EnvironmentError:
pass

if os.name == "posix":
prefixes = ("/usr/local", "/sw", "/opt", "/opt/local", "/usr", "/")
prefix_paths = [Path(x) for x in prefixes]
Expand Down Expand Up @@ -691,7 +698,7 @@ def find_runtime_path(self, locations=default_runtime_dirs):
# Try to locate the compulsory and optional libraries.
lzo2_enabled = False
compiler = new_compiler()
if not BLOSC2_DIR:
if not BLOSC2_DIR and blosc2_inc is not None:
# Inject the blosc2 directory as detected
BLOSC2_DIR = os.path.dirname(blosc2_inc)
for (package, location) in [
Expand Down

0 comments on commit a166e66

Please sign in to comment.