From 609169f25b57a73f11c275610ac6b35f384e1541 Mon Sep 17 00:00:00 2001 From: Josh Bennett Date: Fri, 6 Apr 2018 17:27:36 +0000 Subject: [PATCH 1/4] Add meta.yaml for conda-build --- meta.yaml | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 meta.yaml diff --git a/meta.yaml b/meta.yaml new file mode 100644 index 0000000..227ec14 --- /dev/null +++ b/meta.yaml @@ -0,0 +1,47 @@ +{% set name = "ipython_memwatcher" %} +{% set version = "0.2.1" %} +{% set file_ext = "tar.gz" %} +{% set hash_type = "sha256" %} +{% set hash_value = "a8a3204d5baf930cb3e379ccce215c0af4f33d95338ea7c31a4886cbf6409866" %} + +package: + name: '{{ name|lower }}' + version: '{{ version }}' + +source: + fn: '{{ name }}-{{ version }}.{{ file_ext }}' + url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.{{ file_ext }} + '{{ hash_type }}': '{{ hash_value }}' + +build: + number: 0 + script: python setup.py install --single-version-externally-managed --record=record.txt + +requirements: + host: + - python + - setuptools + - ipython >=2.1 + - memory_profiler + run: + - python + - ipython >=2.1 + - memory_profiler + +test: + imports: + - ipython_memwatcher + +about: + home: https://github.com/FrancescAlted/ipython_memwatcher + license: BSD-2-Clause + license_family: BSD + license_file: 'License.txt' + summary: 'ipython_memwatcher: display memory usage during IPython execution' + description: "ipython_memwatcher is an IPython tool to report memory usage deltas for\nevery command you type.\n\nThis is strongly based on\nhttps://github.com/ianozsvald/ipython_memory_usage by Ian Ozsvald\ + \ and in\nthe future ipython_memwatcher can merged back into ipython_memory_usage." + doc_url: '' + dev_url: '' + +extra: + recipe-maintainers: 'faltet AT gmail DOT com' From 81f92d67b9b9244410a718c8e597f14c70738414 Mon Sep 17 00:00:00 2001 From: Josh Bennett Date: Fri, 6 Apr 2018 19:14:31 +0000 Subject: [PATCH 2/4] Add travis yml and anaconda deploy script * Add .travis.yml for conda builds and the ability to deploy when a tag is created * Add a script to deploy to anaconda. The login is driven by an anaconda org token stashe din the ANACONDA_TOKEN env var. * update .gitignore to exclude conda-bld folder * updated meta.yaml with better info. --- .gitignore | 3 +++ .travis.yml | 34 ++++++++++++++++++++++++++++++++++ meta.yaml | 2 +- scripts/deploy_anaconda.sh | 20 ++++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .travis.yml create mode 100755 scripts/deploy_anaconda.sh diff --git a/.gitignore b/.gitignore index ba74660..3d58548 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,6 @@ docs/_build/ # PyBuilder target/ + +#conda build files +conda-bld/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..aa3bf44 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,34 @@ +language: python + +python: + - "2.7" + - "3.4" + - "3.6" + +install: + - sudo apt-get update + - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then + wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh; + else + wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; + fi + - bash miniconda.sh -b -p $HOME/miniconda + - export PATH="$HOME/miniconda/bin:$PATH" + - hash -r + - conda config --set always_yes yes --set changeps1 no + - conda update -q conda + - conda info -a + - conda install conda-build + - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION + - source activate test-environment + - conda build . + +script: + - echo "script step" + +deploy: + - provider: script + script: ./scripts/deploy_anaconda.sh + on: + tags: true + skip_cleanup: true \ No newline at end of file diff --git a/meta.yaml b/meta.yaml index 227ec14..1bf9b06 100644 --- a/meta.yaml +++ b/meta.yaml @@ -36,7 +36,7 @@ about: home: https://github.com/FrancescAlted/ipython_memwatcher license: BSD-2-Clause license_family: BSD - license_file: 'License.txt' + license_file: 'LICENSE.txt' summary: 'ipython_memwatcher: display memory usage during IPython execution' description: "ipython_memwatcher is an IPython tool to report memory usage deltas for\nevery command you type.\n\nThis is strongly based on\nhttps://github.com/ianozsvald/ipython_memory_usage by Ian Ozsvald\ \ and in\nthe future ipython_memwatcher can merged back into ipython_memory_usage." diff --git a/scripts/deploy_anaconda.sh b/scripts/deploy_anaconda.sh new file mode 100755 index 0000000..f9f715d --- /dev/null +++ b/scripts/deploy_anaconda.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# this script uses the ANACONDA_TOKEN env var. +# to create a token: +# >>> anaconda login +# >>> anaconda auth -c -n travis --max-age 307584000 --url https://anaconda.org/USERNAME/PACKAGENAME --scopes "api:write api:read" +set -e + +CONDA_PATH=$(which conda | sed -e 's/\(miniconda.\)\/.*/\1/g') +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +echo "Converting conda package..." +conda convert --platform all $CONDA_PATH/conda-bld/linux-64/ipython_memwatcher-*.tar.bz2 --output-dir $SCRIPT_DIR/../conda-bld/ + +ecoh "copy original linux-64 packages..." +cp -rv $CONDA_PATH/conda-bld/linux-64/ipython_memwatcher-*.tar.bz2 $SCRIPT_DIR/../conda-bld/ + +echo "Deploying to Anaconda.org..." +#anaconda -t $ANACONDA_TOKEN upload $SCRIPT_DIR/../conda-bld/**/ipython_memwatcher-*.tar.bz2 + +exit 0 \ No newline at end of file From 66be30c9da9bbe75565f6c766fff6737b44234f7 Mon Sep 17 00:00:00 2001 From: Josh Bennett Date: Fri, 6 Apr 2018 19:17:59 +0000 Subject: [PATCH 3/4] Removed the commented line to deploy to anaconda, fixed typo. --- scripts/deploy_anaconda.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/deploy_anaconda.sh b/scripts/deploy_anaconda.sh index f9f715d..d0ce0af 100755 --- a/scripts/deploy_anaconda.sh +++ b/scripts/deploy_anaconda.sh @@ -11,10 +11,10 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" echo "Converting conda package..." conda convert --platform all $CONDA_PATH/conda-bld/linux-64/ipython_memwatcher-*.tar.bz2 --output-dir $SCRIPT_DIR/../conda-bld/ -ecoh "copy original linux-64 packages..." +echo "copy original linux-64 packages..." cp -rv $CONDA_PATH/conda-bld/linux-64/ipython_memwatcher-*.tar.bz2 $SCRIPT_DIR/../conda-bld/ echo "Deploying to Anaconda.org..." -#anaconda -t $ANACONDA_TOKEN upload $SCRIPT_DIR/../conda-bld/**/ipython_memwatcher-*.tar.bz2 +anaconda -t $ANACONDA_TOKEN upload $SCRIPT_DIR/../conda-bld/**/ipython_memwatcher-*.tar.bz2 exit 0 \ No newline at end of file From da0c8af88d41fa8f0b98acc69472b3136add77a8 Mon Sep 17 00:00:00 2001 From: Josh Bennett Date: Fri, 6 Apr 2018 19:40:00 +0000 Subject: [PATCH 4/4] Fixed the copy logic for linux-64 in the anaconda deploy script --- scripts/deploy_anaconda.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/deploy_anaconda.sh b/scripts/deploy_anaconda.sh index d0ce0af..dc562bf 100755 --- a/scripts/deploy_anaconda.sh +++ b/scripts/deploy_anaconda.sh @@ -7,12 +7,17 @@ set -e CONDA_PATH=$(which conda | sed -e 's/\(miniconda.\)\/.*/\1/g') SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +OUT="$SCRIPT_DIR/../conda-bld" + echo "Converting conda package..." -conda convert --platform all $CONDA_PATH/conda-bld/linux-64/ipython_memwatcher-*.tar.bz2 --output-dir $SCRIPT_DIR/../conda-bld/ +conda convert --platform all $CONDA_PATH/conda-bld/linux-64/ipython_memwatcher-*.tar.bz2 --output-dir $OUT/ echo "copy original linux-64 packages..." -cp -rv $CONDA_PATH/conda-bld/linux-64/ipython_memwatcher-*.tar.bz2 $SCRIPT_DIR/../conda-bld/ +if [ ! -d $OUT/linux-64 ]; then + mkdir $OUT/linux-64/ +fi +cp -v $CONDA_PATH/conda-bld/linux-64/ipython_memwatcher-*.tar.bz2 $OUT/linux-64/ echo "Deploying to Anaconda.org..." anaconda -t $ANACONDA_TOKEN upload $SCRIPT_DIR/../conda-bld/**/ipython_memwatcher-*.tar.bz2