From: allfro Date: Sun, 9 Dec 2012 02:19:53 +0000 (-0500) Subject: Added fix to xml.etree.ElementPath for Python 2.6 X-Git-Url: https://git.nothing2do.fr/?a=commitdiff_plain;h=949753b28b354f0c4cbaf16e37b91e93ed858e28;p=get-hack-src.git Added fix to xml.etree.ElementPath for Python 2.6 --- diff --git a/setup.py b/setup.py index 3aa74af..99f8d08 100755 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ if name == 'nt': setup( name='canari', author='Nadeem Douba', - version='0.3', + version='0.4', author_email='ndouba@gmail.com', description='Rapid transform development and transform execution framework for Maltego.', license='GPL', diff --git a/src/canari/commands/common.py b/src/canari/commands/common.py index 1433cda..6e74b3f 100644 --- a/src/canari/commands/common.py +++ b/src/canari/commands/common.py @@ -21,6 +21,13 @@ __maintainer__ = 'Nadeem Douba' __email__ = 'ndouba@gmail.com' __status__ = 'Development' +def fix_etree(): + try: + from xml.etree.cElementTree import XML + e = XML('') + e.find('t[@a="1"]') + except SyntaxError: + import canari.xmltools.fixetree def get_bin_dir(): d = install(Distribution()) diff --git a/src/canari/commands/install_package.py b/src/canari/commands/install_package.py index 2d457e4..1238eb6 100644 --- a/src/canari/commands/install_package.py +++ b/src/canari/commands/install_package.py @@ -4,7 +4,7 @@ from ..maltego.configuration import (MaltegoTransform, CmdCwdTransformProperty, CmdLineTransformProperty, CmdParmTransformProperty, InputConstraint, TransformSet, TransformSettings, CmdCwdTransformPropertySetting, CmdDbgTransformPropertySetting, CmdLineTransformPropertySetting, CmdParmTransformPropertySetting) -from common import detect_settings_dir, cmd_name, fix_pypath, get_bin_dir, import_transform, import_package +from common import detect_settings_dir, cmd_name, fix_pypath, get_bin_dir, import_transform, import_package, fix_etree from ..maltego.message import ElementTree from pkg_resources import resource_filename, resource_listdir @@ -271,7 +271,7 @@ def run(args): opts = parse_args(args) fix_pypath() - + fix_etree() if opts.package.endswith('.transforms'): opts.package = opts.package.replace('.transforms', '') diff --git a/src/canari/commands/uninstall_package.py b/src/canari/commands/uninstall_package.py index c360f43..58583ba 100644 --- a/src/canari/commands/uninstall_package.py +++ b/src/canari/commands/uninstall_package.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from common import detect_settings_dir, cmd_name, fix_pypath, import_package, import_transform +from common import detect_settings_dir, cmd_name, fix_pypath, import_package, import_transform, fix_etree from xml.etree.cElementTree import ElementTree, XML from os import path, mkdir, listdir, unlink, rmdir @@ -120,6 +120,8 @@ def run(args): fix_pypath() + fix_etree() + m = import_package('%s.transforms' % opts.package) for t in m.__all__: