From ea0d6c57676c9f162838310960a1b34f2b47351d Mon Sep 17 00:00:00 2001 From: Tristan Carel Date: Wed, 2 Aug 2017 12:21:00 +0200 Subject: [PATCH] Do not make matplotlib mandatory So that it is not required to install it on nodes where ben-sh is executed. --- hpcbench/cli/__init__.py | 8 ++++++-- setup.py | 6 ++++-- tox.ini | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/hpcbench/cli/__init__.py b/hpcbench/cli/__init__.py index 9bcfbed..dcfb3cf 100644 --- a/hpcbench/cli/__init__.py +++ b/hpcbench/cli/__init__.py @@ -3,7 +3,6 @@ import logging from docopt import docopt -import matplotlib from hpcbench import __version__ from hpcbench.toolbox.loader import load_components @@ -27,5 +26,10 @@ def cli_common(doc, **kwargs): arguments = docopt(doc, version='hpcbench ' + __version__, **kwargs) setup_logger(arguments['-v']) load_components() - matplotlib.use('PS') + try: + import matplotlib + except ImportError: + pass + else: + matplotlib.use('PS') return arguments diff --git a/setup.py b/setup.py index 55ab7a4..074d5e7 100755 --- a/setup.py +++ b/setup.py @@ -44,17 +44,19 @@ 'cached-property==1.3.0', 'docopt==0.6.2', 'elasticsearch==5.4.0', - 'matplotlib==2.0.2', 'packaging==16.8', 'PyYAML>=3.12', 'six==1.10', ], + extras_require=dict( + PLOTTING=['matplotlib==2.0.2'], + ), entry_points=""" [console_scripts] ben-doc = hpcbench.cli.bendoc:main ben-elk = hpcbench.cli.benelk:main ben-et = hpcbench.cli.benet:main - ben-plot = hpcbench.cli.benplot:main + ben-plot = hpcbench.cli.benplot:main [PLOTTING] ben-sh = hpcbench.cli.bensh:main ben-umb = hpcbench.cli.benumb:main [hpcbench.benchmarks] diff --git a/tox.ini b/tox.ini index 067cd52..ced624f 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,7 @@ passenv = UT_SKIP_ELASTICSEARCH LD_LIBRARY_PATH commands = - pip install -e . + pip install -e .[PLOTTING] python setup.py nosetests --with-coverage --cover-inclusive --cover-erase {posargs} flake8 hpcbench -pylint hpcbench