diff options
author | Cristian García Romero <cgr71ii@gmail.com> | 2022-03-28 17:54:33 +0300 |
---|---|---|
committer | Cristian García Romero <cgr71ii@gmail.com> | 2022-03-28 17:54:33 +0300 |
commit | a5fba21f86a2baf49b592f3cc4554e0e9a6cfd0c (patch) | |
tree | 203b4708dfacd82bf983658193e3936f561c57f3 | |
parent | 50acbd363008b5d9e5ef8e4fdd450ca0b7a92fa3 (diff) |
Conda build recipe
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | conda_build/bicleaner-ai/build.sh | 6 | ||||
-rw-r--r-- | conda_build/bicleaner-ai/meta.yaml | 38 | ||||
-rwxr-xr-x | conda_build/make_build.sh | 78 |
4 files changed, 127 insertions, 0 deletions
@@ -53,6 +53,11 @@ You can also provide the path to the Hunspell dictionaries directories by using The remaining extra modules required by Bicleaner AI will be automatically downloaded and installed/upgraded (if required) with the first command. +Also, you can install the conda package: +``` +conda install -c conda-forge -c bitextor bicleaner-ai +``` + After installation, three binary files (`bicleaner-ai-train`, `bicleaner-ai-classify`) will be located in your `python/installation/prefix/bin` directory. This is usually `$HOME/.local/bin` or `/usr/local/bin/`. ### TensorFlow diff --git a/conda_build/bicleaner-ai/build.sh b/conda_build/bicleaner-ai/build.sh new file mode 100644 index 0000000..1e45a09 --- /dev/null +++ b/conda_build/bicleaner-ai/build.sh @@ -0,0 +1,6 @@ + +export PIP_NO_INDEX="False" # We are downloading requisites from PyPi +export PIP_NO_DEPENDENCIES="False" # We need the dependencies from our defined dependencies +export PIP_IGNORE_INSTALLED="False" # We need to take into account the dependencies + +$PYTHON -m pip install . diff --git a/conda_build/bicleaner-ai/meta.yaml b/conda_build/bicleaner-ai/meta.yaml new file mode 100644 index 0000000..7463420 --- /dev/null +++ b/conda_build/bicleaner-ai/meta.yaml @@ -0,0 +1,38 @@ + +{% set rdir = "../.." %} +{% set data = load_setup_py_data(setup_file=''+rdir+'/setup.py', from_recipe_dir=True) %} + +package: + name: bicleaner-ai + version: {{ data.get('version') }} + +source: + path: {{ rdir }} + +build: + string: {{ environ.get('GIT_DESCRIBE_HASH') }} + preserve_egg_dir: True + +requirements: + build: + - pip + - setuptools + - python>=3.7 + - fastspell + run: + - python>=3.7 + - kenlm + - fastspell + +test: + source_files: + - tests/* + requires: + - pytest + commands: + - pushd tests; pytest; popd + +about: + home: https://github.com/bitextor/bicleaner-ai + license: GPL3 + summary: Bicleaner fork that uses neural networks diff --git a/conda_build/make_build.sh b/conda_build/make_build.sh new file mode 100755 index 0000000..881b6dd --- /dev/null +++ b/conda_build/make_build.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +usage() +{ + echo "$(basename $0) [-h] [-e <CONDA_ENV_NAME>] [-r] -n <package_name>" + echo "" + echo "OPTIONS:" + echo " -e <CONDA_ENV_NAME> Name of the conda environment which will be used to build" + echo " Bifixer. If not specified, the default value is" + echo " the provided package name with the suffix '-build'." + echo " -r It removes the conda environment before start if exists." + echo " -h It displays this help message." + echo " -n Conda package name in order to retrieve the pkg path" +} + +CONDA_ENV_NAME="" +CONDA_PACKAGE_NAME="" +REMOVE_ENV_IF_EXISTS="" + +while getopts "e:n:rh" options +do + case "${options}" in + e) CONDA_ENV_NAME=$OPTARG;; + r) REMOVE_ENV_IF_EXISTS="y";; + h) usage + exit 0;; + n) CONDA_PACKAGE_NAME=$OPTARG;; + \?) usage 1>&2 + exit 1;; + esac +done + +if [[ "$CONDA_PACKAGE_NAME" == "" ]]; then + >&2 echo "Error: package name is mandatory" + >&2 echo "" + usage 1>&2 + exit 1 +fi + +if [[ "$CONDA_ENV_NAME" == "" ]]; then + CONDA_ENV_NAME="${CONDA_PACKAGE_NAME}-build" +fi + +CONDA_PACKAGE_PATH="${SCRIPT_DIR}/${CONDA_PACKAGE_NAME}" + +if [[ ! -f "${CONDA_PACKAGE_PATH}/meta.yaml" ]]; then + >&2 echo "File 'meta.yaml' not found: ${CONDA_PACKAGE_PATH}/meta.yaml" + exit 1 +fi + +source $(conda info --base)/etc/profile.d/conda.sh + +if [[ "$REMOVE_ENV_IF_EXISTS" == "y" ]]; then + conda remove -y -n $CONDA_ENV_NAME --all +fi + +if [[ "$(conda env list | grep ^$CONDA_ENV_NAME[\ +])" != "" ]]; then + >&2 echo "Error: conda environment '$CONDA_ENV_NAME' already exists" + >&2 echo "" + usage 1>&2 + exit 1 +fi + +conda create -y -n $CONDA_ENV_NAME -c conda-forge conda-build conda-verify +conda activate $CONDA_ENV_NAME + +echo "git describe --tags:" +git describe --tags || true + +echo "git describe --always:" +git describe --always + +CONDA_CHANNELS="-c conda-forge -c bitextor" + +# Make build +conda-build --no-test --no-anaconda-upload $CONDA_CHANNELS $CONDA_PACKAGE_PATH |