summaryrefslogtreecommitdiff
path: root/tools/build/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'tools/build/src/util')
-rw-r--r--tools/build/src/util/__init__.py46
-rw-r--r--tools/build/src/util/doc.jam2
-rw-r--r--tools/build/src/util/order.jam4
-rw-r--r--tools/build/src/util/os.jam2
4 files changed, 53 insertions, 1 deletions
diff --git a/tools/build/src/util/__init__.py b/tools/build/src/util/__init__.py
index f80fe70e9..e6a277af7 100644
--- a/tools/build/src/util/__init__.py
+++ b/tools/build/src/util/__init__.py
@@ -3,6 +3,9 @@ import bjam
import re
import types
+from itertools import groupby
+
+
# Decorator the specifies bjam-side prototype for a Python function
def bjam_signature(s):
@@ -134,3 +137,46 @@ def stem(filename):
return filename[0:i]
else:
return filename
+
+
+def abbreviate_dashed(s):
+ """Abbreviates each part of string that is delimited by a '-'."""
+ r = []
+ for part in s.split('-'):
+ r.append(abbreviate(part))
+ return '-'.join(r)
+
+
+def abbreviate(s):
+ """Apply a set of standard transformations to string to produce an
+ abbreviation no more than 4 characters long.
+ """
+ if not s:
+ return ''
+ # check the cache
+ if s in abbreviate.abbreviations:
+ return abbreviate.abbreviations[s]
+ # anything less than 4 characters doesn't need
+ # an abbreviation
+ if len(s) < 4:
+ # update cache
+ abbreviate.abbreviations[s] = s
+ return s
+ # save the first character in case it's a vowel
+ s1 = s[0]
+ s2 = s[1:]
+ if s.endswith('ing'):
+ # strip off the 'ing'
+ s2 = s2[:-3]
+ # reduce all doubled characters to one
+ s2 = ''.join(c for c, _ in groupby(s2))
+ # remove all vowels
+ s2 = s2.translate(None, "AEIOUaeiou")
+ # shorten remaining consonants to 4 characters
+ # and add the first char back to the front
+ s2 = s1 + s2[:4]
+ # update cache
+ abbreviate.abbreviations[s] = s2
+ return s2
+# maps key to its abbreviated form
+abbreviate.abbreviations = {}
diff --git a/tools/build/src/util/doc.jam b/tools/build/src/util/doc.jam
index 702cab4b5..733fa7c97 100644
--- a/tools/build/src/util/doc.jam
+++ b/tools/build/src/util/doc.jam
@@ -264,7 +264,7 @@ local rule print-help-top ( )
print.list-item "-a Rebuild everything" ;
print.list-item "-n Don't execute the commands, only print them" ;
print.list-item "-d+2 Show commands as they are executed" ;
- print.list-item "-d0 Supress all informational messages" ;
+ print.list-item "-d0 Suppress all informational messages" ;
print.list-item "-q Stop at first error" ;
print.list-item "--reconfigure Rerun all configuration checks" ;
print.list-item "--debug-configuration Diagnose configuration" ;
diff --git a/tools/build/src/util/order.jam b/tools/build/src/util/order.jam
index a74fc8c84..793c96130 100644
--- a/tools/build/src/util/order.jam
+++ b/tools/build/src/util/order.jam
@@ -166,4 +166,8 @@ rule __test__ ( )
$(c1).add-pair x l2 ;
assert.result l1 l2 : $(c1).order l2 l1 ;
assert.result l1 l2 l3 : $(c1).order l2 l3 l1 ;
+
+ # The output should be stable for unconstrained
+ # elements.
+ assert.result l4 l5 : $(c1).order l4 l5 ;
}
diff --git a/tools/build/src/util/os.jam b/tools/build/src/util/os.jam
index daef27f77..818b0b423 100644
--- a/tools/build/src/util/os.jam
+++ b/tools/build/src/util/os.jam
@@ -75,6 +75,8 @@ if $(.name) = NT
.shared-library-path-variable-AIX = LIBPATH ;
+.shared-library-path-variable-HAIKU = LIBRARY_PATH ;
+
# Default constants
.shared-library-path-variable = LD_LIBRARY_PATH ;
.path-separator = ":" ;