← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1708: 1. IMPORTANT! All features are lower-cased now (avoids mess: openGL or OpenGL etc). This will pro...

 

------------------------------------------------------------
revno: 1708
committer: Václav Šmilauer <vaclav@flux>
branch nick: trunk
timestamp: Thu 2009-08-20 11:38:22 +0200
message:
  1. IMPORTANT! All features are lower-cased now (avoids mess: openGL or OpenGL etc). This will probably break your profile files.
  2. IMPORTANT! openmp is one of features, no longer a separate options. Adjust your profiles
  3. Rename LOG4CXX to YADE_LOG4CXX; all features now #define YADE_FEATURE macros
  4. Better $ORIGIN syntax in scons
  5. Abort yade if running PythonUI_rc.py fails
  6. Adjust pbuilder script
modified:
  SConstruct
  core/yade.cpp
  debian/rules
  gui/py/PythonUI.cpp
  gui/py/PythonUI.hpp
  gui/qt3/QtGUI-python.cpp
  lib/base/Logging.hpp
  pkg/common/DataClass/VelocityBins.cpp
  py/_eudoxos.cpp
  py/_packPredicates.cpp
  py/_utils.cpp
  py/log.cpp
  py/yadeWrapper/yadeWrapper.cpp
  scripts/pbuilder-test-distributions.sh
  scripts/regression-tests.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-08-19 13:34:43 +0000
+++ SConstruct	2009-08-20 09:38:22 +0000
@@ -137,7 +137,7 @@
 	ListVariable('exclude','Yade components that will not be built','none',names=['qt3','gui','extra','common','dem','fem','lattice','mass-spring','realtime-rigidbody','snow']),
 	EnumVariable('PGO','Whether to "gen"erate or "use" Profile-Guided Optimization','',['','gen','use'],{'no':'','0':'','false':''},1),
 	# OK, dummy prevents bug in scons: if one selects all, it says all in scons.config, but without quotes, which generates error.
-	ListVariable('features','Optional features that are turned on','python,log4cxx,openGL,GTS',names=['openGL','python','log4cxx','CGAL','dummy','GTS']),
+	ListVariable('features','Optional features that are turned on','python,log4cxx,opengl,gts,openmp',names=['opengl','python','log4cxx','cgal','openmp','gts']),
 	('jobs','Number of jobs to run at the same time (same as -j, but saved)',4,None,int),
 	('extraModules', 'Extra directories with their own SConscript files (must be in-tree) (whitespace separated)',None,None,Split),
 	('buildPrefix','Where to create build-[version][variant] directory for intermediary files','..'),
@@ -320,7 +320,6 @@
 		conf.env.Append(CPPPATH='/usr/include/wm3') # packaged version
 		ok&=conf.CheckLibWithHeader('Wm3Foundation','Wm3Math.h','c++','Wm3::Math<double>::PI;',autoadd=1)
 
-
 	if not ok:
 		print "\nOne of the essential libraries above was not found, unable to continue.\n\nCheck `%s' for possible causes, note that there are options that you may need to customize:\n\n"%(buildDir+'/config.log')+opts.GenerateHelpText(env)
 		Exit(1)
@@ -328,17 +327,15 @@
 		print "\nERROR: Unable to compile with optional feature `%s'.\n\nIf you are sure, remove it from features (scons features=featureOne,featureTwo for example) and build again."%featureName
 		Exit(1)
 	# check "optional" libs
-	if 'openGL' in env['features']:
+	if 'opengl' in env['features']:
 		ok=conf.CheckLibWithHeader('glut','GL/glut.h','c','glutGetModifiers();',autoadd=1)
 		if not ok: featureNotOK('openGL')
-		env.Append(CPPDEFINES=['YADE_OPENGL'])
-	if 'GTS' in env['features']:
+	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')
-		env.Append(CPPDEFINES=['YADE_GTS'])
+		if not ok: featureNotOK('gts')
 	if 'qt3' not in env['exclude']:
