forked from litex-hub/litex-conda-packages
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathconda-env.sh
More file actions
executable file
·74 lines (64 loc) · 2.19 KB
/
conda-env.sh
File metadata and controls
executable file
·74 lines (64 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
export CONDA_PATH=${CONDA_PATH:-~/conda}
if [ ! -d $CONDA_PATH ];then
echo "Conda not found at $CONDA_PATH"
exit 1
fi
if [ ! -f $CONDA_PATH/bin/activate ];then
echo "conda's bin/activate not found in $CONDA_PATH"
exit 1
fi
if [ x$PACKAGE = x"" ]; then
echo "\$PACKAGE not set."
exit 1
fi
# Disable this warning;
# xxxx/conda_build/environ.py:377: UserWarning: The environment variable
# 'TRAVIS' is being passed through with value 0. If you are splitting
# build and test phases with --no-test, please ensure that this value is
# also set similarly at test time.
export PYTHONWARNINGS=ignore::UserWarning:conda_build.environ
if [ -z "$DATE_STR" ]; then
export DATE_NUM="$(date -u +%y%m%d%H%M)"
export DATE_STR="$(date -u +%Y%m%d_%H%M%S)"
echo "Setting date number to $DATE_NUM"
echo "Setting date string to $DATE_STR"
fi
if [ -z "$GITREV" ]; then
export GITREV="$(git describe --long)"
echo "Setting git revision $GITREV"
fi
export TRAVIS=0
export CI=0
export TRAVIS_EVENT_TYPE=${TRAVIS_EVENT_TYPE:-"local"}
echo "TRAVIS_EVENT_TYPE='${TRAVIS_EVENT_TYPE}'"
export TRAVIS_BRANCH="${TRAVIS_BRANCH:-$(git rev-parse --abbrev-ref HEAD)}"
echo "TRAVIS_BRANCH='${TRAVIS_BRANCH}'"
export TRAVIS_COMMIT="${TRAVIS_BRANCH:-$(git rev-parse HEAD)}"
echo "TRAVIS_COMMIT='${TRAVIS_COMMIT}'"
export TRAVIS_REPO_SLUG="${TRAVIS_REPO_SLUG:-$(git remote get-url origin | sed -e's-.*github\.com/--' -e's/\.git//')}"
echo "TRAVIS_REPO_SLUG='${TRAVIS_REPO_SLUG}'"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$("$CONDA_PATH/bin/conda" 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "$CONDA_PATH/etc/profile.d/conda.sh" ]; then
. "$CONDA_PATH/etc/profile.d/conda.sh"
else
export PATH="$CONDA_PATH/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
export CONDARC=$CONDA_PATH/.condarc
PACKAGE_ENV=$CONDA_PATH/envs/$PACKAGE
if [ ! -d $PACKAGE_ENV ]; then
conda create --yes --name $PACKAGE --strict-channel-priority
ln -sf $(realpath $PACKAGE/condarc) $PACKAGE_ENV/condarc
fi
conda activate $PACKAGE
./conda-meta-extra.sh $PACKAGE
./conda-tag-filter.sh $PACKAGE
conda $@