Skip to content

Instantly share code, notes, and snippets.

@giswqs
Last active March 2, 2021 02:02
Show Gist options
  • Save giswqs/4eb62fb08658c8a200c4e18bb5e6270c to your computer and use it in GitHub Desktop.
Save giswqs/4eb62fb08658c8a200c4e18bb5e6270c to your computer and use it in GitHub Desktop.
Building a conda package and uploading it to Anaconda Cloud
#!/bin/bash
# change the package name to the existing PyPi package you would like to build and adjust the Python versions
pkg='whitebox'
array=( 3.5 3.6 3.7 )
echo "Building conda package ..."
cd ~
conda skeleton pypi $pkg
cd $pkg
wget https://conda.io/docs/_downloads/build1.sh
wget https://conda.io/docs/_downloads/bld.bat
cd ~
# building conda packages
for i in "${array[@]}"
do
conda-build --python $i $pkg
done
# convert package to other platforms
cd ~
platforms=( osx-64 linux-32 linux-64 win-32 win-64 )
find $HOME/conda-bld/linux-64/ -name *.tar.bz2 | while read file
do
echo $file
#conda convert --platform all $file -o $HOME/conda-bld/
for platform in "${platforms[@]}"
do
conda convert --platform $platform $file -o $HOME/conda-bld/
done
done
# upload packages to conda
find $HOME/conda-bld/ -name *.tar.bz2 | while read file
do
echo $file
anaconda upload $file
done
echo "Building conda package done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment