From: <sv...@ww...> - 2006-04-08 21:12:52
|
Author: mkrose Date: 2006-04-08 14:12:45 -0700 (Sat, 08 Apr 2006) New Revision: 1884 Modified: trunk/csp/bin/sim.ini trunk/csp/demo/win/makedemo.py trunk/csp/demo/win/template/COPYING Log: Patch makedemo.py to work with the latest code and directory layout. Update copyright notices in the demo COPYING file and add notices for new third-party dependencies. Set the default logging level to 2 (WARNING). Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1884 Modified: trunk/csp/bin/sim.ini =================================================================== --- trunk/csp/bin/sim.ini 2006-04-08 21:10:34 UTC (rev 1883) +++ trunk/csp/bin/sim.ini 2006-04-08 21:12:45 UTC (rev 1884) @@ -1,7 +1,7 @@ ; CSP configuration settings [Debug] -LoggingLevel = 0 +LoggingLevel = 2 Battlefield = 1 Demeter = true @@ -57,5 +57,3 @@ IncomingBandwidth = 20000 OutgoingBandwidth = 20000 -[Modules] -StandardModules = ../modules/demeter/.bin/libdemeter.so Modified: trunk/csp/demo/win/makedemo.py =================================================================== --- trunk/csp/demo/win/makedemo.py 2006-04-08 21:10:34 UTC (rev 1883) +++ trunk/csp/demo/win/makedemo.py 2006-04-08 21:12:45 UTC (rev 1884) @@ -6,7 +6,12 @@ import os.path import re import time +from glob import glob +def error(msg): + print >>sys.stderr, msg + sys.exit(1) + USAGE = """\ CSPSim demo generation script. @@ -24,40 +29,53 @@ # redirect csp log output if not otherwise specified. os.environ.setdefault('CSPLOG_FILE', 'makedemo.log') -import csp -import csp.csplib -import csp.cspsim +# ensure that the devpack binaries are found first in case the +# PATH is not set properly. +CSPDEVPACK = os.environ.get('CSPDEVPACK') +if CSPDEVPACK: + CSPDEVPACK_BIN = os.path.join(CSPDEVPACK, 'bin') + PATH = os.environ.get('PATH', '') + if PATH.split(os.pathsep)[0] != CSPDEVPACK_BIN: + print >>sys.stderr, 'WARNING: placing %s at start of PATH' % CSPDEVPACK_BIN + os.environ['PATH'] = '%s;%s' % (CSPDEVPACK, os.environ.get('PATH', '')) +try: + import csp + import csp.csplib + import csp.cspsim +except ImportError, e: + error('ERROR: unable to import csp packages. %s\nHave you built everything?' % e) + BASE = os.path.dirname(csp.__file__) DATA = os.path.join(BASE, 'data') BIN = os.path.join(BASE, 'bin') -# not sure which if any of these and the AddPackagePath statements below are -# needed for the new directory structure. some experimentation will probably -# be necessary. +CSPSIM_BIN = os.path.join(BASE, 'cspsim', '.bin') +CSPLIB_BIN = os.path.join(BASE, 'csplib', '.bin') -#CSPLIB = os.path.join(BASE, 'csplib') -#CSPSIM_BIN = os.path.join(BASE, 'cspsim', '.bin') -#sys.path.append(CSPSIM_BIN) - try: import modulefinder - #modulefinder.AddPackagePath('csp.cspsim', BIN) - #modulefinder.AddPackagePath('csp.cspsim', CSPSIM_BIN) - #modulefinder.AddPackagePath('csp', CSPLIB) -except ImportError: - print 'WARNING: unable to import modulefinder' +except ImportError, e: + error('ERROR: unable to import modulefinder %s' % e) +# modulefinder needs a bit of help to deal with the .bin __path__ +# redirections in csp.csplib and csp.cspsim. +modulefinder.AddPackagePath('csp.cspsim', CSPSIM_BIN) +modulefinder.AddPackagePath('csp.csplib', CSPLIB_BIN) +# in addition to the package paths, sys.path needs to be tweaked +# so that modulefinder can import the swig extensions in .bin. +sys.path.append(CSPLIB_BIN) +sys.path.append(CSPSIM_BIN) + from distutils.core import setup -import py2exe +try: + import py2exe +except ImportError, e: + error('ERROR: unable to import py2exe. %s\nIs it installed?' % e) -def error(msg): - print >>sys.stderr, msg - sys.exit(1) - def copy_tree(src, dst, symlinks=0, exclude=None): """Just like shutil.copytree, but allows files to be excluded based on a regexp.""" if isinstance(exclude, str): exclude = re.compile(exclude) @@ -82,6 +100,7 @@ raise Error, errors +# TODO force msvcrt80.dll and msvcrp80.dll to be included? def make_demo(version): TEMPLATE = 'template' DEMO = 'cspsim-demo-%s' % version @@ -92,16 +111,24 @@ if os.path.exists(DEMO): error('%s already exists! Aborting.' % DEMO) + CSPDEVPACK = os.environ.get('CSPDEVPACK') + if CSPDEVPACK is None: + error('CSPDEVPACK environment variable is not set') + DP_BIN = os.path.join(CSPDEVPACK, 'bin') + print 'Copying data from %s to %s' % (TEMPLATE, DEMO) copy_tree(TEMPLATE, DEMO, exclude=r'^\.svn$') DIST_DIR = os.path.join(DEMO, 'bin') print 'Running py2exe to create %s' % DIST_DIR + TEST_OBJECTS = os.path.join(BIN, 'test_objects.py') + opts = { 'py2exe': { 'excludes': ['dl'], - 'dist_dir': DIST_DIR + 'dist_dir': DIST_DIR, + 'packages': ['encodings'], } } @@ -110,6 +137,17 @@ setup(options=opts, console=[TARGET], data_files=[CONFIG]) + # not all dependencies can be found by py2exe, so ensure that all + # dlls in the devpack are copied. same for csp modules. + DEVPACK_DLLS = glob(os.path.join(DP_BIN, '*.dll')) + print os.path.join(BASE, 'modules', '*', '.bin', '*.dll') + MODULES = glob(os.path.join(BASE, 'modules', '*', '.bin', '*.dll')) + for src in MODULES + DEVPACK_DLLS: + dest = os.path.join(DIST_DIR, os.path.basename(src)) + if not os.path.exists(dest) or os.path.getmtime(dest) < os.path.getmtime(src): + print 'Copying', src + shutil.copy2(src, DIST_DIR) + DATA_TARGET = os.path.join(DEMO, 'data') if not os.path.exists(DATA_TARGET): print 'Copying data from %s to %s' % (DATA, DATA_TARGET) Modified: trunk/csp/demo/win/template/COPYING =================================================================== --- trunk/csp/demo/win/template/COPYING 2006-04-08 21:10:34 UTC (rev 1883) +++ trunk/csp/demo/win/template/COPYING 2006-04-08 21:12:45 UTC (rev 1884) @@ -6,13 +6,13 @@ on the forums at http://csp.sf.net/forum. CSPSim -Copyright 2002-2005 The Combat Simulator Project +Copyright 2002-2006 The Combat Simulator Project Licensed under the terms of the GNU General Public License version 2 or later. http://csp.sf.net/forum -SimData -Copyright 2002-2005 Mark Rose <mk...@us...> +CSPLib (formerly SimData) +Copyright 2002-2006 Mark Rose <mk...@us...> Licensed under the terms of the GNU General Public License version 2 or later. http://csp.sf.net/forum @@ -68,11 +68,18 @@ http://www.gnu.org/software/commoncpp/ LibSigC++ -Copyright 2002, The libsigc++ Development Team +Copyright 2002, the libsigc++ Development Team Licensed under the terms of the GNU Library General Public License version 2 or later. http://libsigc.sourceforge.net/ +FreeType +Copyright 2001, 2002, 2003, 2004, 2006, David Turner, Robert Wilhelm, and +Werner Lemberg. +Licensed under the terms of the GNU General Public License version 2 or +later. +http://savannah.nongnu.org/projects/freetype + zlib Copyright 1995-1998 Jean-loup Gailly and Mark Adler See LICENSES/zlib @@ -88,3 +95,31 @@ See LICENSES/libpng for the license. http://libpng.sourceforge.net/ +libogg +Copyright 2002 Xiph.Org Foundation +See LICENSES/xiph +http://www.xiph.org/ + +libvorbis +Copyright 2002-2004 Xiph.Org Foundation +See LICENSES/xiph +http://www.xiph.org/ + +openal +Copyright 1999-2000 various authors (see LICENSES/openal) +Licensed under the terms of the GNU Library General Public License version +2 or later. +http://www.openal.org + +openal++ +Copyright 2002 VRlab, Umeniversity +Licensed under the terms of the GNU Library General Public License version +2.1 or later. +http://alpp.sourceforge.net + +osgAL +Copyright 2004 VRlab, Umeniversity +Licensed under the terms of the GNU Library General Public License version +2.1 or later. +http://www.vrlab.umu.se/research/osgAL/ + |