From cec7d4a205f00350b2f3a8c73b788ed33e7b2559 Mon Sep 17 00:00:00 2001
From: Joseph Weston <joseph@weston.cloud>
Date: Wed, 6 Feb 2019 18:08:18 +0100
Subject: [PATCH] add qsymm to optional dependencies

Also update CI to install qsymm on relevant platforms, and update
pytest config to skip kwant.qsymm tests when qsymm is not installed
---
 .gitlab-ci.yml | 7 ++++++-
 conftest.py    | 5 +++--
 setup.py       | 4 +++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index afe62f85..06e84dab 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -105,6 +105,7 @@ build-env:default:
   before_script:
     - source deactivate
     - source activate kwant-latest
+    - pip install qsymm
     - unset CFLAGS  # https://github.com/conda-forge/toolchain-feedstock/issues/41
 
 .bleeding-edge-env: &bleeding_edge_env
@@ -112,13 +113,17 @@ build-env:default:
     - source deactivate
     - conda env update -f /kwant-latest.yml
     - source activate kwant-latest
+    - pip install qsymm
 
 .ubuntu-env: &ubuntu_env
   image: gitlab.kwant-project.org:5005/kwant/kwant/ubuntu
+  before_script:
+    - pip3 install qsymm
 
 .debian-env: &debian_env
   image: gitlab.kwant-project.org:5005/kwant/kwant/debian
-
+  before_script:
+    - pip3 install qsymm
 
 ## Build Jobs
 
diff --git a/conftest.py b/conftest.py
index 00882f37..cdf296db 100644
--- a/conftest.py
+++ b/conftest.py
@@ -1,4 +1,4 @@
-# Copyright 2011-2017 Kwant authors.
+# Copyright 2011-2018 Kwant authors.
 #
 # This file is part of Kwant.  It is subject to the license terms in the file
 # LICENSE.rst found in the top-level directory of this distribution and at
@@ -17,7 +17,8 @@ import importlib
 
 # map from subpackage to sequence of dependency module names
 subpackage_dependencies = {
-    'kwant/continuum': ['sympy']
+    'kwant/continuum': ['sympy'],
+    'kwant/tests/test_qsymm': ['qsymm', 'sympy'],
 }
 
 
diff --git a/setup.py b/setup.py
index 57bf904c..e5116a80 100755
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python3
 
-# Copyright 2011-2017 Kwant authors.
+# Copyright 2011-2018 Kwant authors.
 #
 # This file is part of Kwant.  It is subject to the license terms in the file
 # LICENSE.rst found in the top-level directory of this distribution and at
@@ -586,6 +586,8 @@ def main():
               # The oldest versions between: Debian stable, Ubuntu LTS
               'plotting': 'matplotlib >= 1.5.1',
               'continuum': 'sympy >= 0.7.6',
+              # qsymm is only packaged on PyPI
+              'qsymm': 'qsymm >= 1.1.2',
           },
           classifiers=[c.strip() for c in classifiers.split('\n')])
 
-- 
GitLab