Merge lp:~mandel/ubuntuone-client/unify-filemonitors into lp:ubuntuone-client

Proposed by Manuel de la Peña on 2012-07-16
Status: Merged
Approved by: Manuel de la Peña on 2012-07-19
Approved revision: 1304
Merged at revision: 1279
Proposed branch: lp:~mandel/ubuntuone-client/unify-filemonitors
Merge into: lp:ubuntuone-client
Prerequisite: lp:~mandel/ubuntuone-client/unify-processors
Diff against target: 187 lines (+63/-23)
8 files modified
tests/platform/filesystem_notifications/test_darwin.py (+3/-3)
tests/platform/filesystem_notifications/test_fsevents_daemon.py (+3/-1)
tests/platform/filesystem_notifications/test_linux.py (+2/-2)
tests/platform/filesystem_notifications/test_windows.py (+3/-3)
ubuntuone/platform/filesystem_notifications/__init__.py (+5/-11)
ubuntuone/platform/filesystem_notifications/monitor/__init__.py (+42/-0)
ubuntuone/platform/filesystem_notifications/monitor/common.py (+2/-2)
ubuntuone/platform/filesystem_notifications/monitor/darwin/__init__.py (+3/-1)
To merge this branch: bzr merge lp:~mandel/ubuntuone-client/unify-filemonitors
Reviewer Review Type Date Requested Status
Diego Sarmentero (community) Approve on 2012-07-16
Mike McCracken (community) 2012-07-16 Approve on 2012-07-16
Review via email: mp+115154@code.launchpad.net

Commit Message

Unify the file monitor implementations to simplify the fact that more than one monitor implementation exists on darwin.

Description of the Change

Unify the file monitor implementations to simplify the fact that more than one monitor implementation exists on darwin.

To post a comment you must log in.
1297. By Manuel de la Peña on 2012-07-16

Merged with changes one on mac.

1298. By Manuel de la Peña on 2012-07-16

Fix broken import.

1299. By Manuel de la Peña on 2012-07-16

Make import line smaller to fit 80 chars.

1300. By Manuel de la Peña on 2012-07-16

Fix the import.

Mike McCracken (mikemc) wrote :

Looks like the tests need to be changed to reflect the refactor too:

