-
Notifications
You must be signed in to change notification settings - Fork 196
/
upload_to_conda.sh
executable file
·83 lines (68 loc) · 2.31 KB
/
upload_to_conda.sh
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
75
76
77
78
79
80
81
82
83
#!/bin/bash
#set -e
# Any subsequent(*) commands which fail will cause the shell script to exit immediately
# ## MANUAL STEPS TO BUILD AND UPLOAD A NEW PACKAGE VERSION:
# conda build . --python <python version>
# conda build prints output path of the .tar.bz2 file
# conda convert --platform all <path of tar.bz2 file> -o $HOME/Anaconda3/conda-bld/
# anaconda login --username <username> --password <password>
# anaconda upload <path of tar.bz2 file> (have to do that for each tar file)
# anaconda logout
PYTHON_VERSION=(3.6 3.7)
anaconda_credentials=( `cat "anaconda_credentials.txt" `)
ANACONDA_USERNAME="$(echo ${anaconda_credentials[0]}|tr -d '\n\r')"
ANACONDA_ORGANIZATION="$(echo ${anaconda_credentials[1]}|tr -d '\n\r')"
ANACONDA_PASSWORD="$(echo ${anaconda_credentials[2]}|tr -d '\n\r')"
for py_version in "${PYTHON_VERSION[@]}"
do
conda build . --python $py_version
done
bit=$(uname -m)
if [[ "$bit" == *"x86_64"* ]]; then
bit="64"
else
bit="32"
fi
if [[ "$OSTYPE" == *"linux"* ]]; then
host_platform="linux-$bit"
elif [[ "$OSTYPE" == *"darwin"* ]]; then
# Mac OSX
host_platform="osx-$bit"
elif [[ "$OSTYPE" == "cygwin" ]]; then
# POSIX compatibility layer and Linux environment emulation for Windows
host_platform="win-$bit"
elif [[ "$OSTYPE" == "msys" ]]; then
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
host_platform="win-$bit"
elif [[ "$OSTYPE" == *"win"* ]]; then
# I'm not sure this can happen.
host_platform="win-$bit"
else
echo "ERROR: Unknown platform!"
return
fi
cd ~
if [ -d ./Anaconda3 ]; then
conda_build_path="Anaconda3/conda-bld"
elif [ -d ./miniconda3 ]; then
conda_build_path="miniconda3/conda-bld"
else
echo "ERROR: Could not determine directory of conda-build!"
return
fi
PLATFORMS=( osx-64 linux-32 linux-64 win-32 win-64 )
find $HOME/$conda_build_path/$host_platform -name *.tar.bz2 | while read file
do
for platform in "${PLATFORMS[@]}"
do
conda convert --platform $platform $file -o $HOME/Anaconda3/conda-bld/
done
done
anaconda login --username $ANACONDA_USERNAME --password $ANACONDA_PASSWORD
find $HOME/$conda_build_path/ -name *.tar.bz2 | while read file
do
echo $file
anaconda upload $file
done
anaconda logout
echo "execution completed!"