-		if 'openGL' not in env['features']:
+		if 'opengl' not in env['features']:
 			print "\nQt3 interface can only be used if openGL is enabled.\nEither add openGL to 'features' or add qt3 to 'exclude'."
 			Exit(1)
 		ok&=conf.CheckQt(env['QTDIR'])
@@ -348,19 +345,19 @@
 	if 'log4cxx' in env['features']:
 		ok=conf.CheckLibWithHeader('log4cxx','log4cxx/logger.h','c++','log4cxx::Logger::getLogger("");',autoadd=1)
 		if not ok: featureNotOK('log4cxx')
-		env.Append(CPPDEFINES=['LOG4CXX'])
 	if 'python' in env['features']:
 		ok=(conf.CheckPython()
 			and conf.CheckIPython() # not needed now: and conf.CheckScientificPython()
 			and CheckLib_maybeMT(conf,'boost_python','boost/python.hpp','c++','boost::python::scope();')
 			and conf.CheckCXXHeader(['Python.h','numpy/ndarrayobject.h'],'<>'))
 		if not ok: featureNotOK('python')
-		env.Append(CPPDEFINES=['YADE_PYTHON'])
-	if 'CGAL' in env['features']:
+	if 'cgal' in env['features']:
 		ok=cong.CheckLibWithHeader('CGAL','CGAL/Exact_predicates_inexact_constructions_kernel.h','c++','CGAL::Exact_predicates_inexact_constructions_kernel::Point_3();')
-		if not ok: featureNotOK('CGAL')
+		if not ok: featureNotOK('cgal')
 	if env['useMiniWm3']: env.Append(LIBS='miniWm3',CPPDEFINES=['MINIWM3'])
 
+	env.Append(CPPDEFINES=['YADE_'+f.upper() for f in env['features']])
+
 	env=conf.Finish()
 
 	if os.path.exists('../brefcom-mm.hh'):
@@ -405,9 +402,10 @@
 # where are we going to be installed... pkg/dem becomes pkg-dem
 instLibDirs=[os.path.join('$PREFIX','lib','yade$SUFFIX',x) for x in libDirs]
 ## runtime library search directories; there can be up to 2 levels of libs, so we do in in quite a crude way here:
-## FIXME: find some better way to do that?
-runtimeLibDirs=[os.path.join(r"'$$$$ORIGIN'/../",x) for x in libDirs]+[os.path.join(r"'$$$$ORIGIN'/../../",x) for x in libDirs]+["'$$$$ORIGIN'/../lib/yade$SUFFIX/lib"]
-
+## FIXME: use syntax as shown here: http://www.scons.org/wiki/UsingOrigin
+relLibDirs=['../'+x for x in libDirs]+['../../'+x for x in libDirs]+[env.subst('../lib/yade$SUFFIX/lib')]
+runtimeLibDirs=[env.Literal('\\$$ORIGIN/'+x) for x in relLibDirs]
+#runtimeLibDirs=[os.path.join(r"'$$$$ORIGIN'/../",x) for x in libDirs]+[os.path.join(r"'$$$$ORIGIN'/../../",x) for x in libDirs]+["'$$$$ORIGIN'/../lib/yade$SUFFIX/lib"]
 
 ### PREPROCESSOR FLAGS
 env.Append(CPPDEFINES=[('SUFFIX',r'\"$SUFFIX\"'),('PREFIX',r'\"$runtimePREFIX\"')])
@@ -416,7 +414,7 @@
 ### COMPILER
 if env['debug']: env.Append(CXXFLAGS='-ggdb2',CPPDEFINES=['YADE_DEBUG'])
 else: env.Append(CXXFLAGS='-O3')
