diff options
author | Steven Knight <knight@baldmt.com> | 2003-11-10 16:13:15 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-11-10 16:13:15 (GMT) |
commit | 8de5ae79c1f6096683ee125b38b2e2d7525b7f07 (patch) | |
tree | 386f3ae3eac37497adf92f1a1539cd9f7ce13bd3 /src/engine | |
parent | 9dd1434a94d2472b6f6d2956eb2b3e422d251a75 (diff) | |
download | SCons-8de5ae79c1f6096683ee125b38b2e2d7525b7f07.zip SCons-8de5ae79c1f6096683ee125b38b2e2d7525b7f07.tar.gz SCons-8de5ae79c1f6096683ee125b38b2e2d7525b7f07.tar.bz2 |
Use sys.stdout.write() instead of print so line feeds in -j output will stay (more) consistent. Fix suffix-handling on case-insensitive Cygwin systems. Test fixes for Cygwin portability. (Chad Austin)
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Action.py | 3 | ||||
-rw-r--r-- | src/engine/SCons/Tool/as.py | 6 | ||||
-rw-r--r-- | src/engine/SCons/Tool/c++.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Tool/cc.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Tool/f77.py | 6 | ||||
-rw-r--r-- | src/engine/SCons/Tool/gcc.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Tool/masm.py | 6 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msvc.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msvs.py | 18 | ||||
-rw-r--r-- | src/engine/SCons/Tool/nasm.py | 6 | ||||
-rw-r--r-- | src/engine/SCons/Tool/qt.py | 7 | ||||
-rw-r--r-- | src/engine/SCons/Util.py | 12 |
12 files changed, 44 insertions, 28 deletions
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 13409aa..93580cc 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -33,6 +33,7 @@ import os import os.path import re import string +import sys import SCons.Errors import SCons.Util @@ -144,7 +145,7 @@ class ActionBase: def show(self, string): if print_actions: - print string + sys.stdout.write(string + '\n') def get_actions(self): return [self] diff --git a/src/engine/SCons/Tool/as.py b/src/engine/SCons/Tool/as.py index 0686489..14a2d43 100644 --- a/src/engine/SCons/Tool/as.py +++ b/src/engine/SCons/Tool/as.py @@ -43,10 +43,10 @@ assemblers = ['as'] 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.""" diff --git a/src/engine/SCons/Tool/c++.py b/src/engine/SCons/Tool/c++.py index 9e8a9f9..2ed7d44 100644 --- a/src/engine/SCons/Tool/c++.py +++ b/src/engine/SCons/Tool/c++.py @@ -41,7 +41,7 @@ import SCons.Util 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): diff --git a/src/engine/SCons/Tool/cc.py b/src/engine/SCons/Tool/cc.py index ab51589..18b62d2 100644 --- a/src/engine/SCons/Tool/cc.py +++ b/src/engine/SCons/Tool/cc.py @@ -39,7 +39,7 @@ import SCons.Defaults 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): diff --git a/src/engine/SCons/Tool/f77.py b/src/engine/SCons/Tool/f77.py index c99bd21..4267096 100644 --- a/src/engine/SCons/Tool/f77.py +++ b/src/engine/SCons/Tool/f77.py @@ -43,10 +43,10 @@ compilers = ['f77'] 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.""" diff --git a/src/engine/SCons/Tool/gcc.py b/src/engine/SCons/Tool/gcc.py index a9f8ee1..acbe440 100644 --- a/src/engine/SCons/Tool/gcc.py +++ b/src/engine/SCons/Tool/gcc.py @@ -45,7 +45,7 @@ def generate(env): if env['PLATFORM'] == 'cygwin': env['SHCCFLAGS'] = '$CCFLAGS' else: - env['SHCCFLAGS'] = '$CCFLAGS -fPIC' + env['SHCCFLAGS'] = ['$CCFLAGS', '-fPIC'] def exists(env): return env.Detect(compilers) diff --git a/src/engine/SCons/Tool/masm.py b/src/engine/SCons/Tool/masm.py index 87570bd..92f4c35 100644 --- a/src/engine/SCons/Tool/masm.py +++ b/src/engine/SCons/Tool/masm.py @@ -40,10 +40,10 @@ import SCons.Tool 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.""" diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index 4b15568..2a067b9 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -384,7 +384,7 @@ def generate(env): 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' diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 68e8fda..949793a 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -297,7 +297,7 @@ class _GenerateV6DSP(_DSPGenerator): 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. @@ -345,7 +345,7 @@ class _GenerateV6DSP(_DSPGenerator): 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: @@ -458,7 +458,7 @@ class _GenerateV7DSP(_DSPGenerator): 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. @@ -505,7 +505,7 @@ class _GenerateV7DSP(_DSPGenerator): 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: @@ -555,7 +555,7 @@ class _GenerateV7DSW(_DSWGenerator): 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. @@ -617,7 +617,7 @@ class _GenerateV7DSW(_DSWGenerator): 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: @@ -661,7 +661,7 @@ class _GenerateV6DSW(_DSWGenerator): 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: @@ -946,7 +946,7 @@ def GenerateProject(target, source, env): 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 @@ -954,7 +954,7 @@ def GenerateProject(target, source, env): 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 diff --git a/src/engine/SCons/Tool/nasm.py b/src/engine/SCons/Tool/nasm.py index ed2feba..6a2fc36 100644 --- a/src/engine/SCons/Tool/nasm.py +++ b/src/engine/SCons/Tool/nasm.py @@ -40,10 +40,10 @@ import SCons.Tool 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.""" diff --git a/src/engine/SCons/Tool/qt.py b/src/engine/SCons/Tool/qt.py index 12bf161..ffdff18 100644 --- a/src/engine/SCons/Tool/qt.py +++ b/src/engine/SCons/Tool/qt.py @@ -1,3 +1,4 @@ + """SCons.Tool.qt Tool-specific initialization for qt. @@ -33,6 +34,7 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import sys import os.path import re @@ -40,7 +42,10 @@ import SCons.Defaults 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: """ diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 41e3883..a558c2a 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -337,7 +337,7 @@ class DisplayEngine: self.__call__ = self.print_it def print_it(self, text): - print text + sys.stdout.write(text + '\n') def dont_print(self, text): pass @@ -972,3 +972,13 @@ class Selector(UserDict.UserDict): 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)) |