commit b66e5581519e4b231459cb2157fb73fd0340f7a5 Author: Arturo Filastò art@fuffa.org Date: Thu Nov 13 12:46:46 2014 +0100
Delete settings.ini and only create it when building --- ooni/settings.ini | 3 --- ooni/settings.py | 5 +++-- setup.py | 4 +--- 3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/ooni/settings.ini b/ooni/settings.ini deleted file mode 100644 index 52fb901..0000000 --- a/ooni/settings.ini +++ /dev/null @@ -1,3 +0,0 @@ -[directories] -data_dir = /var/lib/ooni/ - diff --git a/ooni/settings.py b/ooni/settings.py index 8496c16..5ad622d 100644 --- a/ooni/settings.py +++ b/ooni/settings.py @@ -34,18 +34,19 @@ class OConfig(object):
@property def data_directory(self): + embedded_settings = os.path.join(get_ooni_root(), 'settings.ini') if os.getenv("OONI_DATA_DIR"): return os.getenv("OONI_DATA_DIR") elif self.global_options.get('datadir'): return abspath(expanduser(self.global_options['datadir'])) elif self.advanced.get('data_dir'): return self.advanced['data_dir'] - else: - embedded_settings = os.path.join(get_ooni_root(), 'settings.ini') + elif os.path.isfile(embedded_settings): settings = SafeConfigParser() with open(embedded_settings) as fp: settings.readfp(fp) return os.path.abspath(settings.get("directories", "data_dir")) + return abspath(os.path.join(get_ooni_root(), '..', 'data'))
def set_paths(self, ooni_home=None): if ooni_home: diff --git a/setup.py b/setup.py index d06540b..1e67c1d 100644 --- a/setup.py +++ b/setup.py @@ -44,8 +44,6 @@ class install(_st_install): ] ) settings = SafeConfigParser() - with open("ooni/settings.ini") as fp: - settings.readfp(fp) settings.set("directories", "data_dir", os.path.join(share_path, "ooni")) with open("ooni/settings.ini", "w+") as fp: @@ -106,7 +104,7 @@ setup( package_dir={'ooni': 'ooni'}, data_files=data_files, packages=packages, - include_package_data = True, + include_package_data=True, scripts=["bin/oonideckgen", "bin/ooniprobe", "bin/oonireport", "bin/ooniresources"], dependency_links=dependency_links,
tor-commits@lists.torproject.org