Skip to content

Commit bfcf0d8

Browse files
author
Tristan Carel
authored
Advise BB5 user when setuptools is not available (#147)
1 parent 046add4 commit bfcf0d8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cpp/lib.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import functools
1111
import logging
1212
import operator
13+
import os
1314
import os.path
1415
from pathlib import Path
1516
import re
@@ -22,7 +23,17 @@
2223
import urllib.request
2324
import venv
2425

25-
import pkg_resources
26+
try:
27+
import pkg_resources
28+
except ImportError:
29+
home = os.environ["HOME"]
30+
bb5_home = f"/gpfs/bbp.cscs.ch/home/{os.environ['USER']}"
31+
if home == bb5_home:
32+
print("Error: could not find setuptools Python package.", file=sys.stderr)
33+
print("Consider loading module 'python-dev'\n", file=sys.stderr)
34+
print(" module load python-dev\n", file=sys.stderr)
35+
sys.exit(1)
36+
raise
2637

2738
THIS_SCRIPT_DIR = Path(__file__).resolve().parent
2839
DEFAULT_RE_EXTRACT_VERSION = "([0-9]+\\.[0-9]+(\\.[0-9]+)?[ab]?)"

0 commit comments

Comments
 (0)