diff --git a/benchmarks/run-benchmarks.py b/benchmarks/run-benchmarks.py index 73ef96d..275581b 100755 --- a/benchmarks/run-benchmarks.py +++ b/benchmarks/run-benchmarks.py @@ -1,4 +1,24 @@ #!/usr/bin/env python +# +# run-benchmarks.py - some benchmarking code for warcprox +# +# Copyright (C) 2015-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# import sys import aiohttp @@ -89,7 +109,7 @@ class AsyncClient(object): logging.debug("finished reading from %s", url) r.close() break - + @asyncio.coroutine def one_request(self, url): logging.debug("issuing request to %s", url) diff --git a/bin/dump-anydbm b/bin/dump-anydbm index 1d1ae4b..b9200bc 100755 --- a/bin/dump-anydbm +++ b/bin/dump-anydbm @@ -1,5 +1,23 @@ #!/usr/bin/env python -# vim:set sw=4 et: +# +# dump-anydbm - dumps contents of dbm file to stdout +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. # """ @@ -14,7 +32,7 @@ try: whichdb = dbm.whichdb except: - import anydbm + import anydbm dbm = anydbm from whichdb import whichdb diff --git a/bin/warcprox b/bin/warcprox index d978c53..d236cf6 100755 --- a/bin/warcprox +++ b/bin/warcprox @@ -1,5 +1,4 @@ #!/usr/bin/env python -# vim: set sw=4 et: from __future__ import absolute_import diff --git a/setup.py b/setup.py index 66924ae..c33494d 100755 --- a/setup.py +++ b/setup.py @@ -1,4 +1,24 @@ #!/usr/bin/env python +# +# setup.py - setuptools installation config for warcprox +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# from setuptools.command.test import test as TestCommand import sys @@ -30,7 +50,7 @@ except: deps.append('futures') setuptools.setup(name='warcprox', - version='2.0.dev4', + version='2.0.dev5', description='WARC writing MITM HTTP/S proxy', url='https://github.com/internetarchive/warcprox', author='Noah Levitt', diff --git a/tests/Dockerfile b/tests/Dockerfile index 975e767..ab1f01a 100644 --- a/tests/Dockerfile +++ b/tests/Dockerfile @@ -1,3 +1,24 @@ +# +# Dockerfile for warcprox tests +# +# Copyright (C) 2015-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# + FROM phusion/baseimage MAINTAINER Noah Levitt diff --git a/tests/conftest.py b/tests/conftest.py index f417fed..27d4141 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,24 @@ -# vim:set sw=4 et: +# +# tests/conftest.py - command line options for warcprox tests +# +# Copyright (C) 2015-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# + import pytest def pytest_addoption(parser): diff --git a/tests/run-tests.sh b/tests/run-tests.sh index 86e2a7e..b28e606 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -1,9 +1,28 @@ #!/bin/bash # -# Runs tests in a docker container. Also runs a temporary instance of rethinkdb -# inside the container. The tests run with rethinkdb features enabled, against -# that instance of rethinkdb, and also run without rethinkdb features enabled. -# With python 2.7 and 3.4. +# tests/run-tests.sh - Runs tests in a docker container. Also runs a temporary +# instance of rethinkdb inside the container. The tests run with rethinkdb +# features enabled, against that instance of rethinkdb, and also run without +# rethinkdb features enabled. With python 2.7 and 3.4. +# +# tests/conftest.py - command line options for warcprox tests +# +# Copyright (C) 2015-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. # # 😬 # diff --git a/tests/single-threaded-proxy.py b/tests/single-threaded-proxy.py index 69db94c..5954fd1 100755 --- a/tests/single-threaded-proxy.py +++ b/tests/single-threaded-proxy.py @@ -1,4 +1,26 @@ #!/usr/bin/env python +# +# tests/single-threaded-proxy.py - single-threaded recording proxy, useful for +# debugging +# +# Copyright (C) 2015-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# + """Useful for debugging. Does not write warcs.""" from __future__ import absolute_import diff --git a/tests/test_dump-anydbm.py b/tests/test_dump-anydbm.py index 6bb600d..1bc6ccc 100644 --- a/tests/test_dump-anydbm.py +++ b/tests/test_dump-anydbm.py @@ -1,4 +1,24 @@ #!/usr/bin/env python +# +# tests/test_dump-anydbm.py - tests for dump-anydbm +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# import pytest import os diff --git a/tests/test_warcprox.py b/tests/test_warcprox.py index 5dcd4df..6bb99ae 100755 --- a/tests/test_warcprox.py +++ b/tests/test_warcprox.py @@ -1,5 +1,24 @@ #!/usr/bin/env python -# vim: set sw=4 et: +# +# tests/test_warcprox.py - automated tests for warcprox +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# import pytest import threading diff --git a/warcprox/__init__.py b/warcprox/__init__.py index 8afe606..394d8b8 100644 --- a/warcprox/__init__.py +++ b/warcprox/__init__.py @@ -1,10 +1,33 @@ +# +# warcprox/__init__.py - warcprox package main file, contains some utility code +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# + from argparse import Namespace as _Namespace from pkg_resources import get_distribution as _get_distribution __version__ = _get_distribution('warcprox').version def digest_str(hash_obj, base32): import base64 - return hash_obj.name.encode('utf-8') + b':' + (base64.b32encode(hash_obj.digest()) if base32 else hash_obj.hexdigest().encode('ascii')) + return hash_obj.name.encode('utf-8') + b':' + ( + base64.b32encode(hash_obj.digest()) if base32 + else hash_obj.hexdigest().encode('ascii')) class Options(_Namespace): def __getattr__(self, name): diff --git a/warcprox/bigtable.py b/warcprox/bigtable.py index 8aea52c..3f8989a 100644 --- a/warcprox/bigtable.py +++ b/warcprox/bigtable.py @@ -1,3 +1,27 @@ +# +# warcprox/bigtable.py - module for "big" RethinkDB table for deduplication; +# the table is "big" in the sense that it is designed to be usable as an index +# for playback software outside of warcprox, and contains information not +# needed merely for deduplication +# +# Copyright (C) 2015-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# + from __future__ import absolute_import import logging diff --git a/warcprox/controller.py b/warcprox/controller.py index 3c7dfe1..a813345 100644 --- a/warcprox/controller.py +++ b/warcprox/controller.py @@ -1,3 +1,27 @@ +# +# warcprox/controller.py - contains WarcproxController class, responsible for +# starting up and shutting down the various components of warcprox, and for +# sending heartbeats to the service registry if configured to do so; also has +# some memory profiling capabilities +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# + from __future__ import absolute_import import logging diff --git a/warcprox/dedup.py b/warcprox/dedup.py index baa5fc3..eb71cb4 100644 --- a/warcprox/dedup.py +++ b/warcprox/dedup.py @@ -1,3 +1,24 @@ +# +# warcprox/dedup.py - identical payload digest deduplication +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# + from __future__ import absolute_import import logging diff --git a/warcprox/kafkafeed.py b/warcprox/kafkafeed.py index 8f8aea1..e9d2176 100644 --- a/warcprox/kafkafeed.py +++ b/warcprox/kafkafeed.py @@ -1,3 +1,25 @@ +# +# warcprox/kafkafeed.py - support for publishing information about archived +# urls to apache kafka +# +# Copyright (C) 2015-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# + import kafka import datetime import json diff --git a/warcprox/main.py b/warcprox/main.py index de7ce89..6f791d7 100644 --- a/warcprox/main.py +++ b/warcprox/main.py @@ -1,5 +1,25 @@ #!/usr/bin/env python -# vim:set sw=4 et: +# +# warcprox/main.py - entrypoint for warcprox executable, parses command line +# arguments, initializes components, starts controller, handles signals +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# from __future__ import absolute_import diff --git a/warcprox/mitmproxy.py b/warcprox/mitmproxy.py index b8f645e..083f43f 100644 --- a/warcprox/mitmproxy.py +++ b/warcprox/mitmproxy.py @@ -1,3 +1,29 @@ +# +# warcprox/mitmproxy.py - man-in-the-middle http/s proxy code, handles http +# CONNECT method by creating a snakeoil certificate for the requested site, +# calling ssl.wrap_socket() on the client connection; connects to remote +# (proxied) host, possibly using tor if host tld is .onion and tor proxy is +# configured +# +# Copyright (C) 2012 Cygnos Corporation +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# + from __future__ import absolute_import try: diff --git a/warcprox/playback.py b/warcprox/playback.py index 089fc64..2624175 100644 --- a/warcprox/playback.py +++ b/warcprox/playback.py @@ -1,4 +1,24 @@ -# vim:set sw=4 et: +# +# warcprox/playback.py - rudimentary support for playback of urls archived by +# warcprox (not much used or maintained) +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# from __future__ import absolute_import diff --git a/warcprox/stats.py b/warcprox/stats.py index 68f7586..8dd3a86 100644 --- a/warcprox/stats.py +++ b/warcprox/stats.py @@ -1,3 +1,24 @@ +# +# warcprox/stats.py - keeps statistics on what has been proxied, archived +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# + from __future__ import absolute_import import logging diff --git a/warcprox/warc.py b/warcprox/warc.py index 5cba38d..fbc2a33 100644 --- a/warcprox/warc.py +++ b/warcprox/warc.py @@ -1,3 +1,24 @@ +# +# warcprox/warc.py - assembles warc records +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# + from __future__ import absolute_import import logging diff --git a/warcprox/warcproxy.py b/warcprox/warcproxy.py index 9a22545..c41d8e1 100644 --- a/warcprox/warcproxy.py +++ b/warcprox/warcproxy.py @@ -1,10 +1,24 @@ -#!/usr/bin/env python # -""" -WARC writing MITM HTTP/S proxy - -See README.rst or https://github.com/internetarchive/warcprox -""" +# warcprox/warcproxy.py - recording proxy, extends mitmproxy to record traffic, +# enqueue info on the recorded url queue +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# from __future__ import absolute_import diff --git a/warcprox/writer.py b/warcprox/writer.py index 4603c0c..72c292f 100644 --- a/warcprox/writer.py +++ b/warcprox/writer.py @@ -1,4 +1,23 @@ -# vim:set sw=4 et: +# +# warcprox/writer.py - warc writer, manages and writes records to warc files +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# from __future__ import absolute_import diff --git a/warcprox/writerthread.py b/warcprox/writerthread.py index b3d2d9c..002b897 100644 --- a/warcprox/writerthread.py +++ b/warcprox/writerthread.py @@ -1,3 +1,25 @@ +# +# warcprox/writerthread.py - warc writer thread, reads from the recorded url +# queue, writes warc records, runs final tasks after warc records are written +# +# Copyright (C) 2013-2016 Internet Archive +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# + from __future__ import absolute_import try: