[med-svn] [Git][med-team/ctdconverter][master] do a final 2to3 conversion, release

Alexandre Detiste (@detiste-guest) gitlab at salsa.debian.org
Wed Jun 19 10:56:51 BST 2024



Alexandre Detiste pushed to branch master at Debian Med / ctdconverter


Commits:
1e3e897c by Alexandre Detiste at 2024-06-19T11:55:41+02:00
do a final 2to3 conversion, release

- - - - -


5 changed files:

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


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+ctdconverter (2.1-7) unstable; urgency=medium
+
+  * Team upload.
+  * Do a one shot final 2to3 conversion (Closes: #1045042)
+
+ -- Alexandre Detiste <tchet at debian.org>  Wed, 19 Jun 2024 11:54:31 +0200
+
 ctdconverter (2.1-6) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/control
=====================================
@@ -12,7 +12,6 @@ Build-Depends: debhelper-compat (= 13),
                python3-ruamel.yaml,
                python3-ctdopts,
                help2man,
-               2to3
 Standards-Version: 4.6.2
 Vcs-Browser: https://salsa.debian.org/med-team/ctdconverter
 Vcs-Git: https://salsa.debian.org/med-team/ctdconverter.git


=====================================
debian/patches/2to3.patch
=====================================
@@ -0,0 +1,171 @@
+--- a/common/utils.py
++++ b/common/utils.py
+@@ -4,7 +4,7 @@
+ import os
+ 
+ from lxml import etree
+-from logger import info, error, warning
++from .logger import info, error, warning
+ 
+ from common.exceptions import ApplicationException
+ from CTDopts.CTDopts import CTDModel, ParameterGroup
+@@ -100,7 +100,7 @@
+         try:
+             info("Loading validation schema from %s" % xsd_location, 0)
+             schema = etree.XMLSchema(etree.parse(xsd_location))
+-        except Exception, e:
++        except Exception as e:
+             error("Could not load validation schema %s. Reason: %s" % (xsd_location, str(e)), 0)
+     else:
+         warning("Validation against a schema has not been enabled.", 0)
+@@ -127,7 +127,7 @@
+     try:
+         parser = etree.XMLParser(schema=schema)
+         etree.parse(ctd_file, parser=parser)
+-    except etree.XMLSyntaxError, e:
++    except etree.XMLSyntaxError as e:
+         raise ApplicationException("Invalid CTD file %s. Reason: %s" % (ctd_file, str(e)))
+ 
+ 
+@@ -195,9 +195,9 @@
+ def extract_tool_help_text(ctd_model):
+     manual = ""
+     doc_url = None
+-    if "manual" in ctd_model.opt_attribs.keys():
++    if "manual" in list(ctd_model.opt_attribs.keys()):
+         manual += "%s\n\n" % ctd_model.opt_attribs["manual"]
+-    if "docurl" in ctd_model.opt_attribs.keys():
++    if "docurl" in list(ctd_model.opt_attribs.keys()):
+         doc_url = ctd_model.opt_attribs["docurl"]
+ 
+     help_text = "No help available"
+@@ -258,7 +258,7 @@
+                 parameters.append(parameter)
+             else:
+                 # append the first-level children of this ParameterGroup
+-                pending.extend(parameter.parameters.values())
++                pending.extend(list(parameter.parameters.values()))
+     # returned the reversed list of parameters (as it is now,
+     # we have the last parameter in the CTD as first in the list)
+     return reversed(parameters)
+--- a/convert.py
++++ b/convert.py
+@@ -175,11 +175,11 @@
+     # converter will register its own parameters after we've registered the basic ones... we have to do it old school
+     if len(argv) < 2:
+         utils.error("Not enough arguments provided")
+-        print("\nUsage: $ {} [TARGET] "
++        print(("\nUsage: $ {} [TARGET] "
+               " [ARGUMENTS]\n\n".format(program_name) +
+               "Where:\n" +
+               "  target: one of 'cwl' or 'galaxy'\n\n" +
+-              "Run again using the -h/--help option to print more detailed help.\n")
++              "Run again using the -h/--help option to print more detailed help.\n"))
+         return 1
+ 
+     # TODO: at some point this should look like real software engineering and use a map containing converter instances
+@@ -224,19 +224,19 @@
+         print("Interrupted...")
+         return 0
+ 
+-    except ApplicationException, e:
++    except ApplicationException as e:
+         traceback.print_exc()
+         utils.error("CTDConverter could not complete the requested operation.", 0)
+         utils.error("Reason: " + e.msg, 0)
+         return 1
+ 
+-    except ModelError, e:
++    except ModelError as e:
+         traceback.print_exc()
+         utils.error("There seems to be a problem with one of your input CTDs.", 0)
+         utils.error("Reason: " + e.msg, 0)
+         return 1
+ 
+-    except Exception, e:
++    except Exception as e:
+         traceback.print_exc()
+         utils.error("CTDConverter could not complete the requested operation.", 0)
+         utils.error("Reason: " + e.msg, 0)
+--- a/galaxy/converter.py
++++ b/galaxy/converter.py
+@@ -134,10 +134,10 @@
+                 else:
+                     logger.info("Macro %s found" % name, 1)
+                     macros_to_expand.add(name)
+-        except ParseError, e:
++        except ParseError as e:
+             raise ApplicationException("The macros file " + macros_file_name + " could not be parsed. Cause: " +
+                                        str(e))
+-        except IOError, e:
++        except IOError as e:
+             raise ApplicationException("The macros file " + macros_file_name + " could not be opened. Cause: " +
+                                        str(e))
+ 
+@@ -281,7 +281,7 @@
+     if galaxy_tool_path is None:
+         galaxy_tool_path = ""
+     
+-    for category, file_names in categories_to_tools.iteritems():
++    for category, file_names in categories_to_tools.items():
+         section_node = add_child_node(toolbox_node, "section")
+         section_node.attrib["id"] = "section-id-" + "".join(category.split())
+         section_node.attrib["name"] = category
+@@ -322,7 +322,7 @@
+ 
+ 
+ def create_description(tool, model):
+-    if "description" in model.opt_attribs.keys() and model.opt_attribs["description"] is not None:
++    if "description" in list(model.opt_attribs.keys()) and model.opt_attribs["description"] is not None:
+         description = SubElement(tool,"description")
+         description.text = model.opt_attribs["description"]
+ 
+@@ -667,7 +667,7 @@
+ def generate_label_and_help(desc):
+     help_text = ""
+     # This tag is found in some descriptions 
+-    if not isinstance(desc, basestring):
++    if not isinstance(desc, str):
+         desc = str(desc)
+     desc = desc.encode("utf8").replace("#br#", " <br>")
+     # Get rid of dots in the end
+@@ -734,9 +734,9 @@
+ 
+ 
+ def get_lowercase_list(some_list):
+-    lowercase_list = map(str, some_list)
+-    lowercase_list = map(string.lower, lowercase_list)
+-    lowercase_list = map(strip, lowercase_list)
++    lowercase_list = list(map(str, some_list))
++    lowercase_list = list(map(string.lower, lowercase_list))
++    lowercase_list = list(map(strip, lowercase_list))
+     return lowercase_list
+ 
+ 
+@@ -800,7 +800,7 @@
+             # check if there are formats that have not been registered yet...
+             output = list()
+             for format_name in param.restrictions.formats:
+-                if not format_name in supported_file_formats.keys():
++                if not format_name in list(supported_file_formats.keys()):
+                     output.append(str(format_name))
+ 
+             # warn only if there's about to complain
+@@ -833,7 +833,7 @@
+ 
+ # Get the supported file format for one given format
+ def get_supported_file_type(format_name, supported_file_formats):
+-    if format_name in supported_file_formats.keys():
++    if format_name in list(supported_file_formats.keys()):
+         return supported_file_formats.get(format_name, DataType(format_name, format_name)).galaxy_extension
+     else:
+         return None
+@@ -841,7 +841,7 @@
+ 
+ def get_supported_file_types(formats, supported_file_formats):
+     return set([supported_file_formats.get(format_name, DataType(format_name, format_name)).galaxy_extension
+-               for format_name in formats if format_name in supported_file_formats.keys()])
++               for format_name in formats if format_name in list(supported_file_formats.keys())])
+ 
+ 
+ def create_change_format_node(parent, data_formats, input_ref):


=====================================
debian/patches/series
=====================================
@@ -3,3 +3,4 @@ upgrade_deprecated_strip
 correct_name
 py3_compat
 python3-syntax.patch
+2to3.patch


=====================================
debian/rules
=====================================
@@ -19,10 +19,6 @@ include /usr/share/dpkg/default.mk
 %:
 	dh $@ --buildsystem=pybuild
 
-override_dh_auto_build:
-	2to3 --write --nobackups --no-diffs convert.py galaxy/ cwl/ common/
-	dh_auto_build
-
 debian/CTDConverter.1: debian/rules debian/CTDConverter.help2man
 	help2man 'python3 convert.py' --include=debian/CTDConverter.help2man \
 		--no-info --version-string="$(DEB_VERSION_UPSTREAM)" \



View it on GitLab: https://salsa.debian.org/med-team/ctdconverter/-/commit/1e3e897c68078fa2128591afa2e99b60a1f7ecae

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/med-team/ctdconverter/-/commit/1e3e897c68078fa2128591afa2e99b60a1f7ecae
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/20240619/6b71f401/attachment-0001.htm>


More information about the debian-med-commit mailing list