-if env['openmp']: env.Append(CXXFLAGS='-fopenmp',LIBS='gomp',CPPDEFINES='YADE_OPENMP')
+if 'openmp' in env['features']: env.Append(CXXFLAGS='-fopenmp',LIBS='gomp',CPPDEFINES='YADE_OPENMP')
 if env['optimize']:
 	env.Append(CXXFLAGS=Split('-O3 -march=%s'%env['march']),
 		CPPDEFINES=[('YADE_CAST','static_cast'),('YADE_PTR_CAST','static_pointer_cast'),'NDEBUG'])
@@ -425,20 +423,17 @@
 	env.Append(CPPDEFINES=[('YADE_CAST','dynamic_cast'),('YADE_PTR_CAST','dynamic_pointer_cast')])
 
 if env['gprof']: env.Append(CXXFLAGS=['-pg'],LINKFLAGS=['-pg'],SHLINKFLAGS=['-pg'])
-env.Prepend(CXXFLAGS=['-pipe','-Wall']) # '-Wc++0x-compat' ## not know to gcc-3.*
+env.Prepend(CXXFLAGS=['-pipe','-Wall'])
 
 if env['PGO']=='gen': env.Append(CXXFLAGS=['-fprofile-generate'],LINKFLAGS=['-fprofile-generate'])
 if env['PGO']=='use': env.Append(CXXFLAGS=['-fprofile-use'],LINKFLAGS=['-fprofile-use'])
 
 ### LINKER
 ## libs for all plugins
-# Investigate whether soname is useful for something. Probably not: SHLINKFLAGS=['-Wl,-soname=${TARGET.file},'-rdynamic']
 env.Append(LIBS=[],SHLINKFLAGS=['-rdynamic'])
 
-#env.Append(LIBS=['yade-core']); env.Append(SHLINKFLAGS=['-Wl,--no-undefined']);
-
-# if this is not present, vtables & typeinfos for classes in yade binary itself are not exported; breaks plugin loading
-env.Append(LINKFLAGS=['-rdynamic']) 
+# if this is not present, vtables & typeinfos for classes in yade binary itself would not be exported, plugins wouldn't work
+env.Append(LINKFLAGS=['-rdynamic','-z','origin']) 
 # makes dynamic library loading easier (no LD_LIBRARY_PATH) and perhaps faster
 env.Append(RPATH=runtimeLibDirs)
 # find already compiled but not yet installed libraries for linking

=== modified file 'core/yade.cpp'
--- core/yade.cpp	2009-08-19 10:48:06 +0000
+++ core/yade.cpp	2009-08-20 09:38:22 +0000
@@ -31,7 +31,7 @@
 
 using namespace std;
 
-#ifdef LOG4CXX
+#ifdef YADE_LOG4CXX
 	// provides parent logger for everybody
 	log4cxx::LoggerPtr logger=log4cxx::Logger::getLogger("yade");
 
@@ -156,12 +156,15 @@
 	#ifdef YADE_OPENMP
 		"   YADE_OPENMP   (supports openMP; set OMP_NUM_THREADS env. var to control parallelism.)\n"
 	#endif
-	#ifdef LOG4CXX
-		"   LOG4CXX       (configurable logging framework enabled; ~/.yade" SUFFIX "/logging.conf)\n"
+	#ifdef YADE_LOG4CXX
+		"   YADE_LOG4CXX  (configurable logging framework enabled; ~/.yade" SUFFIX "/logging.conf)\n"
 	#endif
 	#ifdef YADE_OPENGL
 		"   YADE_OPENGL   (3d rendering)\n"
 	#endif
+	#ifdef YADE_PYTHON
+		"   YADE_PYTHON   (python scripting support)\n"
+	#endif
 	;
 	if(!isnan(std::numeric_limits<double>::quiet_NaN())) cerr<<
 		"   -ffast-math?  WARNING: NaN's will not work"<<endl;
@@ -211,7 +214,7 @@
 	// reset getopt globals for next processing in frontends
 	optind=0; opterr=0;
 
