|
[Rivet-svn] r2546 - in trunk: . bin doc pyext pyext/rivetblackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon Jun 28 15:18:26 BST 2010
Author: buckley Date: Mon Jun 28 15:18:28 2010 New Revision: 2546 Log: Converting rivet Python module to be a package, with the dlopen flag setting etc. done around the SWIG generated core wrapper module (rivet.rivetwrap). Plus updating version number to 1.2.2 in anticipation of release. Added: trunk/pyext/rivet/ (props changed) trunk/pyext/rivet/Makefile.am - copied, changed from r2543, trunk/pyext/Makefile.am trunk/pyext/rivet/__init__.py trunk/pyext/rivet/rivetwrap.i - copied, changed from r2545, trunk/pyext/rivet.i Deleted: trunk/pyext/rivet.i Modified: trunk/ChangeLog trunk/bin/rivet trunk/bin/rivet-mkhtml trunk/configure.ac trunk/doc/mk-analysis-html trunk/doc/mk-analysis-latex trunk/pyext/ (props changed) trunk/pyext/Makefile.am trunk/pyext/setup.py.in Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Mon Jun 28 14:01:40 2010 (r2545) +++ trunk/ChangeLog Mon Jun 28 15:18:28 2010 (r2546) @@ -1,3 +1,16 @@ +2010-06-28 Andy Buckley <andy at insectnation.org> + + * Rivet 1.2.2 release. + + * Converting rivet Python module to be a package, with the dlopen + flag setting etc. done around the SWIG generated core wrapper + module (rivet.rivetwrap). + + * Requiring Python >= 2.4.0 in rivet scripts (and adding a Python + version checker function to rivet module) + + * Adding --epspng option to make-plots (and converting to use subprocess.Popen). + 2010-06-27 Andy Buckley <andy at insectnation.org> * Converting JADE_OPAL analysis to use the fastjet Modified: trunk/bin/rivet ============================================================================== --- trunk/bin/rivet Mon Jun 28 14:01:40 2010 (r2545) +++ trunk/bin/rivet Mon Jun 28 15:18:28 2010 (r2546) @@ -25,17 +25,6 @@ import os, time import logging, signal -from optparse import OptionParser, OptionGroup - - -## Change dlopen status to GLOBAL for Rivet lib -## TODO: Push this into rivet.py -try: - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) -except: - import dl - sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL) ## Try to rename the process on Linux try: @@ -79,6 +68,7 @@ ## Parse command line options +from optparse import OptionParser, OptionGroup parser = OptionParser(usage=__doc__, version="rivet v%s" % rivet.version()) parser.add_option("-n", "--nevts", dest="MAXEVTNUM", type="int", default=None, metavar="NUM", Modified: trunk/bin/rivet-mkhtml ============================================================================== --- trunk/bin/rivet-mkhtml Mon Jun 28 14:01:40 2010 (r2545) +++ trunk/bin/rivet-mkhtml Mon Jun 28 15:18:28 2010 (r2546) @@ -138,12 +138,6 @@ </style>""" import sys -try: - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) -except: - import dl - sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL) rivetavailable = True try: import rivet Modified: trunk/configure.ac ============================================================================== --- trunk/configure.ac Mon Jun 28 14:01:40 2010 (r2545) +++ trunk/configure.ac Mon Jun 28 15:18:28 2010 (r2546) @@ -1,7 +1,7 @@ ## Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([Rivet],[1.2.2a],[rivet at projects.hepforge.org],[Rivet]) +AC_INIT([Rivet],[1.2.2],[rivet at projects.hepforge.org],[Rivet]) AC_CONFIG_SRCDIR([src/Core/Analysis.cc]) AC_CONFIG_HEADERS([include/Rivet/Config/DummyConfig.hh include/Rivet/Config/RivetConfig.hh include/Rivet/Config/BuildOptions.hh]) AM_INIT_AUTOMAKE(dist-bzip2) @@ -295,8 +295,7 @@ AC_CONFIG_FILES(src/Projections/Makefile) AC_CONFIG_FILES(src/Analyses/Makefile) AC_CONFIG_FILES(test/Makefile) -AC_CONFIG_FILES(pyext/Makefile) -AC_CONFIG_FILES(pyext/setup.py) +AC_CONFIG_FILES(pyext/Makefile pyext/rivet/Makefile pyext/setup.py) AC_CONFIG_FILES(data/Makefile data/refdata/Makefile data/anainfo/Makefile data/plotinfo/Makefile data/texmf/Makefile) AC_CONFIG_FILES(doc/Makefile) AC_CONFIG_FILES(doc/rivetversion.sty) Modified: trunk/doc/mk-analysis-html ============================================================================== --- trunk/doc/mk-analysis-html Mon Jun 28 14:01:40 2010 (r2545) +++ trunk/doc/mk-analysis-html Mon Jun 28 15:18:28 2010 (r2546) @@ -9,20 +9,6 @@ else: OUTFILE = sys.argv[1] -## Make "set" a builtin type on Python < 2.4 -try: - tmp = set() - del tmp -except: - from sets import Set as set - -## Make "sorted" a builtin function on Python < 2.4 -if not 'sorted' in dir(__builtins__): - def sorted(iterable, cmp=None, key=None, reverse=None): - rtn = iterable - rtn.sort(cmp)#, key, reverse) - return rtn - ## Get input paths to allow rivet module to be imported from the src dir import os, re, glob Modified: trunk/doc/mk-analysis-latex ============================================================================== --- trunk/doc/mk-analysis-latex Mon Jun 28 14:01:40 2010 (r2545) +++ trunk/doc/mk-analysis-latex Mon Jun 28 15:18:28 2010 (r2546) @@ -10,21 +10,6 @@ OUTNAME = sys.argv[1] -## Make "set" a builtin type on Python < 2.4 -try: - tmp = set() - del tmp -except: - from sets import Set as set - -## Make "sorted" a builtin function on Python < 2.4 -if not 'sorted' in dir(__builtins__): - def sorted(iterable, cmp=None, key=None, reverse=None): - rtn = iterable - rtn.sort(cmp)#, key, reverse) - return rtn - - ## Get input paths to allow rivet module to be imported from the src dir import os, re, glob pybuild = os.path.abspath(os.path.join(os.getcwd(), "..", "pyext", "build")) Modified: trunk/pyext/Makefile.am ============================================================================== --- trunk/pyext/Makefile.am Mon Jun 28 14:01:40 2010 (r2545) +++ trunk/pyext/Makefile.am Mon Jun 28 15:18:28 2010 (r2546) @@ -1,27 +1,25 @@ -EXTRA_DIST = rivet.i ez_setup.py lighthisto.py spiresbib.py - -rivet_wrap.cc rivet.py: rivet.i - $(SWIG) -c++ -python -I$(top_srcdir)/include -o rivet_wrap.cc $<; +EXTRA_DIST = ez_setup.py lighthisto.py spiresbib.py if ENABLE_PYEXT -all-local: rivet_wrap.cc +SUBDIRS = rivet . + +all-local: rivet/rivetwrap_wrap.cc $(PYTHON) setup.py build install-exec-local: $(PYTHON) setup.py install --prefix=$(DESTDIR)$(prefix) uninstall-local: - rm -rf $(DESTDIR)$(prefix)/lib*/python*/site-packages/*rivet* + rm -rf $(DESTDIR)$(prefix)/lib*/python*/site-packages/rivet rm -rf $(DESTDIR)$(prefix)/lib*/python*/site-packages/lighthisto.py* + rm -rf $(DESTDIR)$(prefix)/lib*/python*/site-packages/spiresbib.py* clean-local: $(PYTHON) setup.py clean --all @rm -f $(top_builddir)/*.pyc @rm -rf $(builddir)/build @rm -rf dist - @rm -f rivet.py - @rm -f rivet_wrap.cc distclean-local: @rm -rf rivet.egg-info Copied and modified: trunk/pyext/rivet/Makefile.am (from r2543, trunk/pyext/Makefile.am) ============================================================================== --- trunk/pyext/Makefile.am Mon Jun 28 10:19:50 2010 (r2543, copy source) +++ trunk/pyext/rivet/Makefile.am Mon Jun 28 15:18:28 2010 (r2546) @@ -1,29 +1,12 @@ -EXTRA_DIST = rivet.i ez_setup.py lighthisto.py spiresbib.py +EXTRA_DIST = __init__.py rivetwrap.i -rivet_wrap.cc rivet.py: rivet.i - $(SWIG) -c++ -python -I$(top_srcdir)/include -o rivet_wrap.cc $<; +all-local: rivetwrap_wrap.cc rivetwrap.py + @true -if ENABLE_PYEXT - -all-local: rivet_wrap.cc - $(PYTHON) setup.py build - -install-exec-local: - $(PYTHON) setup.py install --prefix=$(DESTDIR)$(prefix) - -uninstall-local: - rm -rf $(DESTDIR)$(prefix)/lib*/python*/site-packages/*rivet* - rm -rf $(DESTDIR)$(prefix)/lib*/python*/site-packages/lighthisto.py* +rivetwrap_wrap.cc rivetwrap.py: rivetwrap.i + $(SWIG) -c++ -python -I$(top_srcdir)/include -o rivetwrap_wrap.cc $< clean-local: - $(PYTHON) setup.py clean --all - @rm -f $(top_builddir)/*.pyc - @rm -rf $(builddir)/build - @rm -rf dist - @rm -f rivet.py - @rm -f rivet_wrap.cc - -distclean-local: - @rm -rf rivet.egg-info - -endif + @rm -f *.pyc + @rm -f rivetwrap.py + @rm -f rivetwrap_wrap.cc Added: trunk/pyext/rivet/__init__.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/pyext/rivet/__init__.py Mon Jun 28 15:18:28 2010 (r2546) @@ -0,0 +1,24 @@ +"Python interface to the Rivet MC validation system" + +## Change dlopen status to GLOBAL for Rivet lib +import sys +try: + import ctypes + sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) + del ctypes +except: + import dl + sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL) + del dl +del sys + +## Import SWIG-generated wrapper core +from rivetwrap import * + +## Provide an extra Python-only function used to enforce the Rivet scripts' minimal Python version +def check_python_version(): + import sys + req_version = (2,4,0) + if sys.version_info[:3] < req_version: + print "rivet scripts require Python version >= %s... exiting" % ".".join(req_version) + sys.exit(1) Copied and modified: trunk/pyext/rivet/rivetwrap.i (from r2545, trunk/pyext/rivet.i) ============================================================================== --- trunk/pyext/rivet.i Mon Jun 28 14:01:40 2010 (r2545, copy source) +++ trunk/pyext/rivet/rivetwrap.i Mon Jun 28 15:18:28 2010 (r2546) @@ -1,4 +1,4 @@ -%module rivet +%module rivetwrap %{ #define SWIG_FILE_WITH_INIT @@ -143,14 +143,3 @@ } %include "Rivet/Run.hh" - - -// Provide an extra Python-only function used to enforce the Rivet scripts' minimal Python version -%pythoncode %{ -def check_python_version(): - import sys - req_version = (2,4,0) - if sys.version_info[:3] < req_version: - print "rivet scripts require Python version >= %s... exiting" % ".".join(req_version) - sys.exit(1) -%} Modified: trunk/pyext/setup.py.in ============================================================================== --- trunk/pyext/setup.py.in Mon Jun 28 14:01:40 2010 (r2545) +++ trunk/pyext/setup.py.in Mon Jun 28 15:18:28 2010 (r2546) @@ -12,8 +12,8 @@ import os incdir = os.path.abspath('@top_srcdir@/include') srcdir = os.path.abspath('@top_srcdir@/src') -ext = Extension('_rivet', - ['@srcdir@/rivet_wrap.cc'], +ext = Extension('_rivetwrap', + ['@srcdir@/rivet/rivetwrap_wrap.cc'], define_macros = [("SWIG_TYPE_TABLE", "hepmccompat")], #include_dirs=[incdir, os.path.join(incdir, 'eigen2'), '@HEPMCINCPATH@', '@BOOSTINCPATH@', '@GSLINCPATH@'], include_dirs=[incdir, '@HEPMCINCPATH@', '@BOOSTINCPATH@', '@GSLINCPATH@'], @@ -22,10 +22,11 @@ libraries=['HepMC', 'Rivet']) ## Setup definition -setup(name = 'rivet', +setup(name = 'Rivet', version = '@PACKAGE_VERSION@', + ext_package='rivet', ext_modules=[ext], - py_modules = ['rivet', 'lighthisto', 'spiresbib'], + py_modules = ['lighthisto', 'spiresbib'], author = ['Andy Buckley'], author_email = 'andy at insectnation.org', url = 'http://projects.hepforge.org/rivet/',
More information about the Rivet-svn mailing list |