summaryrefslogtreecommitdiff
path: root/buildscripts/utils.py
diff options
context:
space:
mode:
authorDaniel Gottlieb <daniel.gottlieb@10gen.com>2017-01-12 16:57:46 -0500
committerDaniel Gottlieb <daniel.gottlieb@10gen.com>2017-01-12 16:57:46 -0500
commit7733be17af8cf698fc3ef7ff785c8da9fb0f4479 (patch)
tree6f97b706ec503db4f9a213bc1041d71ac6e7c8c5 /buildscripts/utils.py
parente97a1f8a16856fbea25b10e5a5ee1a1a3ab3567a (diff)
downloadmongo-7733be17af8cf698fc3ef7ff785c8da9fb0f4479.tar.gz
SERVER-11095: Have getAllSourceFiles follow symlinks inside the modules directory
Diffstat (limited to 'buildscripts/utils.py')
-rw-r--r--buildscripts/utils.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/buildscripts/utils.py b/buildscripts/utils.py
index 63a4ba6c405..cecd479681b 100644
--- a/buildscripts/utils.py
+++ b/buildscripts/utils.py
@@ -15,12 +15,12 @@ import hashlib
def getAllSourceFiles( arr=None , prefix="." ):
if arr is None:
arr = []
-
+
if not os.path.isdir( prefix ):
# assume a file
arr.append( prefix )
return arr
-
+
for x in os.listdir( prefix ):
if ( x.startswith( "." )
or x.startswith( "pcre-" )
@@ -38,8 +38,18 @@ def getAllSourceFiles( arr=None , prefix="." ):
if x.find("v8-3.25") != -1 or x.find("mozjs") != -1:
continue
+ def isFollowableDir(prefix, full):
+ if not os.path.isdir(full):
+ return False
+ if not os.path.islink(full):
+ return True
+ # Follow softlinks in the modules directory (e.g: enterprise).
+ if os.path.split(prefix)[1] == "modules":
+ return True
+ return False;
+
full = prefix + "/" + x
- if os.path.isdir( full ) and not os.path.islink( full ):
+ if isFollowableDir(prefix, full):
getAllSourceFiles( arr , full )
else:
if full.endswith( ".cpp" ) or full.endswith( ".h" ) or full.endswith( ".c" ):
@@ -250,4 +260,3 @@ def unicode_dammit(string, encoding='utf8'):
#
# name inpsired by BeautifulSoup's "UnicodeDammit"
return string.decode(encoding, 'repr')
-