changeset 51:b15a20c2372a

fix python 2 compatibility
author Jan Kanis <jan.code@jankanis.nl>
date Wed, 21 May 2014 18:34:35 +0200
parents bfc82a8aa3c9
children d6c7b5de2833
files blast2html.py blast2html.xml tool_dependencies.xml
diffstat 3 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/blast2html.py	Wed May 21 18:17:03 2014 +0200
+++ b/blast2html.py	Wed May 21 18:34:35 2014 +0200
@@ -13,6 +13,7 @@
 import warnings
 from os import path
 from itertools import repeat
+import six
 import argparse
 from lxml import objectify
 import jinja2
@@ -22,7 +23,7 @@
 _filters = {}
 def filter(func_or_name):
     "Decorator to register a function as filter in the current jinja environment"
-    if isinstance(func_or_name, str):
+    if isinstance(func_or_name, six.string_types):
         def inner(func):
             _filters[func_or_name] = func.__name__
             return func
--- a/blast2html.xml	Wed May 21 18:17:03 2014 +0200
+++ b/blast2html.xml	Wed May 21 18:34:35 2014 +0200
@@ -4,6 +4,7 @@
     
     <requirements>
       <requirement type="package" version="v0.0.18">blast_datatypes</requirement>
+      <requirement name="package" version="1.3.0">six</requirement>
       <requirement name="package" version="1.2.1">argparse</requirement>
       <requirement name="package" version="2.2.3">lxml</requirement>
       <requirement name="package" version="2.7.2">jinja2</requirement>
--- a/tool_dependencies.xml	Wed May 21 18:17:03 2014 +0200
+++ b/tool_dependencies.xml	Wed May 21 18:34:35 2014 +0200
@@ -25,7 +25,18 @@
     </install>
     <readme>The Python argparse library. This is included in the stdlib for python 2.7 and up, but not for 2.6</readme>
   </package>
-  
+
+  <package name="python_six" version="1.3.0">
+    <install version="1.0">
+      <actions>
+        <action type="setup_virtualenv">
+          six >= 1.3.0
+        </action>
+      </actions>
+    </install>
+    <readme>The Python six library for python 2/3 compatibility</readme>
+  </package>
+
   <package name="lxml" version="2.2.3">
     <install version="1.0">
       <actions>