_exe = '.exe'
_obj = '.obj'
_shobj = '.obj'
- _dll = '.dll'
lib_ = ''
+ _lib = '.lib'
+ dll_ = ''
+ _dll = '.dll'
fortran_lib = gccFortranLibs()
elif sys.platform == 'cygwin':
_exe = '.exe'
_obj = '.o'
_shobj = '.os'
+ lib_ = 'lib'
+ _lib = '.a'
+ dll_ = ''
_dll = '.dll'
- lib_ = ''
fortran_lib = gccFortranLibs()
elif string.find(sys.platform, 'irix') != -1:
_exe = ''
_obj = '.o'
_shobj = '.o'
- _dll = '.so'
lib_ = 'lib'
+ _lib = '.a'
+ dll_ = 'lib'
+ _dll = '.so'
fortran_lib = ['ftn']
else:
_exe = ''
_obj = '.o'
_shobj = '.os'
- _dll = '.so'
lib_ = 'lib'
+ _lib = '.a'
+ dll_ = 'lib'
+ _dll = '.so'
fortran_lib = gccFortranLibs()
RELEASE 0.95 - XXX
+ From Chad Austin:
+
+ - Replace print statements with calls to sys.stdout.write() so output
+ lines stay together when -j is used.
+
+ - Add portability fixes for a number of tests.
+
+ - Accomodate the fact that Cygwin's os.path.normcase() lies about
+ the underlying system being case-sensitive.
+
From Steven Knight:
- Fix EnsureSConsVersion() so it checks against the SCons version,
import os.path
import re
import string
+import sys
import SCons.Errors
import SCons.Util
def show(self, string):
if print_actions:
- print string
+ sys.stdout.write(string + '\n')
def get_actions(self):
return [self]
ASSuffixes = ['.s', '.asm', '.ASM']
ASPPSuffixes = ['.spp', '.SPP']
-if os.path.normcase('.s') == os.path.normcase('.S'):
- ASSuffixes.extend(['.S'])
-else:
+if SCons.Util.case_sensitive_suffixes('.s', '.S'):
ASPPSuffixes.extend(['.S'])
+else:
+ ASSuffixes.extend(['.S'])
def generate(env):
"""Add Builders and construction variables for as to an Environment."""
compilers = ['CC', 'c++']
CXXSuffixes = ['.cpp', '.cc', '.cxx', '.c++', '.C++']
-if os.path.normcase('.c') != os.path.normcase('.C'):
+if SCons.Util.case_sensitive_suffixes('.c', '.C'):
CXXSuffixes.append('.C')
def iscplusplus(source):
import SCons.Util
CSuffixes = ['.c']
-if os.path.normcase('.c') == os.path.normcase('.C'):
+if not SCons.Util.case_sensitive_suffixes('.c', '.C'):
CSuffixes.append('.C')
def generate(env):
F77Suffixes = ['.f', '.for', '.FOR']
F77PPSuffixes = ['.fpp', '.FPP']
-if os.path.normcase('.f') == os.path.normcase('.F'):
- F77Suffixes.append('.F')
-else:
+if SCons.Util.case_sensitive_suffixes('.f', '.F'):
F77PPSuffixes.append('.F')
+else:
+ F77Suffixes.append('.F')
def generate(env):
"""Add Builders and construction variables for f77 to an Environment."""
if env['PLATFORM'] == 'cygwin':
env['SHCCFLAGS'] = '$CCFLAGS'
else:
- env['SHCCFLAGS'] = '$CCFLAGS -fPIC'
+ env['SHCCFLAGS'] = ['$CCFLAGS', '-fPIC']
def exists(env):
return env.Detect(compilers)
ASSuffixes = ['.s', '.asm', '.ASM']
ASPPSuffixes = ['.spp', '.SPP']
-if os.path.normcase('.s') == os.path.normcase('.S'):
- ASSuffixes.extend(['.S'])
-else:
+if SCons.Util.case_sensitive_suffixes('.s', '.S'):
ASPPSuffixes.extend(['.S'])
+else:
+ ASSuffixes.extend(['.S'])
def generate(env):
"""Add Builders and construction variables for masm to an Environment."""
env['SHCCFLAGS'] = '$CCFLAGS'
env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CCCOMFLAGS'
env['CXX'] = '$CC'
- env['CXXFLAGS'] = '$CCFLAGS $( /TP $)'
+ env['CXXFLAGS'] = ['$CCFLAGS', '$(', '/TP', '$)']
env['CXXCOM'] = '$CXX $CXXFLAGS $CCCOMFLAGS'
env['SHCXX'] = '$CXX'
env['SHCXXFLAGS'] = '$CXXFLAGS'
def Parse(self):
try:
- dspfile = file(self.dspfile,'r')
+ dspfile = open(self.dspfile,'r')
except IOError:
return # doesn't exist yet, so can't add anything to configs.
def Build(self):
try:
- self.file = file(self.dspfile,'w')
+ self.file = open(self.dspfile,'w')
except IOError, detail:
raise SCons.Errors.InternalError, 'Unable to open "' + self.dspfile + '" for writing:' + str(detail)
else:
def Parse(self):
try:
- dspfile = file(self.dspfile,'r')
+ dspfile = open(self.dspfile,'r')
except IOError:
return # doesn't exist yet, so can't add anything to configs.
def Build(self):
try:
- self.file = file(self.dspfile,'w')
+ self.file = open(self.dspfile,'w')
except IOError, detail:
raise SCons.Errors.InternalError, 'Unable to open "' + self.dspfile + '" for writing:' + str(detail)
else:
def Parse(self):
try:
- dswfile = file(self.dswfile,'r')
+ dswfile = open(self.dswfile,'r')
except IOError:
return # doesn't exist yet, so can't add anything to configs.
def Build(self):
try:
- self.file = file(self.dswfile,'w')
+ self.file = open(self.dswfile,'w')
except IOError, detail:
raise SCons.Errors.InternalError, 'Unable to open "' + self.dswfile + '" for writing:' + str(detail)
else:
def Build(self):
try:
- self.file = file(self.dswfile,'w')
+ self.file = open(self.dswfile,'w')
except IOError, detail:
raise SCons.Errors.InternalError, 'Unable to open "' + self.dswfile + '" for writing:' + str(detail)
else:
if os.path.abspath(os.path.normcase(str(dspfile))) != \
os.path.abspath(os.path.normcase(str(builddspfile))):
try:
- bdsp = file(str(builddspfile), "w+")
+ bdsp = open(str(builddspfile), "w+")
except IOError, detail:
print 'Unable to open "' + str(dspfile) + '" for writing:',detail,'\n'
raise
bdsp.write("This is just a placeholder file.\nThe real project file is here:\n%s\n" % dspfile.get_abspath())
try:
- bdsw = file(str(builddswfile), "w+")
+ bdsw = open(str(builddswfile), "w+")
except IOError, detail:
print 'Unable to open "' + str(dspfile) + '" for writing:',detail,'\n'
raise
ASSuffixes = ['.s', '.asm', '.ASM']
ASPPSuffixes = ['.spp', '.SPP']
-if os.path.normcase('.s') == os.path.normcase('.S'):
- ASSuffixes.extend(['.S'])
-else:
+if SCons.Util.case_sensitive_suffixes('.s', '.S'):
ASPPSuffixes.extend(['.S'])
+else:
+ ASSuffixes.extend(['.S'])
def generate(env):
"""Add Builders and construction variables for nasm to an Environment."""
+
"""SCons.Tool.qt
Tool-specific initialization for qt.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import sys
import os.path
import re
import SCons.Tool
import SCons.Util
-header_extensions = (".h", ".H", ".hxx", ".hpp", ".hh")
+header_extensions = [".h", ".hxx", ".hpp", ".hh"]
+
+if SCons.Util.case_sensitive_suffixes('.h', '.H'):
+ header_extensions.append('.H')
class _Automoc:
"""
self.__call__ = self.print_it
def print_it(self, text):
- print text
+ sys.stdout.write(text + '\n')
def dont_print(self, text):
pass
return self[None]
except KeyError:
return None
+
+
+if sys.platform == 'cygwin':
+ # On Cygwin, os.path.normcase() lies, so just report back the
+ # fact that the underlying Win32 OS is case-insensitive.
+ def case_sensitive_suffixes(s1, s2):
+ return 0
+else:
+ def case_sensitive_suffixes(s1, s2):
+ return (os.path.normcase(s1) != os.path.normcase(s2))
resOK = resOK and retActOK and int(outputActOK)==0
resFAIL = retCompileFAIL or retLinkFAIL or retRunFAIL or outputRunFAIL!=""
resFAIL = resFAIL or retActFAIL or outputActFAIL!=""
- test.Result( resOK and not resFAIL )
+ test.Result( int(resOK and not resFAIL) )
return resOK and not resFAIL
env = Environment()
_exe = TestSCons._exe
_dll = TestSCons._dll
-lib_ = TestSCons.lib_
+dll_ = TestSCons.dll_
test = TestSCons.TestSCons()
test.subdir('lib1', 'lib2')
prog1 = test.workpath('prog') + _exe
-prog2 = test.workpath(lib_ + 'shlib') + _dll
+prog2 = test.workpath(dll_ + 'shlib') + _dll
test.write('SConstruct', """
env1 = Environment(LIBS = [ 'foo1' ],
python = TestSCons.python
_exe = TestSCons._exe
-_dll = TestSCons._dll
lib_ = TestSCons.lib_
+_lib = TestSCons._lib
+dll_ = TestSCons.dll_
+_dll = TestSCons._dll
test = TestSCons.TestSCons()
# 2. create .cpp, .h, moc_....cpp from .ui file
-aaa_dll = lib_ + 'aaa' + _dll
+aaa_dll = dll_ + 'aaa' + _dll
moc = 'moc_aaa.cc'
cpp = 'aaa.cc'
h = 'aaa.h'
# 3. create a moc file from a cpp file
-lib_aaa = lib_ + 'aaa.a'
+lib_aaa = lib_ + 'aaa' + _lib
moc = 'moc_aaa.cc'
createSConstruct(test, ['work3', 'SConstruct'])
import sys
import TestSCons
-lib_ = TestSCons.lib_
+dll_ = TestSCons.dll_
test = TestSCons.TestSCons()
test.run(arguments = '.')
-test.fail_test(not os.path.exists(test.workpath(lib_ + 'foo.shlib')))
+test.fail_test(not os.path.exists(test.workpath(dll_ + 'foo.shlib')))
test.pass_test()
import TestSCons
python = TestSCons.python
-lib_ = TestSCons.lib_
+dll_ = TestSCons.dll_
_shlib = TestSCons._dll
test = TestSCons.TestSCons()
}
""")
-test.run(arguments = lib_ + 'foo' + _shlib)
+test.run(arguments = dll_ + 'foo' + _shlib)
test.fail_test(os.path.exists(test.workpath('wrapper.out')))
-test.run(arguments = lib_ + 'bar' + _shlib)
+test.run(arguments = dll_ + 'bar' + _shlib)
test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
import TestSCons
python = TestSCons.python
-lib_ = TestSCons.lib_
+lib_ = TestSCons.dll_
_shlib = TestSCons._dll
test = TestSCons.TestSCons()
import TestSCons
import string
+import sys
python = TestSCons.python
_exe = TestSCons._exe
_dll = TestSCons._dll
-lib_ = TestSCons.lib_
+dll_ = TestSCons.dll_
test = TestSCons.TestSCons()
test.subdir('gnutools')
if not res: print "'"+obj+command+flags+"'"+"!='"+str(line1)+"'"
return res
+if sys.platform == 'cygwin':
+ fpic = ''
+else:
+ fpic = '-fPIC '
+
test.fail_test(not testObject(test, 'cfile1.o', 'gcc', '-c') or
not testObject(test, 'cfile2.o', 'gcc', '-c') or
not testObject(test, 'cppfile1.o', 'g++', '-c') or
not testObject(test, 'cppfile2.o', 'g++', '-c') or
- not testObject(test, 'cfile1.os', 'gcc', '-fPIC -c') or
- not testObject(test, 'cfile2.os', 'gcc', '-fPIC -c') or
- not testObject(test, 'cppfile1.os', 'g++', '-fPIC -c') or
- not testObject(test, 'cppfile2.os', 'g++', '-fPIC -c') or
+ not testObject(test, 'cfile1.os', 'gcc', fpic + '-c') or
+ not testObject(test, 'cfile2.os', 'gcc', fpic + '-c') or
+ not testObject(test, 'cppfile1.os', 'g++', fpic + '-c') or
+ not testObject(test, 'cppfile2.os', 'g++', fpic + '-c') or
not testObject(test, 'c-only' + _exe, 'gcc', '') or
not testObject(test, 'cpp-only' + _exe, 'g++', '') or
not testObject(test, 'c-and-cpp' + _exe, 'g++', '') or
- not testObject(test, lib_ + 'c-only' + _dll, 'gcc', '-shared') or
- not testObject(test, lib_ + 'cpp-only' + _dll, 'g++', '-shared') or
- not testObject(test, lib_ + 'c-and-cpp' + _dll, 'g++', '-shared'))
+ not testObject(test, dll_ + 'c-only' + _dll, 'gcc', '-shared') or
+ not testObject(test, dll_ + 'cpp-only' + _dll, 'g++', '-shared') or
+ not testObject(test, dll_ + 'c-and-cpp' + _dll, 'g++', '-shared'))
test.pass_test()