[med-svn] [Git][med-team/snakemake][main] 2 commits: Use packaged python3-retry.

Rebecca N. Palmer (@rnpalmer-guest) gitlab at salsa.debian.org
Wed Feb 1 22:29:16 GMT 2023



Rebecca N. Palmer pushed to branch main at Debian Med / snakemake


Commits:
a98249fa by Rebecca N. Palmer at 2023-02-01T22:23:23+00:00
Use packaged python3-retry.

- - - - -
1bfa9986 by Rebecca N. Palmer at 2023-02-01T22:28:49+00:00
Don't try to use local Javascript in GUI, as this is risky. (Closes: #1019317)

- - - - -


7 changed files:

- debian/changelog
- debian/control
- debian/copyright
- debian/patches/cirumvent-retry.patch
- debian/rules
- − debian/snakemake.README.Debian
- debian/tests/control


Changes:

=====================================
debian/changelog
=====================================
@@ -1,8 +1,11 @@
-snakemake (7.20.0-1) UNRELEASED; urgency=medium
+snakemake (7.20.0-1) unstable; urgency=medium
 
   * New upstream release.  Refresh patches, d/copyright.
+  * Use packaged python3-retry.
+  * Don't try to use local Javascript in GUI, as this is risky.
+    (Closes: #1019317)
 
- -- Rebecca N. Palmer <rebecca_palmer at zoho.com>  Wed, 01 Feb 2023 21:56:33 +0000
+ -- Rebecca N. Palmer <rebecca_palmer at zoho.com>  Wed, 01 Feb 2023 22:28:39 +0000
 
 snakemake (7.19.1-1) unstable; urgency=medium
 


=====================================
debian/control
=====================================
@@ -36,6 +36,7 @@ Build-Depends: ca-certificates,
                python3-recommonmark <!nodoc>,
                python3-requests,
                python3-requests-mock <!nocheck>,
+               python3-retry,
                python3-pytest-mock <!nocheck>,
                python3-rpy2 <!nocheck>,
                python3-setuptools,
@@ -99,7 +100,7 @@ Recommends: cwltool,
             python3-ftputil,
             python3-irodsclient,
             python3-kubernetes,
-# we don't have python3-retry, #961109
+            python3-retry,
             python3-urllib3
 Suggests: slurm-client,
           snakemake-doc


=====================================
debian/copyright
=====================================
@@ -40,11 +40,6 @@ Files: debian/*
 Copyright: 2015-2023 Kevin Murray <spam at kdmurray.id.au> and Debian Med Team
 License: Expat
 
-Files: debian/patches/circumvent_retry.patch
-Copyright: 2014-2016 invl
-           2022 Nilesh Patra
-Comment: Embedded copy of https://github.com/invl/retry
-
 License: Expat
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal


=====================================
debian/patches/cirumvent-retry.patch
=====================================
@@ -1,5 +1,6 @@
-Description: retry has not been packaged yet, embed code for time-being
-Author: invl, Nilesh Patra <nilesh at debian.org>
+Description: Debian has original retry, not reretry
+
+Author: Nilesh Patra <nilesh at debian.org>, Rebecca N. Palmer <rebecca_palmer at zoho.com>
 Forwarded: not-needed
 
 --- a/snakemake/remote/__init__.py
@@ -9,130 +10,10 @@ Forwarded: not-needed
  
  from wrapt import ObjectProxy
 -from reretry import retry
-+from snakemake.retry_api import retry
++from retry import retry
  
  try:
      from connection_pool import ConnectionPool
---- /dev/null
-+++ b/snakemake/retry_api.py
-@@ -0,0 +1,117 @@
-+import logging
-+import random
-+import time
-+
-+from functools import partial
-+
-+logging_logger = logging.getLogger(__name__)
-+
-+try:
-+    from decorator import decorator
-+except ImportError:
-+    def decorator(caller):
-+        """ Turns caller into a decorator.
-+        Unlike decorator module, function signature is not preserved.
-+        :param caller: caller(f, *args, **kwargs)
-+        """
-+        def decor(f):
-+            @functools.wraps(f)
-+            def wrapper(*args, **kwargs):
-+                return caller(f, *args, **kwargs)
-+            return wrapper
-+        return decor
-+
-+
-+try:  # Python 2.7+
-+    from logging import NullHandler
-+except ImportError:
-+    class NullHandler(logging.Handler):
-+
-+        def emit(self, record):
-+            pass
-+
-+def __retry_internal(f, exceptions=Exception, tries=-1, delay=0, max_delay=None, backoff=1, jitter=0,
-+                     logger=logging_logger):
-+    """
-+    Executes a function and retries it if it failed.
-+    :param f: the function to execute.
-+    :param exceptions: an exception or a tuple of exceptions to catch. default: Exception.
-+    :param tries: the maximum number of attempts. default: -1 (infinite).
-+    :param delay: initial delay between attempts. default: 0.
-+    :param max_delay: the maximum value of delay. default: None (no limit).
-+    :param backoff: multiplier applied to delay between attempts. default: 1 (no backoff).
-+    :param jitter: extra seconds added to delay between attempts. default: 0.
-+                   fixed if a number, random if a range tuple (min, max)
-+    :param logger: logger.warning(fmt, error, delay) will be called on failed attempts.
-+                   default: retry.logging_logger. if None, logging is disabled.
-+    :returns: the result of the f function.
-+    """
-+    _tries, _delay = tries, delay
-+    while _tries:
-+        try:
-+            return f()
-+        except exceptions as e:
-+            _tries -= 1
-+            if not _tries:
-+                raise
-+
-+            if logger is not None:
-+                logger.warning('%s, retrying in %s seconds...', e, _delay)
-+
-+            time.sleep(_delay)
-+            _delay *= backoff
-+
-+            if isinstance(jitter, tuple):
-+                _delay += random.uniform(*jitter)
-+            else:
-+                _delay += jitter
-+
-+            if max_delay is not None:
-+                _delay = min(_delay, max_delay)
-+
-+def retry(exceptions=Exception, tries=-1, delay=0, max_delay=None, backoff=1, jitter=0, logger=logging_logger):
-+    """Returns a retry decorator.
-+    :param exceptions: an exception or a tuple of exceptions to catch. default: Exception.
-+    :param tries: the maximum number of attempts. default: -1 (infinite).
-+    :param delay: initial delay between attempts. default: 0.
-+    :param max_delay: the maximum value of delay. default: None (no limit).
-+    :param backoff: multiplier applied to delay between attempts. default: 1 (no backoff).
-+    :param jitter: extra seconds added to delay between attempts. default: 0.
-+                   fixed if a number, random if a range tuple (min, max)
-+    :param logger: logger.warning(fmt, error, delay) will be called on failed attempts.
-+                   default: retry.logging_logger. if None, logging is disabled.
-+    :returns: a retry decorator.
-+    """
-+
-+    @decorator
-+    def retry_decorator(f, *fargs, **fkwargs):
-+        args = fargs if fargs else list()
-+        kwargs = fkwargs if fkwargs else dict()
-+        return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
-+                                logger)
-+
-+    return retry_decorator
-+
-+
-+def retry_call(f, fargs=None, fkwargs=None, exceptions=Exception, tries=-1, delay=0, max_delay=None, backoff=1,
-+               jitter=0,
-+               logger=logging_logger):
-+    """
-+    Calls a function and re-executes it if it failed.
-+    :param f: the function to execute.
-+    :param fargs: the positional arguments of the function to execute.
-+    :param fkwargs: the named arguments of the function to execute.
-+    :param exceptions: an exception or a tuple of exceptions to catch. default: Exception.
-+    :param tries: the maximum number of attempts. default: -1 (infinite).
-+    :param delay: initial delay between attempts. default: 0.
-+    :param max_delay: the maximum value of delay. default: None (no limit).
-+    :param backoff: multiplier applied to delay between attempts. default: 1 (no backoff).
-+    :param jitter: extra seconds added to delay between attempts. default: 0.
-+                   fixed if a number, random if a range tuple (min, max)
-+    :param logger: logger.warning(fmt, error, delay) will be called on failed attempts.
-+                   default: retry.logging_logger. if None, logging is disabled.
-+    :returns: the result of the f function.
-+    """
-+    args = fargs if fargs else list()
-+    kwargs = fkwargs if fkwargs else dict()
-+    return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter, logger)
 --- a/snakemake/sourcecache.py
 +++ b/snakemake/sourcecache.py
 @@ -429,7 +429,7 @@ class SourceCache:
@@ -140,17 +21,18 @@ Forwarded: not-needed
  
      def _open_local_or_remote(self, source_file, mode, encoding=None):
 -        from reretry.api import retry_call
-+        from snakemake.retry_api import retry_call
++        from retry.api import retry_call
  
          if source_file.is_local:
              return self._open(source_file, mode, encoding=encoding)
 --- a/setup.cfg
 +++ b/setup.cfg
-@@ -49,7 +49,6 @@ install_requires =
+@@ -49,7 +49,7 @@ install_requires =
      pulp >=2.0
      pyyaml
      requests
 -    reretry
++    retry
      smart_open >=3.0
      stopit
      tabulate


=====================================
debian/rules
=====================================
@@ -51,14 +51,6 @@ execute_after_dh_auto_build:
 
 execute_after_dh_installdocs:
 	find debian -name '__pycache__' -o name '.gitignore' | xargs rm -rf
-	# Attention: Upstream is using jquery 2.1.1 while the replacement below is using the packaged version 3.5.13 - no idea whether this might break anything
-	for html in `find debian -name "*.html"` ; do \
-	    sed -i \
-		-e 's#https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/[^/]*/css/bootstrap.min.css#file:///usr/share/javascript/bootstrap/css/bootstrap.min.css#g' \
-		-e 's#https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/[^/]*/js/bootstrap.min.js#file:///usr/share/javascript/bootstrap/js/bootstrap.min.js#g' \
-		-e 's#https://cdnjs.cloudflare.com/ajax/libs/jquery/[^/]*/jquery.min.js#file:///usr/share/javascript/jquery/jquery.min.js#g' \
-		    $${html} ; \
-	done
 
 # the modules.sh is a workaround for #928826; putting it in PYBUILD_BEFORE_TEST_python3 doesn't work
 override_dh_auto_test:


=====================================
debian/snakemake.README.Debian deleted
=====================================
@@ -1,13 +0,0 @@
-snakemake for Debian
-====================
-
-To ensure your privacy this package is using the Debian packaged bootstrap and jquery
-in snakemake/gui.html.  Since the upstream code originally pointed to JQuery 2.1.1
-while the Debian package which is used at the time of writing this is 3.5.13 this might
-lead to unexpected issues in the user interface.  Please report such issues you might
-observe via
-
-      reportbug snakemake
-
-
- -- Andreas Tille <tille at debian.org>  Mon, 25 Jul 2022 21:22:29 +0200


=====================================
debian/tests/control
=====================================
@@ -15,6 +15,7 @@ Depends: snakemake,
          python3-pandas,
          python3-pytest,
          python3-requests-mock,
+         python3-retry,
          python3-pytest-mock,
          python3-pygments,
          stress



View it on GitLab: https://salsa.debian.org/med-team/snakemake/-/compare/40dd5c453ab303dced16e128ada332fb62ebfbe0...1bfa9986e7089f27d92cfd86fb8e7aeb82910f87

-- 
View it on GitLab: https://salsa.debian.org/med-team/snakemake/-/compare/40dd5c453ab303dced16e128ada332fb62ebfbe0...1bfa9986e7089f27d92cfd86fb8e7aeb82910f87
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/20230201/32732f67/attachment-0001.htm>


More information about the debian-med-commit mailing list