From 4082f67f78a1245cbaf1c9a3c3c61cc8f1713829 Mon Sep 17 00:00:00 2001 From: Alan Post Date: Tue, 14 Sep 2010 20:53:01 -0600 Subject: [PATCH] makfa: only import ElementTree if we're going to use it. ElementTree is not available by default. (it is in pyexpat, which is a non-default module.) since ElementTree is only used by the Updater code, and this code is not designed to run on the NanoNote (it is only run as part of the build process), move the import statement inside the Updater in the hopes that the user on the NanoNote never has to deal with it. In the future I will make pyexpat a default module for the Lojban config, but this change will still see a performance gain in the most typical use case for makfa. --- makfa/patches/02-pyexpat.patch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 makfa/patches/02-pyexpat.patch diff --git a/makfa/patches/02-pyexpat.patch b/makfa/patches/02-pyexpat.patch new file mode 100644 index 0000000..47bf510 --- /dev/null +++ b/makfa/patches/02-pyexpat.patch @@ -0,0 +1,18 @@ +--- a/makfa 2010-09-14 20:40:00.000000000 -0600 ++++ b/makfa 2010-09-14 20:37:31.000000000 -0600 +@@ -8,7 +8,6 @@ + import sys + import textwrap + import urllib +-import xml.etree.cElementTree as etree + + + +@@ -486,6 +485,7 @@ + class Updater(object): + + def __init__(self, lang='en', filename='/usr/share/makfa/makfa.dump'): ++ import xml.etree.cElementTree as etree + self.db = {'order': [], 'entries': {}} + url = 'http://jbovlaste.lojban.org/export/xml-export.html?lang=%s' + tree = etree.parse(urllib.urlopen(url % lang))