Traceback (most recent call last):
  File "/Users/mmccrack/Documents/Canonical/Source/buildout-env/scripts/devsetup/bin/python", line 58, in <module>
    execfile(__file__)
  File "/Users/mmccrack/Documents/Canonical/Source/buildout-env/scripts/devsetup/parts/ubuntuone-dev-tools/bin/u1trial", line 341, in <module>
    main()
  File "/Users/mmccrack/Documents/Canonical/Source/buildout-env/scripts/devsetup/parts/ubuntuone-dev-tools/bin/u1trial", line 321, in main
    suite = trial_runner.get_suite(config)
  File "/Users/mmccrack/Documents/Canonical/Source/buildout-env/scripts/devsetup/parts/ubuntuone-dev-tools/bin/u1trial", line 192, in get_suite
    config['ignore-paths']))
  File "/Users/mmccrack/Documents/Canonical/Source/buildout-env/scripts/devsetup/parts/ubuntuone-dev-tools/bin/u1trial", line 176, in _collect_tests
    module_suite = self._load_unittest(filepath)
  File "/Users/mmccrack/Documents/Canonical/Source/buildout-env/scripts/devsetup/parts/ubuntuone-dev-tools/bin/u1trial", line 116, in _load_unittest
    module = __import__(modpath, None, None, [""])
  File "/Users/mmccrack/Documents/Canonical/Source/buildout-env/scripts/devsetup/parts/unify-filemonitors/tests/platform/filesystem_notifications/test_darwin.py", line 42, in <module>
    from ubuntuone.platform.filesystem_notifications import (
ImportError: cannot import name common

review: Needs Fixing
1301. By Manuel de la Peña on 2012-07-16

Fix imports.

Mike McCracken (mikemc) wrote :

The tests now run.

Note that to run the tests you need to have the lp:ubuntuone-fsevents-daemon , and put its python/ subdir on PYTHONPATH.
You also need lp:~diego.sarmentero/+junk/python-macfsevents built and put the build/lib dir on your PYTHONPATH.

Then just run python $u1trial --reactor=twisted -i "test_linux.py,test_windows.py" -p tests/platform/linux tests/platform/filesystem_notifications/

- don't use run-mac-tests because run-mac-tests overwrites PYTHONPATH, and only test the platform/filesystem_notifications/ directory because not everything else is fixed yet.

finally, this will hang on cleanup - there's apparently another branch pending to fix that

review: Approve
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
1302. By Manuel de la Peña on 2012-07-17

Merged unify-processors into unify-filemonitors.

1303. By Manuel de la Peña on 2012-07-19

Merged unify-processors into unify-filemonitors.

1304. By Manuel de la Peña on 2012-07-19

Merged unify-processors into unify-filemonitors.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/platform/filesystem_notifications/test_darwin.py'
2--- tests/platform/filesystem_notifications/test_darwin.py 2012-07-19 14:25:27 +0000
3+++ tests/platform/filesystem_notifications/test_darwin.py 2012-07-19 14:25:27 +0000
4@@ -39,14 +39,14 @@
5
6 from contrib.testing.testcase import BaseTwistedTestCase
7 from ubuntuone.devtools.handlers import MementoHandler
8-from ubuntuone.platform.filesystem_notifications import (
9+from ubuntuone.platform.filesystem_notifications.monitor import (
10 common,
11 )
12-from ubuntuone.platform.filesystem_notifications.darwin import (
13+from ubuntuone.platform.filesystem_notifications.monitor.darwin import (
14 fsevents_client as filesystem_notifications,
15 )
16 from ubuntuone.platform.filesystem_notifications import notify_processor
17-from ubuntuone.platform.filesystem_notifications.common import (
18+from ubuntuone.platform.filesystem_notifications.monitor.common import (
19 Watch,
20 WatchManager,
21 )
22
23=== modified file 'tests/platform/filesystem_notifications/test_fsevents_daemon.py'
24--- tests/platform/filesystem_notifications/test_fsevents_daemon.py 2012-07-19 14:25:27 +0000
25+++ tests/platform/filesystem_notifications/test_fsevents_daemon.py 2012-07-19 14:25:27 +0000
26@@ -34,7 +34,9 @@
27
28 from contrib.testing.testcase import BaseTwistedTestCase
29 from ubuntuone.darwin import fsevents
30-from ubuntuone.platform.filesystem_notifications.darwin import fsevents_daemon
31+from ubuntuone.platform.filesystem_notifications.monitor.darwin import (
32+ fsevents_daemon,
33+)
34 from ubuntuone.platform.filesystem_notifications.pyinotify_agnostic import (
35 IN_CREATE,
36 IN_DELETE,
37
38=== modified file 'tests/platform/filesystem_notifications/test_linux.py'
39--- tests/platform/filesystem_notifications/test_linux.py 2012-07-19 14:25:27 +0000
40+++ tests/platform/filesystem_notifications/test_linux.py 2012-07-19 14:25:27 +0000
41@@ -38,8 +38,8 @@
42 from contrib.testing import testcase
43 from ubuntuone.syncdaemon import volume_manager
44 from ubuntuone.platform.filesystem_notifications import notify_processor
45-from ubuntuone.platform.filesystem_notifications import (
46- linux as filesystem_notifications,
47+from ubuntuone.platform.filesystem_notifications.monitor import (
48+ linux as filesystem_notifications
49 )
50 from tests.platform.filesystem_notifications import BaseFSMonitorTestCase
51
52
53=== modified file 'tests/platform/filesystem_notifications/test_windows.py'
54--- tests/platform/filesystem_notifications/test_windows.py 2012-07-19 14:25:27 +0000
55+++ tests/platform/filesystem_notifications/test_windows.py 2012-07-19 14:25:27 +0000
56@@ -50,16 +50,16 @@
57 IN_DELETE,
58 IN_OPEN,
59 )
60-from ubuntuone.platform.filesystem_notifications import (
61+from ubuntuone.platform.filesystem_notifications.monitor import (
62 windows as filesystem_notifications,
63 )
64 from ubuntuone.platform.filesystem_notifications import notify_processor
65-from ubuntuone.platform.filesystem_notifications.common import (
66+from ubuntuone.platform.filesystem_notifications.monitor.common import (
67 FilesystemMonitor,
68 Watch,
69 WatchManager,
70 )
71-from ubuntuone.platform.filesystem_notifications.windows import (
72+from ubuntuone.platform.filesystem_notifications.monitor.windows import (
73 ACTIONS,
74 FILE_NOTIFY_CHANGE_FILE_NAME,
75 FILE_NOTIFY_CHANGE_DIR_NAME,
76
77=== modified file 'ubuntuone/platform/filesystem_notifications/__init__.py'
78--- ubuntuone/platform/filesystem_notifications/__init__.py 2012-07-19 14:25:27 +0000
79+++ ubuntuone/platform/filesystem_notifications/__init__.py 2012-07-19 14:25:27 +0000
80@@ -28,16 +28,10 @@
81 # files in the program, then also delete it here.
82 """File System Notification module."""
83
84-import sys
85-
86-from ubuntuone.platform.filesystem_notifications import notify_processor
87+from ubuntuone.platform.filesystem_notifications import (
88+ monitor,
89+ notify_processor,
90+)
91
92 _GeneralINotifyProcessor = notify_processor.NotifyProcessor
93-
94-
95-if sys.platform in ('darwin', 'win32'):
96- from ubuntuone.platform.filesystem_notifications import common
97- FilesystemMonitor = common.FilesystemMonitor
98-else:
99- from ubuntuone.platform.filesystem_notifications import linux
100- FilesystemMonitor = linux.FilesystemMonitor
101+FilesystemMonitor = monitor.FilesystemMonitor
102
103=== added directory 'ubuntuone/platform/filesystem_notifications/monitor'
104=== added file 'ubuntuone/platform/filesystem_notifications/monitor/__init__.py'
105--- ubuntuone/platform/filesystem_notifications/monitor/__init__.py 1970-01-01 00:00:00 +0000
106+++ ubuntuone/platform/filesystem_notifications/monitor/__init__.py 2012-07-19 14:25:27 +0000
107@@ -0,0 +1,42 @@
108+# -*- coding: utf-8 *-*
109+#
110+# Copyright 2011-2012 Canonical Ltd.
111+#
112+# This program is free software: you can redistribute it and/or modify it
113+# under the terms of the GNU General Public License version 3, as published
114+# by the Free Software Foundation.
115+#
116+# This program is distributed in the hope that it will be useful, but
117+# WITHOUT ANY WARRANTY; without even the implied warranties of
118+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
119+# PURPOSE. See the GNU General Public License for more details.
120+#
121+# You should have received a copy of the GNU General Public License along
122+# with this program. If not, see <http://www.gnu.org/licenses/>.
123+#
124+# In addition, as a special exception, the copyright holders give
125+# permission to link the code of portions of this program with the
126+# OpenSSL library under certain conditions as described in each
127+# individual source file, and distribute linked combinations
128+# including the two.
129+# You must obey the GNU General Public License in all respects
130+# for all of the code used other than OpenSSL. If you modify
131+# file(s) with this exception, you may extend this exception to your
132+# version of the file(s), but you are not obligated to do so. If you
133+# do not wish to do so, delete this exception statement from your
134+# version. If you delete this exception statement from all source
135+# files in the program, then also delete it here.
136+"""Filesystem monitors per platform."""
137+
138+import sys
139+
140+if sys.platform in ('win32', 'darwin'):
141+ from ubuntuone.platform.filesystem_notifications.monitor import (
142+ common,
143+ )
144+ FilesystemMonitor = common.FilesystemMonitor
145+else:
146+ from ubuntuone.platform.filesystem_notifications.monitor import (
147+ linux,
148+ )
149+ FilesystemMonitor = linux.FilesystemMonitor
150
151=== renamed file 'ubuntuone/platform/filesystem_notifications/common.py' => 'ubuntuone/platform/filesystem_notifications/monitor/common.py'
152--- ubuntuone/platform/filesystem_notifications/common.py 2012-07-19 14:25:27 +0000
153+++ ubuntuone/platform/filesystem_notifications/monitor/common.py 2012-07-19 14:25:27 +0000
154@@ -54,12 +54,12 @@
155 )
156
157 if sys.platform == 'darwin':
158- from ubuntuone.platform.filesystem_notifications.darwin import (
159+ from ubuntuone.platform.filesystem_notifications.monitor.darwin import (
160 fsevents_client,
161 )
162 source = fsevents_client
163 elif sys.platform == 'win32':
164- from ubuntuone.platform.filesystem_notifications import windows
165+ from ubuntuone.platform.filesystem_notifications.monitor import windows
166 source = windows
167 else:
168 raise ImportError('Not supported platform')
169
170=== renamed directory 'ubuntuone/platform/filesystem_notifications/darwin' => 'ubuntuone/platform/filesystem_notifications/monitor/darwin'
171=== modified file 'ubuntuone/platform/filesystem_notifications/monitor/darwin/__init__.py'
172--- ubuntuone/platform/filesystem_notifications/darwin/__init__.py 2012-07-19 14:25:27 +0000
173+++ ubuntuone/platform/filesystem_notifications/monitor/darwin/__init__.py 2012-07-19 14:25:27 +0000
174@@ -28,7 +28,9 @@
175 # files in the program, then also delete it here.
176 """Filesystem Notifications module for MAC OS."""
177
178-from ubuntuone.platform.filesystem_notifications.darwin import fsevents_daemon
179+from ubuntuone.platform.filesystem_notifications.monitor.darwin import (
180+ fsevents_daemon,
181+)
182
183
184 FilesystemMonitor = fsevents_daemon.FilesystemMonitor
185
186=== renamed file 'ubuntuone/platform/filesystem_notifications/linux.py' => 'ubuntuone/platform/filesystem_notifications/monitor/linux.py'
187=== renamed file 'ubuntuone/platform/filesystem_notifications/windows.py' => 'ubuntuone/platform/filesystem_notifications/monitor/windows.py'

Subscribers

People subscribed via source and target branches