[tor-commits] [ooni-probe/master] Annotate reports with the platform on which they are running. (#632)
art at torproject.org
art at torproject.org
Fri Oct 14 19:00:56 UTC 2016
commit 4ef87a3b47e6939b8dfdddf674e5dccc22747cb0
Author: Arturo Filastò <arturo at filasto.net>
Date: Fri Oct 14 11:56:57 2016 +0200
Annotate reports with the platform on which they are running. (#632)
---
ooni/nettest.py | 2 ++
ooni/settings.py | 15 +++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/ooni/nettest.py b/ooni/nettest.py
index 1bb5678..5d33342 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -172,6 +172,8 @@ class NetTestLoader(object):
annotations={}):
self.options = options
self.annotations = annotations
+ self.annotations['platform'] = self.annotations.get('platform',
+ config.platform)
self.requiresTor = False
diff --git a/ooni/settings.py b/ooni/settings.py
index 44bd8dc..ef220ca 100644
--- a/ooni/settings.py
+++ b/ooni/settings.py
@@ -3,6 +3,7 @@ import sys
import yaml
import errno
import getpass
+import platform
from ConfigParser import SafeConfigParser
from twisted.internet import defer, reactor
@@ -325,6 +326,20 @@ class OConfig(object):
self.advanced.webui_port
)
+ @property
+ def platform(self):
+ if os.path.exists('/etc/default/lepidopter'):
+ return 'lepidopter'
+ system = platform.system()
+ if system == 'Darwin':
+ return 'macos'
+ elif system == 'Linux':
+ return 'linux'
+ elif system == 'Windows':
+ # Really?
+ return 'windows'
+ return 'unknown'
+
def get_data_file_path(self, file_name):
for target_dir in self.data_directory_candidates:
file_path = os.path.join(target_dir, file_name)
More information about the tor-commits
mailing list