From e75257c7d02949985f5e2abc8e3ecec00037382c Mon Sep 17 00:00:00 2001 From: Joel Bender Date: Fri, 24 Feb 2017 09:40:00 -0500 Subject: [PATCH] allow the INI file name to be specified in the environment --- py25/bacpypes/consolelogging.py | 3 ++- py27/bacpypes/consolelogging.py | 3 ++- py34/bacpypes/consolelogging.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/py25/bacpypes/consolelogging.py b/py25/bacpypes/consolelogging.py index 0d7e48f..f6bbda5 100755 --- a/py25/bacpypes/consolelogging.py +++ b/py25/bacpypes/consolelogging.py @@ -25,6 +25,7 @@ _debug = 0 _log = ModuleLogger(globals()) # configuration +BACPYPES_INI = os.getenv('BACPYPES_INI', 'BACpypes.ini') BACPYPES_DEBUG = os.getenv('BACPYPES_DEBUG', '') BACPYPES_COLOR = os.getenv('BACPYPES_COLOR', None) BACPYPES_MAXBYTES = int(os.getenv('BACPYPES_MAXBYTES', 1048576)) @@ -209,7 +210,7 @@ class ConfigArgumentParser(ArgumentParser): # add a way to read a configuration file self.add_argument('--ini', help="device object configuration file", - default="BACpypes.ini", + default=BACPYPES_INI, ) def parse_args(self, *args, **kwargs): diff --git a/py27/bacpypes/consolelogging.py b/py27/bacpypes/consolelogging.py index d6633ef..93fc3f4 100755 --- a/py27/bacpypes/consolelogging.py +++ b/py27/bacpypes/consolelogging.py @@ -19,6 +19,7 @@ _debug = 0 _log = ModuleLogger(globals()) # configuration +BACPYPES_INI = os.getenv('BACPYPES_INI', 'BACpypes.ini') BACPYPES_DEBUG = os.getenv('BACPYPES_DEBUG', '') BACPYPES_COLOR = os.getenv('BACPYPES_COLOR', None) BACPYPES_MAXBYTES = int(os.getenv('BACPYPES_MAXBYTES', 1048576)) @@ -199,7 +200,7 @@ class ConfigArgumentParser(ArgumentParser): # add a way to read a configuration file self.add_argument('--ini', help="device object configuration file", - default="BACpypes.ini", + default=BACPYPES_INI, ) def parse_args(self, *args, **kwargs): diff --git a/py34/bacpypes/consolelogging.py b/py34/bacpypes/consolelogging.py index d1deffe..4deae56 100755 --- a/py34/bacpypes/consolelogging.py +++ b/py34/bacpypes/consolelogging.py @@ -19,6 +19,7 @@ _debug = 0 _log = ModuleLogger(globals()) # configuration +BACPYPES_INI = os.getenv('BACPYPES_INI', 'BACpypes.ini') BACPYPES_DEBUG = os.getenv('BACPYPES_DEBUG', '') BACPYPES_COLOR = os.getenv('BACPYPES_COLOR', None) BACPYPES_MAXBYTES = int(os.getenv('BACPYPES_MAXBYTES', 1048576)) @@ -199,7 +200,7 @@ class ConfigArgumentParser(ArgumentParser): # add a way to read a configuration file self.add_argument('--ini', help="device object configuration file", - default="BACpypes.ini", + default=BACPYPES_INI, ) def parse_args(self, *args, **kwargs):