[tor-commits] [ooni-probe/master] Run ooniresources without any command line options in the setup.py
art at torproject.org
art at torproject.org
Fri Apr 29 09:42:26 UTC 2016
commit a4244fcb6eeb402a606ab99fec6ac1a15e0d8960
Author: Arturo Filastò <arturo at filasto.net>
Date: Sat Apr 23 20:44:37 2016 +0200
Run ooniresources without any command line options in the setup.py
* Print some progress when running oonireport
* Use print function instead of old print
---
ooni/report/tool.py | 23 ++++++++++++++---------
setup.py | 2 +-
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/ooni/report/tool.py b/ooni/report/tool.py
index 5946c42..5c7bcb2 100644
--- a/ooni/report/tool.py
+++ b/ooni/report/tool.py
@@ -1,4 +1,6 @@
+from __future__ import print_function
import yaml
+import sys
from twisted.internet import defer
@@ -49,9 +51,12 @@ def upload(report_file, collector=None, bouncer=None):
report_id = yield oonib_reporter.createReport()
report.header['report_id'] = report_id
yield oonib_report_log.created(report_file, collector, report_id)
+ log.msg("Writing report entries")
for entry in report:
yield oonib_reporter.writeReportEntry(entry)
- log.msg("Closing report.")
+ sys.stdout.write('.')
+ sys.stdout.flush()
+ log.msg("Closing report")
yield oonib_reporter.finish()
yield oonib_report_log.closed(report_file)
@@ -68,24 +73,24 @@ def upload_all(collector=None, bouncer=None):
def print_report(report_file, value):
- print "* %s" % report_file
- print " %s" % value['created_at']
+ print("* %s" % report_file)
+ print(" %s" % value['created_at'])
def status():
oonib_report_log = OONIBReportLog()
- print "Reports to be uploaded"
- print "----------------------"
+ print("Reports to be uploaded")
+ print("----------------------")
for report_file, value in oonib_report_log.reports_to_upload:
print_report(report_file, value)
- print "Reports in progress"
- print "-------------------"
+ print("Reports in progress")
+ print("-------------------")
for report_file, value in oonib_report_log.reports_in_progress:
print_report(report_file, value)
- print "Incomplete reports"
- print "------------------"
+ print("Incomplete reports")
+ print("------------------")
for report_file, value in oonib_report_log.reports_incomplete:
print_report(report_file, value)
diff --git a/setup.py b/setup.py
index 388de5f..1fd9a7b 100644
--- a/setup.py
+++ b/setup.py
@@ -148,7 +148,7 @@ class install(_st_install):
def ooniresources(self):
ooniresources = find_executable("ooniresources")
from subprocess import Popen
- process = Popen([ooniresources, '--update-inputs', '--update-geoip'],
+ process = Popen([ooniresources],
stdout=sys.stdout.fileno(), stderr=sys.stderr.fileno())
process.wait()
More information about the tor-commits
mailing list