pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

py-cvss: Refactor the handling of EOF



Module Name:	pkgsrc-wip
Committed By:	Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By:	leot
Date:		Thu Jun 21 20:44:47 2018 +0200
Changeset:	f8512230c89f301cc83c22dece83349405e68f20

Modified Files:
	py-cvss/distinfo
Added Files:
	py-cvss/patches/patch-cvss_cvss__calculator.py
Removed Files:
	py-cvss/patches/patch-cvss_interactive.py

Log Message:
py-cvss: Refactor the handling of EOF

Catching an exception and then raising a different one feels a bit
hackish...  instead of doing that directly catch EOFError in the same try-except
block of KeyboardInterrupt.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=f8512230c89f301cc83c22dece83349405e68f20

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 py-cvss/distinfo                               |  2 +-
 py-cvss/patches/patch-cvss_cvss__calculator.py | 15 +++++++++++++++
 py-cvss/patches/patch-cvss_interactive.py      | 18 ------------------
 3 files changed, 16 insertions(+), 19 deletions(-)

diffs:
diff --git a/py-cvss/distinfo b/py-cvss/distinfo
index 1f9cf03d45..68dfbe8340 100644
--- a/py-cvss/distinfo
+++ b/py-cvss/distinfo
@@ -4,6 +4,6 @@ SHA1 (cvss-1.7.tar.gz) = 76ebd64e66783ce615db34ac46a67674bca0934e
 RMD160 (cvss-1.7.tar.gz) = 3e32f253d4cbe91696fc13cda29a77878eaa52f6
 SHA512 (cvss-1.7.tar.gz) = e2437afd1cd3aceb5884fc1d3203d9be0308591dbecbecaa3c8284f22efc6703797cc75ecaf79e136f3b987562552cccd6b4092b3354d05e9de0bbd97dfc57e0
 Size (cvss-1.7.tar.gz) = 3178715 bytes
-SHA1 (patch-cvss_interactive.py) = 8438eb1c80592ccf3addb38c077e89c7e4167999
+SHA1 (patch-cvss_cvss__calculator.py) = 8364cffab57e8dbc3c1de56ec21208e8659eb2b3
 SHA1 (patch-tests_test__cvss2.py) = 9f1c51bf48d944b30bbe58cd3e3e232325e28f99
 SHA1 (patch-tests_test__cvss3.py) = 83de56438bf4a95b1737cc48fd4bba6ab553d54e
diff --git a/py-cvss/patches/patch-cvss_cvss__calculator.py b/py-cvss/patches/patch-cvss_cvss__calculator.py
new file mode 100644
index 0000000000..6cc1b5d049
--- /dev/null
+++ b/py-cvss/patches/patch-cvss_cvss__calculator.py
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Gracefully handle possible ^D and treat it like a ^C.
+
+--- cvss/cvss_calculator.py.orig	2017-01-11 09:11:40.000000000 +0000
++++ cvss/cvss_calculator.py
+@@ -66,7 +66,7 @@ def main():
+                     print(scores[i])
+             print('Cleaned vector:       ', cvss_vector.clean_vector())
+             print('Red Hat vector:       ', cvss_vector.rh_vector())
+-    except KeyboardInterrupt:
++    except (KeyboardInterrupt, EOFError):
+         print()
+ 
+ 
diff --git a/py-cvss/patches/patch-cvss_interactive.py b/py-cvss/patches/patch-cvss_interactive.py
deleted file mode 100644
index 50d4071e2a..0000000000
--- a/py-cvss/patches/patch-cvss_interactive.py
+++ /dev/null
@@ -1,18 +0,0 @@
-$NetBSD$
-
-Gracefully handle possible ^D and treat it like a ^C.
-
---- cvss/interactive.py.orig	2018-06-21 08:24:26.154082541 +0000
-+++ cvss/interactive.py
-@@ -95,7 +95,10 @@ def ask_interactively(version=3, all_met
-         while True:
-             print(METRICS_ABBREVIATIONS[metric] + ':', end=' ')
-             print('/'.join(values), end=' ')
--            input_value = string_input().upper()
-+            try:
-+                input_value = string_input().upper()
-+            except EOFError:
-+                raise KeyboardInterrupt('EOF')
-             if not input_value:
-                 if version == 2:
-                     input_value = 'ND'


Home | Main Index | Thread Index | Old Index