summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Bock <nicolasbock@gentoo.org>2013-12-13 19:51:39 +0000
committerNicolas Bock <nicolasbock@gentoo.org>2013-12-13 19:51:39 +0000
commit43f68bed7e13d0c7c41c54f815252d4781d8972e (patch)
treedbb4fd762f40ca153a6409bded679cc032dc6ea8 /sys-cluster/charm
parentSync up 9999 ebuilds with changes to 2.1.1. (diff)
downloadhistorical-43f68bed7e13d0c7c41c54f815252d4781d8972e.tar.gz
historical-43f68bed7e13d0c7c41c54f815252d4781d8972e.tar.bz2
historical-43f68bed7e13d0c7c41c54f815252d4781d8972e.zip
sys-cluster/charm: Adding charm-6.5.1-r3 from sci overlay.
Package-Manager: portage-2.2.7/cvs/Linux x86_64 Manifest-Sign-Key: 0xAC91CA52
Diffstat (limited to 'sys-cluster/charm')
-rw-r--r--sys-cluster/charm/ChangeLog8
-rw-r--r--sys-cluster/charm/Manifest10
-rw-r--r--sys-cluster/charm/charm-6.5.1-r3.ebuild204
-rw-r--r--sys-cluster/charm/files/charm-6.5.1-fix-markupSanitizer.patch203
4 files changed, 420 insertions, 5 deletions
diff --git a/sys-cluster/charm/ChangeLog b/sys-cluster/charm/ChangeLog
index ea9897f8b987..51269dafcbfd 100644
--- a/sys-cluster/charm/ChangeLog
+++ b/sys-cluster/charm/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-cluster/charm
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-cluster/charm/ChangeLog,v 1.38 2013/12/13 19:41:26 nicolasbock Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/charm/ChangeLog,v 1.39 2013/12/13 19:51:35 nicolasbock Exp $
+
+*charm-6.5.1-r3 (13 Dec 2013)
+
+ 13 Dec 2013; Nicolas Bock <nicolasbock@gentoo.org> +charm-6.5.1-r3.ebuild,
+ +files/charm-6.5.1-fix-markupSanitizer.patch:
+ sys-cluster/charm: Adding charm-6.5.1-r3 from sci overlay.
13 Dec 2013; Nicolas Bock <nicolasbock@gentoo.org> metadata.xml:
sys-cluster/charm: Updated maintainer email to gentoo.org
diff --git a/sys-cluster/charm/Manifest b/sys-cluster/charm/Manifest
index d38ea9cd72df..cf199dd79f95 100644
--- a/sys-cluster/charm/Manifest
+++ b/sys-cluster/charm/Manifest
@@ -4,18 +4,20 @@ Hash: SHA256
AUX charm-6.5.1-CkReductionMgr.patch 1441 SHA256 35ecf0d8727004cec2fe26ea04764ef6d923d589e63fbc5f77fc9c858c72d7e8 SHA512 133a7a7d78c50f7966425f8a0f66cc22916a72de247c641fbd65f9e823a9f4044b9946bbd7e175cafde2b5d536820e2a65cd75afb593c65f11f1d7814c6c2dff WHIRLPOOL 1bd758ef9e68ff0427414304d9d4bdc004357e79c87b38bc54443a76d2527ac96d24bfa8e6a3bda033888ca984124402fc373a64c7b7ba9bf0ddd23d4eecbab5
AUX charm-6.5.1-charmc-gentoo.patch 1305 SHA256 b1fbf52d856805101487d0cb20f3ebd36f2ae8123422e7a014cbc5fbaddc8327 SHA512 994becbf0e40c0e181222a854df98e3c7b571b517a24a0548ad323ac116f146f11b7d2e6ec4f8289ffb5926dda57d92831412e9367951387d1e224208306ed03 WHIRLPOOL 3fdae548a9d0ad0672d08a2a15711dd07da6e1c350ac7a2d95a9858b815cbff55a7e3767f957923dd9eee243c310553f35101f229eb9ac4f048165f28dc52dc5
AUX charm-6.5.1-cleanup-config.patch 1982 SHA256 b8f11377869671705694cd940767cc44981af66df9cdb9f12c4a5d5c1d1b6710 SHA512 fb8817b3a3593ff34665a3d1a31dc2f286ad4fbd81b36a136391c6a75129bc7e93707f794805c90d07119a67d937ace2d1ce1955bd940048ba5cd2282bcb08e9 WHIRLPOOL d05bc8663be87d9191e1fe6c5ad5954298d59c9746846d1b41d47e263cf47a99349f2ca258301dac8793f1305b0bc46e7855aeb8510d5ece960a677de01e4a71
+AUX charm-6.5.1-fix-markupSanitizer.patch 6439 SHA256 8408aa89e59e72fae02179e738a924240a6a89b9eb162ebb746bb54e16be496f SHA512 fb1061dcd6af95cf147e84a7d49d32be03ac8a23378387dec5f340064b8db5b0531fa105c9745bdc9ec947b59f3384a3c878298f0380f9a12c79329c203b81f2 WHIRLPOOL 8da747d32bc891db2bd224fc1456d69a66913c36083fab6c5770f7a636252a29119deeb0142b1030a612ac251d38d635e435a771e6bb1abbbeb0a3e1b56b3c29
AUX charm-6.5.1-fix-navmenuGenerator.patch 856 SHA256 ca39bcc048f91b66dfff009744320c231ec98e12b67f4645ee3407b4210d1c53 SHA512 c71d8a4113b494a0a0285cfeba197475ba706e00f002eb6d164df4a8ac587a6d259609b8090a1587397f10cc70d89365a6a6a660a4f14876968225acdbbf0db2 WHIRLPOOL efaaa2e88329a4515642331a99da0975fc7c1c9dfdc594c8b5d039c5e9b8d391dbc9ddceffae9a1e665f6d8429b194d533dc0927577801a2d23a1ea1861d2d66
AUX charm-6.5.1-fix-string-parsing.patch 1658 SHA256 e6223fbb97685715ee9e1f02bb5a11cb98957046e7a73a2e2264c650b43fcb1b SHA512 81f84aa219c2e709cac252245ab43cde23a10ddd8f1c9717c77d32f1e62a88c1872452ac91d9dfb83f6a87570e9814272952acef7ac7b7264793115455e5a87e WHIRLPOOL 1858cbe6bd5d8765757b0ccf5343248b0d874d67857f01d3ec137c145aef685749dd82e3337f9d2cd81f3d00c78c9c661faa228a6ad5588942e6ef744fa3aeee
AUX charm-6.5.1-static-library-fix.patch 17080 SHA256 1cebaeb901c88a4f35a148fd51ce0c3e8050946f46b25575adad56c44296c99e SHA512 8209a8af4e316a5b961500e70450a87db2ceea9dd409cb73cdf8133dc4ba53e1bb73dfa7a2fd1c819f9a0d37b1ee9760bdda181aa73e2e5fe370d53e12cec82a WHIRLPOOL a782704014012fcfe7b28ce01514846d390c34ceadf64ef27eeb3e8e724aaf490c88ac0d8f093f3d1c8628769a58d7844849ba2587ed0288a733aac17bf40b12
DIST charm-6.5.1.tar.gz 19265741 SHA256 68aa43e2a6e476e116a7e80e385c25c6ac6497807348025505ba8bfa256ed34a SHA512 1a25c76f3699e30d0614e85f39ea0f594896cbc299b0e670c52fcea176171e8834ea7f9ba3ba0c1957598b0f1cbfa6a4ed9279ae0c030fa32faa6acca879b694 WHIRLPOOL 0def514af09c137b951842250fe112c68e573e8eff7d5911a71ccbe55cc38b319f1d9c4587e706777f748b0c1ef69b63c4161bbf663b05984a566ff325fa49c3
EBUILD charm-6.5.1-r1.ebuild 5368 SHA256 07aeebc151441baa3aee6b3cddc6e36bf9ddaa516dc342c3478a6e95a3a17f7e SHA512 12d2afb4c88e900542e44d19c35fabe0502260e612b3da81fc60cca05ca3ddc652a1cce54960aa9a7bdd9b5f45986a13a2c911ae48307194f8f1ddaec845e218 WHIRLPOOL 1ecd4405bb5eaa962d1b3b56c32e8693cfd5ce06aa5874b07d9a89782f52313278fe61457b4a4f3c9a4a1122f02686ce0b3a72d68d8c67a7048024d606d0d9e1
EBUILD charm-6.5.1-r2.ebuild 5431 SHA256 e40245a09e9889a053fb4ebaaa9f6651218993af1c94ae3699e0cd0a15e74767 SHA512 d181c08a298d8733456facc532953c0f018e53a1a032da816e39d40a6a05a0ec4c8ec93dd7b5bbe197835dd36951708ccdeb4b9548e697dca349a75fbf7fc083 WHIRLPOOL 52a48f96bb73bcff41b3e27ff5f518ed573350b6821d1634e106788d49ffe2356a6e1621dca0787432359e034bbc7310e9e683e00669b7c57647f4599b284a9f
-MISC ChangeLog 6668 SHA256 3e22f81f6476379adf5582828293e05da84be4d63e487434ff59aa07fbab26b5 SHA512 fd0fd4c3bb75bf875bf10893081f78034eed1e3718a9db20729d38304a800f9724b09e17eb12e4241f7b0d0e6ceabfc990b904ea9369c3417c2d93586886861e WHIRLPOOL 3f13dec2498311715b9976be2d6ff898480516526e82fc16c2cc34aa9828012b18b10c6cbe4f87d7c9465372a544595c04aed1f84211d6c0401886481c3f7f54
+EBUILD charm-6.5.1-r3.ebuild 5301 SHA256 bff606507c6ebda5f13ee2681b71d93d60eba71706922a381cc2060cedb43aa5 SHA512 4f44c9c0603a936b81ef74ae5894df85be8fb543d84d5617aee364d741492ab5be42d4dc5ab18ba68663ce2292ad929a20b9136da038e383c3bde0cda539b5c7 WHIRLPOOL d0adbc9a33af9348da4c8936d526a9b239d2cbb104e919d925e0978e1fdc662ec8ec57d7415a66d4a7a0add3223bf2ea5396ea7bc48daa53e11d4260be21bf9d
+MISC ChangeLog 6886 SHA256 02e5d58241e4dd95df7447ccebc18f20435526a8c37d6f6a0928509a89484589 SHA512 23432abb3ffba4e0015be3dd511767b27510dc727ac1da80479c4453809d9e60b825885187ea6d488b1eafaf8079490ed0d18fb4bb3f6537672e989183eade0a WHIRLPOOL 3285cc2b32bc6ab1d028e5fad7c3f642b44737ed39f415cbd36fac78e636c5f24a9ace42d6cea247fdbbf5ae8d43d964f52aa5bb8dc793533c6089533e741ed6
MISC metadata.xml 801 SHA256 4f15971f2c242322338a8c9a08d45707ce56a9a8d09e4e83a5808dd0754d21e4 SHA512 570f95d5d7609b34529524f7932327d1b1a9a3734211a14696fa8156475cc7a0d61a9fcf81f2732acd8f8ae61f88504635bd4278c061fe9e2ee6b796e9860ad5 WHIRLPOOL 70592d90dd5c757e5ec748b809e4dba8acd1f2900a83d639bd0d2f17bf99f957153d5a7664a8950167dc5b89331c2ea2e462afb592c1de57acf083e2e86e2f42
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
-iEYEAREIAAYFAlKrYucACgkQf15tZKyRylK3XgCg8nehVfTXSTcI/SD7S7q/jQyr
-SJQAn20tp+rdnDB/VN0qhrZLJQHurthX
-=SoMx
+iEYEAREIAAYFAlKrZUoACgkQf15tZKyRylK+dwCfRGAzQCWN0Q4N7P1+UMWnlUNM
+AcMAnRwZgbWDS2HLO1RH49b3tLeEUaLD
+=oDVu
-----END PGP SIGNATURE-----
diff --git a/sys-cluster/charm/charm-6.5.1-r3.ebuild b/sys-cluster/charm/charm-6.5.1-r3.ebuild
new file mode 100644
index 000000000000..c17edc10fa37
--- /dev/null
+++ b/sys-cluster/charm/charm-6.5.1-r3.ebuild
@@ -0,0 +1,204 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/charm/charm-6.5.1-r3.ebuild,v 1.1 2013/12/13 19:51:35 nicolasbock Exp $
+
+EAPI=5
+
+inherit eutils flag-o-matic fortran-2 multilib toolchain-funcs
+
+DESCRIPTION="Message-passing parallel language and runtime system"
+HOMEPAGE="http://charm.cs.uiuc.edu/"
+SRC_URI="http://charm.cs.uiuc.edu/distrib/${P}.tar.gz"
+
+LICENSE="charm"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="charmdebug charmtracing charmproduction cmkopt doc examples mlogft mpi numa smp static-libs syncft tcp"
+
+RDEPEND="mpi? ( virtual/mpi )"
+DEPEND="
+ ${RDEPEND}
+ doc? (
+ >=app-text/poppler-0.12.3-r3[utils]
+ dev-tex/latex2html
+ virtual/tex-base
+ >=dev-python/beautifulsoup-4
+ dev-python/lxml
+ media-libs/netpbm
+ )"
+
+REQUIRED_USE="
+ doc? ( ${PYTHON_REQUIRED_USE} )
+ cmkopt? ( !charmdebug !charmtracing )
+ charmproduction? ( !charmdebug !charmtracing )"
+
+FORTRAN_STANDARD="90"
+
+get_opts() {
+ local CHARM_OPTS
+
+ # TCP instead of default UDP for socket comunication
+ # protocol
+ CHARM_OPTS+="$(usex tcp ' tcp' '')"
+
+ # enable direct SMP support using shared memory
+ CHARM_OPTS+="$(usex smp ' smp' '')"
+
+ CHARM_OPTS+="$(usex mlogft ' mlogft' '')"
+ CHARM_OPTS+="$(usex syncft ' syncft' '')"
+
+ # Build shared libraries by default.
+ CHARM_OPTS+=" --build-shared"
+
+ if use charmproduction; then
+ CHARM_OPTS+=" --with-production"
+ else
+ if use charmdebug; then
+ CHARM_OPTS+=" --enable-charmdebug"
+ fi
+
+ if use charmtracing; then
+ CHARM_OPTS+=" --enable-tracing --enable-tracing-commthread"
+ fi
+ fi
+
+ CHARM_OPTS+="$(usex numa ' --with-numa' '')"
+ echo $CHARM_OPTS
+}
+
+src_prepare() {
+ sed \
+ -e "/CMK_CF90/s:f90:$(usex mpi "mpif90" "$(tc-getFC)"):g" \
+ -e "/CMK_CXX/s:g++:$(usex mpi "mpic++" "$(tc-getCXX)"):g" \
+ -e "/CMK_CC/s:gcc:$(usex mpi "mpicc" "$(tc-getCC)"):g" \
+ -e '/CMK_F90_MODINC/s:-p:-I:g' \
+ -e "/CMK_LD/s:\"$: ${LDFLAGS} \":g" \
+ -i src/arch/$(usex mpi "mpi" "net")-linux*/*sh || die
+
+ sed \
+ -e "s:-o conv-cpm:${LDFLAGS} &:g" \
+ -e "s:-o charmxi:${LDFLAGS} &:g" \
+ -e "s:-o charmrun-silent:${LDFLAGS} &:g" \
+ -e "s:-o charmrun-notify:${LDFLAGS} &:g" \
+ -e "s:-o charmrun:${LDFLAGS} &:g" \
+ -e "s:-o charmd_faceless:${LDFLAGS} &:g" \
+ -e "s:-o charmd:${LDFLAGS} &:g" \
+ -i \
+ src/scripts/Makefile \
+ src/arch/net/charmrun/Makefile || die
+
+ # CMK optimization
+ use cmkopt && append-cppflags -DCMK_OPTIMIZE=1
+
+ # Fix QA notice. Filed report with upstream.
+ append-cflags -DALLOCA_H
+
+ epatch "${FILESDIR}/charm-6.5.1-cleanup-config.patch"
+ epatch "${FILESDIR}/charm-6.5.1-CkReductionMgr.patch"
+ epatch "${FILESDIR}/charm-6.5.1-fix-string-parsing.patch"
+ epatch "${FILESDIR}/charm-6.5.1-fix-navmenuGenerator.patch"
+ epatch "${FILESDIR}/charm-6.5.1-fix-markupSanitizer.patch"
+ epatch "${FILESDIR}/charm-6.5.1-static-library-fix.patch"
+}
+
+src_compile() {
+ local mybuildoptions="$(usex mpi "mpi" "net")-linux$(usex amd64 "-amd64" '') $(get_opts) ${MAKEOPTS} -j1 ${CFLAGS}"
+
+ # Build charmm++ first.
+ einfo "running ./build charm++ ${mybuildoptions}"
+ ./build charm++ ${mybuildoptions} || die "Failed to build charm++"
+
+ # make pdf/html docs
+ if use doc; then
+ emake -j1 -C doc/charm++
+ fi
+}
+
+src_test() {
+ make -C tests/charm++ test TESTOPTS="++local" || die
+}
+
+src_install() {
+ # Make charmc play well with gentoo before we move it into /usr/bin. This
+ # patch cannot be applied during src_prepare() because the charmc wrapper
+ # is used during building.
+ epatch "${FILESDIR}/charm-6.5.1-charmc-gentoo.patch"
+
+ sed -e "s|gentoo-include|${P}|" \
+ -e "s|gentoo-libdir|$(get_libdir)|g" \
+ -e "s|VERSION|${P}/VERSION|" \
+ -i ./src/scripts/charmc || die "failed patching charmc script"
+
+ # In the following, some of the files are symlinks to ../tmp which we need
+ # to dereference first (see bug 432834).
+
+ local i
+
+ # Install binaries.
+ for i in bin/*; do
+ if [[ -L ${i} ]]; then
+ i=$(readlink -e "${i}") || die
+ fi
+ dobin "${i}"
+ done
+
+ # Install headers.
+ insinto /usr/include/${P}
+ for i in include/*; do
+ if [[ -L ${i} ]]; then
+ i=$(readlink -e "${i}") || die
+ fi
+ doins "${i}"
+ done
+
+ # Install static libs. Charm has a lot of .o "libs" that it requires at
+ # runtime.
+ if use static-libs; then
+ for i in lib/*.{a,o}; do
+ if [[ -L ${i} ]]; then
+ i=$(readlink -e "${i}") || die
+ fi
+ dolib "${i}"
+ done
+ fi
+
+ # Install shared libs.
+ for i in lib_so/*; do
+ if [[ -L ${i} ]]; then
+ i=$(readlink -e "${i}") || die
+ fi
+ dolib.so "${i}"
+ done
+
+ # Basic docs.
+ dodoc CHANGES README
+
+ # Install examples.
+ if use examples; then
+ find examples/ -name 'Makefile' | xargs sed \
+ -r "s:(../)+bin/charmc:/usr/bin/charmc:" -i || \
+ die "Failed to fix examples"
+ find examples/ -name 'Makefile' | xargs sed \
+ -r "s:./charmrun:./charmrun ++local:" -i || \
+ die "Failed to fix examples"
+ insinto /usr/share/doc/${PF}/examples
+ doins -r examples/charm++/*
+ fi
+
+ # Install pdf/html docs
+ if use doc; then
+ cd "${S}/doc/charm++"
+ # Install pdfs.
+ insinto /usr/share/doc/${PF}/pdf
+ doins *.pdf
+ # Install html.
+ docinto html
+ dohtml -r manual/*
+ fi
+}
+
+pkg_postinst() {
+ einfo "Please test your charm installation by copying the"
+ einfo "content of /usr/share/doc/${PF}/examples to a"
+ einfo "temporary location and run 'make test'."
+}
diff --git a/sys-cluster/charm/files/charm-6.5.1-fix-markupSanitizer.patch b/sys-cluster/charm/files/charm-6.5.1-fix-markupSanitizer.patch
new file mode 100644
index 000000000000..6ed4c1989b4c
--- /dev/null
+++ b/sys-cluster/charm/files/charm-6.5.1-fix-markupSanitizer.patch
@@ -0,0 +1,203 @@
+From 88f5739d3f0d34c51f318fc460b843253b4242e0 Mon Sep 17 00:00:00 2001
+From: Nicolas Bock <nicolasbock@gmail.com>
+Date: Fri, 8 Nov 2013 09:58:55 -0700
+Subject: [PATCH 2/2] Make markupSanitizer.py support python 3.1 and 3.2
+
+The script only supports <python-3 because of how uni-code literals are
+treated in python-3.{1,2}. In python-2, a unicode string had to be prefixed
+with 'u', while this notation was dropped in python-3.{1,2}. I have added a
+check to the script so that it runs now with python-2.7 and python-3.{1,2,3}.
+---
+ doc/markupSanitizer.py | 179 ++++++++++++++++++++++++++-----------------------
+ 1 file changed, 95 insertions(+), 84 deletions(-)
+
+diff --git a/doc/markupSanitizer.py b/doc/markupSanitizer.py
+index f206cab..6fe247d 100755
+--- a/doc/markupSanitizer.py
++++ b/doc/markupSanitizer.py
+@@ -4,87 +4,98 @@ from bs4 import BeautifulSoup
+ import sys
+ import os
+
+-# Accept filename as user input
+-argc = len( sys.argv )
+-if (argc < 2): raise Exception
+-fileName = sys.argv[1];
+-
+-# Construct a DOM object
+-soup = BeautifulSoup(open(fileName), "lxml")
+-
+-# Assuming, tt tags are not spewed recklessly by latex2html,
+-# replace them with code tags
+-for t in soup('tt'):
+- t.wrap( soup.new_tag('code') )
+- t.unwrap()
+-
+-# Rewrap all div class=alltt blocks in pre tags
+-for d in soup('div','alltt'):
+- d.wrap( soup.new_tag('pre') )
+- d.unwrap()
+-
+-# Remove br and span tags from within pre sections
+-for p in soup('pre'):
+- for b in p('br'):
+- b.extract()
+- for s in p('span'):
+- s.unwrap()
+-
+-# Remove all useless class 'arabic' spans
+-for s in soup('span','arabic'):
+- s.unwrap()
+-
+-# Extract the navigation bar
+-navmenu = soup.find('div', 'navigation')
+-if navmenu:
+- navmenu.extract()
+-
+-# Wrap the remaining contents within a div
+-if not soup.find('div', id='maincontainer'):
+- soup.body['id'] = 'maincontainer'
+- soup.body.name = 'div'
+- soup.find('div', id='maincontainer').wrap( soup.new_tag('body') )
+-
+-if navmenu:
+- # If this navmenu doesn't already have a TOC, insert one
+- if not navmenu.find('ul','manual-toc'):
+- # Add a toc within the navmenu
+- navmenuTOC = BeautifulSoup(open("tmp-navmenu.html"), "lxml")
+- navmenuTOC = navmenuTOC.find('ul','manual-toc').extract()
+- navmenuTOC.append( BeautifulSoup("".join([
+- '<li><a href="http://charm.cs.illinois.edu">PPL Homepage</a></li>',
+- '<li><a href="http://charm.cs.illinois.edu/help">Other Manuals</a></li>'])
+- ) )
+- navmenu.append(navmenuTOC)
+-
+- # Insert navigation symbols to prev and next links
+- prevsymbol = soup.new_tag('span')
+- prevsymbol['class'] = 'navsymbol'
+- prevsymbol.string = u'\xab'
+- prv = navmenu.find('li',id='nav-prev')
+- if prv:
+- prv.find('a').insert(0, prevsymbol)
+-
+- nextsymbol = soup.new_tag('span')
+- nextsymbol['class'] = 'navsymbol'
+- nextsymbol.string = u'\xbb'
+- nxt = navmenu.find('li',id='nav-next')
+- if nxt:
+- nxt.find('a').append(nextsymbol)
+-
+- # Reinsert the navigation bar at the end
+- soup.body.append(navmenu)
+-
+-# Extract the title
+-titl = soup.find('title')
+-
+-# Replace the head section with the user-supplied head markup
+-soup.find('head').extract()
+-newhead = BeautifulSoup(open("../assets/head.html"), "lxml")
+-newhead = newhead.find('head').extract()
+-newhead.append(titl)
+-soup.html.body.insert_before(newhead)
+-
+-# Print cleaned up markup to stdout
+-print( soup.prettify(formatter="html") )
+-
++def main ():
++ # Accept filename as user input
++ argc = len( sys.argv )
++ if (argc < 2): raise Exception
++ fileName = sys.argv[1];
++
++ # Construct a DOM object
++ soup = BeautifulSoup(open(fileName), "lxml")
++
++ # Assuming, tt tags are not spewed recklessly by latex2html,
++ # replace them with code tags
++ for t in soup('tt'):
++ t.wrap( soup.new_tag('code') )
++ t.unwrap()
++
++ # Rewrap all div class=alltt blocks in pre tags
++ for d in soup('div','alltt'):
++ d.wrap( soup.new_tag('pre') )
++ d.unwrap()
++
++ # Remove br and span tags from within pre sections
++ for p in soup('pre'):
++ for b in p('br'):
++ b.extract()
++ for s in p('span'):
++ s.unwrap()
++
++ # Remove all useless class 'arabic' spans
++ for s in soup('span','arabic'):
++ s.unwrap()
++
++ # Extract the navigation bar
++ navmenu = soup.find('div', 'navigation')
++ if navmenu:
++ navmenu.extract()
++
++ # Wrap the remaining contents within a div
++ if not soup.find('div', id='maincontainer'):
++ soup.body['id'] = 'maincontainer'
++ soup.body.name = 'div'
++ soup.find('div', id='maincontainer').wrap( soup.new_tag('body') )
++
++ if navmenu:
++ # If this navmenu doesn't already have a TOC, insert one
++ if not navmenu.find('ul','manual-toc'):
++ # Add a toc within the navmenu
++ navmenuTOC = BeautifulSoup(open("tmp-navmenu.html"), "lxml")
++ navmenuTOC = navmenuTOC.find('ul','manual-toc').extract()
++ navmenuTOC.append( BeautifulSoup("".join([
++ '<li><a href="http://charm.cs.illinois.edu">PPL Homepage</a></li>',
++ '<li><a href="http://charm.cs.illinois.edu/help">Other Manuals</a></li>'])
++ ) )
++ navmenu.append(navmenuTOC)
++
++ # Insert navigation symbols to prev and next links
++ prevsymbol = soup.new_tag('span')
++ prevsymbol['class'] = 'navsymbol'
++ prevsymbol.string = u('\xab')
++ prv = navmenu.find('li',id='nav-prev')
++ if prv:
++ prv.find('a').insert(0, prevsymbol)
++
++ nextsymbol = soup.new_tag('span')
++ nextsymbol['class'] = 'navsymbol'
++ nextsymbol.string = u('\xbb')
++ nxt = navmenu.find('li',id='nav-next')
++ if nxt:
++ nxt.find('a').append(nextsymbol)
++
++ # Reinsert the navigation bar at the end
++ soup.body.append(navmenu)
++
++ # Extract the title
++ titl = soup.find('title')
++
++ # Replace the head section with the user-supplied head markup
++ soup.find('head').extract()
++ newhead = BeautifulSoup(open("../assets/head.html"), "lxml")
++ newhead = newhead.find('head').extract()
++ newhead.append(titl)
++ soup.html.body.insert_before(newhead)
++
++ # Print cleaned up markup to stdout
++ print( soup.prettify(formatter="html") )
++
++if sys.version < '3':
++ import codecs
++ def u (x):
++ return codecs.unicode_escape_decode(x)[0]
++else:
++ def u (x):
++ return x
++
++if __name__ == "__main__":
++ main()
+--
+1.8.1.5
+