From: "Petteri Räty" <betelgeuse@gentoo.org>
To: Gentoo Java <gentoo-java@lists.gentoo.org>
Subject: [gentoo-java] RFC: java-ant_remove-taskdefs
Date: Mon, 10 Mar 2008 01:05:53 +0200 [thread overview]
Message-ID: <47D46D51.1070205@gentoo.org> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 132 bytes --]
xml-rewrite-N.py only works on attributes so I think it's easiest to
just have some inline python for this.
Regards,
Petteri
[-- Attachment #1.2: remove-taskdefs.patch --]
[-- Type: text/plain, Size: 1781 bytes --]
Index: java-ant-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v
retrieving revision 1.30
diff -u -r1.30 java-ant-2.eclass
--- java-ant-2.eclass 5 Mar 2008 19:30:29 -0000 1.30
+++ java-ant-2.eclass 9 Mar 2008 23:01:32 -0000
@@ -380,6 +380,31 @@
}
# ------------------------------------------------------------------------------
+# @public java-ant_remove-taskdefs
+#
+# Removes taskdef elements from the file
+# @param $1 - the file to rewrite (defaults to build.xml)
+# ------------------------------------------------------------------------------
+java-ant_remove-taskdefs() {
+ debug-print-function ${FUNCNAME} $*
+ local file=${1:-build.xml}
+ echo "Removing taskdefs from ${file}"
+ python <<EOF
+import sys
+from xml.dom.minidom import parse
+dom = parse("${file}")
+for elem in dom.getElementsByTagName('taskdef'):
+ elem.parentNode.removeChild(elem)
+ elem.unlink()
+f = open("${file}", "w")
+dom.writexml(f)
+f.close()
+EOF
+ [[ $? != 0 ]] && die "Removing taskdefs failed"
+}
+
+
+# ------------------------------------------------------------------------------
# @public java-ant_ignore-system-classes
#
# Makes the available task ignore classes in the system classpath
@@ -387,9 +412,8 @@
# ------------------------------------------------------------------------------
java-ant_ignore-system-classes() {
debug-print-function ${FUNCNAME} $*
- local file="${1}"
- [[ -z "${1}" ]] && file=build.xml
- echo "Changing ignoresystemclasses to true for available tasks"
+ local file=${1:-build.xml}
+ echo "Changing ignoresystemclasses to true for available tasks in ${file}"
java-ant_xml-rewrite -f "${file}" --change \
-e available -a ignoresystemclasses -v "true"
}
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
reply other threads:[~2008-03-09 23:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47D46D51.1070205@gentoo.org \
--to=betelgeuse@gentoo.org \
--cc=gentoo-java@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox