From 0c82f4f4bb78c995b6175a01967b2dc0a1ecb3cb Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Tue, 9 Jul 2024 19:33:30 -0400 Subject: add el8+py3.6 support --- library_info_cli.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'library_info_cli.py') diff --git a/library_info_cli.py b/library_info_cli.py index 49a3b5d..57b9188 100755 --- a/library_info_cli.py +++ b/library_info_cli.py @@ -10,6 +10,7 @@ # Reference: # Improve: # Dependencies: +# dep-almalinux8: python3-requests, python3-dateutil import argparse, sys, json, datetime import library_info_lib @@ -22,7 +23,13 @@ group1 = parser.add_mutually_exclusive_group() group1.add_argument("-s","--single", help="Show this single account.") group1.add_argument("-a","--all", action='store_true', default=True, help="Check all accounts") parser.add_argument("-o","--output", choices=["html","json","raw"], default="raw", help="Output format.") -parser.add_argument("-f","--full", action=argparse.BooleanOptionalAction, default=True, help="Use full image objects or not. They are huge and during debugging it is useful to turn off.") +try: + # This was only added in python 3.9 + parser.add_argument("-f","--full", action=argparse.BooleanOptionalAction, default=True, help="Use full image objects or not. They are huge and during debugging it is useful to turn off.") +except AttributeError: + group2 = parser.add_mutually_exclusive_group() + group2.add_argument("-f","--full", action="store_true", default=True, help="Use full image objects or not. They are huge and during debugging it is useful to turn off.") + group2.add_argument("--no-f","--no-full", action="store_true", default=False) args = parser.parse_args() @@ -78,7 +85,12 @@ def html(items): prn("

Accounts: ") prn(", ".join(seen_accounts)) prn("

\n") - prn("Last modified: " + datetime.datetime.now(datetime.UTC).strftime("%FT%TZ") + "\n") + try: + # fails on python36 on almalinux8 + now = datetime.datetime.now(datetime.UTC) + except AttributeError: + now = datetime.datetime.utcnow() + prn("Last modified: " + now.strftime("%FT%TZ") + "\n") if len(items): prn("\n") prn(f"\n") -- cgit
PatronbarcodedueformatcoverTitle