fix pisitools and shelltools
This commit is contained in:
@@ -282,3 +282,34 @@ def removeDir(destinationDirectory):
|
||||
|
||||
for directory in destdirGlob:
|
||||
unlinkDir(directory)
|
||||
|
||||
|
||||
class Flags:
|
||||
def __init__(self, *evars):
|
||||
self.evars = evars
|
||||
|
||||
def add(self, *flags):
|
||||
for evar in self.evars:
|
||||
os.environ[evar] = " ".join(os.environ[evar].split() + [f.strip() for f in flags])
|
||||
|
||||
def remove(self, *flags):
|
||||
for evar in self.evars:
|
||||
os.environ[evar] = " ".join([v for v in os.environ[evar].split() if v not in [f.strip() for f in flags]])
|
||||
|
||||
def replace(self, old_val, new_val):
|
||||
for evar in self.evars:
|
||||
os.environ[evar] = " ".join([new_val if v == old_val else v for v in os.environ[evar].split()])
|
||||
|
||||
def sub(self, pattern, repl, count=0, flags=0):
|
||||
for evar in self.evars:
|
||||
os.environ[evar] = re.sub(pattern, repl, os.environ[evar], count, flags)
|
||||
|
||||
def reset(self):
|
||||
for evar in self.evars:
|
||||
os.environ[evar] = ""
|
||||
|
||||
|
||||
cflags = Flags("CFLAGS")
|
||||
ldflags = Flags("LDFLAGS")
|
||||
cxxflags = Flags("CXXFLAGS")
|
||||
flags = Flags("CFLAGS", "CXXFLAGS")
|
||||
|
||||
@@ -271,7 +271,7 @@ def dirName(filePath):
|
||||
|
||||
|
||||
def system(command):
|
||||
command = string.join(string.split(command))
|
||||
command = ' '.join(command.split())
|
||||
retValue = run_logged(command)
|
||||
|
||||
#if return value is different than 0, it means error, raise exception
|
||||
|
||||
Reference in New Issue
Block a user