2015-08-24 23:53:11 +00:00
|
|
|
from argparse import Namespace as _Namespace
|
2015-07-30 00:12:59 +00:00
|
|
|
|
|
|
|
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'))
|
|
|
|
|
2014-11-15 03:20:05 -08:00
|
|
|
def _read_version_bytes():
|
|
|
|
import os
|
|
|
|
version_txt = os.path.sep.join(__file__.split(os.path.sep)[:-1] + ['version.txt'])
|
|
|
|
with open(version_txt, 'rb') as fin:
|
|
|
|
return fin.read().strip()
|
|
|
|
|
2015-08-24 23:53:11 +00:00
|
|
|
class Options(_Namespace):
|
|
|
|
def __getattr__(self, name):
|
|
|
|
try:
|
|
|
|
return super(Options, self).__getattr__(self, name)
|
|
|
|
except AttributeError:
|
|
|
|
return None
|
|
|
|
|
2014-11-15 03:20:05 -08:00
|
|
|
version_bytes = _read_version_bytes().strip()
|
|
|
|
version_str = version_bytes.decode('utf-8')
|
2015-08-24 23:53:11 +00:00
|
|
|
|
2015-09-16 18:19:20 +00:00
|
|
|
# XXX linux-specific
|
2015-09-04 21:00:04 +00:00
|
|
|
def gettid():
|
|
|
|
try:
|
|
|
|
import ctypes
|
|
|
|
libc = ctypes.cdll.LoadLibrary('libc.so.6')
|
|
|
|
SYS_gettid = 186
|
|
|
|
tid = libc.syscall(SYS_gettid)
|
|
|
|
return tid
|
|
|
|
except:
|
2015-09-16 18:19:20 +00:00
|
|
|
logging.warn("gettid failed?", exc_info=True)
|
2015-09-04 21:00:04 +00:00
|
|
|
|
2015-08-24 23:53:11 +00:00
|
|
|
import warcprox.controller as controller
|
|
|
|
import warcprox.playback as playback
|
|
|
|
import warcprox.dedup as dedup
|
|
|
|
import warcprox.warcproxy as warcproxy
|
|
|
|
import warcprox.mitmproxy as mitmproxy
|
|
|
|
import warcprox.writer as writer
|
|
|
|
import warcprox.warc as warc
|
|
|
|
import warcprox.writerthread as writerthread
|
|
|
|
import warcprox.stats as stats
|
2015-08-25 01:26:51 +00:00
|
|
|
import warcprox.bigtable as bigtable
|
2015-09-04 01:33:19 +00:00
|
|
|
import warcprox.kafkafeed as kafkafeed
|