Skip to content
Open
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
6 changes: 3 additions & 3 deletions d/docling-parse/build_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
"wheel_build" : true,
"package_dir": "d/docling-parse",
"default_branch": "main",
"build_script": "docling-parse_ubi_9.6.sh",
"build_script": "docling-parse_7.0.0_ubi_10.2.sh",
"docker_build": false,
"validate_build_script": true,
"use_non_root_user": "false",
"v7.0.0":{
"build_script":"docling-parse_7.0.0_ubi_9.6.sh"
"build_script":"docling-parse_7.0.0_ubi_10.2.sh"
},
"v4.7.1":{
"build_script":"docling-parse_ubi_9.6.sh"
},
"*":{
"build_script":"docling-parse_7.0.0_ubi_9.6.sh"
"build_script":"docling-parse_7.0.0_ubi_10.2.sh"
}
}
110 changes: 110 additions & 0 deletions d/docling-parse/docling-parse_7.0.0_ubi_10.2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/bin/bash -e
# -----------------------------------------------------------------------------
#
# Package : docling-parse
# Version : v7.0.0
# Source repo : https://github.com/docling-project/docling-parse
# Tested on : UBI 10.2
# Language : Python
# Ci-Check : True
# Script License : Apache License, Version 2 or later
# Maintainer : Ryder Salinas <rbsalinas@ibm.com>
#
# Disclaimer : This script has been tested in root mode on given
# ========== platform using the mentioned version of the package.
# It may not work as expected with newer versions of the
# package and/or distribution. In such case, please
# contact "Maintainer" of this script.
#
# ----------------------------------------------------------------------------

set -e

# Variables
PACKAGE_DIR="docling-parse"
PACKAGE_NAME="docling-parse"
PACKAGE_VERSION="${1:-v7.0.0}"
PACKAGE_URL="https://github.com/docling-project/docling-parse.git"
SOURCE_ROOT="$(pwd)"

OS_NAME=$(grep ^PRETTY_NAME /etc/os-release | cut -d= -f2)
SOURCE=Github

# Install dependencies
echo "Installing required packages..."
yum install -y git wget gcc-toolset-15 python3.12-devel python3.12-pip zlib zlib-devel libjpeg-devel libjpeg-turbo libjpeg-turbo-devel freetype-devel

python3.12 -m pip install build pytest wheel huggingface-hub

export PATH=$PATH:/usr/local/bin/
export PATH=/opt/rh/gcc-toolset-15/root/usr/bin:$PATH
export LD_LIBRARY_PATH=/opt/rh/gcc-toolset-15/root/usr/lib64:$LD_LIBRARY_PATH

# Clone or extract the package
cd "$SOURCE_ROOT"
rm -rf matplotlib

if [[ "$PACKAGE_URL" == *github.com* ]]; then
if [ -d "$PACKAGE_DIR" ]; then
cd "$PACKAGE_DIR" || exit
else
if ! git clone "$PACKAGE_URL" "$PACKAGE_DIR"; then
echo "------------------$PACKAGE_NAME:clone_fails---------------------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Clone_Fails"
exit 1
fi
cd "$PACKAGE_DIR" || exit
git checkout "$PACKAGE_VERSION" || exit
fi
else
if [ -d "$PACKAGE_DIR" ]; then
cd "$PACKAGE_DIR" || exit
else
if ! curl -L "$PACKAGE_URL" -o "$PACKAGE_DIR.tar.gz"; then
echo "------------------$PACKAGE_NAME:download_fails---------------------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Download_Fails"
exit 1
fi
mkdir "$PACKAGE_DIR"
if ! tar -xzf "$PACKAGE_DIR.tar.gz" -C "$PACKAGE_DIR" --strip-components=1; then
echo "------------------$PACKAGE_NAME:untar_fails---------------------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Untar_Fails"
exit 1
fi
cd "$PACKAGE_DIR" || exit
fi
fi

# Install the package
if ! python3.12 -m pip install ./; then
echo "------------------$PACKAGE_NAME:install_fails------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Install_Failed"
exit 1
fi

# ------------------ Unified Test Execution Block ------------------

test_status=1 # 0 = success, non-zero = failure

# Run pytest if any matching test files found
if ls */test_*.py > /dev/null 2>&1 && [ $test_status -ne 0 ]; then
echo "Running pytest..."
(python3.12 -m pytest) && test_status=0 || test_status=$?
fi

# Final test result output
if [ $test_status -eq 0 ]; then
echo "------------------$PACKAGE_NAME:install_and_test_both_success-------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Pass | Both_Install_and_Test_Success"
exit 0
else
echo "------------------$PACKAGE_NAME:install_success_but_test_fails---------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Install_success_but_test_Fails"
exit 2
fi
Loading