[tor-commits] [ooni-probe/master] Add oonideckgen and ooniresources to setup.py
art at torproject.org
art at torproject.org
Tue Sep 2 23:20:50 UTC 2014
commit 2397c14fe4c0a8862976bf359b340c573af52780
Author: Arturo Filastò <art at fuffa.org>
Date: Tue Aug 12 18:32:44 2014 +0200
Add oonideckgen and ooniresources to setup.py
---
bin/oonireport | 3 ++-
ooni/settings.py | 1 +
ooni/utils/__init__.py | 14 ++++++++++++++
setup.py | 5 ++++-
4 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/bin/oonireport b/bin/oonireport
index 4e6d48a..3a06b3b 100755
--- a/bin/oonireport
+++ b/bin/oonireport
@@ -7,6 +7,7 @@ sys.path.insert(0, os.path.abspath(os.getcwd()))
from twisted.internet import defer, reactor
+from ooni.utils import log
from ooni.report import cli
def failed(failure):
@@ -20,7 +21,7 @@ def done(result):
def start():
d = defer.maybeDeferred(cli.run)
d.addCallback(done)
- d.addErrback(done)
+ d.addErrback(failed)
reactor.callWhenRunning(start)
reactor.run()
diff --git a/ooni/settings.py b/ooni/settings.py
index a2a56b8..130ce2e 100644
--- a/ooni/settings.py
+++ b/ooni/settings.py
@@ -54,6 +54,7 @@ class OConfig(object):
self.decks_directory = os.path.join(self.ooni_home, 'decks')
self.reports_directory = os.path.join(self.ooni_home, 'reports')
self.report_log_file = os.path.join(self.ooni_home, 'reporting.yml')
+ self.resources_directory = os.path.join(self.data_directory, "resources")
if self.global_options.get('configfile'):
config_file = self.global_options['configfile']
diff --git a/ooni/utils/__init__.py b/ooni/utils/__init__.py
index ec1b1ce..5050e14 100644
--- a/ooni/utils/__init__.py
+++ b/ooni/utils/__init__.py
@@ -3,6 +3,8 @@ import random
import glob
import os
+from zipfile import ZipFile
+
from ooni import otime
from ooni import errors
@@ -142,3 +144,15 @@ def sanitize_options(options):
option = os.path.basename(option)
sanitized_options.append(option)
return sanitized_options
+
+def unzip(filename, dst):
+
+ assert filename.endswith('.zip')
+ dst_path = os.path.join(
+ dst,
+ os.path.basename(filename).replace(".zip", "")
+ )
+ with open(filename) as zfp:
+ zip_file = ZipFile(zfp)
+ zip_file.extractall(dst_path)
+ return dst_path
diff --git a/setup.py b/setup.py
index b19cb47..006c289 100644
--- a/setup.py
+++ b/setup.py
@@ -73,6 +73,7 @@ for root, dirs, file_names in os.walk('data/'):
packages=[
'ooni',
'ooni.api',
+ 'ooni.deckgen',
'ooni.kit',
'ooni.nettests',
'ooni.nettests.manipulation',
@@ -81,6 +82,7 @@ packages=[
'ooni.nettests.blocking',
'ooni.nettests.third_party',
'ooni.report',
+ 'ooni.resources',
'ooni.templates',
'ooni.tests',
'ooni.utils'
@@ -113,7 +115,8 @@ setup(
package_dir={'ooni': 'ooni'},
data_files=data_files,
packages=packages,
- scripts=["bin/ooniprobe", "bin/oonireport"],
+ scripts=["bin/oonideckgen", "bin/ooniprobe",
+ "bin/oonireport", "bin/ooniresources"],
dependency_links=dependency_links,
install_requires=install_requires,
classifiers=(
More information about the tor-commits
mailing list