Merge lp:~diegosarmentero/ubuntuone-client/refactor-os-helper into lp:ubuntuone-client

Proposed by Diego Sarmentero
Status: Merged
Approved by: Diego Sarmentero
Approved revision: 1231
Merged at revision: 1231
Proposed branch: lp:~diegosarmentero/ubuntuone-client/refactor-os-helper
Merge into: lp:ubuntuone-client
Prerequisite: lp:~diegosarmentero/ubuntuone-client/refactor-session
Diff against target: 215 lines (+47/-21)
11 files modified
Makefile.am (+3/-3)
tests/platform/os_helper/__init__.py (+27/-0)
tests/platform/os_helper/test_linux.py (+1/-2)
tests/platform/os_helper/test_windows.py (+3/-3)
tests/platform/windows/test_filesystem_notifications.py (+4/-3)
ubuntuone/platform/__init__.py (+1/-1)
ubuntuone/platform/linux/__init__.py (+1/-1)
ubuntuone/platform/linux/filesystem_notifications.py (+1/-1)
ubuntuone/platform/os_helper/__init__.py (+4/-4)
ubuntuone/platform/windows/__init__.py (+1/-2)
ubuntuone/platform/windows/filesystem_notifications.py (+1/-1)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-client/refactor-os-helper
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
dobey (community) Approve
Review via email: mp+103946@code.launchpad.net

Commit message

