File dont_import_gtk.patch of Package python-distutils-extra
--- python-distutils-extra-2.26/DistUtilsExtra/auto.py.orig 2011-03-15 11:47:28.000000000 +0100
+++ python-distutils-extra-2.26/DistUtilsExtra/auto.py 2011-03-16 23:28:18.925716210 +0100
@@ -340,7 +340,10 @@
for node in ast.walk(tree):
if isinstance(node, ast.Import):
for alias in node.names:
- if __external_mod(alias.name, attrs):
+ # do not attempt to test if 'gtk' is an external module
+ # since doing so will fail if no DISPLAY is available
+ # e.g. on RPM builders or remote servers without X forwarding
+ if alias.name == 'gtk' or __external_mod(alias.name, attrs):
imports.add(alias.name)
if isinstance(node, ast.ImportFrom):
if __external_mod(node.module, attrs):