def set_paths(self, ooni_home=None): if ooni_home: self._custom_home = ooni_home self.nettest_directory = os.path.join(get_ooni_root(), 'nettests') self.inputs_directory = os.path.join(self.ooni_home, 'inputs') self.decks_directory = os.path.join(self.ooni_home, 'decks') self.reports_directory = os.path.join(self.ooni_home, 'reports') self.resources_directory = os.path.join(self.data_directory, "resources") if self.advanced.report_log_file: self.report_log_file = self.advanced.report_log_file else: self.report_log_file = os.path.join(self.ooni_home, 'reporting.yml') if self.global_options.get('configfile'): config_file = self.global_options['configfile'] self.config_file = expanduser(config_file) else: self.config_file = os.path.join(self.ooni_home, 'ooniprobe.conf') if 'logfile' in self.basic: self.basic.logfile = expanduser( self.basic.logfile.replace('~', '~' + self.current_user))
def set_paths(self): self.nettest_directory = os.path.join(get_ooni_root(), 'nettests') if self.advanced.inputs_dir: self.inputs_directory = self.advanced.inputs_dir else: self.inputs_directory = os.path.join(self.ooni_home, 'inputs') if self.advanced.decks_dir: self.decks_directory = self.advanced.decks_dir else: self.decks_directory = os.path.join(self.ooni_home, 'decks') self.reports_directory = os.path.join(self.ooni_home, 'reports') self.resources_directory = os.path.join(self.data_directory, "resources") if self.advanced.report_log_file: self.report_log_file = self.advanced.report_log_file else: self.report_log_file = os.path.join(self.ooni_home, 'reporting.yml') if self.global_options.get('configfile'): config_file = self.global_options['configfile'] self.config_file = expanduser(config_file) else: self.config_file = os.path.join(self.ooni_home, 'ooniprobe.conf') if 'logfile' in self.basic: self.basic.logfile = expanduser(self.basic.logfile.replace( '~', '~'+self.current_user))
def embedded_settings(self, category, option): embedded_settings = os.path.join(get_ooni_root(), 'settings.ini') if os.path.isfile(embedded_settings): settings = SafeConfigParser() with open(embedded_settings) as fp: settings.readfp(fp) return settings.get(category, option) return None
def data_directory_candidates(self): dirs = [ os.path.join(expanduser('~' + self.current_user), '.ooni'), self.var_lib_path, self.usr_share_path, os.path.join(get_ooni_root(), '..', 'data'), '/usr/share/' ] if os.getenv("OONI_DATA_DIR"): dirs.insert(0, os.getenv("OONI_DATA_DIR")) if self.global_options.get('datadir'): dirs.insert(0, abspath(expanduser(self.global_options['datadir']))) return dirs
def data_directory_candidates(self): dirs = [ os.path.join(expanduser('~'+self.current_user), '.ooni'), self.var_lib_path, self.usr_share_path, os.path.join(get_ooni_root(), '..', 'data'), '/usr/share/' ] if os.getenv("OONI_DATA_DIR"): dirs.insert(0, os.getenv("OONI_DATA_DIR")) if self.global_options.get('datadir'): dirs.insert(0, abspath(expanduser(self.global_options['datadir']))) return dirs
"webui_port": 8842, "webui_address": "127.0.0.1", "webui_disabled": False }, "tor": { "socks_port": None, "control_port": None, "bridges": None, "data_dir": None, "timeout": 400, "torrc": {} } } # This is the root of the ooniprobe source code tree OONIPROBE_ROOT = get_ooni_root() IS_VIRTUALENV = False if hasattr(sys, 'real_prefix'): IS_VIRTUALENV = True # These are the the embedded settings _SETTINGS_INI = os.path.join(OONIPROBE_ROOT, 'settings.ini') # This can be overridden by an environment variable for end to end testing if 'OONIPROBE_SETTINGS' in os.environ: _SETTINGS_INI = os.environ['OONIPROBE_SETTINGS'] USR_SHARE_PATH = '/usr/share/ooni' VAR_LIB_PATH = '/var/lib/ooni' ETC_PATH = '/etc'
"webui_port": 8842, "webui_address": "127.0.0.1", "webui_disabled": False }, "tor": { "socks_port": None, "control_port": None, "bridges": None, "data_dir": None, "timeout": 400, "torrc": {} } } # This is the root of the ooniprobe source code tree OONIPROBE_ROOT = get_ooni_root() IS_VIRTUALENV = False if hasattr(sys, 'real_prefix'): IS_VIRTUALENV = True # These are the the embedded settings _SETTINGS_INI = os.path.join(OONIPROBE_ROOT, 'settings.ini') # This can be overridden by an environment variable for end to end testing if 'OONIPROBE_SETTINGS' in os.environ: _SETTINGS_INI = os.environ['OONIPROBE_SETTINGS'] USR_SHARE_PATH = os.getenv('HOME') + '/.ooni'#'/usr/share/ooni' VAR_LIB_PATH = '/var/lib/ooni' ETC_PATH = '/etc'