← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1951: 1. FIx core class registration in the factory (fixes inheritance info in python for such classes)

 

------------------------------------------------------------
revno: 1951
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Sat 2010-01-09 18:26:41 +0100
message:
  1. FIx core class registration in the factory (fixes inheritance info in python for such classes)
  2. Fix debian packaging, use update-alternatives
added:
  core/corePlugins.cpp
modified:
  SConstruct
  core/SConscript
  core/main/main.py.in
  debian/control-template
  debian/rules
  py/config.py.in
  scripts/yade-exec-wrapper
  yadeSCons.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'SConstruct'
--- SConstruct	2009-12-09 17:11:51 +0000
+++ SConstruct	2010-01-09 17:26:41 +0000
@@ -130,7 +130,7 @@
 opts.AddVariables(
 	### OLD: use PathOption with PathOption.PathIsDirCreate, but that doesn't exist in 0.96.1!
 	('PREFIX','Install path prefix','/usr/local'),
-	('runtimePREFIX','Runtime path prefix; DO NOT USE, inteded for packaging only.','$PREFIX'),
+	('runtimePREFIX','Runtime path prefix; DO NOT USE, inteded for packaging only.',None),
 	('variant','Build variant, will be suffixed to all files, along with version (beware: if PREFIX is the same, headers of the older version will still be overwritten',defOptions['variant'],None,lambda x:x),
 	BoolVariable('debug', 'Enable debugging information and disable optimizations',defOptions['debug']),
 	BoolVariable('gprof','Enable profiling information for gprof',0),
@@ -161,16 +161,9 @@
 	#BoolVariable('useLocalQGLViewer','use in-tree QGLViewer library instead of the one installed in system',1),
 )
 opts.Update(env)
-
-# deprecated feature, is mandatory now. This removes it from the saved profile
-# so that when we remove it from features definitely, the profile will be OK.
-if 'python' in env['features']: env['features'].remove('python')
-# pretty is deprecated; save value to brief and reset pretty to the default (True) so that it is not saved in the profile
-# otherwise once it is removed completely, scons would crash at unknown var in there.
-if env['pretty'] not in (True,1,'y','yes','true','t','all'):
-	env['brief']=env['pretty']; env['pretty']=True
-
 opts.Save(optsFile,env)
+# fix expansion in python substitution by assigning the right value if not specified
+if not env.has_key('runtimePREFIX') or not env['runtimePREFIX']: env['runtimePREFIX']=env['PREFIX']
 # handle colon-separated lists:
 for k in ('CPPPATH','LIBPATH','QTDIR','PATH'):
 	if env.has_key(k):
@@ -357,14 +350,6 @@
 		if note: print "Note:",note
 		Exit(1)
 	# check "optional" libs
-	if 'vtk' in env['features']:
-		ok=conf.CheckLibWithHeader(['vtkCommon'],'vtkInstantiator.h','c++','vtkInstantiator::New();',autoadd=1)
-		env.Append(LIBS='vtkHybrid')
-		if not ok: featureNotOK('vtk',note="You might have to add VTK header directory (e.g. /usr/include/vtk-5.4) to CPPPATH.")
-	if 'gts' in env['features']:
-		env.ParseConfig('pkg-config glib-2.0 --cflags --libs');
-		ok=conf.CheckLibWithHeader('gts','gts.h','c++','gts_object_class();',autoadd=1)
-		if not ok: featureNotOK('gts')
 	if 'opengl' in env['features']:
 		ok=conf.CheckLibWithHeader('glut','GL/glut.h','c++','glutGetModifiers();',autoadd=1)
 		# TODO ok=True for darwin platform where openGL (and glut) is native
@@ -373,6 +358,14 @@
 		if not ok: featureNotOK('opengl','Building with OpenGL implies qt3 interface, which was not found, although OpenGL was.')
 		env.Tool('qt'); env.Replace(QT_LIB='qt-mt')
 		env['QGLVIEWER_LIB']='yade-QGLViewer';
+	if 'vtk' in env['features']:
+		ok=conf.CheckLibWithHeader(['vtkCommon'],'vtkInstantiator.h','c++','vtkInstantiator::New();',autoadd=1)
+		env.Append(LIBS='vtkHybrid')
+		if not ok: featureNotOK('vtk',note="You might have to add VTK header directory (e.g. /usr/include/vtk-5.4) to CPPPATH.")
+	if 'gts' in env['features']:
+		env.ParseConfig('pkg-config gts --cflags --libs');
+		ok=conf.CheckLibWithHeader('gts','gts.h','c++','gts_object_class();',autoadd=1)
+		if not ok: featureNotOK('gts')
 	if 'log4cxx' in env['features']:
 		ok=conf.CheckLibWithHeader('log4cxx','log4cxx/logger.h','c++','log4cxx::Logger::getLogger("");',autoadd=1)
 		if not ok: featureNotOK('log4cxx')

