Skip to content

Commit

Permalink
Merge branch 'conda-py3' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Oct 26, 2015
2 parents 153edb0 + 4622b8f commit 0061e8c
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 45 deletions.
96 changes: 51 additions & 45 deletions scripts/conda/conda.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ else
fi

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

absolutepathname(){
Expand All @@ -40,48 +40,54 @@ absolutepathname(){
echo "$(pwd)/$(basename "$1")"
}

for pkgname in reprozip reprounzip reprounzip-docker reprounzip-vagrant reprounzip-vistrails; 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
for PYTHONVER in 2.7 3.5; do
for PKGNAME in reprozip reprounzip reprounzip-docker reprounzip-vagrant reprounzip-vistrails; do
TEMP_DIR="$(mktemp -d /tmp/rr_conda_XXXXXXXX)"

PKGDIR="$TOPLEVEL/$PKGNAME"
cd "$PKGDIR"

# 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"

# Change build string
sedi "s/_REPLACE_buildstr_REPLACE_/py$PYTHONVER/g" "$TEMP_DIR/$PKGNAME/meta.yaml"

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

# Copies result out
cd "$PKGDIR"
cp "$OUTPUT_PKG" "$DEST_DIR/"

# Removes temporary directory
rm -Rf "$TEMP_DIR"
done
done

# Clears Conda cache
Expand Down
1 change: 1 addition & 0 deletions scripts/conda/reprounzip-docker/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ build:
# 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
string: _REPLACE_buildstr_REPLACE_

requirements:
build:
Expand Down
1 change: 1 addition & 0 deletions scripts/conda/reprounzip-vagrant/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ build:
# 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
string: _REPLACE_buildstr_REPLACE_

requirements:
build:
Expand Down
1 change: 1 addition & 0 deletions scripts/conda/reprounzip-vistrails/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ build:
# 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
string: _REPLACE_buildstr_REPLACE_

requirements:
build:
Expand Down
1 change: 1 addition & 0 deletions scripts/conda/reprounzip/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ build:
# 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
string: _REPLACE_buildstr_REPLACE_

requirements:
build:
Expand Down
1 change: 1 addition & 0 deletions scripts/conda/reprozip/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ build:
# 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
string: _REPLACE_buildstr_REPLACE_

requirements:
build:
Expand Down

0 comments on commit 0061e8c

Please sign in to comment.