-	#ifdef LOG4CXX
+	#ifdef YADE_LOG4CXX
 		// read logging configuration from file and watch it (creates a separate thread)
 		std::string logConf=configPath+"/logging.conf";
 		if(filesystem::exists(logConf)){

=== modified file 'debian/rules'
--- debian/rules	2009-08-19 14:06:32 +0000
+++ debian/rules	2009-08-20 09:38:22 +0000
@@ -58,7 +58,7 @@
 	###   (a) use fakeroot-tcp instead of fakeroot
 	###   (b) use just 1 job
 	#debug build
-	NO_SCONS_GET_RECENT= scons buildPrefix=debian runtimePREFIX=/usr version=${VERSION} pretty=0 linkStrategy=monolithic features=GTS,python,log4cxx,openGL openmp=True exclude=realtime-rigidbody,mass-spring,snow,fem PREFIX=debian/yade${_VERSION}-dbg/usr variant=-dbg optimize=0 debug=1 
+	NO_SCONS_GET_RECENT= scons buildPrefix=debian runtimePREFIX=/usr version=${VERSION} pretty=0 linkStrategy=monolithic features=gts,python,log4cxx,opengl,openmp exclude=realtime-rigidbody,mass-spring,snow,fem PREFIX=debian/yade${_VERSION}-dbg/usr variant=-dbg optimize=0 debug=1 
 	#optimized build
 	NO_SCONS_GET_RECENT= scons PREFIX=debian/yade${_VERSION}/usr variant='' optimize=1 debug=0
 	#install platform-independent files (docs, scripts, examples)
@@ -67,8 +67,8 @@
 check: install
 	dh_testdir
 	dh_testroot
-	LD_PRELOAD= LD_LIBRARY_PATH=debian/yade${_VERSION}-dbg/usr/lib/yade${_VERSION}-dbg/lib YADE_PREFIX=debian/yade${_VERSION}-dbg/usr debian/yade${_VERSION}-dbg/usr/bin/yade${_VERSION}-dbg -x -N PythonUI -- -n -x scripts/regression-tests.py 
-	LD_PRELOAD= LD_LIBRARY_PATH=debian/yade${_VERSION}/usr/lib/yade${_VERSION}/lib YADE_PREFIX=debian/yade${_VERSION}/usr debian/yade${_VERSION}/usr/bin/yade${_VERSION} -x -N PythonUI -- -n -x scripts/regression-tests.py 
+	LD_PRELOAD= YADE_PREFIX=debian/yade${_VERSION}-dbg/usr debian/yade${_VERSION}-dbg/usr/bin/yade${_VERSION}-dbg -x -N PythonUI -- -n -x scripts/regression-tests.py 
+	LD_PRELOAD= YADE_PREFIX=debian/yade${_VERSION}/usr debian/yade${_VERSION}/usr/bin/yade${_VERSION} -x -N PythonUI -- -n -x scripts/regression-tests.py 
 
 # Build architecture-independent files here.
 binary-indep: build install

=== modified file 'gui/py/PythonUI.cpp'
--- gui/py/PythonUI.cpp	2009-08-19 10:48:06 +0000
+++ gui/py/PythonUI.cpp	2009-08-20 09:38:22 +0000
@@ -39,15 +39,17 @@
 ";
 }
 
-void PythonUI::execScript(string script){
+int PythonUI::execScript(string script){
 	LOG_DEBUG("Python will now run file `"<<script<<"'.");
 	FILE* scriptFILE=fopen(script.c_str(),"r");
 	if(scriptFILE){
-		PyRun_SimpleFile(scriptFILE,script.c_str());
+		int ret=PyRun_SimpleFile(scriptFILE,script.c_str());
+		return ret;
 	}
 	else{
 		string strerr(strerror(errno));
 		LOG_ERROR("Unable to open file `"<<script<<"': "<<strerr<<".");
+		return -1;
 	}
 }
 
@@ -97,7 +99,8 @@
 			{ ostringstream oss; oss<<"yade.runtime.argv=["; if(scriptArgs.size()>0){ FOREACH(string s, scriptArgs) oss<<"'"<<s<<"',"; } oss<<"]"; PyRun_SimpleString(oss.str().c_str()); }
 		#undef PYTHON_DEFINE_STRING
 		#undef PYTHON_DEFINE_BOOL
-		execScript((prefix+"/lib/yade" SUFFIX "/gui/PythonUI_rc.py").c_str());
+		int ret=execScript((prefix+"/lib/yade" SUFFIX "/gui/PythonUI_rc.py").c_str());
+		if(ret!=0){ LOG_FATAL("Error executing PythonUI_rc.py, aborting! Please report bug."); abort(); }
 	PyGILState_Release(pyState);
 }
 

=== modified file 'gui/py/PythonUI.hpp'
--- gui/py/PythonUI.hpp	2009-08-05 09:09:52 +0000
+++ gui/py/PythonUI.hpp	2009-08-20 09:38:22 +0000
@@ -7,7 +7,7 @@
 {
 	private:
 		void help();
-		static void execScript(string);
+		static int execScript(string);
 		static struct termios tios,tios_orig;
 		static void termSetup();
 		static void termRestore();

=== modified file 'gui/qt3/QtGUI-python.cpp'
--- gui/qt3/QtGUI-python.cpp	2009-08-05 09:09:52 +0000
+++ gui/qt3/QtGUI-python.cpp	2009-08-20 09:38:22 +0000
@@ -9,7 +9,7 @@
 
 #include<cstdio>
 
-#ifdef LOG4CXX
+#ifdef YADE_LOG4CXX
 log4cxx::LoggerPtr logger=log4cxx::Logger::getLogger("yade.QtGUI-python");
 #endif
 

=== modified file 'lib/base/Logging.hpp'
--- lib/base/Logging.hpp	2009-03-03 09:07:53 +0000
+++ lib/base/Logging.hpp	2009-08-20 09:38:22 +0000
@@ -10,7 +10,7 @@
  * Some other macros will be very likely added, to allow for easy variable tracing etc. Suggestions welcome.
  *
  * All of user macros should come in 2 flavors, depending on whether we use log4cxx or not (backward compatibility).
- * The default is not to use it, unless the preprocessor macro LOG4CXX is defined. In that case, you want to #include
+ * The default is not to use it, unless the preprocessor macro YADE_LOG4CXX is defined. In that case, you want to #include
  * yade-core/logging.h and link with log4cxx.
  *
  * TODO:
@@ -24,7 +24,7 @@
  *
  */
 
-#ifdef LOG4CXX
+#ifdef YADE_LOG4CXX
 
 #	include<log4cxx/logger.h>
 #	include<log4cxx/basicconfigurator.h>

=== modified file 'pkg/common/DataClass/VelocityBins.cpp'
--- pkg/common/DataClass/VelocityBins.cpp	2009-07-19 19:24:24 +0000
+++ pkg/common/DataClass/VelocityBins.cpp	2009-08-20 09:38:22 +0000
@@ -75,7 +75,7 @@
 		// LOG_TRACE("#"<<b->getId()<<": vel="<<sqrt(velSq)<<", bin "<<(int)newBin);
 		bins[newBin].nBodies+=1;
 	}
