Merge lp:~jduriez/yslope/trunk into lp:yslope

Proposed by Jérôme Duriez
Status: Approved
Approved by: Jérôme Duriez
Approved revision: 3
Proposed branch: lp:~jduriez/yslope/trunk
Merge into: lp:yslope
Diff against target: 189 lines (+169/-0) (has conflicts)
2 files modified
pkg/dem/Engine/GlobalEngine/MechJointStateRecorder.hpp (+5/-0)
yadeSCons.py (+164/-0)
Text conflict in pkg/dem/Engine/GlobalEngine/MechJointStateRecorder.hpp
Conflict adding file yadeSCons.py.  Moved existing file to yadeSCons.py.moved.
To merge this branch: bzr merge lp:~jduriez/yslope/trunk
Reviewer Review Type Date Requested Status
yslope Users Pending
Review via email: mp+40938@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

3. By jduriez <jduriez@c1solimara-l>

- commit avec yadeSCons.py, qui n'avait pas été déposé sur lp / contrôlé par bzr. Son absence empêchait la compilation

L'occasion de voir si je reçois des mails de commit... J'ai installé le paquet bzr-email, et c'est tout ce que j'ai fait pour le moment...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pkg/dem/Engine/GlobalEngine/MechJointStateRecorder.cpp'
2=== modified file 'pkg/dem/Engine/GlobalEngine/MechJointStateRecorder.hpp'
3--- pkg/dem/Engine/GlobalEngine/MechJointStateRecorder.hpp 2010-11-15 14:50:45 +0000
4+++ pkg/dem/Engine/GlobalEngine/MechJointStateRecorder.hpp 2010-11-16 09:16:13 +0000
5@@ -23,8 +23,13 @@
6 tau=0.0;
7 normalDisp=0.0;
8 tangentialDisp=0.0;
9+<<<<<<< TREE
10 sumFn=Vector3r::Zero();
11 sumFs=Vector3r::Zero();
12+=======
13+ sumFn=0.0;
14+ sumFs=Vector3r::Zero();
15+>>>>>>> MERGE-SOURCE
16 sumSec=0.0;
17 );
18 DECLARE_LOGGER;
19
20=== added file 'yadeSCons.py'
21--- yadeSCons.py 1970-01-01 00:00:00 +0000
22+++ yadeSCons.py 2010-11-16 09:16:13 +0000
23@@ -0,0 +1,164 @@
24+
25+def getRealVersion():
26+ "Attempts to get yade version from RELEASE file if it exists or from bzr/svn, or from VERSION"
27+ import os.path,re,os
28+ if os.path.exists('RELEASE'):
29+ return file('RELEASE').readline().strip()
30+ if os.path.exists('.bzr'):
31+ for l in os.popen("LC_ALL=C bzr revno 2>/dev/null").readlines():
32+ return 'bzr'+l[:-1]
33+ if os.path.exists('VERSION'):
34+ return file('VERSION').readline().strip()
35+ return None
36+
37+
38+class Plugin:
39+ def __init__(self,name,src,deps,feats,module):
40+ self.name,self.src,self.deps,self.feats,self.module=name,src,deps,feats,module
41+ def __str__(self):
42+ return '%s/%s [%s] (%s)'%(self.module,self.name,','.join(self.feats),','.join(self.libs))
43+
44+def grepForIncludes(root,f):
45+ import re
46+ ret=set()
47+ skipping=False
48+ lineNo=0
49+ for l in open(root+'/'+f):
50+ if re.match(r'\s*#endif.*$',l): skipping=False; continue
51+ if skipping: continue
52+ m=re.match(r'^\s*#include\s*<yade/([^/]*)/(.*)>.*$',l)
53+ if m:
54+ incMod=m.group(1); baseName=m.group(2).split('.')[0];
55+ if incMod=='core' or incMod.startswith('lib-'): continue
56+ if skipping: continue
57+ ret.add(baseName)
58+ continue
59+ m=re.match(r'\s*#ifdef\s*YADE_(.*)\s*$',l)
60+ if m:
61+ feat=m.group(1).lower()
62+ if feat not in features: skipping=True; continue
63+ return ret
64+
65+features=[]
66+
67+def scanAllPlugins(cacheFile,feats):
68+ """Traverse all files in pkg/, recording what plugins they link with and what features they require.
69+ Save the result in a cache file and only regenerate the information if the cache file is missing."""
70+ import os, os.path, re, shelve
71+ features=feats # update the module-level var
72+ if cacheFile:
73+ refresh=os.path.exists(cacheFile)
74+ plugInfo=shelve.open(cacheFile)
75+ else:
76+ plugInfo={}; refresh=True
77+ if refresh:
78+ for root, dirs, files in os.walk('pkg/',topdown=True):
79+ for f in files:
80+ if not (f.endswith('.cpp') or f.endswith('.cc') or f.endswith('C')): continue
81+ ff=root+'/'+f
82+ linkDeps,featureDeps=set(),set()
83+ isPlugin=True # False
84+ skipping=False
85+ for l in open(ff):
86+ if re.match(r'\s*#endif.*$',l): skipping=False; continue
87+ if skipping: continue
88+ m=re.match(r'\s*#(ifdef|ifndef)\s*YADE_(.*)\s*$',l)
89+ if m:
90+ cond,feat=m.group(1),m.group(2).lower()
91+ if (cond=='ifdef' and feat not in features) or (cond=='ifndef' and feat in features): skipping=True
92+ if re.match(r'\s*YADE_PLUGIN\(.*',l): isPlugin=True
93+ m=re.match(r'^\s*#include\s*<yade/([^/]*)/(.*)>.*$',l)
94+ if m:
95+ incMod=m.group(1); incHead=m.group(2); baseName=incHead.split('.')[0]; assert(len(incHead.split('.'))==2)
96+ if incMod=='core' or incMod.startswith('lib-'): continue
97+ if os.path.exists(root+'/'+m.group(2)):
98+ linkDeps.update(grepForIncludes(root,m.group(2)))
99+ linkDeps.add(incHead.split('.')[0])
100+ continue
101+ m=re.match('^\s*YADE_REQUIRE_FEATURE\s*\(\s*(.*)\s*\).*$',l)
102+ if m:
103+ featureDeps.add(m.group(1).upper())
104+ m=re.match('^s*YADE_LINK_EXTRA_LIB\((.*)\).*$',l)
105+ if m:
106+ linkDeps.add('!'+m.group(1)) # hack!! see getPLuginLibs
107+ m=re.match('^\s*#include\s*"([^/]*)".*$',l)
108+ if m:
109+ inc=m.group(1); incBaseName=m.group(1).split('.')[0]
110+ if not os.path.exists(root+'/'+m.group(1)):
111+ print "WARNING: file %s included from %s doesn't exist"%(m.group(1),ff)
112+ else:
113+ linkDeps.update(grepForIncludes(root,m.group(1)))
114+ continue
115+ if isPlugin:
116+ plugin=f.split('.')[0]
117+ m=re.match(r'.*pkg/([^/]*)(/.*|)$',root)
118+ plugInfo[plugin]=Plugin(plugin,ff,linkDeps,featureDeps,m.group(1))
119+ pp={}
120+ for p in plugInfo.keys(): pp[p]=plugInfo[p]
121+ if cacheFile: plugInfo.close()
122+ return pp
123+
124+def getWantedPlugins(plugInfo,excludes,features,linkStrategy):
125+ """Use pluginInfo (generated by scanAllPlugins) and return only plugins that we should build,
126+ based on excludes and available features.
127+
128+ Set the plugin object according to linkStrategy and set also other plugins this one should link to."""
129+ ret={}
130+ feats=set([feat.upper() for feat in features])
131+ excludes=set(excludes)
132+ for p in plugInfo:
133+ plug=plugInfo[p]
134+ if plug.module in excludes: continue
135+ if not plug.feats<=feats:
136+ continue # plugin needs more feature than we have
137+ ret[plug.name]=plug
138+ for p in plugInfo.values(): p.obj=getPluginObj(p,linkStrategy)
139+ for p in plugInfo.values(): p.libs=getPluginLibs(p,plugInfo)
140+ return ret
141+
142+def getPluginObj(plug,linkStrategy):
143+ """Return name of library this plugin will be compiled into, based on current linkStrategy."""
144+ if linkStrategy=='per-class': return plug.name
145+ elif linkStrategy=='per-pkg': return plug.module
146+ elif linkStrategy=='monolithic': return 'plugins'
147+ elif linkStrategy=='static': return 'plugins'
148+
149+def getPluginLibs(p,plugInfo):
150+ """Returns library names this plugin should link to, based on current information about other plugins."""
151+ ret=set()
152+ for dep in p.deps:
153+ if dep in plugInfo.keys():
154+ ret.add(plugInfo[dep].obj)
155+ elif dep.startswith('!'):
156+ ret.add(dep[1:])
157+ else:
158+ pass
159+ #print p.src+':',dep,"not a plugin?"
160+ ret.discard(p.obj)
161+ return ret
162+
163+def buildPluginLibs(env,plugInfo):
164+ objs={}
165+ linkStrategy=env['linkStrategy']
166+ chunkSize=env['chunkSize']
167+ for p in plugInfo.values():
168+ if not objs.has_key(p.obj): objs[p.obj]=(set(),set())
169+ objs[p.obj][0].add(p.src)
170+ objs[p.obj][1].update(p.libs)
171+ for obj in objs.keys():
172+ srcs=list(objs[obj][0])
173+ if len(srcs)>1:
174+ if len(srcs)<chunkSize or chunkSize<=0: srcs=env.Combine('$buildDir/'+obj+'.cpp',srcs)
175+ # thanks to http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python :
176+ else: srcs=[env.Combine('$buildDir/'+obj+'%d.cpp'%j,srcs[i:i+chunkSize]) for j,i in enumerate(range(0,len(srcs),chunkSize))]
177+ if linkStrategy!='static':
178+ env.Install('$PREFIX/lib/yade$SUFFIX/plugins',env.SharedLibrary(obj,srcs,LIBS=env['LIBS']+['yade-support','core']+list(objs[obj][1])))
179+ else:
180+ env.Install('$PREFIX/lib/yade$SUFFIX/plugins',env.StaticLibrary(obj,srcs,LIBS=env['LIBS']+['yade-support','core']+list(objs[obj][1])))
181+
182+
183+
184+
185+
186+
187+
188
189=== renamed file 'yadeSCons.py' => 'yadeSCons.py.moved'

Subscribers

People subscribed via source and target branches

to all changes: