Add optional $CONDA_HOME environment variable

This commit is contained in:
Eren Dogan 2023-05-11 16:42:29 -07:00
parent 26a082f44d
commit 8ac95c19a4
3 changed files with 16 additions and 11 deletions

View File

@ -22,17 +22,22 @@ if "OPENRAM_HOME" not in os.environ.keys():
__path__.insert(0, OPENRAM_HOME)
# Find the conda installation directory
# Find the conda installer script
if os.path.exists(OPENRAM_HOME + "/install_conda.sh"):
CONDA_INSTALLER = OPENRAM_HOME + "/install_conda.sh"
CONDA_HOME = OPENRAM_HOME + "/miniconda"
elif os.path.exists(OPENRAM_HOME + "/../install_conda.sh"):
CONDA_INSTALLER = OPENRAM_HOME + "/../install_conda.sh"
CONDA_HOME = os.path.abspath(OPENRAM_HOME + "/../miniconda")
# Add CONDA_HOME to environment variables
# Override CONDA_HOME if it's set as an environment variable
if "CONDA_HOME" in os.environ.keys():
CONDA_HOME = os.environ["CONDA_HOME"]
# Add CONDA_HOME to environment variables just in case
try:
os.environ["CONDA_HOME"] = CONDA_HOME
except:
from openram import debug
debug.warning("Couldn't find install_conda.sh")
debug.warning("Couldn't find conda setup directory.")
# Import everything in globals.py

View File

@ -215,8 +215,8 @@ def install_conda():
debug.info(1, "Creating conda setup...");
from openram import CONDA_HOME
subprocess.call("./install_conda.sh", cwd=os.path.abspath(CONDA_HOME + "/.."))
from openram import CONDA_INSTALLER
subprocess.call(CONDA_INSTALLER)
def setup_bitcell():

View File

@ -1,17 +1,17 @@
#!/bin/bash
CONDA_INSTALLER_URL="https://repo.anaconda.com/miniconda/Miniconda3-py38_22.11.1-1-Linux-x86_64.sh"
CONDA_INSTALLER_FILE="miniconda_installer_py38.sh"
CONDA_BASE="miniconda"
CONDA_HOME="${CONDA_HOME:-miniconda}"
TOOLS="klayout magic netgen ngspice trilinos xyce"
# Install miniconda if not installed
if [ ! -d "miniconda" ]
# Install miniconda if not already installed
if [[ ! -d "${CONDA_HOME}/bin" ]]
then
curl -s -o ${CONDA_INSTALLER_FILE} ${CONDA_INSTALLER_URL}
/bin/bash ${CONDA_INSTALLER_FILE} -b -p ${CONDA_BASE}
/bin/bash ${CONDA_INSTALLER_FILE} -b -p ${CONDA_HOME}
rm ${CONDA_INSTALLER_FILE}
source ${CONDA_BASE}/bin/activate
source ${CONDA_HOME}/bin/activate
# Prioritize channels to prevent version conflicts
conda config --add channels conda-forge
@ -28,7 +28,7 @@ then
# Install required Python packages
# (This step isn't required but used to prevent possible issues)
pip3 install -r requirements.txt
python3 -m pip install -r requirements.txt
conda deactivate
fi