commit dd8c48922c294b74ba6ec6a371e6ffbe7c0f14a1 Author: Arturo Filastò art@fuffa.org Date: Mon Sep 1 17:34:25 2014 +0200
Make oonibackend ready for being uploaded to pypi --- ChangeLog.rst | 21 +++++++++++ MANIFEST.in | 13 ++++++- data/archive/empty.txt | 2 + data/decks/README | 1 + data/reports/empty.txt | 2 + data/tor/empty.txt | 2 + setup.py | 96 ++++++++++++++++++++++++++++++++++++++++++++++-- 7 files changed, 132 insertions(+), 5 deletions(-)
diff --git a/ChangeLog.rst b/ChangeLog.rst new file mode 100644 index 0000000..e655e27 --- /dev/null +++ b/ChangeLog.rst @@ -0,0 +1,21 @@ +1.0.2 (Wed, 21 May 2014) +------------------------ + +Various code improvements and fixes following the Least Authority release +engineering work. + +1.0.0 (Wed, 26 Mar 2014) +------------------------ + +First public release of oonibackend + +* Implements collector for receiver reports. + +* Implements HTTPReturnJSONHeaders HTTP helper + +* Implement DNS resolver helper + +* Implements TCP echo helper + +* Implements bouncer for directing directing probes to an adequate collector + and test helper. diff --git a/MANIFEST.in b/MANIFEST.in index 406cfc4..18db7db 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,15 @@ +include data/decks/README +include data/inputs/Makefile +include data/reports/empty.txt +include data/archive/empty.txt +include data/tor/empty.txt +include data/bouncer.yaml +include data/policy.yaml +include oonib.conf.example include requirements.txt include AUTHORS include HACKING include LICENSE -include Manifest.in -include README.md +include MANIFEST.in +include README.rst +include ChangeLog.rst diff --git a/data/archive/empty.txt b/data/archive/empty.txt new file mode 100644 index 0000000..9a166f9 --- /dev/null +++ b/data/archive/empty.txt @@ -0,0 +1,2 @@ +In here will end up the archived reports. +This file may be deleted at any time. diff --git a/data/decks/README b/data/decks/README new file mode 100644 index 0000000..619a189 --- /dev/null +++ b/data/decks/README @@ -0,0 +1 @@ +In here you shall place the decks to be served to clients. diff --git a/data/reports/empty.txt b/data/reports/empty.txt new file mode 100644 index 0000000..7e24f09 --- /dev/null +++ b/data/reports/empty.txt @@ -0,0 +1,2 @@ +In here will end up reports in progress. +This file may be deleted at any time. diff --git a/data/tor/empty.txt b/data/tor/empty.txt new file mode 100644 index 0000000..ec3be8f --- /dev/null +++ b/data/tor/empty.txt @@ -0,0 +1,2 @@ +In here will end up all tor related files. +This file may be deleted at any time. diff --git a/setup.py b/setup.py index c9a2dc4..c8d374e 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,11 @@ from __future__ import with_statement
+import os +import sys from oonib import __version__ from setuptools import setup, find_packages +from setuptools.command import install +
def get_requirements(): with open('requirements.txt', 'r') as f: @@ -25,16 +29,102 @@ def get_requirements():
return pypi_packages, dependency_links
+usr_share_path = '/usr/share' +var_path = '/var' +etc_path = '/etc' +# If this is true then it means we are in a virtualenv +# therefore we should not place our data files inside /usr/share/ooni, but +# place them inside the virtual env system prefix. +if hasattr(sys, 'real_prefix'): + usr_share_path = os.path.abspath(os.path.join(sys.prefix, 'share')) + var_path = os.path.abspath(os.path.join(sys.prefix, 'var')) + etc_path = os.path.abspath(os.path.join(sys.prefix, 'etc')) + +data_dir = os.path.join(usr_share_path, 'ooni', 'backend') +spool_dir = os.path.join(var_path, 'spool', 'ooni', 'backend') +var_dir = os.path.join(var_path, 'spool', 'ooni', 'backend') + +def install_config_file(self): + print "Writing the default configuration file to %s" % etc_path + if not os.path.isdir(etc_path): + os.makedirs(etc_path) + import yaml + example_config = yaml.safe_load(open('oonib.conf.example')) + example_config['main']['report_dir'] = os.path.join(spool_dir, 'reports') + example_config['main']['archive_dir'] = os.path.join(spool_dir, 'archive') + example_config['main']['deck_dir'] = os.path.join(data_dir, 'decks') + example_config['main']['input_dir'] = os.path.join(data_dir, 'inputs') + example_config['main']['policy_file'] = os.path.join(var_dir, 'policy.yaml') + example_config['main']['bouncer_file'] = os.path.join(var_dir, 'bouncer.yaml') + example_config['main']['tor_datadir'] = os.path.join(var_dir, 'tor') + + with open(os.path.join(etc_path, 'oonibackend.conf'), 'w+') as fw: + yaml.dump(example_config, fw, default_flow_style=False) + +install.install.sub_commands.append(('install_config_file', install_config_file)) + +data_files = [ + (data_dir, ['oonib.conf.example']), + (os.path.join(data_dir, 'decks'), ['data/decks/README']), + (os.path.join(data_dir, 'inputs'), ['data/inputs/Makefile']), + (os.path.join(spool_dir, 'reports'), ['data/reports/empty.txt']), + (os.path.join(spool_dir, 'archive'), ['data/archive/empty.txt']), + (os.path.join(var_dir, 'tor'), ['data/tor/empty.txt']), + (var_dir, ['data/bouncer.yaml', 'data/policy.yaml']) +] + +with open('README.rst') as f: + readme = f.read() + +with open('ChangeLog.rst') as f: + changelog = f.read() + install_requires, dependency_links = get_requirements() setup( - name="oonib", + name="oonibackend", version=__version__, author="The Tor Project, Inc", url="https://ooni.torproject.org", - license="LICENSE", - description="OONI-Probe Backend", + license="BSD 2 clause", + description="Open Observatory of Network Interference Backend", + long_description=readme + '\n\n' + changelog, scripts=["bin/oonib", "bin/oonibadmin", "bin/archive_oonib_reports"], packages=find_packages(), + data_files=data_files, install_requires=install_requires, dependency_links=dependency_links, + classifiers=( + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Framework :: Twisted", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: End Users/Desktop", + "Intended Audience :: Information Technology", + "Intended Audience :: Science/Research", + "Intended Audience :: Telecommunications Industry", + "License :: OSI Approved :: BSD License" + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2 :: Only", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX", + "Operating System :: POSIX :: BSD", + "Operating System :: POSIX :: BSD :: BSD/OS", + "Operating System :: POSIX :: BSD :: FreeBSD", + "Operating System :: POSIX :: BSD :: NetBSD", + "Operating System :: POSIX :: BSD :: OpenBSD", + "Operating System :: POSIX :: Linux", + "Operating System :: Unix", + "Topic :: Scientific/Engineering :: Information Analysis", + "Topic :: Security", + "Topic :: Security :: Cryptography", + "Topic :: Software Development :: Libraries :: Application Frameworks", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: Testing", + "Topic :: Software Development :: Testing :: Traffic Generation", + "Topic :: System :: Networking :: Monitoring", + ) )
tor-commits@lists.torproject.org