diff --git a/.gitignore b/.gitignore index f509a6b4334..bc43df63bfa 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/misc/installer/anaconda/LinuxCondaBuilder_32bit/Dockerfile b/misc/installer/anaconda/LinuxCondaBuilder_32bit/Dockerfile new file mode 100644 index 00000000000..39b1a09397c --- /dev/null +++ b/misc/installer/anaconda/LinuxCondaBuilder_32bit/Dockerfile @@ -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 diff --git a/misc/installer/anaconda/LinuxCondaBuilder_64bit/Dockerfile b/misc/installer/anaconda/LinuxCondaBuilder_64bit/Dockerfile new file mode 100644 index 00000000000..ce303eb1473 --- /dev/null +++ b/misc/installer/anaconda/LinuxCondaBuilder_64bit/Dockerfile @@ -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 diff --git a/misc/installer/anaconda/README.md b/misc/installer/anaconda/README.md new file mode 100644 index 00000000000..162cbdbbe42 --- /dev/null +++ b/misc/installer/anaconda/README.md @@ -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 diff --git a/misc/installer/anaconda/build_conda_packages_linux.sh b/misc/installer/anaconda/build_conda_packages_linux.sh new file mode 100755 index 00000000000..d7a2004b631 --- /dev/null +++ b/misc/installer/anaconda/build_conda_packages_linux.sh @@ -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 diff --git a/misc/installer/anaconda/obspy/bld.bat b/misc/installer/anaconda/obspy/bld.bat deleted file mode 100644 index 87b1481d740..00000000000 --- a/misc/installer/anaconda/obspy/bld.bat +++ /dev/null @@ -1,8 +0,0 @@ -"%PYTHON%" setup.py install -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. diff --git a/misc/installer/anaconda/obspy/build.sh b/misc/installer/anaconda/obspy/build.sh deleted file mode 100644 index 39de1908dd3..00000000000 --- a/misc/installer/anaconda/obspy/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -if [ -z "$OSX_ARCH" ]; then -$PYTHON setup.py install -else -$PYTHON setup.py install -fi diff --git a/misc/installer/anaconda/obspy/meta.yaml b/misc/installer/anaconda/obspy/meta.yaml index 5c4ff84b37e..f3a79632c29 100644 --- a/misc/installer/anaconda/obspy/meta.yaml +++ b/misc/installer/anaconda/obspy/meta.yaml @@ -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."