[pypy-svn] r76716 - pypy/trunk/pypy/translator/platform

arigo at codespeak.net arigo at codespeak.net
Tue Aug 24 17:35:52 CEST 2010


Author: arigo
Date: Tue Aug 24 17:35:45 2010
New Revision: 76716

Modified:
   pypy/trunk/pypy/translator/platform/__init__.py
   pypy/trunk/pypy/translator/platform/darwin.py
   pypy/trunk/pypy/translator/platform/freebsd7.py
   pypy/trunk/pypy/translator/platform/linux.py
   pypy/trunk/pypy/translator/platform/maemo.py
   pypy/trunk/pypy/translator/platform/posix.py
   pypy/trunk/pypy/translator/platform/windows.py
Log:
issue546 testing

Convert class attributes from lists to tuples, to avoid
accidentally mutating them.


Modified: pypy/trunk/pypy/translator/platform/__init__.py
==============================================================================
--- pypy/trunk/pypy/translator/platform/__init__.py	(original)
+++ pypy/trunk/pypy/translator/platform/__init__.py	Tue Aug 24 17:35:45 2010
@@ -38,9 +38,9 @@
     name = "abstract platform"
     c_environ = None
 
-    relevant_environ = []
+    relevant_environ = ()
 
-    so_prefixes = ['']
+    so_prefixes = ('',)
 
     def __init__(self, cc):
         if self.__class__ is Platform:
@@ -146,7 +146,7 @@
             extra = self.standalone_only
         else:
             extra = self.shared_only
-        cflags = self.cflags + extra
+        cflags = list(self.cflags) + list(extra)
         return (cflags + list(eci.compile_extra) + args)
     
     def _preprocess_library_dirs(self, library_dirs):
@@ -158,7 +158,7 @@
         libraries = self._libs(eci.libraries)
         link_files = self._linkfiles(eci.link_files)
         export_flags = self._exportsymbols_link_flags(eci)
