From f056cf15620367515cae9657d0cd7fb35eb0c8ed Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Sat, 11 May 2019 17:27:02 +0200
Subject: [PATCH] Splitting python on a separate package

---
 conda/py-plumed/build.sh                |  9 +++++
 conda/py-plumed/conda_build_config.yaml |  4 +++
 conda/py-plumed/meta.yaml               | 46 +++++++++++++++++++++++++
 conda/recipe/build.sh                   |  5 ---
 conda/recipe/meta.yaml                  | 24 -------------
 conda/run-conda-build.sh                |  1 +
 conda/run-conda-upload.sh               | 11 ++----
 7 files changed, 62 insertions(+), 38 deletions(-)
 create mode 100644 conda/py-plumed/build.sh
 create mode 100644 conda/py-plumed/conda_build_config.yaml
 create mode 100644 conda/py-plumed/meta.yaml

diff --git a/conda/py-plumed/build.sh b/conda/py-plumed/build.sh
new file mode 100644
index 000000000..c93d32285
--- /dev/null
+++ b/conda/py-plumed/build.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+env | sort
+
+cd python
+make pip
+export plumed_default_kernel=$PREFIX/lib/libplumedKernel$SHLIB_EXT
+$PYTHON -m pip install .
+
diff --git a/conda/py-plumed/conda_build_config.yaml b/conda/py-plumed/conda_build_config.yaml
new file mode 100644
index 000000000..5bb1e3339
--- /dev/null
+++ b/conda/py-plumed/conda_build_config.yaml
@@ -0,0 +1,4 @@
+python:
+    - 2.7
+    - 3.6
+    - 3.7
diff --git a/conda/py-plumed/meta.yaml b/conda/py-plumed/meta.yaml
new file mode 100644
index 000000000..1331a2be8
--- /dev/null
+++ b/conda/py-plumed/meta.yaml
@@ -0,0 +1,46 @@
+{% set name = "py-plumed" %}
+{% set version = environ['VERSION'] %}
+
+package:
+  name: {{ name|lower }}
+  version: {{ version }}
+
+source:
+  path: ../..
+
+build:
+  number: 0
+  skip: True  # [win]
+  # Note: --no-deps is currently required due to https://github.com/conda/conda-build/issues/3254
+  # Once resolved, it should be removed.
+  # script: "{{ PYTHON }} -m pip install . --no-deps -vv"
+
+requirements:
+  host:
+    - python
+    - pip
+    - cython
+
+  run:
+# make sure to test with this version
+    - python
+
+test:
+  requires:
+    - plumed
+  # TODO. In principle these could be the official regtests.
+  commands:
+    - python -c "import plumed; p=plumed.Plumed(); print(p)"
+
+about:
+  home: http://www.plumed.org/
+  license: LGPL
+  license_file: COPYING.LESSER
+  summary: 'Python wrappers for plumed library'
+  description: >
+    PLUMED is an open source library for free energy calculations in
+    molecular systems which works together with some of the most
+    popular molecular dynamics engines.
+  doc_url: https://plumed.github.io/doc-v2.5/user-doc/html/index.html
+  dev_url: https://github.com/plumed/plumed2
+
diff --git a/conda/recipe/build.sh b/conda/recipe/build.sh
index eb8bc15cd..f3c6f1f0c 100644
--- a/conda/recipe/build.sh
+++ b/conda/recipe/build.sh
@@ -33,8 +33,3 @@ fi
 make -j4
 make install
 
-cd python
-make pip
-export plumed_default_kernel=$PREFIX/lib/libplumedKernel$SHLIB_EXT
-$PYTHON -m pip install .
-
diff --git a/conda/recipe/meta.yaml b/conda/recipe/meta.yaml
index ee96692cd..ae9c4085a 100644
--- a/conda/recipe/meta.yaml
+++ b/conda/recipe/meta.yaml
@@ -23,46 +23,22 @@ requirements:
   build:
     - {{ compiler('c') }}
     - {{ compiler('cxx') }}
-    - {{ compiler('fortran') }}
-    - m2-bash  # [win]
-    - m2-curl  # [win]
-    - m2-findutils  # [win]
-    - m2-diffutils  # [win]
-    - m2-gawk  # [win]
-    - m2-grep  # [win]
-    - m2-make  # [win]
-    - m2-sed  # [win]
-    - m2-which  # [win]
-    - m2-tar  # [win]
-    - {{ compiler('m2w64_fortran') }}  # [win]
-    - {{ compiler('m2w64_c') }}  # [win]
-    - {{ compiler('m2w64_cxx') }}  # [win]
 #    - ccache-toolchain
   host:
-    - python
-    - pip
-    - cython
     - zlib
 # cannot link gsl on MacOS
     - gsl # [linux]
-    - m2w64-binutils  # [win]
-    - m2w64-gcc  # [win]
-    - m2w64-tools-git  # [win]
 
   run:
-    - python
     - zlib
     - gsl # [linux]
 
 test:
   # TODO. In principle these could be the official regtests.
-  imports:
-    - plumed
   commands:
     - plumed info --root
     - plumed info --version
     - plumed info --long-version
-    - python -c "import plumed; p=plumed.Plumed(); print(p)"
 
 about:
   home: http://www.plumed.org/
diff --git a/conda/run-conda-build.sh b/conda/run-conda-build.sh
index 60680265e..05d1e199c 100644
--- a/conda/run-conda-build.sh
+++ b/conda/run-conda-build.sh
@@ -24,6 +24,7 @@ conda info -a
 conda install conda-build conda-verify anaconda-client
 
 conda-build recipe
+conda-build py-plumed
 
 ls -l $CONDA_HOME/conda-bld/
 ls -l $CONDA_HOME/conda-bld/$TRAVIS_OS_NAME-64
diff --git a/conda/run-conda-upload.sh b/conda/run-conda-upload.sh
index 1bdb51d9e..54a051684 100644
--- a/conda/run-conda-upload.sh
+++ b/conda/run-conda-upload.sh
@@ -3,15 +3,6 @@
 # Anywhere but outside of the repository
 export CONDA_HOME=/var/tmp/miniconda
 
-if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
-    csys=Linux
-elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
-    csys=MacOSX
-else
-    echo "Unsupported system $TRAVIS_OS_NAME"
-    exit 1
-fi
-    
 export PATH="$CONDA_HOME/bin:$PATH"
 
 # Disabled because it fails
@@ -19,6 +10,8 @@ if [[ -n "$CONDA_UPLOAD_TOKEN" ]]; then
     USER=plumed  # the conda channel
     anaconda -t $CONDA_UPLOAD_TOKEN upload -u $USER -l testing \
 	     $CONDA_HOME/conda-bld/$TRAVIS_OS_NAME-64/plumed*.tar.bz2 --force
+    anaconda -t $CONDA_UPLOAD_TOKEN upload -u $USER -l testing \
+	     $CONDA_HOME/conda-bld/$TRAVIS_OS_NAME-64/py-plumed*.tar.bz2 --force
 fi
 
 
-- 
GitLab