Skip to content
Snippets Groups Projects
Commit fabbd500 authored by François  LAURENT's avatar François LAURENT
Browse files

install procedure to overcome lock-down of gitlab.pasteur.fr

parent a8a9af4b
Branches
Tags
1 merge request!18Set of commits to be tagged v0.18.3
Pipeline #131427 passed
...@@ -102,6 +102,12 @@ cd LarvaTagger ...@@ -102,6 +102,12 @@ cd LarvaTagger
julia --project=. -e 'using Pkg; Pkg.instantiate()' julia --project=. -e 'using Pkg; Pkg.instantiate()'
``` ```
In May 2024, the gitlab.pasteur.fr server began to request an authentication token on cloning public repositories.
If the `git clone` command requests an authentication token, do instead:
```
wget -O- https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/archive/main/larvatagger.jl-main.tar.gz | tar zxv && mv larvatagger.jl-main LarvaTagger
```
Calling `Pkg.instantiate` in a copy of the project is preferred over using `Pkg.add`, Calling `Pkg.instantiate` in a copy of the project is preferred over using `Pkg.add`,
because *LarvaTagger.jl* depends on several unregistered packages. because *LarvaTagger.jl* depends on several unregistered packages.
......
FROM julia:1.10.0-bullseye AS base FROM julia:1.10.2-bullseye AS base
ARG PROJECT_DIR=/app ARG PROJECT_DIR=/app
ARG BRANCH=main ARG BRANCH=main
......
#!/usr/bin/env bash
if [ -z "$BIN_DIR" ]; then
BIN_DIR=~/.local/bin
fi
if [ -z "$LARVATAGGER_PATH" ]; then
export LARVATAGGER_PATH=~/.local/share/larvatagger
fi
if [ "$1" = "--uninstall" ]; then
rm -rf "$BIN_DIR/larvatagger"
rm -rf "$LARVATAGGER_PATH"
else
if ! command -v curl 1>/dev/null 2>&1; then
if command -v brew 1>/dev/null 2>&1; then
# macOS users are not given the choice as they usually do not care about freedom
brew install curl
fi
fi
if ! command -v curl 1>/dev/null 2>&1; then
echo "Command curl required; aborting"
else
if ! command -v realpath 1>/dev/null 2>&1; then
# macOS
if command -v brew 1>/dev/null 2>&1; then
brew install coreutils
fi
fi
if ! command -v julia 1>/dev/null 2>&1; then
if [ -z "$JULIA_INSTALL_ARGS" ]; then
JULIA_INSTALL_ARGS=-y
fi
curl -fsSL https://install.julialang.org | sh -s -- $JULIA_INSTALL_ARGS
source ~/.bashrc
fi
for arg in "$@"; do
if [ "$arg" = "--with-default-backend" ]; then
WITH_DEFAULT_BACKEND=1
break
fi
done
if [ -n "$WITH_DEFAULT_BACKEND" ]; then
if ! command -v python3.8 1>/dev/null 2>&1; then
if command -v pyenv 1>/dev/null 2>&1; then
pyenv install 3.8
elif command -v brew 1>/dev/null 2>&1; then
brew install pyenv
pyenv install 3.8
else
echo "WARNING: command python3.8 not found"
echo "if under Ubuntu, consider running: sudo apt install python3.8 python3.8-venv"
fi
fi
if ! command -v poetry 1>/dev/null 2>&1; then
if command -v pipx 1>/dev/null 2>&1; then
pipx install poetry
else
curl -fsSL https://install.python-poetry.org | python3 -
fi
fi
fi
mkdir -p "$LARVATAGGER_PATH" && pushd $_
##
if [ -d PlanarLarvae ]; then
echo "PlanarLarvae.jl installation found; skipping"
else
if [ -z "$PLANARLARVAE_BRANCH" ]; then
PLANARLARVAE_BRANCH=main
fi
curl -fsSL https://gitlab.pasteur.fr/nyx/planarlarvae.jl/-/archive/${PLANARLARVAE_BRANCH}/planarlarvae.jl-${PLANARLARVAE_BRANCH}.tar.gz | tar zxv
mv planarlarvae.jl-${PLANARLARVAE_BRANCH} PlanarLarvae
fi
if [ -d LarvaTagger.jl ]; then
echo "LarvaTagger.jl installation found; skipping"
else
if [ -z "$LARVATAGGER_BRANCH" ]; then
LARVATAGGER_BRANCH=main
fi
curl -fsSL https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/archive/${LARVATAGGER_BRANCH}/larvatagger.jl-${LARVATAGGER_BRANCH}.tar.gz | tar zxv
mv larvatagger.jl-${LARVATAGGER_BRANCH} LarvaTagger.jl
fi
(cd LarvaTagger.jl && julia --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.develop(path="../PlanarLarvae")')
if [ -z "$WITH_DEFAULT_BACKEND" ]; then
cat <<EOF >$BIN_DIR/larvatagger
#!/usr/bin/env bash
"$LARVATAGGER_PATH/LarvaTagger.jl/scripts/larvatagger" \$@
EOF
else
activate() {
if command -v pyenv 1>/dev/null 2>&1; then
pyenv local 3.8
else
poetry env use 3.8
fi
}
if [ -d TaggingBackends ]; then
echo "TaggingBackends installation found; skipping"
else
if [ -z "$TAGGINGBACKENDS_BRANCH" ]; then
TAGGINGBACKENDS_BRANCH=main
fi
curl -fsSL https://gitlab.pasteur.fr/nyx/TaggingBackends/-/archive/${TAGGINGBACKENDS_BRANCH}/TaggingBackends-${TAGGINGBACKENDS_BRANCH}.tar.gz | tar zxv
mv TaggingBackends-${TAGGINGBACKENDS_BRANCH} TaggingBackends
fi
(cd TaggingBackends && julia --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.develop(path="../PlanarLarvae")')
(cd TaggingBackends && activate && poetry install)
if [ -d MaggotUBA-core ]; then
echo "MaggotUBA-core installation found; skipping"
else
if [ -z "$MAGGOTUBA_CORE_BRANCH" ]; then
MAGGOTUBA_CORE_BRANCH=main
fi
curl -fsSL https://gitlab.pasteur.fr/nyx/maggotuba-core/-/archive/${MAGGOTUBA_CORE_BRANCH}/maggotuba-core-${MAGGOTUBA_CORE_BRANCH}.tar.gz | tar zxv
mv maggotuba-core-${MAGGOTUBA_CORE_BRANCH} MaggotUBA-core
fi
if [ -d MaggotUBA ]; then
echo "MaggotUBA installation found; skipping"
else
if [ -z "$MAGGOTUBA_ADAPTER_BRANCH" ]; then
MAGGOTUBA_ADAPTER_BRANCH=main
fi
curl -fsSL https://gitlab.pasteur.fr/nyx/MaggotUBA-adapter/-/archive/${MAGGOTUBA_ADAPTER_BRANCH}/MaggotUBA-adapter-${MAGGOTUBA_ADAPTER_BRANCH}.tar.gz | tar zxv
mv MaggotUBA-adapter-${MAGGOTUBA_ADAPTER_BRANCH} MaggotUBA #-adapter
#ln -s $(realpath MaggotUBA-adapter) MaggotUBA
fi
(cd MaggotUBA && activate && (cat requirements.txt | xargs -I % sh -c 'poetry add "%"') && poetry install -v && poetry remove taggingbackends && poetry add ../TaggingBackends && poetry remove maggotuba-core && poetry add ../MaggotUBA-core)
(cd MaggotUBA && scripts/make_models.jl default)
cat <<EOF >$BIN_DIR/larvatagger
#!/usr/bin/env bash
JULIA_PROJECT="$(realpath "$LARVATAGGER_PATH/TaggingBackends")" BACKENDS_PATH="$LARVATAGGER_PATH" "$LARVATAGGER_PATH/LarvaTagger.jl/scripts/larvatagger" \$@
EOF
fi
chmod a+x "$BIN_DIR/larvatagger"
##
popd
fi
fi
...@@ -17,11 +17,23 @@ fi ...@@ -17,11 +17,23 @@ fi
case $cmd in case $cmd in
open) open)
shift shift
$currentdir/larvatagger-gui.jl $@ if [ -z "$BACKENDS_PATH" ]; then
"$currentdir/larvatagger-gui.jl" --backends="$BACKENDS_PATH" $@
else
"$currentdir/larvatagger-gui.jl" $@
fi
;;
train|predict)
if [ -z "$BACKENDS_PATH" ]; then
"$currentdir/larvatagger-toolkit.jl" --backends="$BACKENDS_PATH" $@
else
"$currentdir/larvatagger-toolkit.jl" $@
fi
;; ;;
import|merge|train|predict|--version|-V) import|merge|--version|-V)
$currentdir/larvatagger-toolkit.jl $@ "$currentdir/larvatagger-toolkit.jl" $@
;; ;;
*) *)
......
...@@ -68,13 +68,18 @@ if [ -z "$(which shunit2)" ]; then ...@@ -68,13 +68,18 @@ if [ -z "$(which shunit2)" ]; then
git clone -c advice.detachedHead=false -b v2.1.8 https://github.com/kward/shunit2 git clone -c advice.detachedHead=false -b v2.1.8 https://github.com/kward/shunit2
fi fi
# comment out the below line to build a development environment ## comment out the below line to build a development environment
CLONE_OPTS=" --depth 1 --no-tags --single-branch -b dev" #CLONE_OPTS=" --depth 1 --no-tags --single-branch -b dev"
git clone$CLONE_OPTS https://gitlab.pasteur.fr/nyx/planarlarvae.jl PlanarLarvae #git clone$CLONE_OPTS https://gitlab.pasteur.fr/nyx/planarlarvae.jl PlanarLarvae
git clone$CLONE_OPTS https://gitlab.pasteur.fr/nyx/LarvaTagger.jl #git clone$CLONE_OPTS https://gitlab.pasteur.fr/nyx/LarvaTagger.jl
BRANCH=dev
wget -O- https://gitlab.pasteur.fr/nyx/planarlarvae.jl/-/archive/${BRANCH}/planarlarvae.jl-${BRANCH}.tar.gz | tar zxv && mv planarlarvae.jl-${BRANCH} PlanarLarvae
wget -O- https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/archive/${BRANCH}/larvatagger.jl-${BRANCH}.tar.gz | tar zxv && mv larvatagger.jl-${BRANCH} LarvaTagger.jl
ln -s $(realpath LarvaTagger.jl) LarvaTagger ln -s $(realpath LarvaTagger.jl) LarvaTagger
git clone$CLONE_OPTS https://gitlab.pasteur.fr/nyx/TaggingBackends #git clone$CLONE_OPTS https://gitlab.pasteur.fr/nyx/TaggingBackends
git clone$CLONE_OPTS https://gitlab.pasteur.fr/nyx/MaggotUBA-adapter #git clone$CLONE_OPTS https://gitlab.pasteur.fr/nyx/MaggotUBA-adapter
wget -O- https://gitlab.pasteur.fr/nyx/TaggingBackends/-/archive/${BRANCH}/TaggingBackends-${BRANCH}.tar.gz | tar zxv && mv TaggingBackends-${BRANCH} TaggingBackends
wget -O- https://gitlab.pasteur.fr/nyx/MaggotUBA-adapter/-/archive/${BRANCH}/MaggotUBA-adapter-${BRANCH}.tar.gz | tar zxv && mv MaggotUBA-adapter-${BRANCH} MaggotUBA-adapter
ln -s $(realpath MaggotUBA-adapter) MaggotUBA ln -s $(realpath MaggotUBA-adapter) MaggotUBA
# the poetry install step may not be necessary # the poetry install step may not be necessary
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment