View | Details | Raw Unified | Return to bug 219306 | Differences between
and this patch

Collapse All | Expand All

(-)security/py-certbot/Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	certbot
4
PORTNAME=	certbot
5
PORTVERSION=	0.13.0
5
PORTVERSION=	0.13.0
6
PORTREVISION=	1
6
PORTREVISION=	2
7
PORTEPOCH=	1
7
PORTEPOCH=	1
8
CATEGORIES=	security python
8
CATEGORIES=	security python
9
MASTER_SITES=	CHEESESHOP
9
MASTER_SITES=	CHEESESHOP
(-)security/py-certbot/files/patch-certbot_tests_util__test.py (+40 lines)
Line 0 Link Here
1
From 42d07d756df0cf96c9d20b44e772858391d48384 Mon Sep 17 00:00:00 2001
2
From: Ryan Pineo <ry@tsl.io>
3
Date: Fri, 12 May 2017 15:45:54 -0400
4
Subject: [PATCH] support version 0.12.0 of configargparse
5
6
fixes #4648
7
8
--- certbot/tests/util_test.py.orig	2017-05-16 07:27:15 UTC
9
+++ certbot/tests/util_test.py
10
@@ -5,6 +5,7 @@ import os
11
 import stat
12
 import unittest
13
 
14
+import configargparse
15
 import mock
16
 import six
17
 
18
@@ -333,6 +334,22 @@ class AddDeprecatedArgumentTest(unittest
19
                 pass
20
         self.assertTrue("--old-option" not in stdout.getvalue())
21
 
22
+    def test_when_configargparse(self):
23
+        '''In configargparse version < 0.12.0 ACTION_TYPES_THAT_DONT_NEED_A_VALUE is a set.'''
24
+        orig = configargparse.ACTION_TYPES_THAT_DONT_NEED_A_VALUE
25
+        configargparse.ACTION_TYPES_THAT_DONT_NEED_A_VALUE = set()
26
+        self._call("--old-option", 1)
27
+        self.assertEqual(len(configargparse.ACTION_TYPES_THAT_DONT_NEED_A_VALUE), 1)
28
+        configargparse.ACTION_TYPES_THAT_DONT_NEED_A_VALUE = orig
29
+
30
+    def test_when_configargparse_tuple(self):
31
+        '''In configargparse version >= 0.12.0 ACTION_TYPES_THAT_DONT_NEED_A_VALUE is a tuple.'''
32
+        orig = configargparse.ACTION_TYPES_THAT_DONT_NEED_A_VALUE
33
+        configargparse.ACTION_TYPES_THAT_DONT_NEED_A_VALUE = tuple()
34
+        self._call("--old-option", 1)
35
+        self.assertEqual(len(configargparse.ACTION_TYPES_THAT_DONT_NEED_A_VALUE), 1)
36
+        configargparse.ACTION_TYPES_THAT_DONT_NEED_A_VALUE = orig
37
+
38
 
39
 class EnforceLeValidity(unittest.TestCase):
40
     """Test enforce_le_validity."""
(-)security/py-certbot/files/patch-certbot_util.py (+23 lines)
Line 0 Link Here
1
From 42d07d756df0cf96c9d20b44e772858391d48384 Mon Sep 17 00:00:00 2001
2
From: Ryan Pineo <ry@tsl.io>
3
Date: Fri, 12 May 2017 15:45:54 -0400
4
Subject: [PATCH] support version 0.12.0 of configargparse
5
6
fixes #4648
7
8
--- certbot/util.py.orig	2017-05-16 07:21:46 UTC
9
+++ certbot/util.py
10
@@ -437,7 +437,12 @@ def add_deprecated_argument(add_argument
11
             sys.stderr.write(
12
                 "Use of {0} is deprecated.\n".format(option_string))
13
 
14
-    configargparse.ACTION_TYPES_THAT_DONT_NEED_A_VALUE.add(ShowWarning)
15
+    # In version 0.12.0 ACTION_TYPES_THAT_DONT_NEED_A_VALUE was changed from a set
16
+    # to a tuple.
17
+    if isinstance(configargparse.ACTION_TYPES_THAT_DONT_NEED_A_VALUE, set):
18
+        configargparse.ACTION_TYPES_THAT_DONT_NEED_A_VALUE.add(ShowWarning)
19
+    else:
20
+        configargparse.ACTION_TYPES_THAT_DONT_NEED_A_VALUE += (ShowWarning,)
21
     add_argument(argument_name, action=ShowWarning,
22
                  help=argparse.SUPPRESS, nargs=nargs)
23
 

Return to bug 219306