summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-12-27 03:09:34 +0900
committerkali <kali@leap.se>2012-12-27 03:09:34 +0900
commitb4af406e6cf233d939e3dfa5b5c9b2241b6d8ea0 (patch)
tree705a6648ca850000ed07fc65c9d03dc049a9784e
parent1834c0e5207d3edb0002558715aaf30676e6d847 (diff)
import fixes for soledad
-rw-r--r--pkg/test-requirements.pip2
-rw-r--r--src/leap/__init__.py3
-rw-r--r--src/leap/soledad/__init__.py11
-rw-r--r--src/leap/soledad/backends/__init__.py5
-rw-r--r--src/leap/soledad/backends/couch.py5
-rw-r--r--src/leap/soledad/backends/leap_backend.py (renamed from src/leap/soledad/backends/leap.py)5
-rw-r--r--src/leap/soledad/backends/objectstore.py7
-rw-r--r--src/leap/soledad/tests/test_couch.py4
-rw-r--r--src/leap/soledad/tests/test_encrypted.py4
-rw-r--r--src/leap/soledad/tests/test_logs.py3
-rw-r--r--src/leap/soledad/tests/test_sqlcipher.py6
11 files changed, 34 insertions, 21 deletions
diff --git a/pkg/test-requirements.pip b/pkg/test-requirements.pip
index 081d5479..11ccf4eb 100644
--- a/pkg/test-requirements.pip
+++ b/pkg/test-requirements.pip
@@ -1,4 +1,4 @@
-unittest2
+unittest2 # TODO we should include this dep only for python2.6
coverage
mock
nose
diff --git a/src/leap/__init__.py b/src/leap/__init__.py
index 5e003931..2adbb34a 100644
--- a/src/leap/__init__.py
+++ b/src/leap/__init__.py
@@ -6,8 +6,9 @@ website: U{https://leap.se/}
from leap import eip
from leap import baseapp
from leap import util
+from leap import soledad
-__all__ = [eip, baseapp, util]
+__all__ = [eip, baseapp, util, soledad]
__version__ = "unknown"
try:
diff --git a/src/leap/soledad/__init__.py b/src/leap/soledad/__init__.py
index 2caee108..c0146715 100644
--- a/src/leap/soledad/__init__.py
+++ b/src/leap/soledad/__init__.py
@@ -5,9 +5,11 @@
import os
import string
import random
-import cStringIO
+#import cStringIO
import hmac
-from util import GPGWrapper
+
+import util
+
class Soledad(object):
@@ -22,7 +24,7 @@ class Soledad(object):
os.makedirs(self.PREFIX)
if not gpghome:
gpghome = self.GNUPG_HOME
- self._gpg = GPGWrapper(gpghome=gpghome)
+ self._gpg = util.GPGWrapper(gpghome=gpghome)
# load/generate OpenPGP keypair
if not self._has_openpgp_keypair():
self._gen_openpgp_keypair()
@@ -156,3 +158,6 @@ class Soledad(object):
Synchronize with LEAP server.
"""
pass
+
+
+__all__ = ['util']
diff --git a/src/leap/soledad/backends/__init__.py b/src/leap/soledad/backends/__init__.py
index e69de29b..72907f37 100644
--- a/src/leap/soledad/backends/__init__.py
+++ b/src/leap/soledad/backends/__init__.py
@@ -0,0 +1,5 @@
+import objectstore
+
+
+__all__ = [
+ 'objectstore']
diff --git a/src/leap/soledad/backends/couch.py b/src/leap/soledad/backends/couch.py
index ed356fdd..a3909596 100644
--- a/src/leap/soledad/backends/couch.py
+++ b/src/leap/soledad/backends/couch.py
@@ -2,8 +2,9 @@ from u1db import errors
from u1db.remote.http_target import HTTPSyncTarget
from couchdb.client import Server, Document
from couchdb.http import ResourceNotFound
-from soledad.backends.objectstore import ObjectStore
-from soledad.backends.leap import LeapDocument
+
+from leap.soledad.backends.objectstore import ObjectStore
+from leap.soledad.backends.leap_backend import LeapDocument
try:
import simplejson as json
diff --git a/src/leap/soledad/backends/leap.py b/src/leap/soledad/backends/leap_backend.py
index 9fbd49fe..a8a65eb4 100644
--- a/src/leap/soledad/backends/leap.py
+++ b/src/leap/soledad/backends/leap_backend.py
@@ -6,8 +6,9 @@ except ImportError:
from u1db import Document
from u1db.remote.http_target import HTTPSyncTarget
from u1db.remote.http_database import HTTPDatabase
-import base64
-from soledad.util import GPGWrapper
+import base64 # unused
+
+#from leap.soledad import util # import GPGWrapper # unused
class NoDefaultKey(Exception):
diff --git a/src/leap/soledad/backends/objectstore.py b/src/leap/soledad/backends/objectstore.py
index 61445a1f..3cefdf5d 100644
--- a/src/leap/soledad/backends/objectstore.py
+++ b/src/leap/soledad/backends/objectstore.py
@@ -1,7 +1,8 @@
import uuid
from u1db.backends import CommonBackend
from u1db import errors, Document
-from soledad.util import SyncLog, TransactionLog
+
+from leap.soledad import util as soledadutil
class ObjectStore(CommonBackend):
@@ -14,8 +15,8 @@ class ObjectStore(CommonBackend):
# with the database is established, so it can ensure that u1db data is
# configured and up-to-date.
self.set_document_factory(Document)
- self._sync_log = SyncLog()
- self._transaction_log = TransactionLog()
+ self._sync_log = soledadutil.SyncLog()
+ self._transaction_log = soledadutil.TransactionLog()
self._ensure_u1db_data()
#-------------------------------------------------------------------------
diff --git a/src/leap/soledad/tests/test_couch.py b/src/leap/soledad/tests/test_couch.py
index 4468ae04..b5bf4e9b 100644
--- a/src/leap/soledad/tests/test_couch.py
+++ b/src/leap/soledad/tests/test_couch.py
@@ -1,6 +1,6 @@
import unittest2
-from soledad.backends.couch import CouchDatabase
-from soledad.backends.leap import LeapDocument
+from leap.soledad.backends.couch import CouchDatabase
+from leap.soledad.backends.leap_backend import LeapDocument
from u1db import errors, vectorclock
try:
diff --git a/src/leap/soledad/tests/test_encrypted.py b/src/leap/soledad/tests/test_encrypted.py
index eafd258e..4ee03a3c 100644
--- a/src/leap/soledad/tests/test_encrypted.py
+++ b/src/leap/soledad/tests/test_encrypted.py
@@ -7,8 +7,8 @@ import unittest2 as unittest
import os
import u1db
-from soledad import Soledad
-from soledad.backends.leap import LeapDocument
+from leap.soledad import Soledad
+from leap.soledad.backends.leap_backend import LeapDocument
class EncryptedSyncTestCase(unittest.TestCase):
diff --git a/src/leap/soledad/tests/test_logs.py b/src/leap/soledad/tests/test_logs.py
index d61700f2..072ac1a5 100644
--- a/src/leap/soledad/tests/test_logs.py
+++ b/src/leap/soledad/tests/test_logs.py
@@ -1,10 +1,9 @@
import unittest2 as unittest
-from soledad.util import TransactionLog, SyncLog
+from leap.soledad.util import TransactionLog, SyncLog
class LogTestCase(unittest.TestCase):
-
def test_transaction_log(self):
data = [
(2, "doc_3", "tran_3"),
diff --git a/src/leap/soledad/tests/test_sqlcipher.py b/src/leap/soledad/tests/test_sqlcipher.py
index f9e9f681..3bb495ec 100644
--- a/src/leap/soledad/tests/test_sqlcipher.py
+++ b/src/leap/soledad/tests/test_sqlcipher.py
@@ -27,9 +27,9 @@ from u1db import (
errors,
query_parser,
)
-from soledad.backends import sqlcipher
-from soledad.backends.leap import LeapDocument
-from soledad import tests
+from leap.soledad.backends import sqlcipher
+from leap.soledad.backends.leap_backend import LeapDocument
+from leap.soledad import tests
simple_doc = '{"key": "value"}'