Skip to content

Commit a95968b

Browse files
authored
Merge pull request #223 from Helene/required_python
Disable running grafana-bridge 8.0.x with Python <3.8
2 parents 7d24dc7 + 3fc4463 commit a95968b

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

source/profiler.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,21 @@
2424
import io
2525
import os
2626
from cProfile import Profile
27-
from pstats import SortKey, Stats
27+
try:
28+
# Optional dependency
29+
from pstats import SortKey
30+
except ImportError as e:
31+
SortKey = e
32+
from pstats import Stats
2833
from metaclasses import Singleton
2934

3035

3136
class Profiler(metaclass=Singleton):
3237
exposed = True
3338

3439
def __init__(self, path=None):
40+
if isinstance(SortKey, ImportError):
41+
raise SortKey
3542
if not path:
3643
path = os.path.join(os.path.dirname(__file__), 'profile')
3744
self.path = path

source/zimonGrafanaIntf.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,17 @@ def main(argv):
208208
print(msg)
209209
return
210210

211+
if sys.version < '3.8':
212+
print(f'\nYor system running {sys.version} \n\nThe IBM Storage Scale bridge for Grafana requires Python3.8 or above. \
213+
\nRead the following instructions for possible solution: \
214+
\nhttps://github.com/IBM/ibm-spectrum-scale-bridge-for-grafana/wiki/What-to-do-if-your-system-is-on-a-Python-version-lower-than-3.8')
215+
return
216+
217+
if __version__.endswith('-dev'):
218+
print('\n Warning: You are running a Development version of the IBM Storage Scale bridge for Grafana. \
219+
\n It is recommended to use the latest released version, published on: \
220+
\n https://github.com/IBM/ibm-spectrum-scale-bridge-for-grafana/releases \n')
221+
211222
registered_apps = []
212223

213224
if args.get('enabled', False):

0 commit comments

Comments
 (0)