From 23cf1c18b64fda0095c93400be914ef6c0ea5a35 Mon Sep 17 00:00:00 2001
From: Kenny Sharma <kenny.sharma@tum.de>
Date: Thu, 20 Jul 2017 15:47:30 +0200
Subject: [PATCH] [NRRPLT-5460] Only compile numpy once if needed.

After the removal of the additional hbp-nrp dependencies to
support Bitbucket installation, our Jenkins builds now (again)
build one version of numpy with scipy and one separately as
specified by the CLE. This patch migrates the early installation of
numpy from the CLE to mitigate this.

All packages were updated to future proof dependencies, failure is
ignored and normal installation will proceed if there is no numpy
requirement specified.

Minor pylint cleanup also performed in the setup.py files.

Change-Id: I6b055439c80d931845937939261eb4b6b649c50a
---
 hbp_nrp_music_interface/setup.py | 17 +++++++++++------
 hbp_nrp_music_xml/setup.py       | 17 +++++++++++------
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/hbp_nrp_music_interface/setup.py b/hbp_nrp_music_interface/setup.py
index 863ccb5..a06b1e9 100644
--- a/hbp_nrp_music_interface/setup.py
+++ b/hbp_nrp_music_interface/setup.py
@@ -1,11 +1,6 @@
 '''setup.py'''
 
-# pylint: disable=F0401,E0611,W0142
-
-try:
-    from setuptools import setup
-except ImportError:
-    from distutils.core import setup
+from setuptools import setup
 
 import hbp_nrp_music_interface
 import pip
@@ -30,6 +25,16 @@ else:
     )
 reqs = [str(ir.req) for ir in install_reqs]
 
+# ensure we install numpy before the main list of requirements, ignore
+# failures if numpy/cython are not requirements and just proceed (future proof)
+try:
+    cython_req = next(r for r in reqs if r.startswith('cython'))
+    numpy_req = next(r for r in reqs if r.startswith('numpy'))
+    pip.main(['install', '--no-clean', cython_req, numpy_req])
+# pylint: disable=bare-except
+except:
+    pass
+
 config = {
     'description': 'MUSIC interface support for CLE/ExDBackend for HBP SP10',
     'author': 'HBP Neurorobotics',
diff --git a/hbp_nrp_music_xml/setup.py b/hbp_nrp_music_xml/setup.py
index a003be0..fe40451 100644
--- a/hbp_nrp_music_xml/setup.py
+++ b/hbp_nrp_music_xml/setup.py
@@ -1,11 +1,6 @@
 '''setup.py'''
 
-# pylint: disable=F0401,E0611,W0142
-
-try:
-    from setuptools import setup
-except ImportError:
-    from distutils.core import setup
+from setuptools import setup
 
 import hbp_nrp_music_xml
 import pip
@@ -30,6 +25,16 @@ else:
     )
 reqs = [str(ir.req) for ir in install_reqs]
 
+# ensure we install numpy before the main list of requirements, ignore
+# failures if numpy/cython are not requirements and just proceed (future proof)
+try:
+    cython_req = next(r for r in reqs if r.startswith('cython'))
+    numpy_req = next(r for r in reqs if r.startswith('numpy'))
+    pip.main(['install', '--no-clean', cython_req, numpy_req])
+# pylint: disable=bare-except
+except:
+    pass
+
 config = {
     'description': 'MUSIC XML support for pyNN/NEST for HBP SP10',
     'author': 'HBP Neurorobotics',
-- 
GitLab