[pygccxml-commit] SF.net SVN: pygccxml:[1848] ui/simple
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2011-02-26 18:55:33
|
Revision: 1848
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1848&view=rev
Author: roman_yakovenko
Date: 2011-02-26 18:55:27 +0000 (Sat, 26 Feb 2011)
Log Message:
-----------
it is better to use "os.name" instead of "sys.platform" for platform specific logic - thanks to Aron Xu
Modified Paths:
--------------
pygccxml_dev/docs/history/history.rest
pygccxml_dev/pygccxml/binary_parsers/undname.py
pygccxml_dev/pygccxml/parser/config.py
pygccxml_dev/pygccxml/parser/source_reader.py
pygccxml_dev/pygccxml/utils/__init__.py
pygccxml_dev/unittests/autoconfig.py
pygccxml_dev/unittests/complex_types_tester.py
pygccxml_dev/unittests/declarations_tester.py
pygccxml_dev/unittests/undname_creator_tester.py
pyplusplus_dev/docs/history/history.rest
pyplusplus_dev/environment.py
pyplusplus_dev/unittests/autoconfig.py
pyplusplus_dev/unittests/ctypes_tester.py
pyplusplus_dev/unittests/indexing_suites_v2_bug_tester.py
pyplusplus_dev/unittests/unions_tester.py
sphinx/conf.py
ui/simple/freeze.py
Modified: pygccxml_dev/docs/history/history.rest
===================================================================
--- pygccxml_dev/docs/history/history.rest 2011-02-26 16:58:26 UTC (rev 1847)
+++ pygccxml_dev/docs/history/history.rest 2011-02-26 18:55:27 UTC (rev 1848)
@@ -23,6 +23,7 @@
* Gustavo Carneiro
* Christopher Bruns
* Alejandro Dubrovsky
+* Aron Xu
-----------
SVN Version
@@ -63,6 +64,10 @@
11. "__int128_t" and "__uint128_t" types were introduced. Many thanks to Gustavo Carneiro
for providing the patch.
+12. Thanks to Aron Xu, for pointing out that it is better to use "os.name",
+ instead of "sys.platform" for platform specific logic
+
+
-----------
Version 1.0
-----------
Modified: pygccxml_dev/pygccxml/binary_parsers/undname.py
===================================================================
--- pygccxml_dev/pygccxml/binary_parsers/undname.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ pygccxml_dev/pygccxml/binary_parsers/undname.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -73,7 +73,7 @@
compiler and demangled name produced by "nm" utility.
"""
def __init__( self ):
- if 'win32' in sys.platform:
+ if 'nt' == os.name:
import ctypes.wintypes
self.__undname = ctypes.windll.dbghelp.UnDecorateSymbolName
self.__undname.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint]
@@ -209,7 +209,7 @@
"""
name = None
if hint is None:
- if 'win32' in sys.platform:
+ if 'nt' == os.name:
hint = 'msvc'
else:
hint = 'nm'
Modified: pygccxml_dev/pygccxml/parser/config.py
===================================================================
--- pygccxml_dev/pygccxml/parser/config.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ pygccxml_dev/pygccxml/parser/config.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -173,7 +173,7 @@
super( gccxml_configuration_t, self ).raise_on_wrong_settings()
if os.path.isfile( self.gccxml_path ):
return
- if sys.platform == 'win32':
+ if os.name == 'nt':
gccxml_name = 'gccxml' + '.exe'
environment_var_delimiter = ';'
elif os.name == 'posix':
Modified: pygccxml_dev/pygccxml/parser/source_reader.py
===================================================================
--- pygccxml_dev/pygccxml/parser/source_reader.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ pygccxml_dev/pygccxml/parser/source_reader.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -95,7 +95,7 @@
#returns
cmd = []
#first is gccxml executable
- if 'win32' in sys.platform:
+ if 'nt' == os.name:
cmd.append( '"%s"' % os.path.normpath( self.__config.gccxml_path ) )
else:
cmd.append( '%s' % os.path.normpath( self.__config.gccxml_path ) )
@@ -118,7 +118,7 @@
if self.__config.compiler:
cmd.append( " --gccxml-compiler %s" % self.__config.compiler )
cmd_line = ' '.join(cmd)
- if 'win32' in sys.platform :
+ if 'nt' == os.name:
cmd_line = '"%s"' % cmd_line
self.logger.info( 'gccxml cmd: %s' % cmd_line )
return cmd_line
@@ -284,7 +284,7 @@
raise RuntimeError( "pygccxml error: file '%s' does not exist" % file )
def __produce_full_file( self, file_path ):
- if 'win' in sys.platform or 'linux' in sys.platform:
+ if os.name in ['nt', 'posix']:
file_path = file_path.replace( r'\/', os.path.sep )
if os.path.isabs( file_path ):
return file_path
Modified: pygccxml_dev/pygccxml/utils/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/utils/__init__.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ pygccxml_dev/pygccxml/utils/__init__.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -170,7 +170,7 @@
@staticmethod
def get_version():
- if 'win' not in sys.platform:
+ if 'nt' != os.name:
return None #not implemented yet
else:
from distutils import msvccompiler
Modified: pygccxml_dev/unittests/autoconfig.py
===================================================================
--- pygccxml_dev/unittests/autoconfig.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ pygccxml_dev/unittests/autoconfig.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -39,7 +39,7 @@
, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
gccxml.define_symbols.append( gccxml_version )
- if 'win' in sys.platform:
+ if 'nt' == os.name:
gccxml.define_symbols.append( '__PYGCCXML_%s__' % gccxml.compiler.upper() )
if 'msvc9' == gccxml.compiler:
gccxml.define_symbols.append( '_HAS_TR1=0' )
Modified: pygccxml_dev/unittests/complex_types_tester.py
===================================================================
--- pygccxml_dev/unittests/complex_types_tester.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ pygccxml_dev/unittests/complex_types_tester.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -3,6 +3,7 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
+import os
import sys
import unittest
import autoconfig
@@ -32,7 +33,7 @@
def create_suite():
suite = unittest.TestSuite()
- if sys.platform != 'win32':
+ if os.name != 'nt':
suite.addTest( unittest.makeSuite(tester_t))
return suite
Modified: pygccxml_dev/unittests/declarations_tester.py
===================================================================
--- pygccxml_dev/unittests/declarations_tester.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ pygccxml_dev/unittests/declarations_tester.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -3,6 +3,7 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
+import os
import sys
import pprint
import unittest
@@ -205,7 +206,7 @@
suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite(file_by_file_tester_t))
suite.addTest( unittest.makeSuite(all_at_once_tester_t))
- #~ if sys.platform == 'win32' and autoconfig.get_pdb_global_ns():
+ #~ if os.name == 'nt' and autoconfig.get_pdb_global_ns():
#~ suite.addTest( unittest.makeSuite(pdb_based_tester_t))
return suite
Modified: pygccxml_dev/unittests/undname_creator_tester.py
===================================================================
--- pygccxml_dev/unittests/undname_creator_tester.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ pygccxml_dev/unittests/undname_creator_tester.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -21,7 +21,7 @@
@property
def known_issues( self ):
- if 'win32' in sys.platform:
+ if 'nt' == os.name:
issues = set([
# array as function argument: 'int FA10_i_i(int * const)'
'?FA10_i_i@@YAHQAH@Z'
@@ -101,7 +101,7 @@
for blob in parser.loaded_symbols:
if isinstance( blob, tuple ):
blob = blob[0]
- if 'win32' in sys.platform:
+ if 'nt' == os.name:
#TODO: find out where undecorate function is exposed on linux
undname = binary_parsers.undecorate_blob( blob )
if "`" in undname:
@@ -131,15 +131,15 @@
self.fail( os.linesep.join(msg) )
def test_map_file( self ):
- if 'win32' in sys.platform:
+ if 'nt' == os.name:
self.__tester_impl( self.map_file, 71 )
def test_dll_file( self ):
- if 'win32' in sys.platform:
+ if 'nt' == os.name:
self.__tester_impl( self.dll_file, 71 )
def test_z_compare_parsers( self ):
- if 'win32' not in sys.platform:
+ if 'nt' != os.name:
return
dsymbols, dparser = binary_parsers.merge_information( self.global_ns, self.dll_file, runs_under_unittest=True )
msymbols, mparser = binary_parsers.merge_information( self.global_ns, self.map_file, runs_under_unittest=True )
@@ -158,7 +158,7 @@
self.failUnless( was_error == False )
def test_so_file( self ):
- if 'linux2' in sys.platform:
+ if 'posix' in os.name:
self.__tester_impl( self.so_file, 64 )
def dont_test_print( self ):
Modified: pyplusplus_dev/docs/history/history.rest
===================================================================
--- pyplusplus_dev/docs/history/history.rest 2011-02-26 16:58:26 UTC (rev 1847)
+++ pyplusplus_dev/docs/history/history.rest 2011-02-26 18:55:27 UTC (rev 1848)
@@ -29,6 +29,7 @@
* Nikolaus Rath
* Alan Birtles
* Minh-Tri Pham
+* Aron Xu
-----------
SVN Version
@@ -75,6 +76,9 @@
12. Thanks to Minh-Tri Pham, for reporting bug and providing patch for
"from_address" transformer, on 64 bit platforms.
+
+13. Thanks to Aron Xu, for pointing out that it is better to use "os.name",
+ instead of "sys.platform" for platform specific logic
-----------
Version 1.0
Modified: pyplusplus_dev/environment.py
===================================================================
--- pyplusplus_dev/environment.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ pyplusplus_dev/environment.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -33,7 +33,7 @@
ccflags = []
if 'roman' in getpass.getuser():
- if sys.platform == 'win32':
+ if os.name == 'nt':
scons.suffix = '.pyd'
scons.ccflags = ['/MD', '/EHsc', '/GR', '/Zc:wchar_t', '/Zc:forScope' ]
boost.libs = [ r'e:\dev\boost_svn\bin.v2\libs\python\build\msvc-9.0\release\threading-multi' ]
@@ -59,7 +59,7 @@
boost.include = '/home/roman/boost_svn'
python.include = '/usr/include/python2.6'
elif 'root' == getpass.getuser():
- if sys.platform == 'win32':
+ if os.name == 'nt':
scons.suffix = '.pyd'
scons.ccflags = ['/MD', '/EHsc', '/GR', '/Zc:wchar_t', '/Zc:forScope' ]
boost.libs = [ 'd:/dev/boost_svn/bin.v2/libs/python/build/msvc-7.1/release/threading-multi' ]
Modified: pyplusplus_dev/unittests/autoconfig.py
===================================================================
--- pyplusplus_dev/unittests/autoconfig.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ pyplusplus_dev/unittests/autoconfig.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -33,7 +33,7 @@
, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
gccxml.define_symbols.append( gccxml_version )
- if 'win' in sys.platform:
+ if 'nt' == os.name:
gccxml.define_symbols.append( '__PYGCCXML_%s__' % gccxml.compiler.upper() )
if 'msvc9' == gccxml.compiler:
gccxml.define_symbols.append( '_HAS_TR1=0' )
@@ -55,14 +55,15 @@
@staticmethod
def create_sconstruct():
msvc_compiler = ''
- if 'linux' not in sys.platform:
+ if 'posix' != os.name:
msvc_compiler = str( pygccxml.utils.native_compiler.get_version()[1] )
else:
scons_config.libs.append( 'boost_python' )
code = [
- "import sys"
+ "import os"
+ , "import sys"
, "env = Environment()"
- , "if 'linux' not in sys.platform:"
+ , "if 'posix' != os.name:"
, " env['MSVS'] = {'VERSION': '%s'}" % msvc_compiler
, " env['MSVS_VERSION'] = '%s'" % msvc_compiler
, " Tool('msvc')(env)"
@@ -106,7 +107,7 @@
os.chdir( build_dir )
-if sys.platform == 'win32':
+if 'nt' == os.name:
PATH = os.environ.get( 'PATH', '' )
PATH=PATH + ';' + ';'.join( scons_config.libpath )
os.environ['PATH'] = PATH
Modified: pyplusplus_dev/unittests/ctypes_tester.py
===================================================================
--- pyplusplus_dev/unittests/ctypes_tester.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ pyplusplus_dev/unittests/ctypes_tester.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -34,14 +34,14 @@
def symbols_file( self ):
ext = '.so'
prefix = 'lib'
- if 'win32' in sys.platform:
+ if 'nt' == os.name:
prefix = ''
ext = '.map'
return os.path.join( self.project_dir, 'binaries', prefix + self.base_name + ext )
@property
def library_file( self ):
- if 'win32' in sys.platform:
+ if 'nt' == os.name:
return os.path.join( self.project_dir, 'binaries', self.base_name + '.dll' )
else:
return self.symbols_file
Modified: pyplusplus_dev/unittests/indexing_suites_v2_bug_tester.py
===================================================================
--- pyplusplus_dev/unittests/indexing_suites_v2_bug_tester.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ pyplusplus_dev/unittests/indexing_suites_v2_bug_tester.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -10,7 +10,7 @@
import fundamental_tester_base
from pyplusplus import code_creators
-if 'linux' in sys.platform:
+if 'posix' == os.name:
try:
from ctypes import RTLD_NOW, RTLD_GLOBAL
except ImportError:
Modified: pyplusplus_dev/unittests/unions_tester.py
===================================================================
--- pyplusplus_dev/unittests/unions_tester.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ pyplusplus_dev/unittests/unions_tester.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -43,7 +43,7 @@
obj2.set_i( 1977 )
self.failUnless( obj2.i == 1977 )
- if 'win' not in sys.platform:
+ if 'nt' != os.name:
mdll = ctypes.cdll.LoadLibrary( module.__file__ )
self.failUnless( 4 == mdll.mmm( 1, 3 ) )
Modified: sphinx/conf.py
===================================================================
--- sphinx/conf.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ sphinx/conf.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -32,7 +32,7 @@
sys.path.append( doc_project_root )
-has_true_links = 'linux' in sys.platform
+has_true_links = 'posix' == os.name
for pkg in packages:
target = os.path.join( doc_project_root, pkg )
source = os.path.join( project_root, pkg + '_dev', 'docs' )
Modified: ui/simple/freeze.py
===================================================================
--- ui/simple/freeze.py 2011-02-26 16:58:26 UTC (rev 1847)
+++ ui/simple/freeze.py 2011-02-26 18:55:27 UTC (rev 1848)
@@ -20,7 +20,7 @@
target_dir = os.path.join( target_dir, target_name, sys.platform )
if not os.path.exists( target_dir ):
os.makedirs( target_dir )
- if 'win32' == sys.platform:
+ if 'nt' == os.name:
target_name = target_name + '.exe'
cmd = [ freeze_executable ]
@@ -43,9 +43,9 @@
if exit_status:
raise RuntimeError('unable to create executable. error: %s' % msg )
- if sys.platform == 'win32':
+ if os.name == 'nt':
dlls = os.path.join( os.path.split( sys.executable )[0], 'dlls' )
files_to_copy = [ 'tk84.dll', 'tcl84.dll' ]
for f in files_to_copy:
shutil.copyfile( os.path.join( dlls, f )
- , os.path.join( target_dir, f ) )
\ No newline at end of file
+ , os.path.join( target_dir, f ) )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|