summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
Diffstat (limited to 'buildscripts')
-rw-r--r--buildscripts/cleanbb.py12
-rw-r--r--buildscripts/utils.py12
2 files changed, 18 insertions, 6 deletions
diff --git a/buildscripts/cleanbb.py b/buildscripts/cleanbb.py
index 261519a..bfeafd2 100644
--- a/buildscripts/cleanbb.py
+++ b/buildscripts/cleanbb.py
@@ -1,13 +1,15 @@
import sys
-import os
+import os, os.path
import utils
import time
from optparse import OptionParser
-cwd = os.getcwd();
-if cwd.find("buildscripts" ) > 0 :
- cwd = cwd.partition( "buildscripts" )[0]
+# set cwd to the root mongo dir, one level up from this
+# file's location (if we're not already running from there)
+cwd = os.getcwd()
+if os.path.basename(cwd) == 'buildscripts':
+ cwd = os.path.dirname(cwd)
print( "cwd [" + cwd + "]" )
@@ -38,7 +40,7 @@ def killprocs( signal="" ):
if not shouldKill( x ):
continue
- pid = x.partition( " " )[0]
+ pid = x.split( " " )[0]
print( "killing: " + x )
utils.execsys( "/bin/kill " + signal + " " + pid )
killed = killed + 1
diff --git a/buildscripts/utils.py b/buildscripts/utils.py
index 91409c7..bde2b08 100644
--- a/buildscripts/utils.py
+++ b/buildscripts/utils.py
@@ -3,6 +3,8 @@ import re
import socket
import time
import os
+import sys
+
# various utilities that are handy
def getAllSourceFiles( arr=None , prefix="." ):
@@ -139,6 +141,14 @@ def smoke_python_name():
# then we assume that "python" points to a 2.5 or
# greater python VM. otherwise, explicitly use 2.5
# which we assume to be installed.
+ min_version_tuple = (2, 5)
+ try:
+ if sys.version_info >= min_version_tuple:
+ return sys.executable
+ except AttributeError:
+ # In case the version of Python is somehow missing sys.version_info or sys.executable.
+ pass
+
import subprocess
version = re.compile(r'[Pp]ython ([\d\.]+)', re.MULTILINE)
binaries = ['python2.5', 'python2.6', 'python2.7', 'python25', 'python26', 'python27', 'python']
@@ -150,7 +160,7 @@ def smoke_python_name():
match = version.search(stream)
if match:
versiontuple = tuple(map(int, match.group(1).split('.')))
- if versiontuple >= (2, 5):
+ if versiontuple >= min_version_tuple:
return binary
except:
pass