Decorator patter and initial build
This commit is contained in:
66
src/site_scons/miscsetup/ArgumentsSetup.py
Normal file
66
src/site_scons/miscsetup/ArgumentsSetup.py
Normal file
@@ -0,0 +1,66 @@
|
||||
#
|
||||
# This file is part of cpp-patterns.
|
||||
#
|
||||
# cpp-patterns is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# cpp-patterns is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with cpp-patterns. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
class ArgumentsSetup(object):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
from SCons.Script import ARGUMENTS, GetOption
|
||||
|
||||
self.__debugArg = ARGUMENTS.get('DEBUG', '1')
|
||||
if self.__debugArg not in ['0', '1']:
|
||||
raise RuntimeError('Check the DEBUG input argument.')
|
||||
|
||||
self.__assertArg = '1' if self.__debugArg == '1' else '0'
|
||||
if self.__assertArg not in ['0', '1']:
|
||||
raise RuntimeError('Check the ASSERT input argument.')
|
||||
|
||||
self.__compilerName = ARGUMENTS.get('COMPILER', '')
|
||||
|
||||
self.__isClean = GetOption('clean')
|
||||
|
||||
@property
|
||||
def isDebug(self):
|
||||
return self.__debugArg == '1'
|
||||
|
||||
@property
|
||||
def isAssert(self):
|
||||
return self.__assertArg == '1'
|
||||
|
||||
@property
|
||||
def compilerName(self):
|
||||
return self.__compilerName
|
||||
|
||||
@property
|
||||
def isClean(self):
|
||||
return self.__isClean
|
||||
|
||||
def summary(self):
|
||||
|
||||
def printDefault(x):
|
||||
return x if x else '-default-'
|
||||
|
||||
lstr = '=' * 50 + '\n'
|
||||
lstr += 'Build Arguments Summary\n'
|
||||
lstr += '=' * 50 + '\n'
|
||||
lstr += 'debug: ' + str(self.isDebug) + '\n'
|
||||
lstr += 'assert: ' + str(self.isAssert) + '\n'
|
||||
lstr += 'compiler name: ' + printDefault(self.compilerName) + '\n'
|
||||
lstr += 'clean build: ' + str(self.isClean) + '\n'
|
||||
lstr += '-' * 50 + '\n'
|
||||
return lstr
|
||||
Reference in New Issue
Block a user