Skip to content

Commit 251622a

Browse files
committed
configure.py: While the best solution would be for everyone to have the python3 module 'packaging' we also accept 'distutils' for now as a substitute. bugref:11003
svn:sync-xref-src-repo-rev: r172591
1 parent 0a4c20b commit 251622a

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

configure.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# $Id: configure.py 112856 2026-02-06 18:32:32Z klaus.espenlaub@oracle.com $
2+
# $Id: configure.py 112857 2026-02-06 19:37:10Z klaus.espenlaub@oracle.com $
33
"""
44
Configuration script for building VirtualBox.
55
@@ -61,7 +61,7 @@
6161
# External Python modules or other dependencies are not allowed!
6262
#
6363

64-
__revision__ = "$Revision: 112856 $"
64+
__revision__ = "$Revision: 112857 $"
6565

6666
import argparse
6767
import ctypes
@@ -2764,7 +2764,7 @@ def checkCallback_PythonModules(self):
27642764
self.printVerbose(1, 'Python disbled, skipping');
27652765
return True;
27662766

2767-
asModulesToCheck = [ 'packaging' ]; # Required by XPCOM.
2767+
asModulesToCheck = [ 'packaging' ]; # Required by VirtualBox API bindings (both COM and XPCOM).
27682768

27692769
self.printVerbose(1, 'Checking modules ...');
27702770

@@ -2773,6 +2773,16 @@ def checkCallback_PythonModules(self):
27732773
self.printVerbose(1, f"Checking module '{sCurMod}'");
27742774
importlib.import_module(sCurMod);
27752775
except ImportError:
2776+
# Hack to accept distutils for now as a substitute to the packaging module.
2777+
if sCurMod == 'packaging':
2778+
try:
2779+
self.printVerbose(1, f"Checking module 'distutils'");
2780+
importlib.import_module('distutils');
2781+
except ImportError:
2782+
self.printWarn(f"Python module '{sCurMod}' or 'distutils' is not installed");
2783+
self.print(f"Hint: Try running 'pip install {sCurMod}' (or 'pip install distutils')");
2784+
return False;
2785+
continue;
27762786
self.printWarn(f"Python module '{sCurMod}' is not installed");
27772787
self.print (f"Hint: Try running 'pip install {sCurMod}'");
27782788
return False;

0 commit comments

Comments
 (0)