Skip to content

Commit

Permalink
Merge pull request obspy#982 from mbyt/conda
Browse files Browse the repository at this point in the history
updating meta.yaml for conda packaging
  • Loading branch information
krischer committed Mar 19, 2015
2 parents 7de0471 + e3e4404 commit 9153a5e
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 60 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ obspy/station/tests/images/testrun/
obspy/imaging/tests/images/testrun/
obspy/taup/tests/images/testrun/
misc/docker_tests/temp/
# Temporary dir for the anaconda builds.
misc/installer/anaconda/conda_builds
20 changes: 20 additions & 0 deletions misc/installer/anaconda/LinuxCondaBuilder_32bit/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM toopher/centos-i386:centos6

MAINTAINER Lion Krischer

# Can fail on occasion.
RUN linux32 yum install -y gcc tar bzip2


RUN linux32 curl http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86.sh -o miniconda.sh
RUN linux32 chmod +x miniconda.sh

RUN linux32 ./miniconda.sh -b -p /miniconda

RUN linux32 /miniconda/bin/conda update --yes conda
RUN linux32 /miniconda/bin/conda install --yes conda-build binstar jinja2

RUN linux32 mkdir -p /temporary/obspy
COPY meta.yaml /temporary/obspy/meta.yaml

RUN linux32 /miniconda/bin/conda build --py all /temporary/obspy
20 changes: 20 additions & 0 deletions misc/installer/anaconda/LinuxCondaBuilder_64bit/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM centos:centos6

MAINTAINER Lion Krischer

# Can fail on occasion.
RUN yum -y upgrade || true
RUN yum install -y gcc tar bzip2

RUN curl http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh
RUN chmod +x miniconda.sh

RUN ./miniconda.sh -b -p /miniconda

RUN /miniconda/bin/conda update --yes conda
RUN /miniconda/bin/conda install --yes conda-build binstar jinja2

RUN mkdir -p /temporary/obspy
COPY meta.yaml /temporary/obspy/meta.yaml

RUN /miniconda/bin/conda build --py all /temporary/obspy
53 changes: 53 additions & 0 deletions misc/installer/anaconda/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# How to build (Ana)Conda packages

Install the necessary tools with

```bash
$ conda install binstar conda-build
```

You also need to login to binstar once thus you need an account and you have to be part of the ObsPy organization on binstar.

```bash
$ binstar login
```

Once in a while its also a good idea to clean the `conda-bld` directory in the root conda path. `$ conda info` shows the location of that paths. Lots of things are cached there and if the version number of the conda package does not change it will reuse previously downloaded files.


## For Linux Using Docker

This must be done on a Linux with a fairly old `libc` version. We currently do it for `libc 2.12`, thus it is done in Docker containers.

Make sure Docker is installed and running (also that some space is left on your disc or boot2docker's VM!). Execute

```bash
$ ./build_conda_packages_linux.sh
```

This will take a while but it will build packages for all Python versions on 64 and 32 bit. It will copy the final packages to `conda_builds` so as a last step you have to upload them from your local machine.

```bash
$ cd conda_builds
$ binstar upload -u obspy linux-32/obspy*
$ binstar upload -u obspy linux-64/obspy*
```

## For OSX

On OSX just execute (from this directory)

```bash
$ conda build --py all obspy
```

Afterwards check (on of the last lines in the output) where the packages are stored and

```bash
$ cd /path/to/packages
$ binstar upload -u obspy --channel docker obspy*
```

## For Windows

Currently performed on AppVeyor using this: https://github.com/obspy/conda-builder
32 changes: 32 additions & 0 deletions misc/installer/anaconda/build_conda_packages_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
DOCKER=`which docker.io || which docker`
BUILD_DIR=conda_builds

rm -rf $BUILD_DIR
mkdir $BUILD_DIR

# Dockerfiles only work with files in their directory structure
cp obspy/meta.yaml LinuxCondaBuilder_32bit/meta.yaml
cp obspy/meta.yaml LinuxCondaBuilder_64bit/meta.yaml


ID=$RANDOM-$RANDOM-$RANDOM
$DOCKER build -t temp:temp LinuxCondaBuilder_32bit
# Ugly way to ensure a container is running to be able to copy something.
$DOCKER run --name=$ID -d temp:temp python -c "import time; time.sleep(600)"
$DOCKER cp $ID:/miniconda/conda-bld/linux-32 $BUILD_DIR
$DOCKER stop -t 0 $ID
$DOCKER rm $ID
$DOCKER rmi temp:temp


ID=$RANDOM-$RANDOM-$RANDOM
$DOCKER build -t temp:temp LinuxCondaBuilder_64bit
# Ugly way to ensure a container is running to be able to copy something.
$DOCKER run --name=$ID -d temp:temp python -c "import time; time.sleep(600)"
$DOCKER cp $ID:/miniconda/conda-bld/linux-64 $BUILD_DIR
$DOCKER stop -t 0 $ID
$DOCKER rm $ID
$DOCKER rmi temp:temp

rm -f LinuxCondaBuilder_32bit/meta.yaml
rm -f LinuxCondaBuilder_64bit/meta.yaml
8 changes: 0 additions & 8 deletions misc/installer/anaconda/obspy/bld.bat

This file was deleted.

6 changes: 0 additions & 6 deletions misc/installer/anaconda/obspy/build.sh

This file was deleted.

78 changes: 32 additions & 46 deletions misc/installer/anaconda/obspy/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,70 +1,56 @@
# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml

package:
name: obspy
version: !!str 0.10.0
version: "0.10.0rc1"

source:
fn: taupy.zip
url: https://github.com/obspy/obspy/archive/taupy.zip
# patches:
# List any patch files here
# - fix.patch

# build:
#preserve_egg_dir: True
#entry_points:
# Put any entry points (scripts to be generated automatically) here. The
# syntax is module:function. For example
#
# - obspy = obspy:main
#
# Would create an entry point called obspy that calls obspy.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
fn: obspy-master.zip
url: https://github.com/obspy/obspy/archive/master.zip
# alternatively we can use a local path, however this fails with
# shutil.Error: [('/path/to/obspy/misc/docs/source/tutorial/ObsPyTutorial.pdf',
# '/path/to/miniconda3/conda-bld/work/misc/docs/source/tutorial/ObsPyTutorial.pdf',
# "[Errno 2] No such file or directory: '/path/to/obspy/misc/docs/source/tutorial/ObsPyTutorial.pdf'")]
#path: ../../../..

build:
number: 0
script: python setup.py install

requirements:
build:
- python
- numpy
- setuptools
- future
- numpy
- mock # [py2k]
- scipy
- lxml
- matplotlib
- future
- lxml
- sqlalchemy
- argparse # [py26]
- flake8
run:
- python
- numpy
- setuptools
- future
- numpy
- mock # [py2k]
- scipy
- lxml
- matplotlib
- future
- lxml
- sqlalchemy
- argparse # [py26]
- flake8

test:
# Python imports
imports:
- obspy

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


# 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
- obspy.mseed

about:
home: http://www.obspy.org
license: GNU Library or Lesser General Public License (LGPL)

# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml
home: http://obspy.org
license: LGPLv3
summary: "ObsPy: A Python Toolbox for seismology/seismological observatories."

0 comments on commit 9153a5e

Please sign in to comment.