Skip to content

Commit

Permalink
Adds Conda recipes and build script
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Dec 3, 2014
1 parent 6a38858 commit 422016b
Show file tree
Hide file tree
Showing 13 changed files with 391 additions and 0 deletions.
84 changes: 84 additions & 0 deletions scripts/conda/conda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/sh

set -e

# This script automatically builds Conda packages

cd "$(dirname "$0")/../.."
TOPLEVEL="$(pwd)"

# Clears Conda cache
ANACONDA_CACHE="$(dirname "$(which python)")/../conda-bld/src_cache/*"
rm -f "$ANACONDA_CACHE"

if [ -z "$1" ]; then
echo "Usage: $(basename $0) <target_directory> [version]" >&2
exit 1
fi
if [ -z "$2" ]; then
# describe gives us either "0.5" or "0.5-40-g1234567"
# note: no 'sed -r' on OS X
VERSION="$(git describe --always --tags | sed 's/^\([0-9.]*\)-\([0-9]*\)-g\([a-z0-9]*\)$/\1.\2/')"
else
VERSION="$2"
fi

DEST_DIR="$1"

sedi(){
TEMPFILE=$(mktemp /tmp/rpz_conda_XXXXXXXX)
sed "$1" "$2" > $TEMPFILE
mv $TEMPFILE "$2"
}

absolutepathname(){
cd "$(dirname "$1")"
echo "$(pwd)/$(basename "$1")"
}

for pkgname in reprozip reprounzip reprounzip-docker reprounzip-vagrant; do
TEMP_DIR=$(mktemp -d /tmp/rpz_conda_XXXXXXXX)

cd "$TOPLEVEL/$pkgname"

# Builds source distribution
if ! python setup.py sdist --dist-dir $TEMP_DIR; then
rm -Rf $TEMP_DIR
exit 1
fi

# Creates symlink
TEMP_FILE="$(echo $TEMP_DIR/*)"
ln -s "$TEMP_FILE" $TEMP_DIR/$pkgname.tar.gz

# Copies conda recipe
cp -r $TOPLEVEL/scripts/conda/$pkgname $TEMP_DIR/$pkgname

# Changes version in recipe
VERSION_ESCAPED="$(echo "$VERSION" | sed 's/\\/\\\\/g' | sed 's/\//\\\//g')"
sedi "s/_REPLACE_version_REPLACE_/$VERSION_ESCAPED/g" $TEMP_DIR/$pkgname/meta.yaml

# Changes URL
URL_ESCAPED="$(echo "file://$TEMP_DIR/$pkgname.tar.gz" | sed 's/\\/\\\\/g' | sed 's/\//\\\//g')"
sedi "s/_REPLACE_url_REPLACE_/$URL_ESCAPED/g" $TEMP_DIR/$pkgname/meta.yaml

# Builds Conda package
cd $TEMP_DIR
OUTPUT_PKG="$(conda build --output $pkgname)"
OUTPUT_PKG="$(absolutepathname "$OUTPUT_PKG")"
if ! conda build $pkgname; then
rm -Rf $TEMP_DIR
rm -f "$ANACONDA_CACHE"
exit 1
fi

# Copies result out
cd "$TOPLEVEL/$pkgname"
cp "$OUTPUT_PKG" "$DEST_DIR/"

# Removes temporary directory
rm -Rf $TEMP_DIR
done

# Clears Conda cache
rm -f "$ANACONDA_CACHE"
8 changes: 8 additions & 0 deletions scripts/conda/reprounzip-docker/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"%PYTHON%" setup.py install --single-version-externally-managed --record=record.txt
if errorlevel 1 exit 1

:: Add more build steps here, if they are necessary.

:: See
:: http://docs.continuum.io/conda/build.html
:: for a list of environment variables that are set during the build process.
9 changes: 9 additions & 0 deletions scripts/conda/reprounzip-docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

$PYTHON setup.py install --single-version-externally-managed --record=record.txt

# Add more build steps here, if they are necessary.

# See
# http://docs.continuum.io/conda/build.html
# for a list of environment variables that are set during the build process.
57 changes: 57 additions & 0 deletions scripts/conda/reprounzip-docker/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package:
name: reprounzip-docker
version: !!str _REPLACE_version_REPLACE_

source:
fn: reprounzip-docker.tar.gz
url: _REPLACE_url_REPLACE_

build:
#preserve_egg_dir: True
entry_points:
# Put any entry points (scripts to be generated automatically) here. The
# syntax is module:function. For example
#
# - reprounzip = reprounzip:main
#
# Would create an entry point called vistrails that calls vistrails.main()

# If this is a new build for the same version, increment the build
# number. If you do not include this key, it defaults to 0.
# number: 1

requirements:
build:
- python
- setuptools

run:
- python
- reprounzip >=0.4.1

test:
# Python imports
imports:
- reprounzip.unpackers.docker

commands:
# You can put test commands to be run here. Use this to test that the
# entry points work.

