String methods migration for build scripts. (Patch from KA)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-01-14 06:55:22 +00:00
parent b7dbf2d867
commit 94484e61d4
2 changed files with 15 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
import sys, os, string import sys, os
from distutils.msvccompiler import MSVCCompiler from distutils.msvccompiler import MSVCCompiler
from distutils.bcppcompiler import BCPPCompiler from distutils.bcppcompiler import BCPPCompiler
@@ -465,8 +465,8 @@ def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=
if force or newer(i_file, py_file) or newer(i_file, cpp_file): if force or newer(i_file, py_file) or newer(i_file, cpp_file):
# we need forward slashes here even on win32 # we need forward slashes here even on win32
cpp_file = string.join(string.split(cpp_file, '\\'), '/') cpp_file = '/'.join(cpp_file.split('\\'))
i_file = string.join(string.split(i_file, '\\'), '/') i_file = '/'.join(i_file.split('\\'))
cmd = ['./wxSWIG/wxswig'] + swig_args + ['-I'+dir, '-c', '-o', cpp_file, i_file] cmd = ['./wxSWIG/wxswig'] + swig_args + ['-I'+dir, '-c', '-o', cpp_file, i_file]
spawn(cmd, verbose=1) spawn(cmd, verbose=1)

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
#---------------------------------------------------------------------- #----------------------------------------------------------------------
import sys, os, string, glob import sys, os, glob
from distutils.core import setup, Extension from distutils.core import setup, Extension
from distutils.file_util import copy_file from distutils.file_util import copy_file
from distutils.dir_util import mkpath from distutils.dir_util import mkpath
@@ -144,7 +144,7 @@ bcpp_compiling = '-c' in sys.argv and 'my_bcpp' in sys.argv # Bad heuristic
if bcpp_compiling: if bcpp_compiling:
msg("Compiling wxPython by Borland C/C++ Compiler") msg("Compiling wxPython by Borland C/C++ Compiler")
HYBRID=0 HYBRID=0
WXBCPPLIBVER = string.replace(WXDLLVER,"_","") WXBCPPLIBVER = WXDLLVER.replace("_","")
# Version part of BCPP build LIBRARY name # Version part of BCPP build LIBRARY name
WXDLLVER="" # no dll ver path avaible WXDLLVER="" # no dll ver path avaible
@@ -169,8 +169,8 @@ for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
'UNDEF_NDEBUG', 'NO_SCRIPTS', 'UNDEF_NDEBUG', 'NO_SCRIPTS',
'FINAL', 'HYBRID', ]: 'FINAL', 'HYBRID', ]:
for x in range(len(sys.argv)): for x in range(len(sys.argv)):
if string.find(sys.argv[x], flag) == 0: if sys.argv[x].find(flag) == 0:
pos = string.find(sys.argv[x], '=') + 1 pos = sys.argv[x].find('=') + 1
if pos > 0: if pos > 0:
vars()[flag] = eval(sys.argv[x][pos:]) vars()[flag] = eval(sys.argv[x][pos:])
sys.argv[x] = '' sys.argv[x] = ''
@@ -178,8 +178,8 @@ for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
# String options # String options
for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT']: for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT']:
for x in range(len(sys.argv)): for x in range(len(sys.argv)):
if string.find(sys.argv[x], option) == 0: if sys.argv[x].find(option) == 0:
pos = string.find(sys.argv[x], '=') + 1 pos = sys.argv[x].find('=') + 1
if pos > 0: if pos > 0:
vars()[option] = sys.argv[x][pos:] vars()[option] = sys.argv[x][pos:]
sys.argv[x] = '' sys.argv[x] = ''
@@ -210,7 +210,7 @@ def Verify_WX_CONFIG():
WX_CONFIG = 'wx%s%s%s-%s-config' % (WXPORT, uf, df, ver2) WX_CONFIG = 'wx%s%s%s-%s-config' % (WXPORT, uf, df, ver2)
searchpath = os.environ["PATH"] searchpath = os.environ["PATH"]
for p in string.split(searchpath, ':'): for p in searchpath.split(':'):
fp = os.path.join(p, WX_CONFIG) fp = os.path.join(p, WX_CONFIG)
if os.path.exists(fp) and os.access(fp, os.X_OK): if os.path.exists(fp) and os.access(fp, os.X_OK):
# success # success
@@ -360,7 +360,7 @@ elif os.name == 'posix' and sys.platform[:6] == "darwin":
Verify_WX_CONFIG() Verify_WX_CONFIG()
cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1]
cflags = string.split(cflags) cflags = cflags.split()
if UNDEF_NDEBUG: if UNDEF_NDEBUG:
cflags.append('-UNDEBUG') cflags.append('-UNDEBUG')
if debug: if debug:
@@ -368,7 +368,7 @@ elif os.name == 'posix' and sys.platform[:6] == "darwin":
cflags.append('-O0') cflags.append('-O0')
lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1] lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1]
lflags = string.split(lflags) lflags = lflags.split()
NO_SCRIPTS = 1 NO_SCRIPTS = 1
BUILD_DLLWIDGET = 0 BUILD_DLLWIDGET = 0
@@ -407,7 +407,7 @@ elif os.name == 'posix':
cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] + ' ' + portcfg cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] + ' ' + portcfg
cflags = string.split(cflags) cflags = cflags.split()
if UNDEF_NDEBUG: if UNDEF_NDEBUG:
cflags.append('-UNDEBUG') cflags.append('-UNDEBUG')
if debug: if debug:
@@ -415,7 +415,7 @@ elif os.name == 'posix':
cflags.append('-O0') cflags.append('-O0')
lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1] lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1]
lflags = string.split(lflags) lflags = lflags.split()
# Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but
# wx-config doesn't output that for some reason. For now, just # wx-config doesn't output that for some reason. For now, just
@@ -603,7 +603,7 @@ if BUILD_GLCANVAS or GL_ONLY:
gl_libs = [] gl_libs = []
if os.name == 'posix': if os.name == 'posix':
gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1] gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1]
gl_lflags = string.split(gl_config) + lflags gl_lflags = gl_config.split() + lflags
gl_libs = libs gl_libs = libs
else: else:
other_sources = [opj(location, 'msw/myglcanvas.cpp')] other_sources = [opj(location, 'msw/myglcanvas.cpp')]