=== modified file 'core/SConscript'
--- core/SConscript	2009-12-30 17:38:37 +0000
+++ core/SConscript	2010-01-09 17:26:41 +0000
@@ -45,8 +45,7 @@
 			'TimeStepper.cpp',
 			'containers/BodyVector.cpp',
 			'containers/InteractionVecMap.cpp',
-
-			
+			'corePlugins.cpp'			
 			]
 			+(['PhysicalParameters.cpp'] if 'physpar' in env['features'] else [])
 			),

=== added file 'core/corePlugins.cpp'
--- core/corePlugins.cpp	1970-01-01 00:00:00 +0000
+++ core/corePlugins.cpp	2010-01-09 17:26:41 +0000
@@ -0,0 +1,3 @@
+#include<yade/lib-factory/ClassFactory.hpp>
+// make core classes known to the class factory
+YADE_PLUGIN((Body)(Bound)(Cell)(Collider)(DataRecorder)(Dispatcher)(Engine)(FileGenerator)(Functor)(GlobalEngine)(Interaction)(InteractionGeometry)(InteractionPhysics)(Material)(PartialEngine)(Shape)(State));

=== modified file 'core/main/main.py.in'
--- core/main/main.py.in	2009-12-30 15:45:32 +0000
+++ core/main/main.py.in	2010-01-09 17:26:41 +0000
@@ -4,7 +4,7 @@
 
 import sys,os,os.path
 # get yade path (allow YADE_PREFIX to override)
-prefix,suffix='${PREFIX}' if not os.environ.has_key('YADE_PREFIX') else os.environ('YADE_PREFIX'),'${SUFFIX}'
+prefix,suffix='${runtimePREFIX}' if not os.environ.has_key('YADE_PREFIX') else os.environ['YADE_PREFIX'],'${SUFFIX}'
 sys.path.append(os.path.join(prefix,'lib','yade'+suffix,'py'))
 # duplicate some items from yade.config here, so that we can increase verbosity when the c++ part is booting
 debug,features,version=bool(${debug}),'${features}'.split(','),'${realVersion}'

=== modified file 'debian/control-template'
--- debian/control-template	2010-01-09 13:13:52 +0000
+++ debian/control-template	2010-01-09 17:26:41 +0000
@@ -1,14 +1,14 @@
 Source: yade@_VERSION@
 Section: x11
 Priority: optional
-Maintainer: Vaclav Smilauer <eudoxos@xxxxxxxx>
-Build-Depends: debhelper (>= 5), scons, libqt3-mt-dev, qt3-dev-tools, freeglut3-dev, libboost-dev (>=1.34), libboost-date-time-dev (>=1.34), libboost-filesystem-dev (>=1.34), libboost-thread-dev (>=1.34), libboost-regex-dev (>=1.34), libboost-python-dev (>=1.34), libboost-iostreams-dev (>=1.34), libboost-program-options-dev, libboost-serialization-dev, liblog4cxx9-dev | liblog4cxx10-dev, docbook-to-man, ipython, libsqlite3-dev, libgts-dev, libgts-bin, python-numpy, g++(>4.0), libvtk5-dev
+Maintainer: Václav Šmilauer <eudoxos@xxxxxxxx>
+Build-Depends: debhelper (>= 5), scons, libqt3-mt-dev, qt3-dev-tools, freeglut3-dev, libboost-dev (>=1.34), libboost-date-time-dev (>=1.34), libboost-filesystem-dev (>=1.34), libboost-thread-dev (>=1.34), libboost-regex-dev (>=1.34), libboost-python-dev (>=1.34), libboost-iostreams-dev (>=1.34), libboost-program-options-dev, libboost-serialization-dev, liblog4cxx9-dev | liblog4cxx10-dev, docbook-to-man, ipython, libsqlite3-dev, libgts-dev, python-numpy, g++(>4.0), libvtk5-dev, libgl1-mesa-swx11-dev, gdb, ipython, python-matplotlib, python-tk
 Standards-Version: 3.7.2
 
 Package: yade@_VERSION@
 Architecture: any
 Provides: yade@SNAPSHOT@
-Depends: ${shlibs:Depends}, ${misc:Depends}, python-numpy, ipython, python-matplotlib, libgts-bin
+Depends: ${shlibs:Depends}, ${misc:Depends}, python-numpy, ipython, python-matplotlib, python-tk
 Description: Platform for dynamical modeling.
  Yet Another Dynamic Engine. etc.
  .
@@ -17,7 +17,7 @@
 Package: yade@_VERSION@-dbg
 Architecture: any
 Provides: yade@SNAPSHOT@-dbg