- reprounzip docker --help

# You can also put a file called run_test.py in the recipe that will be run
# at test time.

# requires:
# Put any additional test requirements here. For example
# - nose

about:
home: http://vida-nyu.github.io/reprozip/
license: BSD License
summary: 'Linux tool enabling reproducible experiments (docker plugin)'

# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml
8 changes: 8 additions & 0 deletions scripts/conda/reprounzip-vagrant/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"%PYTHON%" setup.py install --single-version-externally-managed --record=record.txt
if errorlevel 1 exit 1

:: Add more build steps here, if they are necessary.

:: See
:: http://docs.continuum.io/conda/build.html
:: for a list of environment variables that are set during the build process.
9 changes: 9 additions & 0 deletions scripts/conda/reprounzip-vagrant/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

$PYTHON setup.py install --single-version-externally-managed --record=record.txt

# Add more build steps here, if they are necessary.

# See
# http://docs.continuum.io/conda/build.html
# for a list of environment variables that are set during the build process.
59 changes: 59 additions & 0 deletions scripts/conda/reprounzip-vagrant/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package:
name: reprounzip-vagrant
version: !!str _REPLACE_version_REPLACE_

source:
fn: reprounzip-vagrant.tar.gz
url: _REPLACE_url_REPLACE_

build:
#preserve_egg_dir: True
entry_points:
# Put any entry points (scripts to be generated automatically) here. The
# syntax is module:function. For example
#
# - reprounzip = reprounzip:main
#
# Would create an entry point called vistrails that calls vistrails.main()

# If this is a new build for the same version, increment the build
# number. If you do not include this key, it defaults to 0.
# number: 1

requirements:
build:
- python
- setuptools

run:
- python
- reprounzip >=0.4.1
- paramiko
- scp

test:
# Python imports
imports:
- reprounzip.unpackers.vagrant

commands:
# You can put test commands to be run here. Use this to test that the
# entry points work.

- reprounzip vagrant --help

# You can also put a file called run_test.py in the recipe that will be run
# at test time.

# requires:
# Put any additional test requirements here. For example
# - nose

about:
home: http://vida-nyu.github.io/reprozip/
license: BSD License
summary: 'Linux tool enabling reproducible experiments (vagrant plugin)'

# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml
8 changes: 8 additions & 0 deletions scripts/conda/reprounzip/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"%PYTHON%" setup.py install --single-version-externally-managed --record=record.txt
if errorlevel 1 exit 1

:: Add more build steps here, if they are necessary.

:: See
:: http://docs.continuum.io/conda/build.html
:: for a list of environment variables that are set during the build process.
9 changes: 9 additions & 0 deletions scripts/conda/reprounzip/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

$PYTHON setup.py install --single-version-externally-managed --record=record.txt

# Add more build steps here, if they are necessary.

# See
# http://docs.continuum.io/conda/build.html
# for a list of environment variables that are set during the build process.
62 changes: 62 additions & 0 deletions scripts/conda/reprounzip/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package:
name: reprounzip
version: !!str _REPLACE_version_REPLACE_

source:
fn: reprounzip.tar.gz
url: _REPLACE_url_REPLACE_

build:
#preserve_egg_dir: True
entry_points:
# Put any entry points (scripts to be generated automatically) here. The
# syntax is module:function. For example
#
# - reprounzip = reprounzip:main
#
# Would create an entry point called vistrails that calls vistrails.main()

- reprounzip = reprounzip.main:main

# If this is a new build for the same version, increment the build
# number. If you do not include this key, it defaults to 0.
# number: 1

requirements:
build:
- python
- setuptools

run:
- python
- setuptools # for pkg_resources
- pyyaml
- rpaths >=0.8

test:
# Python imports
imports:
- reprounzip.main
- reprounzip.unpackers.default

commands:
# You can put test commands to be run here. Use this to test that the
# entry points work.

- reprounzip --help

# You can also put a file called run_test.py in the recipe that will be run
# at test time.

# requires:
# Put any additional test requirements here. For example
# - nose

about:
home: http://vida-nyu.github.io/reprozip/
license: BSD License
summary: 'Linux tool enabling reproducible experiments (unpacker)'

# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml
8 changes: 8 additions & 0 deletions scripts/conda/reprozip/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"%PYTHON%" setup.py install --single-version-externally-managed --record=record.txt
if errorlevel 1 exit 1

:: Add more build steps here, if they are necessary.

:: See
:: http://docs.continuum.io/conda/build.html
:: for a list of environment variables that are set during the build process.
9 changes: 9 additions & 0 deletions scripts/conda/reprozip/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

$PYTHON setup.py install --single-version-externally-managed --record=record.txt

# Add more build steps here, if they are necessary.

# See
# http://docs.continuum.io/conda/build.html
# for a list of environment variables that are set during the build process.
Loading

0 comments on commit 422016b

Please sign in to comment.