Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add shell scripts for building and packaging #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions anaconda_build/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/env bash

# make sure conda-forge is on the channels list
conda config --append channels conda-forge

# handle package specific arguments
function build_args() {
package="$1"
args=""
case $package in
ion-functions/) args="--numpy=1.12" ;;
esac
echo "$args $package"
}

# loop through and build each package
for d in */; do
echo "---------------------------------"
echo "building $d"
echo "---------------------------------"
conda build $(build_args "$d") || exit
done

# remove temporary build files
echo "build complete, cleaning up..."
conda build purge
30 changes: 30 additions & 0 deletions anaconda_build/install-local
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/env bash

# install packages as a bundle into local conda location
# can be used to make sure that packages can be bundled together
# and do not have dependency conflicts

env_name="ooi_python27_$(date +%Y%m%d)"
status_env_name="ooi_status_$(date +%Y%m%d)"

# build up a list of packages
# make sure gunicorn is installed
install_packages="gunicorn"
for d in */; do
install_packages="${d%/} $install_packages"
done

# remvoe ooi-status and create a separate env for that one,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct spelling: 'remove'...'dependencies' ... 'packages'

# it uses dependancies that conflict with other packges
install_packages="${install_packages/ooi-status/}"

# create conda environments and install packages from the local build
echo "creating $env_name"
set -x
conda create -y --copy --use-local --name $env_name $install_packages
set +x

echo "creating $status_env_name"
set -x
conda create -y --copy --use-local --name $status_env_name ooi-status
set +x
57 changes: 57 additions & 0 deletions anaconda_build/package
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/env bash

# create a package bundle, run after a build
# to copy in most recently built packages

tarname="ooi_python_$(date +%Y%m%d)"
build_location="$(conda info --root)/conda-bld"

# copy in the packages
mkdir $tarname
cp -r "$build_location/linux-64" "$tarname"
cp -r "$build_location/noarch" "$tarname"

# obtain the list of packages
packages=""
for d in */; do
packages="$packages ${d%/}"
done

# seperate out ooi-status
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate

# it doesn't play well with the others
packages="${packages/ooi-status}"
# exclude the temporary tar dir
packages="${packages/$tarname}"

# copy in create utility script
cat > "$tarname/create" << HERE
#!/bin/env bash
Copy link
Contributor

@tlfish3638 tlfish3638 Jan 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the above line intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes


# create new ooi_python and ooi_status environments
# based on the packages in this bundle

set -x
conda create -n ooi_python -c ./ $packages gunicorn
conda create -n ooi_status -c ./ ooi-status
HERE
chmod +x "$tarname/create"

# copy in update utility script
cat > "$tarname/update" << HERE
set -x

# update an existing ooi_python and ooi_status environemnt
# based on the packages in this bundle

conda update -n ooi_python -c ./ $packages gunicorn
conda update -n ooi_status -c ./ ooi-status
HERE
chmod +x "$tarname/update"

# tar up the bundle
tar -czf $tarname.tgz $tarname

# clean up the temporary files
rm -fr $tarname