-Depends: ${shlibs:Depends}, ${misc:Depends}, python-numpy, ipython, gdb, python-matplotlib, libgts-bin
+Depends: ${shlibs:Depends}, ${misc:Depends}, python-numpy, ipython, gdb, python-matplotlib, python-tk
 Description: Platform for dynamical modeling.
  Yet Another Dynamic Engine. etc.
  .

=== modified file 'debian/rules'
--- debian/rules	2010-01-09 13:13:52 +0000
+++ debian/rules	2010-01-09 17:26:41 +0000
@@ -44,7 +44,8 @@
 	## eudoxos: FIXME: scons skips config when cleaning and doesn't know where it built anything
 	dh_testdir
 	# scons clean
-	rm -rf debian/build-* debian/yade-*
+	## remove builddirs and installation directories
+	rm -rf debian/build-* `find debian/ -name 'yade-*' -type d`
 	rm -rf scons.profile* scons.current-profile
 	dh_clean 
 
@@ -67,8 +68,8 @@
 check: install
 	dh_testdir
 	dh_testroot
-	scripts/yade-exec-wrapper debian/yade${_VERSION}-dbg/usr/bin/yade${_VERSION}-dbg -x -N PythonUI -- -n -x scripts/regression-tests.py
-	scripts/yade-exec-wrapper debian/yade${_VERSION}/usr/bin/yade${_VERSION} -x -N PythonUI -- -n -x scripts/regression-tests.py
+	scripts/yade-exec-wrapper debian/yade${_VERSION}-dbg/usr/bin/yade${_VERSION}-dbg -x scripts/regression-tests.py
+	scripts/yade-exec-wrapper debian/yade${_VERSION}/usr/bin/yade${_VERSION} -x scripts/regression-tests.py
 
 # Build architecture-independent files here.
 binary-indep: build install

=== modified file 'py/config.py.in'
--- py/config.py.in	2009-12-04 21:56:59 +0000
+++ py/config.py.in	2010-01-09 17:26:41 +0000
@@ -3,8 +3,8 @@
 
 Template file is processed by scons to create the actual configuration at build-time.
 """
-
-prefix='${PREFIX}'
+import os
+prefix='${runtimePREFIX}' 
 suffix='${SUFFIX}'
 libstdcxx='${libstdcxx}'
 features='${features}'.split(',')

=== modified file 'scripts/yade-exec-wrapper'
--- scripts/yade-exec-wrapper	2009-08-20 12:00:28 +0000
+++ scripts/yade-exec-wrapper	2010-01-09 17:26:41 +0000
@@ -12,11 +12,11 @@
 bin=abspath(sys.argv[1])
 print bin,dirname(bin)
 prefix=normpath(dirname(bin)+'/..')
-cmd='LD_PRELOAD= YADE_PREFIX='+prefix+' '+' '.join(sys.argv[1:])
+cmd='DISPLAY= LD_PRELOAD= YADE_PREFIX='+prefix+' '+' '.join(sys.argv[1:])
 print cmd
 p=subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,shell=True)
 pout=p.communicate()[0]
 retval=p.wait()
 print pout
-if retval==0 or 'terminating...' in pout: sys.exit(0)
+if retval==0 or 'Yade: normal exit.' in pout: sys.exit(0)
 sys.exit(retval)

=== modified file 'yadeSCons.py'
--- yadeSCons.py	2009-12-22 22:17:50 +0000
+++ yadeSCons.py	2010-01-09 17:26:41 +0000
@@ -1,12 +1,14 @@
 
 def getRealVersion():
-	"Attempts to get yade version from RELEASE file if it exists or from bzr or svn."
+	"Attempts to get yade version from RELEASE file if it exists or from bzr/svn, or from VERSION"
 	import os.path,re,os
 	if os.path.exists('RELEASE'):
 		return file('RELEASE').readline().strip()
 	if os.path.exists('.bzr'):
 		for l in os.popen("LC_ALL=C bzr revno 2>/dev/null").readlines():
 			return 'bzr'+l[:-1]
+	if os.path.exists('VERSION'):
+		return file('VERSION').readline().strip()
 	return None
 
 
@@ -118,8 +120,8 @@
 	"""Return name of library this plugin will be compiled into, based on current linkStrategy."""
 	if   linkStrategy=='per-class': return plug.name
 	elif linkStrategy=='per-pkg': return plug.module
-	elif linkStrategy=='monolithic': return 'packages'
-	elif linkStrategy=='static': return 'packages'
+	elif linkStrategy=='monolithic': return 'plugins'
+	elif linkStrategy=='static': return 'plugins'
 
 def getPluginLibs(p,plugInfo):
 	"""Returns library names this plugin should link to, based on current information about other plugins."""