-        return (library_dirs + self.link_flags + export_flags +
+        return (library_dirs + list(self.link_flags) + export_flags +
                 link_files + list(eci.link_extra) + libraries)
 
     def _exportsymbols_link_flags(self, eci, relto=None):

Modified: pypy/trunk/pypy/translator/platform/darwin.py
==============================================================================
--- pypy/trunk/pypy/translator/platform/darwin.py	(original)
+++ pypy/trunk/pypy/translator/platform/darwin.py	Tue Aug 24 17:35:45 2010
@@ -5,10 +5,10 @@
 class Darwin(posix.BasePosix):
     name = "darwin"
 
-    link_flags = ['-mmacosx-version-min=10.4']
-    cflags = ['-O3', '-fomit-frame-pointer', '-mmacosx-version-min=10.4']
-    standalone_only = ['-mdynamic-no-pic']
-    shared_only = []
+    link_flags = ('-mmacosx-version-min=10.4',)
+    cflags = ('-O3', '-fomit-frame-pointer', '-mmacosx-version-min=10.4')
+    standalone_only = ('-mdynamic-no-pic',)
+    shared_only = ()
 
     so_ext = 'so'
     
@@ -18,8 +18,9 @@
         self.cc = cc
 
     def _args_for_shared(self, args):
-        return (self.shared_only + ['-dynamiclib', '-undefined', 'dynamic_lookup']
-                                 + args)
+        return (list(self.shared_only)
+                + ['-dynamiclib', '-undefined', 'dynamic_lookup']
+                + args)
     
     def _preprocess_include_dirs(self, include_dirs):
         res_incl_dirs = list(include_dirs)
@@ -72,11 +73,12 @@
 
 class Darwin_i386(Darwin):
     name = "darwin_i386"
-    link_flags = ['-arch', 'i386', '-mmacosx-version-min=10.4']
-    cflags = ['-arch', 'i386', '-O3', '-fomit-frame-pointer', '-mmacosx-version-min=10.4']
+    link_flags = ('-arch', 'i386', '-mmacosx-version-min=10.4')
+    cflags = ('-arch', 'i386', '-O3', '-fomit-frame-pointer',
+              '-mmacosx-version-min=10.4')
 
 class Darwin_x86_64(Darwin):
     name = "darwin_x86_64"
-    link_flags = ['-arch', 'x86_64', '-mmacosx-version-min=10.4']
-    cflags = ['-arch', 'x86_64', '-O3', '-fomit-frame-pointer', '-mmacosx-version-min=10.4']
-
+    link_flags = ('-arch', 'x86_64', '-mmacosx-version-min=10.4')
+    cflags = ('-arch', 'x86_64', '-O3', '-fomit-frame-pointer',
+              '-mmacosx-version-min=10.4')

Modified: pypy/trunk/pypy/translator/platform/freebsd7.py
==============================================================================
--- pypy/trunk/pypy/translator/platform/freebsd7.py	(original)
+++ pypy/trunk/pypy/translator/platform/freebsd7.py	Tue Aug 24 17:35:45 2010
@@ -5,10 +5,10 @@
 class Freebsd7(posix.BasePosix):
     name = "freebsd7"
     
-    link_flags = ['-pthread']
-    cflags = ['-O3', '-pthread', '-fomit-frame-pointer']
-    standalone_only = []
-    shared_only = []
+    link_flags = ('-pthread',)
+    cflags = ('-O3', '-pthread', '-fomit-frame-pointer')
+    standalone_only = ()
+    shared_only = ()
     so_ext = 'so'
     make_cmd = 'gmake'
     
@@ -32,4 +32,4 @@
         return ['/usr/local/lib']
 
 class Freebsd7_64(Freebsd7):
-    shared_only = ['-fPIC']
+    shared_only = ('-fPIC',)

Modified: pypy/trunk/pypy/translator/platform/linux.py
==============================================================================
--- pypy/trunk/pypy/translator/platform/linux.py	(original)
+++ pypy/trunk/pypy/translator/platform/linux.py	Tue Aug 24 17:35:45 2010
@@ -6,12 +6,13 @@
 class Linux(BasePosix):
     name = "linux"
     
-    link_flags = ['-pthread', '-lrt']
-    cflags = ['-O3', '-pthread', '-fomit-frame-pointer', '-Wall', '-Wno-unused']
-    standalone_only = []
-    shared_only = ['-fPIC']
+    link_flags = ('-pthread', '-lrt')
+    cflags = ('-O3', '-pthread', '-fomit-frame-pointer',
+              '-Wall', '-Wno-unused')
+    standalone_only = ()
+    shared_only = ('-fPIC',)
     so_ext = 'so'
-    so_prefixes = ['lib', '']
+    so_prefixes = ('lib', '')
     
     def _args_for_shared(self, args):
         return ['-shared'] + args
@@ -30,4 +31,4 @@
 
 
 class Linux64(Linux):
-    shared_only = ['-fPIC']
+    shared_only = ('-fPIC',)

Modified: pypy/trunk/pypy/translator/platform/maemo.py
==============================================================================
--- pypy/trunk/pypy/translator/platform/maemo.py	(original)
+++ pypy/trunk/pypy/translator/platform/maemo.py	Tue Aug 24 17:35:45 2010
@@ -13,7 +13,7 @@
 class Maemo(Linux):
     name = "maemo"
     
-    available_includedirs = ['/usr/include', '/tmp']
+    available_includedirs = ('/usr/include', '/tmp')
     copied_cache = {}
 
     def _invent_new_name(self, basepath, base):

Modified: pypy/trunk/pypy/translator/platform/posix.py
==============================================================================
--- pypy/trunk/pypy/translator/platform/posix.py	(original)
+++ pypy/trunk/pypy/translator/platform/posix.py	Tue Aug 24 17:35:45 2010
@@ -10,7 +10,7 @@
     exe_ext = ''
     make_cmd = 'make'
 
-    relevant_environ=['CPATH', 'LIBRARY_PATH', 'C_INCLUDE_PATH']
+    relevant_environ = ('CPATH', 'LIBRARY_PATH', 'C_INCLUDE_PATH')
 
     def __init__(self, cc=None):
         if cc is None:
@@ -92,7 +92,7 @@
         else:
             exe_name = exe_name.new(ext=self.exe_ext)
 
-        linkflags = self.link_flags[:]
+        linkflags = list(self.link_flags)
         if shared:
             linkflags = self._args_for_shared(linkflags)
 

Modified: pypy/trunk/pypy/translator/platform/windows.py
==============================================================================
--- pypy/trunk/pypy/translator/platform/windows.py	(original)
+++ pypy/trunk/pypy/translator/platform/windows.py	Tue Aug 24 17:35:45 2010
@@ -72,10 +72,10 @@
     cc = 'cl.exe'
     link = 'link.exe'
 
-    cflags = ['/MD', '/O2']
-    link_flags = []
-    standalone_only = []
-    shared_only = []
+    cflags = ('/MD', '/O2')
+    link_flags = ()
+    standalone_only = ()
+    shared_only = ()
     environ = None
 
     def __init__(self, cc=None):
@@ -218,7 +218,7 @@
         m.exe_name = exe_name
         m.eci = eci
 
-        linkflags = self.link_flags[:]
+        linkflags = list(self.link_flags)
         if shared:
             linkflags = self._args_for_shared(linkflags) + [
                 '/EXPORT:$(PYPY_MAIN_FUNCTION)']
@@ -336,10 +336,10 @@
 
 class MingwPlatform(posix.BasePosix):
     name = 'mingw32'
-    standalone_only = []
-    shared_only = []
-    cflags = ['-O3']
-    link_flags = []
+    standalone_only = ()
+    shared_only = ()
+    cflags = ('-O3',)
+    link_flags = ()
     exe_ext = 'exe'
     so_ext = 'dll'
 



More information about the Pypy-commit mailing list