Small enhancement: replaces multiple string.replace(...) by a single
string.translate() git-svn-id: https://svn.ibp.de/svn/capisuite/trunk/capisuite@399 4ebea2bb-67d4-0310-8558-a5799e421b66master
parent
73a70dedc0
commit
62ad80e7cc
|
@ -16,6 +16,9 @@ open(headerfilename, 'w') # clear file contents
|
|||
|
||||
import SCons.Conftest, string
|
||||
from types import IntType
|
||||
|
||||
transmap = string.maketrans(':./ ', '____')
|
||||
|
||||
def _Have(context, key, have):
|
||||
"""
|
||||
Slightly modified version of SCons.Conftest._Have which uses
|
||||
|
@ -23,11 +26,7 @@ def _Have(context, key, have):
|
|||
necessary until SCons support a way to actually use this feature.
|
||||
In addition this writes '#define ... 1'.
|
||||
"""
|
||||
key_up = string.upper(key)
|
||||
key_up = string.replace(key_up, ':', '_')
|
||||
key_up = string.replace(key_up, '.', '_')
|
||||
key_up = string.replace(key_up, '/', '_')
|
||||
key_up = string.replace(key_up, ' ', '_')
|
||||
key_up = string.translate(string.upper(key), transmap)
|
||||
havedict[key_up] = have
|
||||
if headerfilename:
|
||||
f = open(headerfilename, "a")
|
||||
|
|
Loading…
Reference in New Issue