Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions recipes/array_record/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/bin/bash

set -exuo pipefail

# https://github.com/bazelbuild/bazel/issues/14355
# Remove or change when upgrading from Bazel 5.4.0
rm -rf ${BUILD_PREFIX}/share/bazel/install/*

source gen-bazel-toolchain

export CROSSTOOL_TOP="//bazel_toolchain:toolchain"

if [[ "${target_platform}" == linux-* ]]; then
export AUDITWHEEL_PLATFORM="manylinux2014_$(uname -m)"
fi

export PYTHON_BIN="${PYTHON}"

PYTHON_MAJOR_VERSION=$(${PYTHON_BIN} -c 'import sys; print(sys.version_info.major)')
PYTHON_MINOR_VERSION=$(${PYTHON_BIN} -c 'import sys; print(sys.version_info.minor)')
PYTHON_VERSION="${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}"
export PYTHON_VERSION="${PYTHON_VERSION}"

# Remove .bazelrc if it already exists
[ -e .bazelrc ] && rm -f .bazelrc

echo "build -c opt" >> .bazelrc
echo "build --cxxopt=-std=c++17" >> .bazelrc
echo "build --host_cxxopt=-std=c++17" >> .bazelrc
echo "build --linkopt=\"-lrt -lm\"" >> .bazelrc
echo "build --experimental_repo_remote_exec" >> .bazelrc
echo "build --python_path=\"${PYTHON_BIN}\"" >> .bazelrc

echo "build --logging=6" >> .bazelrc
echo "build --verbose_failures" >> .bazelrc
echo "build --local_cpu_resources=${CPU_COUNT}"

if [ -n "${CROSSTOOL_TOP}" ]; then
echo "build --crosstool_top=${CROSSTOOL_TOP}" >> .bazelrc
echo "build --cpu=${TARGET_CPU}" >> .bazelrc
echo "test --crosstool_top=${CROSSTOOL_TOP}" >> .bazelrc
echo "test --cpu=${TARGET_CPU}" >> .bazelrc
fi

bazel clean
bazel build ...
bazel test --verbose_failures --test_output=errors ...

DEST="./all_dist"
# Create the directory, then do dirname on a non-existent file inside it to
# give us an absolute paths with tilde characters resolved to the destination
# directory.
mkdir -p "${DEST}"
echo "=== destination directory: ${DEST}"

TMPDIR=$(mktemp -d -t tmp.XXXXXXXXXX)

echo $(date) : "=== Using tmpdir: ${TMPDIR}"
mkdir "${TMPDIR}/array_record"

echo $(date) : "=== Copy array_record files"

cp setup.py "${TMPDIR}"
cp LICENSE "${TMPDIR}"
rsync -avm -L --exclude="bazel-*/" . "${TMPDIR}/array_record"
rsync -avm -L --include="*.so" --include="*_pb2.py" \
--exclude="*.runfiles" --exclude="*_obj" --include="*/" --exclude="*" \
bazel-bin/cpp "${TMPDIR}/array_record"
rsync -avm -L --include="*.so" --include="*_pb2.py" \
--exclude="*.runfiles" --exclude="*_obj" --include="*/" --exclude="*" \
bazel-bin/python "${TMPDIR}/array_record"

pushd ${TMPDIR}
echo $(date) : "=== Building wheel"
${PYTHON_BIN} setup.py bdist_wheel --python-tag py3${PYTHON_MINOR_VERSION}

if [ -n "${AUDITWHEEL_PLATFORM}" ]; then
echo $(date) : "=== Auditing wheel"
auditwheel repair --plat ${AUDITWHEEL_PLATFORM} -w dist dist/*.whl
fi

echo $(date) : "=== Listing wheel"
ls -lrt dist/*.whl
cp dist/*.whl "${DEST}"
popd

echo $(date) : "=== Output wheel file is in: ${DEST}"

# Install the wheel to Conda prefix
${PYTHON} -m pip install -vv --no-deps --no-build-isolation ${DEST}/*.whl
68 changes: 68 additions & 0 deletions recipes/array_record/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{% set version = "0.5.0" %}

package:
name: array_record
version: {{ version }}

source:
url: https://github.com/google/array_record/archive/v{{ version }}.tar.gz
sha256: 6294b67f21311034ff8ab81d4192e09a7d0767465a0bf8f49cd4e5559a7e9dcb

build:
number: 0
skip: true # [win]

requirements:
build:
- {{ compiler('c') }}
- {{ stdlib('c') }}
- {{ compiler('cxx') }}
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- bazel 5.4.0
- bazel-toolchain
- git
- rsync
host:
- python
- pip
- libabseil
- absl-py
- auditwheel # [linux]
- patchelf
- setuptools
- twine
- wheel
run:
- python
- absl-py
- etils
- fsspec
- importlib_resources
- typing_extensions
- zipp
run_constrained:
- apache-beam ==2.53.0
- google-cloud-storage >=2.11.0
- tensorflow >=2.14.0
test:
imports:
- array_record
- array_record.python.array_record_data_source
- array_record.python.array_record_module
commands:
- pip check
requires:
- pip

about:
home: https://pypi.org/project/array-record/
summary: A file format that achieves a new frontier of IO efficiency
license: Apache-2.0
license_family: Apache
license_file: LICENSE
dev_url: https://github.com/google/array_record

extra:
recipe-maintainers:
- ehfd
Loading