Merge lp:~dobey/u1sync/use-dirspec into lp:u1sync

Proposed by dobey on 2012-06-21
Status: Merged
Approved by: dobey on 2012-06-22
Approved revision: 7
Merged at revision: 6
Proposed branch: lp:~dobey/u1sync/use-dirspec
Merge into: lp:u1sync
Diff against target: 29 lines (+6/-3)
1 file modified
u1sync/client.py (+6/-3)
To merge this branch: bzr merge lp:~dobey/u1sync/use-dirspec
Reviewer Review Type Date Requested Status
Brian Curtin (community) 2012-06-21 Approve on 2012-06-22
Manuel de la Peña (community) Approve on 2012-06-22
Review via email: mp+111480@code.launchpad.net

Commit Message

Get the log dir from the platform logger module

Description of the Change

To post a comment you must log in.
review: Approve
review: Approve
Ubuntu One Auto Pilot (otto-pilot) wrote :

The attempt to merge lp:~dobey/u1sync/use-dirspec into lp:u1sync failed. Below is the output from the failed tests.

u1sync
  tests
    test_client ... [ERROR]
u1sync.tests.test_merge
  MergeTest
    test_clobber ... [OK]
    test_generic_merge ... [OK]
    test_sync ... [OK]

===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/trial/runner.py", line 572, in loadPackage
    module = modinfo.load()
  File "/usr/lib/python2.7/dist-packages/twisted/python/modules.py", line 383, in load
    return self.pathEntry.pythonPath.moduleLoader(self.name)
  File "/usr/lib/python2.7/dist-packages/twisted/python/reflect.py", line 464, in namedAny
    topLevelPackage = _importAndCheckStack(trialname)
  File "/mnt/tarmac/cache/u1sync/trunk/u1sync/tests/test_client.py", line 23, in <module>
    from u1sync import client
  File "/mnt/tarmac/cache/u1sync/trunk/u1sync/client.py", line 35, in <module>
    from ubuntuone.platform.logger import ubuntuone_log_dir
exceptions.ImportError: No module named logger

u1sync.tests.test_client
-------------------------------------------------------------------------------
Ran 4 tests in 0.148s

FAILED (errors=1, successes=3)

ERROR:root:Could not find any typelib for Unity

review: Approve
review: Approve
Ubuntu One Auto Pilot (otto-pilot) wrote :

The attempt to merge lp:~dobey/u1sync/use-dirspec into lp:u1sync failed. Below is the output from the failed tests.

u1sync
  tests
    test_client ... [ERROR]
u1sync.tests.test_merge
  MergeTest
    test_clobber ... [OK]
    test_generic_merge ... [OK]
    test_sync ... [OK]

===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/trial/runner.py", line 572, in loadPackage
    module = modinfo.load()
  File "/usr/lib/python2.7/dist-packages/twisted/python/modules.py", line 383, in load
    return self.pathEntry.pythonPath.moduleLoader(self.name)
  File "/usr/lib/python2.7/dist-packages/twisted/python/reflect.py", line 464, in namedAny
    topLevelPackage = _importAndCheckStack(trialname)
  File "/usr/lib/python2.7/dist-packages/twisted/python/reflect.py", line 400, in _importAndCheckStack
    return __import__(importName)
  File "/mnt/tarmac/cache/u1sync/trunk/u1sync/tests/test_client.py", line 23, in <module>
    from u1sync import client
  File "/mnt/tarmac/cache/u1sync/trunk/u1sync/client.py", line 67, in <module>
    handler = RotatingFileHandler(LOGFILENAME)
  File "/usr/lib/python2.7/logging/handlers.py", line 118, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python2.7/logging/handlers.py", line 65, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python2.7/logging/__init__.py", line 897, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python2.7/logging/__init__.py", line 916, in _open
    stream = open(self.baseFilename, self.mode)
exceptions.IOError: [Errno 2] No such file or directory: '/mnt/tarmac/.cache/u1sync/log/u1sync.log'

u1sync.tests.test_client
-------------------------------------------------------------------------------
Ran 4 tests in 0.065s

FAILED (errors=1, successes=3)

ERROR:root:Could not find any typelib for Unity

lp:~dobey/u1sync/use-dirspec updated on 2012-06-22
7. By dobey on 2012-06-22

Fix the tests

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'u1sync/client.py'
2--- u1sync/client.py 2012-06-18 13:52:04 +0000
3+++ u1sync/client.py 2012-06-22 15:24:17 +0000
4@@ -28,11 +28,11 @@
5 from Queue import Queue
6 from threading import Lock
7 import zlib
8+
9 from cStringIO import StringIO
10-
11+from dirspec.basedir import xdg_cache_home
12 from twisted.internet import reactor, defer
13 from twisted.internet.defer import inlineCallbacks, returnValue
14-from ubuntuone.platform.xdg_base_directory import ubuntuone_log_dir
15 from ubuntuone.storageprotocol.content_hash import crc32
16 from ubuntuone.storageprotocol.context import get_ssl_context
17 from u1sync.genericmerge import MergeNode
18@@ -62,7 +62,10 @@
19 """Converts a share UUID to a form the protocol likes."""
20 return str(share_uuid) if share_uuid is not None else request.ROOT
21
22-LOGFILENAME = os.path.join(ubuntuone_log_dir, 'u1sync.log')
23+u1sync_log_dir = os.path.join(xdg_cache_home, 'u1sync', 'log')
24+LOGFILENAME = os.path.join(u1sync_log_dir, 'u1sync.log')
25+if not os.path.exists(u1sync_log_dir):
26+ os.makedirs(u1sync_log_dir)
27 u1_logger = logging.getLogger("u1sync.timing.log")
28 handler = RotatingFileHandler(LOGFILENAME)
29 u1_logger.addHandler(handler)

Subscribers

People subscribed via source and target branches

to all changes: