From c925372d6798126cba3a4f1982194d4cf2b1952f Mon Sep 17 00:00:00 2001 From: Fernando Date: Thu, 5 Jun 2025 15:38:38 -0300 Subject: [PATCH 01/19] MNT: Change installer filename for mamba. Now it's Miniforge3. --- bin/sirius-script-mamba-env-create.bash | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index 630ad56..4f8e4d6 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -281,9 +281,10 @@ printf_yellow_clear "Install mamba in path /opt/mamba_files/mamba: " cd /opt/mamba_files if ! [ -d mamba ] then - wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh - sh Mambaforge-Linux-x86_64.sh -b -p /opt/mamba_files/mamba - rm Mambaforge-Linux-x86_64.sh + fname="Miniforge3-Linux-x86_64.sh" + wget https://github.com/conda-forge/miniforge/releases/latest/download/$fname + sh $fname -b -p /opt/mamba_files/mamba + rm $fname printf_green "done!\n" else printf_blue "there already is a mamba installation. Skipping...\n" From 584c0ae3ddd7aed572940edbf09aaacd7ede07da Mon Sep 17 00:00:00 2001 From: Fernando Date: Thu, 5 Jun 2025 15:39:28 -0300 Subject: [PATCH 02/19] MNT: file mamba.sh is deprecated. change way of initializing mamba. --- bin/sirius-script-mamba-env-create.bash | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index 4f8e4d6..2160961 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -297,22 +297,21 @@ sudo chown -R $USER:mamba ~/.conda printf_yellow_clear "Adding mamba and conda to path\n" source /opt/mamba_files/mamba/etc/profile.d/conda.sh -source /opt/mamba_files/mamba/etc/profile.d/mamba.sh +export MAMBA_ROOT_PREFIX='/opt/mamba_files/mamba' +eval "$(mamba shell hook --shell bash)" printf_yellow_clear "Adding mamba and conda paths to .bashrc: " cd ~/ -if ! grep -q "MAMBA_ADD" .bashrc; +if ! grep -q "CONDA_ADD" .bashrc; then cat >> ~/.bashrc <<'EOM' # add conda and mamba to path -MAMBA_ADD=/opt/mamba_files/mamba/etc/profile.d/mamba.sh -if [ -f "$MAMBA_ADD" ] ; then - source "$MAMBA_ADD" -fi CONDA_ADD=/opt/mamba_files/mamba/etc/profile.d/conda.sh if [ -f "$CONDA_ADD" ] ; then source "$CONDA_ADD" fi +export MAMBA_ROOT_PREFIX='/opt/mamba_files/mamba' +eval "$(mamba shell hook --shell bash)" EOM printf_green "done!\n" else From b90f444c52133b663d0757d0de4c5cbdba5bc40f Mon Sep 17 00:00:00 2001 From: Fernando Date: Thu, 5 Jun 2025 15:40:41 -0300 Subject: [PATCH 03/19] MNT: build package is not being installed with mamba anymore. install it with pip instead. --- bin/sirius-script-mamba-env-create.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index 2160961..96c5f14 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -347,7 +347,8 @@ printf_yellow "Install some mamba packages in $ENV_NAME environment.\n" COMM="mamba install --freeze-installed -y" printf_yellow_clear "- System and generic python packages:\n" -$COMM gxx make binutils swig=4.2.0 libxcrypt build gsl libblas wmctrl fftw \ +pip install build +$COMM gxx make binutils swig=4.2.0 libxcrypt gsl libblas wmctrl fftw \ pyparsing bottleneck aiohttp==3.7.4 numpy=1.23 scipy matplotlib \ pytest mpmath entrypoints requests pyqt=5.12.3 pandas pyqtgraph=0.11.0 \ qtpy=2.3.1 QtAwesome=0.7.2 numexpr tk sh pywavelets scikit-image \ From bab42cf1cbd5cb75cd6ad75fca3ac6d8b7b6f6e3 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 9 Jun 2025 16:20:57 -0300 Subject: [PATCH 04/19] MNT: Update pyepics to 3.5.7 to remove pkg_recources dependency for that package. --- bin/sirius-script-mamba-env-create.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index 96c5f14..167235a 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -359,7 +359,7 @@ printf_yellow_clear "- Install EPICS Base:\n" $COMM -c conda-forge/label/cf202003 epics-base=3.15.6 printf_yellow_clear "- And some other EPICS packages:\n" -$COMM pyepics=3.5.0 pcaspy==0.7.3 pydm=1.10.3 timechart=1.2.3 +$COMM pyepics=3.5.7 pcaspy==0.7.3 pydm=1.10.3 timechart=1.2.3 # remove the activate and deactivate files created by pyepics and pydm: cd $CONDA_PREFIX/etc/conda/activate.d if [ -f "pydm.bat" ] From e2878c20b6c0c9b970b1f0a25b47b44457ee7255 Mon Sep 17 00:00:00 2001 From: Fernando Date: Wed, 18 Jun 2025 17:29:21 -0300 Subject: [PATCH 05/19] BUG: Deactivate before creating deactivation file. --- bin/sirius-script-mamba-env-create.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index 167235a..9c77258 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -441,9 +441,12 @@ then clone_or_find insertion-devices lnls-ima && make $TARGET fi +printf_yellow_clear "Deactivate conda enviroment\n" +mamba deactivate + printf_yellow "Add enviroment variables to conda environment\n" -#### Cria arquivo para configurar ativação do ambiente +#### Create file to configure environment activation cat > $CONDA_PREFIX/etc/conda/activate.d/sirius_env.sh <<'EOM' # Define function to set variable and save previous state function defvar () @@ -542,9 +545,6 @@ unalias g-conda unalias g-conda-repos EOM -printf_yellow_clear "Deactivate conda enviroment\n" -mamba deactivate - ############################################################################## printf_yellow "Fix permissions of some files\n" # needed for mamba clone From 6c5f0b48c14209ddcaff069374bec659d8073ceb Mon Sep 17 00:00:00 2001 From: Fernando Date: Wed, 18 Jun 2025 17:30:57 -0300 Subject: [PATCH 06/19] MNT: do not use --freeze-installed in first call of mamba packages installation. --- bin/sirius-script-mamba-env-create.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index 9c77258..e055626 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -348,7 +348,8 @@ COMM="mamba install --freeze-installed -y" printf_yellow_clear "- System and generic python packages:\n" pip install build -$COMM gxx make binutils swig=4.2.0 libxcrypt gsl libblas wmctrl fftw \ +# No not use freeze installed here, since it's the first time it is called. +mamba install -y gxx make binutils swig=4.2.0 libxcrypt gsl libblas wmctrl fftw \ pyparsing bottleneck aiohttp==3.7.4 numpy=1.23 scipy matplotlib \ pytest mpmath entrypoints requests pyqt=5.12.3 pandas pyqtgraph=0.11.0 \ qtpy=2.3.1 QtAwesome=0.7.2 numexpr tk sh pywavelets scikit-image \ From a4f3e2af15d0c746d6e342caaccd87f7fedc8264 Mon Sep 17 00:00:00 2001 From: Fernando Date: Wed, 18 Jun 2025 17:32:20 -0300 Subject: [PATCH 07/19] ENH: Add seaborn to the list of packages to be installed. --- bin/sirius-script-mamba-env-create.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index e055626..3f27d35 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -354,7 +354,7 @@ mamba install -y gxx make binutils swig=4.2.0 libxcrypt gsl libblas wmctrl fftw pytest mpmath entrypoints requests pyqt=5.12.3 pandas pyqtgraph=0.11.0 \ qtpy=2.3.1 QtAwesome=0.7.2 numexpr tk sh pywavelets scikit-image \ scikit-learn pydocstyle pycodestyle pylama openpyxl gpy gpyopt fpdf sympy \ - h5py scienceplots + h5py scienceplots seaborn printf_yellow_clear "- Install EPICS Base:\n" $COMM -c conda-forge/label/cf202003 epics-base=3.15.6 From 2832ba053b78f075f814f0cb8958e5c09c475714 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 30 Jun 2025 15:13:41 -0300 Subject: [PATCH 08/19] BUG: Fix problem with ENV_NAME value substitution in `here files`. --- bin/sirius-script-mamba-env-create.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index 3f27d35..d71935c 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -559,25 +559,25 @@ printf_yellow "Create scripts to access apps in conda environment\n" cd /usr/local/bin printf_yellow_clear " - jupyter-mamba-${ENV_NAME} \n" -sudo tee jupyter-mamba-${ENV_NAME} >/dev/null <<'EOM' +sudo tee jupyter-mamba-${ENV_NAME} >/dev/null </dev/null <<'EOM' +sudo tee ipython-mamba-${ENV_NAME} >/dev/null </dev/null <<'EOM' +sudo tee designer-mamba-${ENV_NAME} >/dev/null </dev/null <<'EOM' +sudo tee sirius-hla-as-ap-launcher-mamba-${ENV_NAME} >/dev/null < Date: Mon, 7 Jul 2025 12:56:29 -0300 Subject: [PATCH 09/19] MAMBA.MNT: Remove alias for repos inside repos folder in conda environment. --- bin/sirius-script-mamba-env-create.bash | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index d71935c..63a7724 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -492,7 +492,6 @@ defvar "PYQTDESIGNERPATH" "$CONDA_PREFIX/repos/hla/pyqt-apps" # Aliases # =======" alias g-conda="cd $CONDA_PREFIX" -alias g-conda-repos="cd $CONDA_PREFIX/repos" EOM #### Cria arquivo para configurar desativação do ambiente @@ -543,7 +542,6 @@ undefvar "PYQTDESIGNERPATH" # Aliases # ======= unalias g-conda -unalias g-conda-repos EOM ############################################################################## From c321c2f8941a1cc6ddc274ca0e2ad78c72c9ce58 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 7 Jul 2025 12:58:19 -0300 Subject: [PATCH 10/19] MAMBA.ENH: use repository insertion-devices from lnls-ids instead of the one from lnls-ima. --- bin/sirius-script-mamba-env-create.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index 63a7724..91c6a6b 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -439,7 +439,7 @@ then clone_or_find fieldmaptrack lnls-fac && make $TARGET clone_or_find Radia lnls-sirius && make install 2>/dev/null clone_or_find idanalysis lnls-fac && make $TARGET - clone_or_find insertion-devices lnls-ima && make $TARGET + clone_or_find insertion-devices lnls-ids && make $TARGET fi printf_yellow_clear "Deactivate conda enviroment\n" From 417baf1afaff82f613f711987f02e444b7403a4b Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 7 Jul 2025 13:03:40 -0300 Subject: [PATCH 11/19] MAMBA.ENH: Change default of script to do not clone repos. --- bin/sirius-script-mamba-env-create.bash | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index 91c6a6b..405f516 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -10,7 +10,7 @@ set -e function help { echo "Usage: sirius-script-mamba-env-create.bash - [ -n | --no-clone-repos ] Instead of cloning, find repos in system. + [ -c | --clone-repos ] Instead of finding repos in system, clone them inside environment folder. [ -d | --develop ] Install sirius packages in develop mode. [ --no-sim ] Do not install simulation packages. [ --no-ioc ] Do not install IOC related packages. @@ -33,8 +33,8 @@ function help [ -h | --help ] Print help and exit." } -SHORT="ndb:e:h" -LONG+="no-clone-repos,develop,no-sim,no-ioc,no-ima,no-colleff,root-lnls-fac:," +SHORT="cdb:e:h" +LONG+="clone-repos,develop,no-sim,no-ioc,no-ima,no-colleff,root-lnls-fac:," LONG+="root-lnls-sirius:,root-lnls-ima:,branches:,env-name:,help" OPTS=$(getopt -a -n sirius-script-mamba-env-create.bash \ --options $SHORT --longoptions $LONG -- "$@") @@ -48,7 +48,7 @@ fi eval set -- "$OPTS" -CLONE="yes" +CLONE="no" DEVELOP="no" INST_SIM="yes" INST_IOC="yes" @@ -62,8 +62,8 @@ ENV_NAME="sirius" # now enjoy the options in order and nicely split until we see -- while true; do case "$1" in - -n|--no-clone-repos) - CLONE="no" + -c|--clone-repos) + CLONE="yes" shift ;; -d|--develop) From f34b5861d20e63388527f2b6e3b053a6e66b93ae Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 7 Jul 2025 13:17:57 -0300 Subject: [PATCH 12/19] MAMBA.ENH: Define only one path of root folder to find packages. --- bin/sirius-script-mamba-env-create.bash | 41 ++++++------------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index 405f516..4b8c8f9 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -16,9 +16,7 @@ function help [ --no-ioc ] Do not install IOC related packages. [ --no-ima ] Do not install magnets simulation packages. [ --no-colleff ] Do not install collective effects packages. - [ --root-lnls-fac ] Root folder for lnls-fac repos. Default: \"/\". - [ --root-lnls-sirius ] Root folder for lnls-sirius repos. Default: \"/\". - [ --root-lnls-ima ] Root folder for lnls-imas repos. Default: \"/\". + [ -r | --root-lnls-repos ] Root folder for lnls repos. Default: \"/\". [ -b | --branches ] Branches to install. For each package you want to force a branch you must provide: :,:,...,: Please note there is no spaces in the string. @@ -33,9 +31,9 @@ function help [ -h | --help ] Print help and exit." } -SHORT="cdb:e:h" -LONG+="clone-repos,develop,no-sim,no-ioc,no-ima,no-colleff,root-lnls-fac:," -LONG+="root-lnls-sirius:,root-lnls-ima:,branches:,env-name:,help" +SHORT="cdr:b:e:h" +LONG+="clone-repos,develop,no-sim,no-ioc,no-ima,no-colleff," +LONG+="root-lnls-repos:,branches:,env-name:,help" OPTS=$(getopt -a -n sirius-script-mamba-env-create.bash \ --options $SHORT --longoptions $LONG -- "$@") @@ -54,9 +52,7 @@ INST_SIM="yes" INST_IOC="yes" INST_IMA="yes" INST_COL="yes" -ROOT_SIR="/" -ROOT_FAC="/" -ROOT_IMA="/" +ROOT_REP="/" BRANCHES="Radia:lnls-sirius" ENV_NAME="sirius" # now enjoy the options in order and nicely split until we see -- @@ -86,16 +82,8 @@ while true; do INST_COL="no" shift ;; - --root-lnls-fac) - ROOT_FAC="$2" - shift 2 - ;; - --root-lnls-sirius) - ROOT_SIR="$2" - shift 2 - ;; - --root-lnls-ima) - ROOT_IMA="$2" + -r|--root-lnls-repos) + ROOT_REP="$2" shift 2 ;; -b|--branches) @@ -180,19 +168,10 @@ function clone_or_find fi cd $1 else - ROO=$ROOT_SIR - if [ $2 == "lnls-fac" ] - then - ROO=$ROOT_FAC - elif [ $2 == "lnls-ima" ] - then - ROO=$ROOT_IMA - fi - - printf_yellow_clear "Searching repo $1 in $ROO: " - VAR="$(find $ROO -path */$1 2>/dev/null)" + printf_yellow_clear "Searching repo $1 in $ROOT_REP: " + local PTH= + local VAR="$(find "$ROOT_REP" -path */$1 2>/dev/null)" VAR=($VAR) - PTH= for V in "${VAR[@]}" do cd $V From 0e43b2d12cb19d46b6ea35a069970997bb874b61 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 7 Jul 2025 13:22:05 -0300 Subject: [PATCH 13/19] MAMBA.ENH: use a more robust way of finding out repositories. --- bin/sirius-script-mamba-env-create.bash | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index 4b8c8f9..0c3dbbf 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -151,6 +151,23 @@ function get_branch done } +# This function extracts the organization and repo name from a +# remote.origin.url of a given repository. +# It was done by Microsoft Windows Copilot and works for urls such as: +# - git@github.com:org/repo.git +# - https://gitlab.com/org/repo.git +# - git@bitbucket.org:org/repo.git +# - lnls-sirius/scripts.git +extract_info_git() +{ + local url="$1" + local path=$(echo "$url" | sed -E 's|.*[:/]([^/]+/[^/]+)$|\1|') + path=${path%.git} + local org=$(echo "$path" | cut -d'/' -f1) + local repo=$(echo "$path" | cut -d'/' -f2) + echo "$org" "$repo" +} + # takes three input variables: repo name, organization, and repo tag/branch function clone_or_find { @@ -177,11 +194,11 @@ function clone_or_find cd $V if git rev-parse --is-inside-work-tree 1>/dev/null 2>&1 then - PH=`git rev-parse --show-toplevel` - NAME="$(basename $PH)" - if [ "$NAME" == "$1" ] + local NAME=$(git config --get remote.origin.url) + NAME=$(extract_info_git "$NAME") + if [ "$NAME" == "$2 $1" ] then - PTH="$PH" + PTH=$(git rev-parse --show-toplevel) break fi fi From 0cf83d333426856ee2143d5fed15555ac320c97e Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 7 Jul 2025 13:23:49 -0300 Subject: [PATCH 14/19] MAMBA.STY: use better syntax for defining functions and define local variables as local. --- bin/sirius-script-mamba-env-create.bash | 32 +++++++++++++++---------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index 0c3dbbf..2bc0fb9 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -7,7 +7,7 @@ set -e # Parse arguments. # Adapted from: https://stackabuse.com/how-to-parse-command-line-arguments-in-bash/ -function help +help() { echo "Usage: sirius-script-mamba-env-create.bash [ -c | --clone-repos ] Instead of finding repos in system, clone them inside environment folder. @@ -115,22 +115,28 @@ done ############################################################################## # Define some useful functions -function printf_yellow { +printf_yellow() +{ printf "\e[1;33m$1\e[0m" } -function printf_yellow_clear { +printf_yellow_clear() +{ printf "\e[0;33m$1\e[0m" } -function printf_blue { +printf_blue() +{ printf "\e[1;34m$1\e[0m" } -function printf_green { +printf_green() +{ printf "\e[1;32m$1\e[0m" } -function printf_red { +printf_red() +{ printf "\e[1;31m$1\e[0m" } -function _abort { +_abort() +{ printf_red "SIGINT received. Aborting...\n" exit } @@ -138,11 +144,11 @@ function _abort { # Trap SIG INT to abort exectution: trap _abort SIGINT; -function get_branch +get_branch() { for BRAN in "${BRANCHES[@]}" do - BR=(${BRAN//:/ }) # split string in array in delimiter ":" + local BR=(${BRAN//:/ }) # split string in array in delimiter ":" if [ "${BR[0]}" == "$1" ] then echo ${BR[1]} @@ -169,7 +175,7 @@ extract_info_git() } # takes three input variables: repo name, organization, and repo tag/branch -function clone_or_find +clone_or_find() { printf_yellow " - $1\n" if [ "$CLONE" == "yes" ] @@ -213,7 +219,7 @@ function clone_or_find return 1 fi fi - BRAN="$(get_branch $1)" + local BRAN="$(get_branch $1)" if ! [ "$BRAN" ] then BRAN="$(get_branch all)" @@ -446,7 +452,7 @@ printf_yellow "Add enviroment variables to conda environment\n" #### Create file to configure environment activation cat > $CONDA_PREFIX/etc/conda/activate.d/sirius_env.sh <<'EOM' # Define function to set variable and save previous state -function defvar () +defvar() { tmp="${1}" if ! [ -z "${!tmp+x}" ] @@ -493,7 +499,7 @@ EOM #### Cria arquivo para configurar desativação do ambiente cat > $CONDA_PREFIX/etc/conda/deactivate.d/sirius_env.sh <<'EOM' # Define function to unset variable with previous state -function undefvar () +undefvar() { tmp="${1}" old="${tmp}_OLD" From 480226be3795f4ef2972fc1091013e74294fb0fa Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 7 Jul 2025 13:24:41 -0300 Subject: [PATCH 15/19] MAMBA.MNT: remove deprecated comment in code. --- bin/sirius-script-mamba-env-create.bash | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index 2bc0fb9..a07082e 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -229,7 +229,6 @@ clone_or_find() printf_yellow_clear "Checking out to branch $BRAN.\n" git checkout $BRAN fi - # wont be nice to fetch and pull the latest updates of the branch? Instead of only "checkouting" it. } ############################################################################## From fe56491a516cebc81041264893aa4dadf64828f2 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 7 Jul 2025 13:25:31 -0300 Subject: [PATCH 16/19] MAMBA.MNT: Adapt to new workflow in Radia package, defined in lnls-sirius/Radia#3. --- bin/sirius-script-mamba-env-create.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index a07082e..d4b3e33 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -53,7 +53,7 @@ INST_IOC="yes" INST_IMA="yes" INST_COL="yes" ROOT_REP="/" -BRANCHES="Radia:lnls-sirius" +BRANCHES="" ENV_NAME="sirius" # now enjoy the options in order and nicely split until we see -- while true; do From 453989d0ea1c94603edea101ed35bd38446d7d12 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 7 Jul 2025 14:49:50 -0300 Subject: [PATCH 17/19] MAMBA.ENH: Change default folder for cloning repos to ~/repos. Add input option for users to change this default. --- bin/sirius-script-mamba-env-create.bash | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index d4b3e33..b7f2bc4 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -11,6 +11,7 @@ help() { echo "Usage: sirius-script-mamba-env-create.bash [ -c | --clone-repos ] Instead of finding repos in system, clone them inside environment folder. + [ -f | --clone-folder ] If repos will be cloned, clone them in this folder. Default: ~/repos. [ -d | --develop ] Install sirius packages in develop mode. [ --no-sim ] Do not install simulation packages. [ --no-ioc ] Do not install IOC related packages. @@ -31,8 +32,8 @@ help() [ -h | --help ] Print help and exit." } -SHORT="cdr:b:e:h" -LONG+="clone-repos,develop,no-sim,no-ioc,no-ima,no-colleff," +SHORT="cf:dr:b:e:h" +LONG+="clone-repos,clone-folder:,develop,no-sim,no-ioc,no-ima,no-colleff," LONG+="root-lnls-repos:,branches:,env-name:,help" OPTS=$(getopt -a -n sirius-script-mamba-env-create.bash \ --options $SHORT --longoptions $LONG -- "$@") @@ -47,6 +48,7 @@ fi eval set -- "$OPTS" CLONE="no" +CLONE_FOL="~/repos" DEVELOP="no" INST_SIM="yes" INST_IOC="yes" @@ -62,6 +64,10 @@ while true; do CLONE="yes" shift ;; + -f|--clone-folder) + CLONE_FOL="$2" + shift 2 + ;; -d|--develop) DEVELOP="yes" shift @@ -180,8 +186,8 @@ clone_or_find() printf_yellow " - $1\n" if [ "$CLONE" == "yes" ] then - printf_yellow_clear "Cloning repo $1 in $CONDA_PREFIX/repos: \n" - cd $CONDA_PREFIX/repos + printf_yellow_clear "Cloning repo $1 in $CLONE_FOL: \n" + cd $CLONE_FOL if ! [ -d "$1" ] then git clone https://github.com/$2/$1.git @@ -382,10 +388,10 @@ mamba update jupyter_client if [ "$CLONE" == "yes" ] then printf_yellow "Clone and install our applications.\n" - printf_yellow_clear "Creating folder $CONDA_PREFIX/repos: " - if ! [ -d $CONDA_PREFIX/repos ] + printf_yellow_clear "Creating folder $CLONE_FOL: " + if ! [ -d $CLONE_FOL ] then - mkdir $CONDA_PREFIX/repos + mkdir $CLONE_FOL printf_green "done!\n" else printf_blue "already exists. Skipping...\n" From 9f5c2e5d5a61a4b47a6fb7e73cc686c69a644594 Mon Sep 17 00:00:00 2001 From: Fernando Date: Thu, 7 Aug 2025 12:53:34 -0300 Subject: [PATCH 18/19] MAMBA.FIX: Define variable needed to create activation files. --- bin/sirius-script-mamba-env-create.bash | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index b7f2bc4..a8bcce2 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -450,12 +450,13 @@ then fi printf_yellow_clear "Deactivate conda enviroment\n" +CONDA_PREF=$CONDA_PREFIX mamba deactivate printf_yellow "Add enviroment variables to conda environment\n" #### Create file to configure environment activation -cat > $CONDA_PREFIX/etc/conda/activate.d/sirius_env.sh <<'EOM' +cat > $CONDA_PREF/etc/conda/activate.d/sirius_env.sh <<'EOM' # Define function to set variable and save previous state defvar() { @@ -502,7 +503,7 @@ alias g-conda="cd $CONDA_PREFIX" EOM #### Cria arquivo para configurar desativação do ambiente -cat > $CONDA_PREFIX/etc/conda/deactivate.d/sirius_env.sh <<'EOM' +cat > $CONDA_PREF/etc/conda/deactivate.d/sirius_env.sh <<'EOM' # Define function to unset variable with previous state undefvar() { @@ -551,6 +552,8 @@ undefvar "PYQTDESIGNERPATH" unalias g-conda EOM +unset CONDA_PREF + ############################################################################## printf_yellow "Fix permissions of some files\n" # needed for mamba clone From b1efa7eb208659c674a3a6565e0c7587e4e4a75e Mon Sep 17 00:00:00 2001 From: Fernando Date: Thu, 7 Aug 2025 12:54:15 -0300 Subject: [PATCH 19/19] MAMBA.MNT: Add print at the end of execution. --- bin/sirius-script-mamba-env-create.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/sirius-script-mamba-env-create.bash b/bin/sirius-script-mamba-env-create.bash index a8bcce2..4481b78 100755 --- a/bin/sirius-script-mamba-env-create.bash +++ b/bin/sirius-script-mamba-env-create.bash @@ -592,3 +592,5 @@ EOM sudo chmod +x jupyter-mamba-${ENV_NAME} ipython-mamba-${ENV_NAME} designer-mamba-${ENV_NAME} \ sirius-hla-as-ap-launcher-mamba-${ENV_NAME} + +printf_yellow "Finished!"