]> git.wh0rd.org - home.git/commitdiff
le-renew: drop Python 2 logic
authorMike Frysinger <vapier@gmail.com>
Sat, 22 Aug 2026 16:36:38 +0000 (23:36 +0700)
committerMike Frysinger <vapier@gmail.com>
Sat, 22 Aug 2026 16:36:38 +0000 (23:36 +0700)
.bin/le-renew

index 58e687b0b7a34ca56356ed60efcbe3fc283515ce..c274e68b4ccbff4ef7c337839ee2dac456e714f5 100755 (executable)
@@ -1,5 +1,4 @@
-#!/usr/bin/python
-#-*- coding:utf-8 -*-
+#!/usr/bin/env python3
 # pylint: disable=invalid-name
 
 """Renew Let's Encrypt certs!
@@ -10,20 +9,12 @@ $ certbot certonly --webroot \\
     --webroot-path /var/www/rss/ -d rss.wh0rd.org
 """
 
-from __future__ import print_function
-
 import argparse
-try:
-    import configparser
-except ImportError:
-    import ConfigParser as configparser
+import configparser
 import cryptography.hazmat.backends
 from cryptography import x509
-try:
-    from cStringIO import StringIO
-except ImportError:
-    from io import StringIO
 import datetime
+import io
 import logging
 import logging.handlers
 import os
@@ -90,7 +81,7 @@ def load_conf(domain):
     path = os.path.join(LE_BASE, 'renewal', domain + '.conf')
     # The config file format is almost enough for the configparser.
     # We need to insert a section header for the first few items.
-    fp = StringIO()
+    fp = io.StringIO()
     fp.write('[globals]\n')
     fp.write(open(path).read())
     fp.seek(0)