[tor-commits] [sbws/master] Remove is_initted and add config paths

pastly at torproject.org pastly at torproject.org
Thu Aug 9 14:21:20 UTC 2018


commit 4e73693a132a28e53f9f646c0841fd344bace785
Author: juga0 <juga at riseup.net>
Date:   Wed Jul 18 19:56:08 2018 +0000

    Remove is_initted and add config paths
---
 sbws/globals.py | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/sbws/globals.py b/sbws/globals.py
index a00cfb1..56597b1 100644
--- a/sbws/globals.py
+++ b/sbws/globals.py
@@ -8,10 +8,6 @@ RESULT_VERSION = 4
 WIRE_VERSION = 1
 SPEC_VERSION = '1.1.0'
 
-PKG_DIR = os.path.abspath(os.path.dirname(__file__))
-
-SOCKET_TIMEOUT = 60  # seconds
-
 # This is a dictionary of torrc options we always want to set when launching
 # Tor and that do not depend on any runtime configuration
 TORRC_STARTING_POINT = {
@@ -27,23 +23,17 @@ TORRC_STARTING_POINT = {
     'UseMicrodescriptors': '0',
 }
 
+PKG_DIR = os.path.abspath(os.path.dirname(__file__))
+DEFAULT_CONFIG_PATH = os.path.join(PKG_DIR, 'config.default.ini')
+DEFAULT_LOG_CONFIG_PATH = os.path.join(PKG_DIR, 'config.log.default.ini')
+MINIMUM_USER_CONFIG_PATH = os.path.join(PKG_DIR, 'config.user.ini')
+USER_CONFIG_PATH = os.path.join(os.path.expanduser('~'), '.sbws.ini')
+
+SOCKET_TIMEOUT = 60  # seconds
 SCALE_CONSTANT = 7500
 BW_LINE_SIZE = 510
 
 
-def is_initted(d):
-    if not os.path.isdir(d):
-        log.debug('%s not initialized: %s doesn\'t exist', d, d)
-        return False
-    conf_fnames = [os.path.join(d, 'config.ini')]
-    for fname in conf_fnames:
-        if not os.path.isfile(fname):
-            log.debug('%s not initialized: missing %s', d, fname)
-            return False
-    log.debug('%s seems initialized.', d)
-    return True
-
-
 def fail_hard(*a, **kw):
     ''' Log something ... and then exit as fast as possible '''
     log.critical(*a, **kw)





More information about the tor-commits mailing list