[med-svn] [Git][med-team/graphlan][master] 5 commits: Use 2to3 to port to Python3

Andreas Tille gitlab at salsa.debian.org
Fri Nov 8 12:59:49 GMT 2019



Andreas Tille pushed to branch master at Debian Med / graphlan


Commits:
ebbe13dd by Andreas Tille at 2019-11-08T12:38:47Z
Use 2to3 to port to Python3

- - - - -
c8113616 by Andreas Tille at 2019-11-08T12:39:06Z
debhelper-compat 12

- - - - -
313a3899 by Andreas Tille at 2019-11-08T12:39:11Z
Standards-Version: 4.4.1

- - - - -
38ff1c9a by Andreas Tille at 2019-11-08T12:48:18Z
Supress check that explicitly enforces Python2

- - - - -
43c74efa by Andreas Tille at 2019-11-08T12:49:08Z
Python3 in packaging

- - - - -


6 changed files:

- debian/changelog
- − debian/compat
- debian/control
- + debian/patches/2to3.patch
- + debian/patches/series
- debian/rules


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+graphlan (1.1.3-2) UNRELEASED; urgency=medium
+
+  * Use 2to3 to port to Python3
+    Closes: #936652
+  * debhelper-compat 12
+  * Standards-Version: 4.4.1
+
+ -- Andreas Tille <tille at debian.org>  Fri, 08 Nov 2019 13:37:28 +0100
+
 graphlan (1.1.3-1) unstable; urgency=medium
 
   * New upstream version


=====================================
debian/compat deleted
=====================================
@@ -1 +0,0 @@
-11


=====================================
debian/control
=====================================
@@ -3,21 +3,21 @@ Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.
 Uploaders: Andreas Tille <tille at debian.org>
 Section: science
 Priority: optional
-Build-Depends: debhelper (>= 11~),
-               python-all,
+Build-Depends: debhelper-compat (= 12),
+               python3-all,
                dh-python
-Standards-Version: 4.2.1
+Standards-Version: 4.4.1
 Vcs-Browser: https://salsa.debian.org/med-team/graphlan
 Vcs-Git: https://salsa.debian.org/med-team/graphlan.git
 Homepage: https://bitbucket.org/nsegata/graphlan/wiki/Home
 
 Package: graphlan
 Architecture: all
-Depends: ${python:Depends},
+Depends: ${python3:Depends},
          ${misc:Depends},
-         python-biopython,
-         python-numpy,
-         python-matplotlib
+         python3-biopython,
+         python3-numpy,
+         python3-matplotlib
 Description: circular representations of taxonomic and phylogenetic trees
  GraPhlAn is a software tool for producing high-quality circular
  representations of taxonomic and phylogenetic trees. It focuses on


