From f5b37987212d21c4dbca539659a6931dbbb53d6d Mon Sep 17 00:00:00 2001 From: luke7858 Date: Wed, 5 Aug 2020 09:51:20 +0100 Subject: [PATCH 1/5] Fixed 'PF_DIR' is not defined error --- postfixbuddy.py | 1 + 1 file changed, 1 insertion(+) diff --git a/postfixbuddy.py b/postfixbuddy.py index 97dee12..d1cb032 100755 --- a/postfixbuddy.py +++ b/postfixbuddy.py @@ -50,6 +50,7 @@ def get_options(): # All variables defined in this script reply on finding the queue_directory. # This defines the PF_DIR variable which is called later on. +PF_DIR = None try: GET_QUEUE_DIR = subprocess.Popen(['/usr/sbin/postconf', '-h', 'queue_directory'], From 2d72e08e4df86448bdc6ea855f96e683969c818f Mon Sep 17 00:00:00 2001 From: dsgnr Date: Tue, 6 Jul 2021 19:02:17 +0100 Subject: [PATCH 2/5] Bump version --- postfixbuddy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postfixbuddy.py b/postfixbuddy.py index d1cb032..06abe08 100755 --- a/postfixbuddy.py +++ b/postfixbuddy.py @@ -13,7 +13,7 @@ from subprocess import call -__version__ = '0.1.0' +__version__ = '0.2.0' def get_options(): From fa81d71c497f6ccb50770a8784091d00d622d462 Mon Sep 17 00:00:00 2001 From: dsgnr Date: Tue, 6 Jul 2021 19:02:41 +0100 Subject: [PATCH 3/5] Fix nonetype --- postfixbuddy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postfixbuddy.py b/postfixbuddy.py index 06abe08..f67188c 100755 --- a/postfixbuddy.py +++ b/postfixbuddy.py @@ -50,7 +50,7 @@ def get_options(): # All variables defined in this script reply on finding the queue_directory. # This defines the PF_DIR variable which is called later on. -PF_DIR = None +PF_DIR = '' try: GET_QUEUE_DIR = subprocess.Popen(['/usr/sbin/postconf', '-h', 'queue_directory'], From fca5840cb7cc0f28577158dbe3e5449d900b065f Mon Sep 17 00:00:00 2001 From: dsgnr Date: Tue, 6 Jul 2021 19:03:07 +0100 Subject: [PATCH 4/5] Correct bytes to str in py3 --- postfixbuddy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postfixbuddy.py b/postfixbuddy.py index f67188c..527e992 100755 --- a/postfixbuddy.py +++ b/postfixbuddy.py @@ -58,7 +58,7 @@ def get_options(): stderr=subprocess.PIPE) OUTPUT, ERROR = GET_QUEUE_DIR.communicate() if OUTPUT: - PF_DIR = OUTPUT.split()[0] + PF_DIR = OUTPUT.split()[0].decode('utf-8') except OSError: pass From 215a2d67c041d668c44540195b8d5f7ea908d594 Mon Sep 17 00:00:00 2001 From: dsgnr Date: Tue, 6 Jul 2021 19:13:42 +0100 Subject: [PATCH 5/5] Bump version --- .pylintrc | 3 ++- postfixbuddy.py | 8 ++++---- requirements.txt | 7 ++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.pylintrc b/.pylintrc index 6b2ea7b..9e0a288 100644 --- a/.pylintrc +++ b/.pylintrc @@ -62,7 +62,8 @@ disable=missing-docstring, pointless-statement, too-many-return-statements, unused-import, - unused-variable + unused-variable, + consider-using-with # Enable the message, report, category or checker with the given id(s). You can diff --git a/postfixbuddy.py b/postfixbuddy.py index 527e992..06246bc 100755 --- a/postfixbuddy.py +++ b/postfixbuddy.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# postfixbuddy.py created by Daniel Hand (daniel.hand@rackspace.co.uk) +# postfixbuddy.py created by Daniel Hand (email@danielhand.io) # This is a recreation of pfHandle.perl but in Python. from __future__ import absolute_import, division, print_function @@ -7,13 +7,13 @@ # Standard Library import argparse import os -from os.path import join -import sys import subprocess +import sys +from os.path import join from subprocess import call -__version__ = '0.2.0' +__version__ = '0.3.0' def get_options(): diff --git a/requirements.txt b/requirements.txt index 9960e07..e30f77a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ -pylint==1.8.1 -pycodestyle==2.5.0 -pytest==3.2.3 +pylint==2.9.3 +pycodestyle==2.7.0 +pytest==6.2.4 +isort==5.9.1