- Refactor os_helper (LP: #989128).

To post a comment you must log in.
Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Manuel de la Peña (mandel) wrote :

Superb, the port is moving! Everything looks ok and ran the tests both on linux P and Windows 7.

review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :

The prerequisite lp:~diegosarmentero/ubuntuone-client/refactor-session has not yet been merged into lp:ubuntuone-client.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2012-04-09 20:09:55 +0000
3+++ Makefile.am 2012-04-27 21:01:23 +0000
4@@ -54,14 +54,14 @@
5 test: logging.conf $(clientdefs_DATA) Makefile
6 echo "$(PYTHONPATH)"
7 if test "x$(builddir)" == "x$(srcdir)"; then \
8- PYTHONPATH="$(PYTHONPATH)" u1trial -r $(REACTOR) -p tests/platform/windows,tests/proxy tests; \
9- PYTHONPATH="$(PYTHONPATH)" u1trial -r qt4 -p tests/platform/windows tests/proxy; \
10+ PYTHONPATH="$(PYTHONPATH)" u1trial -r $(REACTOR) -p tests/platform/windows,tests/proxy -i test_windows.py tests; \
11+ PYTHONPATH="$(PYTHONPATH)" u1trial -r qt4 -p tests/platform/windows -i test_windows.py tests/proxy; \
12 fi
13 rm -rf _trial_temp
14
15 test-coverage: logging.conf $(clientdefs_DATA) Makefile
16 if test "x$(builddir)" == "x$(srcdir)"; then \
17- PYTHONPATH="$(PYTHONPATH)" u1trial -r $(REACTOR) -c -p tests/platform/windows tests; \
18+ PYTHONPATH="$(PYTHONPATH)" u1trial -r $(REACTOR) -c -p tests/platform/windows -i test_windows.py tests; \
19 fi
20 rm -rf _trial_temp
21
22
23=== added directory 'tests/platform/os_helper'
24=== added file 'tests/platform/os_helper/__init__.py'
25--- tests/platform/os_helper/__init__.py 1970-01-01 00:00:00 +0000
26+++ tests/platform/os_helper/__init__.py 2012-04-27 21:01:23 +0000
27@@ -0,0 +1,27 @@
28+# Copyright 2012 Canonical Ltd.
29+#
30+# This program is free software: you can redistribute it and/or modify it
31+# under the terms of the GNU General Public License version 3, as published
32+# by the Free Software Foundation.
33+#
34+# This program is distributed in the hope that it will be useful, but
35+# WITHOUT ANY WARRANTY; without even the implied warranties of
36+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
37+# PURPOSE. See the GNU General Public License for more details.
38+#
39+# You should have received a copy of the GNU General Public License along
40+# with this program. If not, see <http://www.gnu.org/licenses/>.
41+#
42+# In addition, as a special exception, the copyright holders give
43+# permission to link the code of portions of this program with the
44+# OpenSSL library under certain conditions as described in each
45+# individual source file, and distribute linked combinations
46+# including the two.
47+# You must obey the GNU General Public License in all respects
48+# for all of the code used other than OpenSSL. If you modify
49+# file(s) with this exception, you may extend this exception to your
50+# version of the file(s), but you are not obligated to do so. If you
51+# do not wish to do so, delete this exception statement from your
52+# version. If you delete this exception statement from all source
53+# files in the program, then also delete it here.
54+"""Platform/Os Helper test code."""
55
56=== renamed file 'tests/platform/linux/test_os_helper.py' => 'tests/platform/os_helper/test_linux.py'
57--- tests/platform/linux/test_os_helper.py 2012-04-09 20:07:05 +0000
58+++ tests/platform/os_helper/test_linux.py 2012-04-27 21:01:23 +0000
59@@ -44,7 +44,7 @@
60 from twisted.internet import defer
61 from ubuntuone.devtools.handlers import MementoHandler
62
63-from tests.platform import test_os_helper
64+from tests.platform.os_helper import test_os_helper
65 from ubuntuone.platform import (
66 move_to_trash,
67 open_file,
68@@ -118,7 +118,6 @@
69 self.assertTrue(self.handler.check_warning("Problems moving to trash!",
70 "Removing anyway", "foo"))
71
72-
73 def test_movetotrash_file_systemnotcapable(self):
74 """The system is not capable of moving into trash."""
75 FakeGIOFile._bad_trash_call = GIO_NOT_SUPPORTED
76
77=== renamed file 'tests/platform/test_os_helper.py' => 'tests/platform/os_helper/test_os_helper.py'
78=== renamed file 'tests/platform/windows/test_os_helper.py' => 'tests/platform/os_helper/test_windows.py'
79--- tests/platform/windows/test_os_helper.py 2012-04-09 20:07:05 +0000
80+++ tests/platform/os_helper/test_windows.py 2012-04-27 21:01:23 +0000
81@@ -51,8 +51,8 @@
82 SetFileAttributesW
83 )
84
85-from ubuntuone.platform.windows import os_helper
86-from ubuntuone.platform.windows.os_helper import (
87+from ubuntuone.platform.os_helper import windows as os_helper
88+from ubuntuone.platform.os_helper.windows import (
89 _set_file_attributes,
90 _unicode_to_bytes,
91 EVERYONE_SID,
92@@ -70,7 +70,7 @@
93 set_no_rights,
94 WINDOWS_ILLEGAL_CHARS_MAP,
95 )
96-from tests.platform.test_os_helper import OSWrapperTests, WalkTests
97+from tests.platform.os_helper.test_os_helper import OSWrapperTests, WalkTests
98
99
100 # ugly trick to stop pylint for complaining about
101
102=== modified file 'tests/platform/windows/test_filesystem_notifications.py'
103--- tests/platform/windows/test_filesystem_notifications.py 2012-04-09 20:07:05 +0000
104+++ tests/platform/windows/test_filesystem_notifications.py 2012-04-27 21:01:23 +0000
105@@ -42,7 +42,7 @@
106
107 from contrib.testing.testcase import BaseTwistedTestCase
108 from ubuntuone.devtools.handlers import MementoHandler
109-from ubuntuone.platform.windows import os_helper
110+from ubuntuone.platform.os_helper import windows as os_helper
111 from ubuntuone.platform.windows.pyinotify import (
112 ProcessEvent,
113 IN_CLOSE_WRITE,
114@@ -144,8 +144,9 @@
115 # If we use extend we wont have the same logging because it will
116 # group all events in a single lists which is not what the COM API
117 # does.
118- str_events = [(WINDOWS_ACTIONS_NAMES[action], path) for action, path in
119- events]
120+ str_events = [
121+ (WINDOWS_ACTIONS_NAMES[action], path) for action, path in
122+ events]
123 self.raw_events.append(str_events)
124 return events
125
126
127=== modified file 'ubuntuone/platform/__init__.py'
128--- ubuntuone/platform/__init__.py 2012-04-09 20:07:05 +0000
129+++ ubuntuone/platform/__init__.py 2012-04-27 21:01:23 +0000
130@@ -43,7 +43,7 @@
131 from ubuntuone.platform import linux
132 source = linux
133
134-# This imports needs to be here in order to belongs to this namespace
135+# This imports needs to be here in order to be included in this namespace
136 from ubuntuone.platform import credentials
137 from ubuntuone.platform import tools
138
139
140=== modified file 'ubuntuone/platform/linux/__init__.py'
141--- ubuntuone/platform/linux/__init__.py 2012-04-09 20:07:05 +0000
142+++ ubuntuone/platform/linux/__init__.py 2012-04-27 21:01:23 +0000
143@@ -35,7 +35,7 @@
144 platform = "linux"
145
146
147-from ubuntuone.platform.linux.os_helper import (
148+from ubuntuone.platform.os_helper import (
149 access,
150 allow_writes,
151 can_write,
152
153=== modified file 'ubuntuone/platform/linux/filesystem_notifications.py'
154--- ubuntuone/platform/linux/filesystem_notifications.py 2012-04-09 20:07:05 +0000
155+++ ubuntuone/platform/linux/filesystem_notifications.py 2012-04-27 21:01:23 +0000
156@@ -36,7 +36,7 @@
157
158 import pyinotify
159 from twisted.internet import abstract, reactor, error, defer
160-from ubuntuone.platform.linux.os_helper import access
161+from ubuntuone.platform.os_helper import access
162
163
164 # translates quickly the event and it's is_dir state to our standard events
165
166=== added directory 'ubuntuone/platform/os_helper'
167=== renamed file 'ubuntuone/platform/os_helper.py' => 'ubuntuone/platform/os_helper/__init__.py'
168--- ubuntuone/platform/os_helper.py 2012-04-09 20:07:05 +0000
169+++ ubuntuone/platform/os_helper/__init__.py 2012-04-27 21:01:23 +0000
170@@ -32,11 +32,11 @@
171
172
173 if sys.platform == "win32":
174- from ubuntuone.platform.windows import os_helper
175- source = os_helper
176+ from ubuntuone.platform.os_helper import windows
177+ source = windows
178 else:
179- from ubuntuone.platform.linux import os_helper
180- source = os_helper
181+ from ubuntuone.platform.os_helper import linux
182+ source = linux
183
184 set_no_rights = source.set_no_rights
185 set_file_readonly = source.set_file_readonly
186
187=== renamed file 'ubuntuone/platform/linux/os_helper.py' => 'ubuntuone/platform/os_helper/linux.py'
188=== renamed file 'ubuntuone/platform/windows/os_helper.py' => 'ubuntuone/platform/os_helper/windows.py'
189=== modified file 'ubuntuone/platform/windows/__init__.py'
190--- ubuntuone/platform/windows/__init__.py 2012-04-27 21:01:23 +0000
191+++ ubuntuone/platform/windows/__init__.py 2012-04-27 21:01:23 +0000
192@@ -43,9 +43,8 @@
193 import logger
194 import messaging
195 import notification
196-import os_helper
197
198-from ubuntuone.platform.windows.os_helper import (
199+from ubuntuone.platform.os_helper import (
200 access,
201 allow_writes,
202 can_write,
203
204=== modified file 'ubuntuone/platform/windows/filesystem_notifications.py'
205--- ubuntuone/platform/windows/filesystem_notifications.py 2012-04-09 20:07:05 +0000
206+++ ubuntuone/platform/windows/filesystem_notifications.py 2012-04-27 21:01:23 +0000
207@@ -78,7 +78,7 @@
208 IN_MOVED_FROM,
209 IN_MOVED_TO,
210 IN_MODIFY)
211-from ubuntuone.platform.windows.os_helper import (
212+from ubuntuone.platform.os_helper.windows import (
213 is_valid_syncdaemon_path,
214 is_valid_windows_path,
215 get_syncdaemon_valid_path,

Subscribers

People subscribed via source and target branches