|
[Rivet-svn] r4246 - trunk/docblackhole at projects.hepforge.org blackhole at projects.hepforge.orgFri Apr 5 10:46:05 BST 2013
Author: buckley Date: Fri Apr 5 10:46:05 2013 New Revision: 4246 Log: Tidying/improving the doc builder tricks needed to load the Rivet Python module before it's been installed Modified: trunk/doc/mk-analysis-html trunk/doc/mk-analysis-latex Modified: trunk/doc/mk-analysis-html ============================================================================== --- trunk/doc/mk-analysis-html Fri Apr 5 10:14:34 2013 (r4245) +++ trunk/doc/mk-analysis-html Fri Apr 5 10:46:05 2013 (r4246) @@ -12,34 +12,23 @@ ## Get input paths to allow rivet module to be imported from the src dir import os, re, glob +## Add the rivet Python module build dir(s) to the Python module path pybuild = os.path.abspath(os.path.join(os.getcwd(), "..", "pyext", "build")) -dirs = [] +pydirs = [] for d in os.listdir(pybuild): if re.match(r"lib\..*-.*-%d\.%d" % (sys.version_info[0], sys.version_info[1]), d): - dirs.append(os.path.join(pybuild, d)) -sys.path = dirs + sys.path -try: - os.environ["LD_LIBRARY_PATH"] = os.environ["LD_LIBRARY_PATH"] + ":" + \ - os.path.abspath(os.path.join(os.getcwd(), "..", "src", ".libs")) -except: - pass -try: - os.environ["DYLD_LIBRARY_PATH"] = os.environ["DYLD_LIBRARY_PATH"] + ":" + \ - os.path.abspath(os.path.join(os.getcwd(), "..", "src", ".libs")) -except: - pass + pydirs.append(os.path.join(pybuild, d)) +sys.path = pydirs + sys.path +## Set up libRivet directory in shared lib runtime search paths +libpath = os.path.abspath(os.path.join(os.getcwd(), "..", "src", ".libs")) +if os.environ.has_key("LD_LIBRARY_PATH"): + os.environ["LD_LIBRARY_PATH"] = os.environ["LD_LIBRARY_PATH"] + ":" + libpath +if os.environ.has_key("DYLD_LIBRARY_PATH"): + os.environ["DYLD_LIBRARY_PATH"] = os.environ["DYLD_LIBRARY_PATH"] + ":" + libpath +## Set up analysis plugin directory anadirs = glob.glob(os.path.join(os.getcwd(), "..", "src", "Analyses", ".libs")) -#print anadirs os.environ["RIVET_ANALYSIS_PATH"] = ":".join(anadirs) - - -## Change dlopen status to GLOBAL for Rivet lib -try: - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) -except: - import dl - sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL) +## Finally do the rivet module import! import rivet Modified: trunk/doc/mk-analysis-latex ============================================================================== --- trunk/doc/mk-analysis-latex Fri Apr 5 10:14:34 2013 (r4245) +++ trunk/doc/mk-analysis-latex Fri Apr 5 10:46:05 2013 (r4246) @@ -12,24 +12,24 @@ ## Get input paths to allow rivet module to be imported from the src dir import os, re, glob +## Add the rivet Python module build dir(s) to the Python module path pybuild = os.path.abspath(os.path.join(os.getcwd(), "..", "pyext", "build")) -dirs = [] +pydirs = [] for d in os.listdir(pybuild): if re.match(r"lib\..*-.*-%d\.%d" % (sys.version_info[0], sys.version_info[1]), d): - dirs.append(os.path.join(pybuild, d)) -sys.path = dirs + sys.path -try: - os.environ["LD_LIBRARY_PATH"] = os.environ["LD_LIBRARY_PATH"] + ":" + \ - os.path.abspath(os.path.join(os.getcwd(), "..", "src", ".libs")) -except: - pass -try: - os.environ["DYLD_LIBRARY_PATH"] = os.environ["DYLD_LIBRARY_PATH"] + ":" + \ - os.path.abspath(os.path.join(os.getcwd(), "..", "src", ".libs")) -except: - pass + pydirs.append(os.path.join(pybuild, d)) +sys.path = pydirs + sys.path +## Set up libRivet directory in shared lib runtime search paths +libpath = os.path.abspath(os.path.join(os.getcwd(), "..", "src", ".libs")) +if os.environ.has_key("LD_LIBRARY_PATH"): + os.environ["LD_LIBRARY_PATH"] = os.environ["LD_LIBRARY_PATH"] + ":" + libpath +if os.environ.has_key("DYLD_LIBRARY_PATH"): + os.environ["DYLD_LIBRARY_PATH"] = os.environ["DYLD_LIBRARY_PATH"] + ":" + libpath +## Set up analysis plugin directory anadirs = glob.glob(os.path.join(os.getcwd(), "..", "src", "Analyses", ".libs")) os.environ["RIVET_ANALYSIS_PATH"] = ":".join(anadirs) +## Finally do the rivet module import! +import rivet def texify(s): @@ -52,7 +52,6 @@ ## Build analysis pages -import rivet all_analyses = rivet.AnalysisLoader.analysisNames() pages = { "LEP and SLC":[], "Tevatron":[], "LHC":[], "SPS":[], "HERA":[], "RHIC":[], "Monte Carlo":[], "Example":[], "Misc.":[] } ## Use list(...) ctor for 2.3 compatibility
More information about the Rivet-svn mailing list |