[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[minion-cvs] Give a helpful error message on missing distutils



Update of /home/minion/cvsroot/src/minion
In directory moria.mit.edu:/tmp/cvs-serv15380

Modified Files:
	setup.py 
Log Message:
Give a helpful error message on missing distutils

Index: setup.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/setup.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- setup.py	7 Jan 2003 06:12:47 -0000	1.32
+++ setup.py	7 Jan 2003 18:40:48 -0000	1.33
@@ -131,7 +131,27 @@
 
 #======================================================================
 # Define a helper to let us run commands from the compiled code.
-from distutils.core import Command
+def _haveCmd(cmdname):
+    for entry in os.environ.get("PATH", "").split(os.pathsep):
+        if os.path.exists(os.path.join(entry, cmdname)):
+            return 1
+    return 0
+
+try:
+    from distutils.core import Command
+except ImportError:
+    print "Uh oh.  You have Python installed, but I didn't find the distutils"
+    print "module, which is supposed to come with the standard library."
+    if _haveCmd("apt-get"):
+        v = sys.version[:3]
+        print "Debian may expect you to install python%s-dev"%v
+    elif _haveCmd("rpm"):
+        print "Redhat may need to install python2-devel"
+    else:
+        print "You may be missing some 'python development' package for your"
+        print "distribution."
+    sys.exit(0)
+        
 
 class runMMCommand(Command):
     # Based on setup.py from Zooko's pyutil package, which is in turn based on