PATCH:bksys - fix some win32 related path delimiter problems

Ralf Habacker ralf.habacker at freenet.de
Thu Sep 29 00:56:52 BST 2005


Am Donnerstag, 29. September 2005 01:19 schrieb tnagyemail-ml at yahoo.fr:
> While we are at it, lstrip(param) does not work for
> python =< 2.2 (Redhat 9).
any replacement for this available ? 

Ralf 
>
> --- Ralf Habacker <ralf.habacker at freenet.de> a écrit :
> > Am Mittwoch, 28. September 2005 22:58 schrieb Ralf
> >
> > Habacker:
> > > Stephan Kulow schrieb:
> > > > Am Mittwoch, 28. September 2005 21:38 schrieb
> >
> > Jaroslaw Staniek:
> > > >> Ralf Habacker said the following, On 2005-09-28
> >
> > 19:04:
> > > >>> Hi all,
> > > >>>
> > > >>> here comes another patch for bksys. Any
> >
> > objectivities for
> >
> > > >>> submitting ?
> >
> > Here comes an updated patch
> > (win32-fix-path-separator.patch) without the
> > previous site effects. It is tested with mingw
> > compile environment. Can
> > anyone check this patch ?
> >
> > BTW: the generic-indention-problem.patch fixes some
> > indention problems at the
> > end of generic.py and has to be applied first.
> >
> > changelog: fix some win32 related path delimiter
> > problems
> >
> > Regards
> >  Ralf
> >
> > > Index: generic.py
>
> ===================================================================
>
> > --- generic.py	(revision 464982)
> > +++ generic.py	(working copy)
> > @@ -763,9 +763,9 @@
> >  			lenv.AppendUnique(LIBS = [link])
> >  			lenv.PrependUnique(LIBPATH = [dir])
> >
> > -        def link_local_staticlib(lenv, str):
> > -                """ Links against a shared library
> > made in the project """
> > -                lst = lenv.make_list(str)
> > +	def link_local_staticlib(lenv, str):
> > +		""" Links against a shared library made in the
> > project """
> > +		lst = lenv.make_list(str)
> >  		for file in lst:
> >  			import re
> >  			reg = re.compile("(.*)/(lib.*.a)")
> > @@ -797,18 +797,18 @@
> >  	if env.has_key('EXTRALIBS'):     env.AppendUnique(
> > LINKFLAGS = env['EXTRALIBS'])
> >
> >  	if env.has_key('BKS_DEBUG'):
> > -                if (env['BKS_DEBUG'] == "full"):
> > -                        env.AppendUnique(CXXFLAGS =
> > ['-DDEBUG', '-Wall'])
> > -                        if env['WINDOWS']:
> > -                                pass
> > -                        else:
> > -
> > env.AppendUnique(CXXFLAGS = ['-g3'])
> > -                elif (env['BKS_DEBUG'] == "trace"):
> > # i cannot remember who wanted this (TODO ita)
> > -                        env.AppendUnique(
> > -
> > LINKFLAGS=env.Split("-lmrwlog4cxxconfiguration
> > -lmrwautofunctiontracelog4cxx
> > -finstrument-functions"),
> > -
> > CXXFLAGS=env.Split("-DDEBUG -Wall
> > -finstrument-functions -g3 -O0"))
> > -                else:
> > -                        env.AppendUnique(CXXFLAGS =
> > ['-DDEBUG', '-g', '-Wall'])
> > +		if (env['BKS_DEBUG'] == "full"):
> > +			env.AppendUnique(CXXFLAGS = ['-DDEBUG',
> > '-Wall'])
> > +			if env['WINDOWS']:
> > +				pass
> > +			else:
> > +				env.AppendUnique(CXXFLAGS = ['-g3'])
> > +		elif (env['BKS_DEBUG'] == "trace"): # i cannot
> > remember who wanted this (TODO ita)
> > +			env.AppendUnique(
> > +
> > LINKFLAGS=env.Split("-lmrwlog4cxxconfiguration
> > -lmrwautofunctiontracelog4cxx
> > -finstrument-functions"),
> > +			        CXXFLAGS=env.Split("-DDEBUG -Wall
> > -finstrument-functions -g3 -O0"))
> > +		else:
> > +			env.AppendUnique(CXXFLAGS = ['-DDEBUG', '-g',
> > '-Wall'])
> >
> >  	env.Export('env')
> >
> > > --- generic.py.orig	2005-09-29 01:04:46.523633600
> >
> > +0200
> > +++ generic.py	2005-09-29 01:05:56.494246400 +0200
> > @@ -185,7 +185,7 @@
> >  		def reldir(dir):
> >  			ndir    =
> > SCons.Node.FS.default_fs.Dir(dir).srcnode().abspath
> >  			rootdir =
> > SCons.Node.FS.default_fs.Dir('#').abspath
> > -			return ndir.replace(rootdir, '').lstrip('/')
> > +			return ndir.replace(rootdir, '').lstrip(os.sep)
> >
> >  		dir=self.dirprefix
> >  		if not len(dir)>2: dir=reldir('.')
> > @@ -343,15 +343,22 @@
> >  		try: return s.split()
> >  		except AttributeError: return s
> >
> > +## HELPER - replace current os path separators with
> > slashes
> > +def slashify(val):
> > +	if os.sep == "\\":
> > +		return str.replace(val,os.sep,'/')
> > +	else:
> > +		return val
> > +
> >  ## HELPER
> >  def join(lenv, s1, s2, s3=None, s4=None):
> >  	if s4 and s3: return lenv.join(s1, s2,
> > lenv.join(s3, s4))
> >  	if s3 and s2: return lenv.join(s1, lenv.join(s2,
> > s3))
> >  	elif not s2:  return s1
> >  	# having s1, s2
> > -	#print "path1 is "+s1+" path2 is "+s2+"
> > "+os.path.join(s1,string.lstrip(s2,'/'))
> > -	if not s1: s1='/' # TODO on win32 this will not
> > work (for js)
> > -	return os.path.join(s1,string.lstrip(s2,'/'))
> > +	#print "path1 is "+s1+" path2 is "+s2+"
> > "+os.path.join(s1,string.lstrip(s2,os.sep))
> > +	if not s1: s1=os.sep
> > +	return os.path.join(s1,string.lstrip(s2,os.sep))
> >
> >  ## HELPER export the data to xml
> >  bks_dump='<?xml version="1.0"
> > encoding="UTF-8"?>\n<bksys version="1">\n'
> > @@ -368,7 +375,7 @@
> >  def getreldir(lenv):
> >  	cwd=os.getcwd()
> >  	root=SCons.Node.FS.default_fs.Dir('#').abspath
> > -	return cwd.replace(root,'').lstrip('/')
> > +	return cwd.replace(root,'').lstrip(os.sep)
> >
> >  ## HELPER - find programs and headers
> >  def find_path(lenv, file, path_list):
> > @@ -675,7 +682,7 @@
> >  				thisenv['SHLIBSUFFIX']='.so.'+vnum
> >  			thisenv.Depends(target, thisenv.Value(vnum))
> >  			num=vnum.split('.')[0]
> > -			lst=target.split('/')
> > +			lst=target.split(os.sep)
> >  			tname=lst[len(lst)-1]
> >  			libname=tname.split('.')[0]
> >  			if sys.platform == 'darwin':
> > @@ -738,8 +745,10 @@
> >          def link_local_shlib(lenv, str):
> >                  """ Links against a shared library
> > made in the project """
> >                  lst = lenv.make_list(str)
> > -		for file in lst:
> > +		for afile in lst:
> >  			import re
> > +			file = slashify(afile)
> > +
> >  			if sys.platform == 'darwin':
> >  				reg=re.compile("(.*)/lib(.*).(la|so|dylib)$")
> >  			else:
> > @@ -766,8 +775,9 @@
> >  	def link_local_staticlib(lenv, str):
> >  		""" Links against a shared library made in the
> > project """
> >  		lst = lenv.make_list(str)
> > -		for file in lst:
> > +		for afile in lst:
> >  			import re
> > +			file = slashify(afile)
> >  			reg = re.compile("(.*)/(lib.*.a)")
> >  			result = reg.match(file)
> >  			if not result:
>
> /* Thomas Nagy */
>
>
>
>
>
>
> ___________________________________________________________________________
> Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
> Téléchargez cette version sur http://fr.messenger.yahoo.com




More information about the kde-core-devel mailing list