changeset 232:4b5f83e5a2fb

Fix setup.py for the case where executing 'hg' fails.
author Daniele Nicolodi <daniele@grinta.net>
date Wed, 30 Nov 2011 10:18:07 +0100
parents a198738e3187
children f1c4825fef1c
files setup.py
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Wed Nov 30 09:54:23 2011 +0100
+++ b/setup.py	Wed Nov 30 10:18:07 2011 +0100
@@ -26,12 +26,15 @@
 
 if version.endswith('dev') and os.path.isdir('.hg'):
     # add hg revision id to version string
-    p = subprocess.Popen(['hg', 'id', '--id'],
-                         stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    out, err = p.communicate()
-    if not p.returncode:
-        rev = out.strip().replace('+', '')
-        version += '-' + rev
+    try:
+        p = subprocess.Popen(['hg', 'id', '--id'],
+                             stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        out, err = p.communicate()
+        if not p.returncode:
+            rev = out.strip().replace('+', '')
+            version += '-' + rev
+    except OSError:
+        pass
 
 
 setup(name='ltpdarepo',