=====================================
debian/patches/2to3.patch
=====================================
@@ -0,0 +1,233 @@
+Description: Use 2to3 to port to Python3
+Bug-Debian: https://bugs.debian.org/936652
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Fri, 08 Nov 2019 13:37:28 +0100
+
+--- a/examples/hmp_metahit_functional/merge-humann.py
++++ b/examples/hmp_metahit_functional/merge-humann.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python3
+ 
+ from sys import argv
+ 
+@@ -13,8 +13,8 @@ if __name__ == "__main__":
+         argv[5]
+         argv[6]
+     except:
+-        print "Usage error!"
+-        print "$ python merge_humann.py <in_hmp> <skip_rows_hmp> <in_metahit> <skip_rows_metahit> <metahit_map> <out_file>"
++        print("Usage error!")
++        print("$ python3 merge_humann.py <in_hmp> <skip_rows_hmp> <in_metahit> <skip_rows_metahit> <metahit_map> <out_file>")
+         exit(1)
+ 
+     infile1 = str(argv[1])
+--- a/graphlan.py
++++ b/graphlan.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python3
+ 
+ #------------------------------------------------------------------------------
+ # NAME: graphlan.py
+@@ -20,9 +20,9 @@ __date__ = '5 June 2018'
+ 
+ import sys
+ 
+-if sys.version_info[0] > 2:
+-    raise Exception("GraPhlAn requires Python 2, your current Python version is {}.{}.{}"
+-                    .format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))
++#if sys.version_info[0] > 2:
++#    raise Exception("GraPhlAn requires Python 2, your current Python version is {}.{}.{}"
++#                    .format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))
+ 
+ from sys import argv
+ from argparse import ArgumentParser
+--- a/graphlan_annotate.py
++++ b/graphlan_annotate.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python3
+ 
+ #------------------------------------------------------------------------------
+ # NAME: graphlan_annotate.py
+@@ -17,9 +17,9 @@ __date__ = '5 June 2018'
+ 
+ import sys
+ 
+-if sys.version_info[0] > 2:
+-    raise Exception("GraPhlAn requires Python 2, your current Python version is {}.{}.{}"
+-                    .format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))
++#if sys.version_info[0] > 2:
++#    raise Exception("GraPhlAn requires Python 2, your current Python version is {}.{}.{}"
++#                    .format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))
+ 
+ from sys import argv
+ from argparse import ArgumentParser
+--- a/src/graphlan_lib.py
++++ b/src/graphlan_lib.py
+@@ -1,8 +1,8 @@
+ import sys
+ 
+-if sys.version_info[0] > 2:
+-    raise Exception("GraPhlAn requires Python 2, your current Python version is {}.{}.{}"
+-                    .format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))
++#if sys.version_info[0] > 2:
++#    raise Exception("GraPhlAn requires Python 2, your current Python version is {}.{}.{}"
++#                    .format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))
+ 
+ from Bio import Phylo
+ from Bio.Phylo import PhyloXML
+@@ -25,7 +25,7 @@ import matplotlib
+ matplotlib.use('Agg')
+ matplotlib.rcParams['svg.fonttype'] = 'none'
+ from pylab import *
+-from pyphlan import PpaTree
++from .pyphlan import PpaTree
+ 
+ 
+ clade_attr = ( ( 'clade_marker_size',                float, 20.0      ),
+@@ -255,17 +255,17 @@ class CircTree(PpaTree):
+                         clade.properties = []
+ 
+                     if 'class' in props[n]:
+-                        for k,v in classes[props[n]['class']].items():
++                        for k,v in list(classes[props[n]['class']].items()):
+                             lprop[k] = v
+-                    for k,v in props[n].items():
++                    for k,v in list(props[n].items()):
+                         if type(v) == dict:
+-                            for kk,vv in v.items():
++                            for kk,vv in list(v.items()):
+                                 lprop["__".join(['ext',str(kk),k])] = vv
+                         else:
+                             lprop[k] = v
+ 
+                     cp = []
+-                    for k,v in lprop.items():
++                    for k,v in list(lprop.items()):
+                         value = v
+                         if k == 'annotation':
+                             if v.count(":"):
+@@ -278,7 +278,7 @@ class CircTree(PpaTree):
+ 
+                                 if kkk == '*':
+                                     if fn is None:
+-                                        kkk = rkeys_gen.next()
++                                        kkk = next(rkeys_gen)
+                                     else:
+                                         kkk = fn
+                                     fn = kkk
+@@ -297,7 +297,7 @@ class CircTree(PpaTree):
+                 _rec_annotate_( c, rkeys_gen,  npath )
+ 
+         all_keys = set()
+-        for p in props.values():
++        for p in list(props.values()):
+             if 'annotation' in p and p['annotation'].count(":"):
+                 all_keys.add( p['annotation'].split(":")[0] )
+         rkeys = random_keys(all_keys)
+@@ -305,9 +305,9 @@ class CircTree(PpaTree):
+ 
+         _rec_annotate_( self.tree.root, rkeys, "" )
+         tgprop = []
+-        for k,v in gprops.items():
++        for k,v in list(gprops.items()):
+             if type(v) == dict:
+-                for kk,vv in v.items():
++                for kk,vv in list(v.items()):
+                     if k in int_attr_d:
+                         pn = "__".join(['int',str(kk),k])
+                     else:
+@@ -320,7 +320,7 @@ class CircTree(PpaTree):
+                                    ref='A:1', applies_to='phylogeny',
+                                    datatype='xsd:string' )]
+ 
+-        ckeys = sorted([c for c in classes.keys()
++        ckeys = sorted([c for c in list(classes.keys())
+                     if not ('label' in classes[c] and classes[c]['label'] in ['none','None'])])
+         if ckeys:
+             newidrefs = ['leg_keys']
+@@ -619,7 +619,7 @@ class CircTree(PpaTree):
+             if not l in self.int_levs:
+                 self.int_levs[l] = {}
+             self.int_levs[l][k] = v
+-        for k,v in self.ext_levs.items():
++        for k,v in list(self.ext_levs.items()):
+             for att,typ,default in ext_attr:
+                 if att in v:
+                     self.ext_levs[k][att] = typ(self.ext_levs[k][att])
+@@ -645,7 +645,7 @@ class CircTree(PpaTree):
+ 
+         self._ext_max_height = {}
+         if 'ring_height' in gprops:
+-            for i,v in gprops['ring_height'].items():
++            for i,v in list(gprops['ring_height'].items()):
+                 self._ext_max_height[i] = float(v) if float(v) >= 0.0 else 0.0
+         for lev,attr,val in eggrops:
+             if attr == 'ring_height':
+@@ -902,7 +902,7 @@ class CircTree(PpaTree):
+ 
+     def _init_attr( self ):
+         self._depths = dict([(c.name,dist) for c,dist in
+-            self.tree.depths(self.ignore_branch_len).items()])
++            list(self.tree.depths(self.ignore_branch_len).items())])
+         self._max_depth = max(self._depths.values())
+         if not self._max_depth:
+             self._max_depth = 1.0
+@@ -993,7 +993,7 @@ class CircTree(PpaTree):
+ 
+         wbar = ax.bar(self._wing_thetas, self._wing_radii, width=self._wing_widths, bottom=self._wing_bottoms, alpha=self.annotation_background_alpha, color=self._wing_colors, edgecolor=self._wing_colors, align='edge')
+ 
+-        for lev,d in self.int_levs.items():
++        for lev,d in list(self.int_levs.items()):
+             if 'internal_label' in d:
+                 start_rot = ( self.internal_labels_rotation
+                                  if self.internal_labels_rotation
+@@ -1057,11 +1057,11 @@ class CircTree(PpaTree):
+         #    ax.add_line(l)
+ 
+         offset = self._wing_tot_offset + self.annotation_background_offset
+-        for l,v in self.ext_levs.items():
++        for l,v in list(self.ext_levs.items()):
+             for p in ['ring_internal_separator_thickness','ring_external_separator_thickness']:
+                 if p in v and float(v[p]) > 0.0:
+-                    if l not in self._ext_bottoms.keys():
+-                        print('[e] External ring #'+str(l), 'defined, but not used. Please check your annotations file')
++                    if l not in list(self._ext_bottoms.keys()):
++                        print(('[e] External ring #'+str(l), 'defined, but not used. Please check your annotations file'))
+                         continue
+ 
+                     bot = offset + self._ext_bottoms[l]
+--- a/src/pyphlan.py
++++ b/src/pyphlan.py
+@@ -421,9 +421,9 @@ class PpaTree:
+             if markerness < markerness_th:
+                 continue
+             cl2markers[gid].append( line )
+-        for k,v in cl2markers.items():
++        for k,v in list(cl2markers.items()):
+             cl2markers[k] = sorted(v,key=lambda x:float(x[2]),reverse=True)[:max_markers]
+-        return cl2markers.values()
++        return list(cl2markers.values())
+ 
+     def get_c2t( self ):
+         tc2t = {}
+@@ -503,7 +503,7 @@ class PpaTree:
+     def tax_precision( self, c2t_f, strategy = 'lca' ):
+         c2t = self.read_tax_clades( c2t_f )
+         res = []
+-        for c,terms in c2t.items():
++        for c,terms in list(c2t.items()):
+             lca = self.lca( terms )
+             num = partial_branch_length(lca,terms)
+             den = lca.total_branch_length()
+@@ -514,7 +514,7 @@ class PpaTree:
+     def tax_recall( self, c2t_f ):
+         c2t = self.read_tax_clades( c2t_f )
+         res = []
+-        for c,terms in c2t.items():
++        for c,terms in list(c2t.items()):
+             lca = self.lca( terms )
+             ltcs = self.ltcs( terms )
+             lca_terms = set(lca.get_terminals())


=====================================
debian/patches/series
=====================================
@@ -0,0 +1 @@
+2to3.patch


=====================================
debian/rules
=====================================
@@ -5,7 +5,7 @@ export LC_ALL=C.UTF-8
 
 
 %:
-	dh $@  --with python2
+	dh $@  --with python3
 
 override_dh_installexamples:
 	dh_installexamples



View it on GitLab: https://salsa.debian.org/med-team/graphlan/compare/bc2c069e756fb55189f1197be1e763fcdd377d7b...43c74efa7c2b660e514d234f98bc585805877148

-- 
View it on GitLab: https://salsa.debian.org/med-team/graphlan/compare/bc2c069e756fb55189f1197be1e763fcdd377d7b...43c74efa7c2b660e514d234f98bc585805877148
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20191108/94acee6f/attachment-0001.html>


More information about the debian-med-commit mailing list