From 4273d3a6f9c40f7c2cc69e7bdd69ce6ef42d4818 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Fri, 20 Dec 2024 12:01:12 +0000 Subject: [PATCH] Prompt installation of setuptools or packaging if neither found at install --- scripts/firedrake-install | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index fa39e2b3b0..17a8d7fdbc 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -16,10 +16,21 @@ from glob import iglob from itertools import chain import re import importlib + + +class InstallError(Exception): + # Exception for generic install problems. + pass + + try: from pkg_resources.extern.packaging.version import Version, InvalidVersion except ModuleNotFoundError: - from packaging.version import Version, InvalidVersion + try: + from packaging.version import Version, InvalidVersion + except ModuleNotFoundError: + raise InstallError("Neither setuptools or packaging found. Please " + "install one of these packages before trying again.") osname = platform.uname().system arch = platform.uname().machine @@ -52,11 +63,6 @@ firedrake_apps = { } -class InstallError(Exception): - # Exception for generic install problems. - pass - - class FiredrakeConfiguration(dict): """A dictionary extended to facilitate the storage of Firedrake configuration information."""