-	#ifdef LOG4CXX
+	#ifdef YADE_LOG4CXX
 		// if debugging output
 		if(logger->isDebugEnabled() && (rootBody->currentIteration-histLast>=histInterval || histLast<0)){
 			histLast=rootBody->currentIteration;

=== modified file 'py/_eudoxos.cpp'
--- py/_eudoxos.cpp	2009-07-28 05:23:39 +0000
+++ py/_eudoxos.cpp	2009-08-20 09:38:22 +0000
@@ -3,7 +3,7 @@
 #include<yade/extra/boost_python_len.hpp>
 using namespace boost::python;
 using namespace std;
-#ifdef LOG4CXX
+#ifdef YADE_LOG4CXX
 	log4cxx::LoggerPtr logger=log4cxx::Logger::getLogger("yade.eudoxos");
 #endif
 

=== modified file 'py/_packPredicates.cpp'
--- py/_packPredicates.cpp	2009-07-27 17:08:23 +0000
+++ py/_packPredicates.cpp	2009-08-20 09:38:22 +0000
@@ -9,7 +9,7 @@
 
 using namespace boost;
 using namespace std;
-#ifdef LOG4CXX
+#ifdef YADE_LOG4CXX
 	log4cxx::LoggerPtr logger=log4cxx::Logger::getLogger("yade.pack.predicates");
 #endif
 

=== modified file 'py/_utils.cpp'
--- py/_utils.cpp	2009-08-10 10:32:23 +0000
+++ py/_utils.cpp	2009-08-20 09:38:22 +0000
@@ -19,7 +19,7 @@
 
 using namespace boost::python;
 
-#ifdef LOG4CXX
+#ifdef YADE_LOG4CXX
 	log4cxx::LoggerPtr logger=log4cxx::Logger::getLogger("yade.utils");
 #endif
 

=== modified file 'py/log.cpp'
--- py/log.cpp	2009-07-07 10:54:14 +0000
+++ py/log.cpp	2009-08-20 09:38:22 +0000
@@ -4,7 +4,7 @@
 using namespace boost;
 enum{ll_TRACE,ll_DEBUG,ll_INFO,ll_WARN,ll_ERROR,ll_FATAL};
 
-#ifdef LOG4CXX
+#ifdef YADE_LOG4CXX
 	#include<log4cxx/logmanager.h>
 
 	void logSetLevel(std::string loggerName,int level){

=== modified file 'py/yadeWrapper/yadeWrapper.cpp'
--- py/yadeWrapper/yadeWrapper.cpp	2009-08-19 15:27:59 +0000
+++ py/yadeWrapper/yadeWrapper.cpp	2009-08-20 09:38:22 +0000
@@ -119,7 +119,7 @@
 
 */
 
-#ifdef LOG4CXX
+#ifdef YADE_LOG4CXX
 	log4cxx::LoggerPtr logger=log4cxx::Logger::getLogger("yade.python");
 #endif
 

=== modified file 'scripts/pbuilder-test-distributions.sh'
--- scripts/pbuilder-test-distributions.sh	2009-08-19 14:06:32 +0000
+++ scripts/pbuilder-test-distributions.sh	2009-08-20 09:38:22 +0000
@@ -11,6 +11,9 @@
 dpkg-source -b -I trunk
 DSC=yade-`cat trunk/VERSION`_1.dsc
 for DIST in hardy jaunty karmic lenny squeeze; do
+	echo ======================================================================================================
+	echo ============================================= TESTING $DIST ==========================================
+	echo ======================================================================================================
 	BASETGZ=/var/cache/pbuilder/$DIST.tgz
 	sudo pbuilder --build --basetgz $BASETGZ --debbuildopts "-j5 -Zlzma" $DSC
 done

=== modified file 'scripts/regression-tests.py'
--- scripts/regression-tests.py	2009-08-05 07:32:18 +0000
+++ scripts/regression-tests.py	2009-08-20 09:38:22 +0000
@@ -3,7 +3,13 @@
 Exit status is 0 on success and nonzero on failure.
 """
 import yade.tests
-result=yade.tests.testAll()
+try:
+	result=yade.tests.testAll()
+except:
+	print "*********************** UNEXPECTED EXCEPTION WHILE RUNNING TESTS ******************"
+	print "****************** please report bug"
+	print "******************",sys.exc_info()[0]
+	sys.exit(2)
 if result.wasSuccessful():
 	print "*** ALL TESTS PASSED ***"
 else: