Merge lp:~nataliabidart/ubuntuone-client/no-custom-abspath into lp:ubuntuone-client
- no-custom-abspath
- Merge into trunk
Proposed by
Natalia Bidart
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Alejandro J. Cura | ||||
Approved revision: | 1057 | ||||
Merged at revision: | 1055 | ||||
Proposed branch: | lp:~nataliabidart/ubuntuone-client/no-custom-abspath | ||||
Merge into: | lp:ubuntuone-client | ||||
Diff against target: |
408 lines (+45/-65) 8 files modified
tests/platform/test_filesystem_notifications.py (+0/-1) tests/syncdaemon/test_vm.py (+37/-37) ubuntuone/platform/linux/__init__.py (+0/-1) ubuntuone/platform/linux/os_helper.py (+0/-5) ubuntuone/platform/windows/__init__.py (+0/-1) ubuntuone/platform/windows/os_helper.py (+1/-11) ubuntuone/syncdaemon/filesystem_manager.py (+1/-2) ubuntuone/syncdaemon/volume_manager.py (+6/-7) |
||||
To merge this branch: | bzr merge lp:~nataliabidart/ubuntuone-client/no-custom-abspath | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alejandro J. Cura (community) | Approve | ||
Manuel de la Peña (community) | Approve | ||
Review via email: mp+68418@code.launchpad.net |
Commit message
- No more custom abspath, credits to Manuel de la Peña (LP: #812976).
Description of the change
To post a comment you must log in.
- 1057. By Natalia Bidart
-
Removing no longer valid comments about prepending \\?\ when dealing with tritcask.
Revision history for this message
Manuel de la Peña (mandel) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'tests/platform/test_filesystem_notifications.py' | |||
2 | --- tests/platform/test_filesystem_notifications.py 2011-04-19 15:33:42 +0000 | |||
3 | +++ tests/platform/test_filesystem_notifications.py 2011-07-19 16:19:28 +0000 | |||
4 | @@ -84,7 +84,6 @@ | |||
5 | 84 | self.root_dir = platform_mangled_path(self.mktemp('root_dir')) | 84 | self.root_dir = platform_mangled_path(self.mktemp('root_dir')) |
6 | 85 | self.home_dir = platform_mangled_path(self.mktemp('home_dir')) | 85 | self.home_dir = platform_mangled_path(self.mktemp('home_dir')) |
7 | 86 | self.vm = testcase.FakeVolumeManager(self.root_dir) | 86 | self.vm = testcase.FakeVolumeManager(self.root_dir) |
8 | 87 | # FIXME: Trictask cannot deal with \\\\?\\ infornt of files | ||
9 | 88 | self.tritcask_dir = self.mktemp("tritcask_dir") | 87 | self.tritcask_dir = self.mktemp("tritcask_dir") |
10 | 89 | self.db = Tritcask(self.tritcask_dir) | 88 | self.db = Tritcask(self.tritcask_dir) |
11 | 90 | self.fs = filesystem_manager.FileSystemManager(fsmdir, partials_dir, | 89 | self.fs = filesystem_manager.FileSystemManager(fsmdir, partials_dir, |
12 | 91 | 90 | ||
13 | === modified file 'tests/syncdaemon/test_vm.py' | |||
14 | --- tests/syncdaemon/test_vm.py 2011-07-08 12:21:59 +0000 | |||
15 | +++ tests/syncdaemon/test_vm.py 2011-07-19 16:19:28 +0000 | |||
16 | @@ -59,7 +59,6 @@ | |||
17 | 59 | VolumeDoesNotExist, | 59 | VolumeDoesNotExist, |
18 | 60 | ) | 60 | ) |
19 | 61 | from ubuntuone.platform import ( | 61 | from ubuntuone.platform import ( |
20 | 62 | abspath, | ||
21 | 63 | get_udf_path, | 62 | get_udf_path, |
22 | 64 | make_link, | 63 | make_link, |
23 | 65 | make_dir, | 64 | make_dir, |
24 | @@ -576,7 +575,7 @@ | |||
25 | 576 | 'Modify') | 575 | 'Modify') |
26 | 577 | # initialize the the root | 576 | # initialize the the root |
27 | 578 | self.vm._got_root('root_uuid') | 577 | self.vm._got_root('root_uuid') |
29 | 579 | shared_dir = abspath(os.path.join(self.root_dir, 'shared_dir')) | 578 | shared_dir = os.path.abspath(os.path.join(self.root_dir, 'shared_dir')) |
30 | 580 | self.main.fs.create(path=shared_dir, share_id="", is_dir=True) | 579 | self.main.fs.create(path=shared_dir, share_id="", is_dir=True) |
31 | 581 | self.main.fs.set_node_id(shared_dir, shared_response.subtree) | 580 | self.main.fs.set_node_id(shared_dir, shared_response.subtree) |
32 | 582 | response = ListShares(None) | 581 | response = ListShares(None) |
33 | @@ -628,7 +627,7 @@ | |||
34 | 628 | self.assertEquals('View', access_level) | 627 | self.assertEquals('View', access_level) |
35 | 629 | self.assertTrue(marker is not None) | 628 | self.assertTrue(marker is not None) |
36 | 630 | share = self.vm.marker_share_map[marker] | 629 | share = self.vm.marker_share_map[marker] |
38 | 631 | self.assertEquals(abspath(path), share.path) | 630 | self.assertEquals(os.path.abspath(path), share.path) |
39 | 632 | self.assertEquals('View', share.access_level) | 631 | self.assertEquals('View', share.access_level) |
40 | 633 | self.assertEquals(marker, share.volume_id) | 632 | self.assertEquals(marker, share.volume_id) |
41 | 634 | self.assertEquals('fake_user', share.other_username) | 633 | self.assertEquals('fake_user', share.other_username) |
42 | @@ -654,7 +653,7 @@ | |||
43 | 654 | @defer.inlineCallbacks | 653 | @defer.inlineCallbacks |
44 | 655 | def test_create_share_missing_node_id(self): | 654 | def test_create_share_missing_node_id(self): |
45 | 656 | """Test VolumeManager.create_share in the case of missing node_id.""" | 655 | """Test VolumeManager.create_share in the case of missing node_id.""" |
47 | 657 | path = abspath(os.path.join(self.vm.root.path, 'shared_path')) | 656 | path = os.path.abspath(os.path.join(self.vm.root.path, 'shared_path')) |
48 | 658 | self.main.fs.create(path, "") | 657 | self.main.fs.create(path, "") |
49 | 659 | expected_node_id = uuid.uuid4() | 658 | expected_node_id = uuid.uuid4() |
50 | 660 | expected_share_id = uuid.uuid4() | 659 | expected_share_id = uuid.uuid4() |
51 | @@ -877,9 +876,7 @@ | |||
52 | 877 | for path in paths: | 876 | for path in paths: |
53 | 878 | self.assertTrue(self.main.event_q.has_watch(path)) | 877 | self.assertTrue(self.main.event_q.has_watch(path)) |
54 | 879 | # remove the watches | 878 | # remove the watches |
58 | 880 | # TODO: because tritcask does not work well with \\?\ we are adding it | 879 | self.vm._remove_watches(os.path.abspath(self.root_dir)) |
56 | 881 | # here rather than in mktemp which is the correct place to do it | ||
57 | 882 | self.vm._remove_watches(abspath(self.root_dir)) | ||
59 | 883 | for path in paths: | 880 | for path in paths: |
60 | 884 | self.assertFalse(self.main.event_q.has_watch(path), path) | 881 | self.assertFalse(self.main.event_q.has_watch(path), path) |
61 | 885 | 882 | ||
62 | @@ -893,16 +890,14 @@ | |||
63 | 893 | 890 | ||
64 | 894 | os.rename(path, path+'.old') | 891 | os.rename(path, path+'.old') |
65 | 895 | # remove the watches | 892 | # remove the watches |
69 | 896 | # TODO: because tritcask does not work well with \\?\ we are adding it | 893 | self.vm._remove_watches(os.path.abspath(self.root_dir)) |
67 | 897 | # here rather than in mktemp which is the correct place to do it | ||
68 | 898 | self.vm._remove_watches(abspath(self.root_dir)) | ||
70 | 899 | 894 | ||
71 | 900 | self.assertFalse(self.main.event_q.has_watch(path), | 895 | self.assertFalse(self.main.event_q.has_watch(path), |
72 | 901 | 'watch should not be present') | 896 | 'watch should not be present') |
73 | 902 | 897 | ||
74 | 903 | def test_delete_fsm_object(self): | 898 | def test_delete_fsm_object(self): |
75 | 904 | """Test for VolumeManager._delete_fsm_object""" | 899 | """Test for VolumeManager._delete_fsm_object""" |
77 | 905 | path = abspath(os.path.join(self.root_dir, 'dir')) | 900 | path = os.path.abspath(os.path.join(self.root_dir, 'dir')) |
78 | 906 | make_dir(path, recursive=True) | 901 | make_dir(path, recursive=True) |
79 | 907 | self.main.fs.create(path, "", is_dir=True) | 902 | self.main.fs.create(path, "", is_dir=True) |
80 | 908 | self.main.fs.set_node_id(path, 'dir_node_id') | 903 | self.main.fs.set_node_id(path, 'dir_node_id') |
81 | @@ -1217,7 +1212,7 @@ | |||
82 | 1217 | dirs = ['dir', os.path.join('dir','subdir'), | 1212 | dirs = ['dir', os.path.join('dir','subdir'), |
83 | 1218 | os.path.join('dir', 'empty_dir')] | 1213 | os.path.join('dir', 'empty_dir')] |
84 | 1219 | for i, dir in enumerate(dirs): | 1214 | for i, dir in enumerate(dirs): |
86 | 1220 | path = abspath(os.path.join(share.path, dir)) | 1215 | path = os.path.abspath(os.path.join(share.path, dir)) |
87 | 1221 | with allow_writes(os.path.split(share.path)[0]): | 1216 | with allow_writes(os.path.split(share.path)[0]): |
88 | 1222 | with allow_writes(share.path): | 1217 | with allow_writes(share.path): |
89 | 1223 | if not os.path.exists(path): | 1218 | if not os.path.exists(path): |
90 | @@ -1227,7 +1222,7 @@ | |||
91 | 1227 | files = ['a_file', os.path.join('dir', 'file'), | 1222 | files = ['a_file', os.path.join('dir', 'file'), |
92 | 1228 | os.path.join('dir', 'subdir', 'file')] | 1223 | os.path.join('dir', 'subdir', 'file')] |
93 | 1229 | for i, path in enumerate(files): | 1224 | for i, path in enumerate(files): |
95 | 1230 | path = abspath(os.path.join(share.path, path)) | 1225 | path = os.path.abspath(os.path.join(share.path, path)) |
96 | 1231 | with allow_writes(os.path.split(share.path)[0]): | 1226 | with allow_writes(os.path.split(share.path)[0]): |
97 | 1232 | with allow_writes(share.path): | 1227 | with allow_writes(share.path): |
98 | 1233 | open(path, 'w').close() | 1228 | open(path, 'w').close() |
99 | @@ -1292,7 +1287,7 @@ | |||
100 | 1292 | share = self.vm.shares['share_id'] | 1287 | share = self.vm.shares['share_id'] |
101 | 1293 | shouldbe_dir = os.path.join(self.shares_dir, | 1288 | shouldbe_dir = os.path.join(self.shares_dir, |
102 | 1294 | get_share_dir_name(share_response)) | 1289 | get_share_dir_name(share_response)) |
104 | 1295 | self.assertEquals(abspath(shouldbe_dir), share.path) | 1290 | self.assertEquals(os.path.abspath(shouldbe_dir), share.path) |
105 | 1296 | 1291 | ||
106 | 1297 | def test_handle_SHARES_visible_username(self): | 1292 | def test_handle_SHARES_visible_username(self): |
107 | 1298 | """test the handling of AQ_SHARE_LIST with non-ascii visible uname.""" | 1293 | """test the handling of AQ_SHARE_LIST with non-ascii visible uname.""" |
108 | @@ -1311,7 +1306,7 @@ | |||
109 | 1311 | share = self.vm.shares['share_id'] | 1306 | share = self.vm.shares['share_id'] |
110 | 1312 | shouldbe_dir = os.path.join(self.shares_dir, | 1307 | shouldbe_dir = os.path.join(self.shares_dir, |
111 | 1313 | get_share_dir_name(share_response)) | 1308 | get_share_dir_name(share_response)) |
113 | 1314 | self.assertEquals(abspath(shouldbe_dir), share.path) | 1309 | self.assertEquals(os.path.abspath(shouldbe_dir), share.path) |
114 | 1315 | 1310 | ||
115 | 1316 | def test_handle_SV_SHARE_CHANGED_sharename(self): | 1311 | def test_handle_SV_SHARE_CHANGED_sharename(self): |
116 | 1317 | """test the handling of SV_SHARE_CHANGED for non-ascii share name.""" | 1312 | """test the handling of SV_SHARE_CHANGED for non-ascii share name.""" |
117 | @@ -1323,8 +1318,8 @@ | |||
118 | 1323 | self.vm.handle_SV_SHARE_CHANGED(info=share_holder) | 1318 | self.vm.handle_SV_SHARE_CHANGED(info=share_holder) |
119 | 1324 | shouldbe_dir = os.path.join(self.shares_dir, | 1319 | shouldbe_dir = os.path.join(self.shares_dir, |
120 | 1325 | get_share_dir_name(share_holder)) | 1320 | get_share_dir_name(share_holder)) |
123 | 1326 | self.assertEquals(abspath(shouldbe_dir), | 1321 | self.assertEquals(os.path.abspath(shouldbe_dir), |
124 | 1327 | abspath(self.vm.shares['share_id'].path)) | 1322 | os.path.abspath(self.vm.shares['share_id'].path)) |
125 | 1328 | 1323 | ||
126 | 1329 | def test_handle_SV_SHARE_CHANGED_visible(self): | 1324 | def test_handle_SV_SHARE_CHANGED_visible(self): |
127 | 1330 | """test the handling of SV_SHARE_CHANGED for non-ascii visible name.""" | 1325 | """test the handling of SV_SHARE_CHANGED for non-ascii visible name.""" |
128 | @@ -1336,8 +1331,8 @@ | |||
129 | 1336 | self.vm.handle_SV_SHARE_CHANGED(info=share_holder) | 1331 | self.vm.handle_SV_SHARE_CHANGED(info=share_holder) |
130 | 1337 | shouldbe_dir = os.path.join(self.shares_dir, | 1332 | shouldbe_dir = os.path.join(self.shares_dir, |
131 | 1338 | get_share_dir_name(share_holder)) | 1333 | get_share_dir_name(share_holder)) |
134 | 1339 | self.assertEquals(abspath(shouldbe_dir), | 1334 | self.assertEquals(os.path.abspath(shouldbe_dir), |
135 | 1340 | abspath(self.vm.shares['share_id'].path)) | 1335 | os.path.abspath(self.vm.shares['share_id'].path)) |
136 | 1341 | 1336 | ||
137 | 1342 | 1337 | ||
138 | 1343 | class VolumeManagerVolumesTests(BaseVolumeManagerTests): | 1338 | class VolumeManagerVolumesTests(BaseVolumeManagerTests): |
139 | @@ -1358,7 +1353,8 @@ | |||
140 | 1358 | 1353 | ||
141 | 1359 | with environ('HOME', self.home_dir): | 1354 | with environ('HOME', self.home_dir): |
142 | 1360 | udf = self._create_udf(suggested_path=suggested_path) | 1355 | udf = self._create_udf(suggested_path=suggested_path) |
144 | 1361 | self.assertEquals(map(abspath, map(os.path.expanduser, expected)), | 1356 | self.assertEquals(map(os.path.abspath, |
145 | 1357 | map(os.path.expanduser, expected)), | ||
146 | 1362 | udf.ancestors) | 1358 | udf.ancestors) |
147 | 1363 | 1359 | ||
148 | 1364 | @defer.inlineCallbacks | 1360 | @defer.inlineCallbacks |
149 | @@ -1368,8 +1364,8 @@ | |||
150 | 1368 | udf = self._create_udf(suggested_path='~/' + suggested_path, | 1364 | udf = self._create_udf(suggested_path='~/' + suggested_path, |
151 | 1369 | subscribed=False) | 1365 | subscribed=False) |
152 | 1370 | yield self.vm.add_udf(udf) | 1366 | yield self.vm.add_udf(udf) |
155 | 1371 | self.assertEquals(abspath(os.path.join(self.home_dir, suggested_path)), | 1367 | self.assertEquals(os.path.abspath(os.path.join(self.home_dir, suggested_path)), |
156 | 1372 | abspath(udf.path)) | 1368 | os.path.abspath(udf.path)) |
157 | 1373 | self.assertEquals(1, len(self.vm.udfs)) | 1369 | self.assertEquals(1, len(self.vm.udfs)) |
158 | 1374 | # check that the UDF is in the fsm metadata | 1370 | # check that the UDF is in the fsm metadata |
159 | 1375 | mdobj = self.main.fs.get_by_path(udf.path) | 1371 | mdobj = self.main.fs.get_by_path(udf.path) |
160 | @@ -1383,8 +1379,8 @@ | |||
161 | 1383 | # add it again, but this time with subscribed = True | 1379 | # add it again, but this time with subscribed = True |
162 | 1384 | udf.subscribed = True | 1380 | udf.subscribed = True |
163 | 1385 | yield self.vm.add_udf(udf) | 1381 | yield self.vm.add_udf(udf) |
166 | 1386 | self.assertEquals(abspath(os.path.join(self.home_dir, suggested_path)), | 1382 | self.assertEquals(os.path.abspath(os.path.join(self.home_dir, suggested_path)), |
167 | 1387 | abspath(udf.path)) | 1383 | os.path.abspath(udf.path)) |
168 | 1388 | self.assertEquals(1, len(self.vm.udfs)) | 1384 | self.assertEquals(1, len(self.vm.udfs)) |
169 | 1389 | # check that the UDF is in the fsm metadata | 1385 | # check that the UDF is in the fsm metadata |
170 | 1390 | mdobj = self.main.fs.get_by_path(udf.path) | 1386 | mdobj = self.main.fs.get_by_path(udf.path) |
171 | @@ -1531,8 +1527,8 @@ | |||
172 | 1531 | self.assertEqual('fake_share_uuid', share.node_id) | 1527 | self.assertEqual('fake_share_uuid', share.node_id) |
173 | 1532 | udf = self.vm.udfs[str(udf_id)] | 1528 | udf = self.vm.udfs[str(udf_id)] |
174 | 1533 | self.assertEqual('udf_uuid', udf.node_id) | 1529 | self.assertEqual('udf_uuid', udf.node_id) |
177 | 1534 | self.assertEqual(abspath(os.path.join(self.home_dir, 'UDF')), | 1530 | self.assertEqual(os.path.abspath(os.path.join(self.home_dir, 'UDF')), |
178 | 1535 | abspath(udf.path)) | 1531 | os.path.abspath(udf.path)) |
179 | 1536 | # check that the root it's there, have right node_id and generation | 1532 | # check that the root it's there, have right node_id and generation |
180 | 1537 | self.assertIn(request.ROOT, self.vm.shares) | 1533 | self.assertIn(request.ROOT, self.vm.shares) |
181 | 1538 | root = self.vm.shares[request.ROOT] | 1534 | root = self.vm.shares[request.ROOT] |
182 | @@ -1599,9 +1595,9 @@ | |||
183 | 1599 | self.assertEqual('fake_share_uuid', share.node_id) | 1595 | self.assertEqual('fake_share_uuid', share.node_id) |
184 | 1600 | udf = self.vm.udfs[str(udf_id)] | 1596 | udf = self.vm.udfs[str(udf_id)] |
185 | 1601 | self.assertEqual('udf_uuid', udf.node_id) | 1597 | self.assertEqual('udf_uuid', udf.node_id) |
189 | 1602 | self.assertEqual(abspath(os.path.join(self.home_dir, | 1598 | self.assertEqual(os.path.abspath(os.path.join(self.home_dir, |
190 | 1603 | u'ñoño'.encode("utf8"))), | 1599 | u'ñoño'.encode("utf8"))), |
191 | 1604 | abspath(udf.path)) | 1600 | os.path.abspath(udf.path)) |
192 | 1605 | 1601 | ||
193 | 1606 | def test_handle_AQ_LIST_VOLUMES_root(self): | 1602 | def test_handle_AQ_LIST_VOLUMES_root(self): |
194 | 1607 | """Test the handling of the AQ_LIST_VOLUMES event.""" | 1603 | """Test the handling of the AQ_LIST_VOLUMES event.""" |
195 | @@ -1778,8 +1774,8 @@ | |||
196 | 1778 | self.assertIn(str(udf_id), self.vm.udfs) | 1774 | self.assertIn(str(udf_id), self.vm.udfs) |
197 | 1779 | udf = self.vm.udfs[str(udf_id)] | 1775 | udf = self.vm.udfs[str(udf_id)] |
198 | 1780 | self.assertEqual('udf_uuid', udf.node_id) | 1776 | self.assertEqual('udf_uuid', udf.node_id) |
201 | 1781 | self.assertEqual(abspath(os.path.join(self.home_dir, 'UDF')), | 1777 | self.assertEqual(os.path.abspath(os.path.join(self.home_dir, 'UDF')), |
202 | 1782 | abspath(udf.path)) | 1778 | os.path.abspath(udf.path)) |
203 | 1783 | if auto_subscribe: | 1779 | if auto_subscribe: |
204 | 1784 | # root and udf | 1780 | # root and udf |
205 | 1785 | self.assertEqual(2, len(list(self.vm.get_volumes()))) | 1781 | self.assertEqual(2, len(list(self.vm.get_volumes()))) |
206 | @@ -1839,7 +1835,8 @@ | |||
207 | 1839 | def check(info): | 1835 | def check(info): |
208 | 1840 | """Check the udf attributes.""" | 1836 | """Check the udf attributes.""" |
209 | 1841 | udf = info['udf'] | 1837 | udf = info['udf'] |
211 | 1842 | self.assertEquals(abspath(udf.path), abspath(path)) | 1838 | self.assertEquals(os.path.abspath(udf.path), |
212 | 1839 | os.path.abspath(path)) | ||
213 | 1843 | self.assertEquals(udf.volume_id, str(udf_id)) | 1840 | self.assertEquals(udf.volume_id, str(udf_id)) |
214 | 1844 | self.assertEquals(udf.node_id, str(node_id)) | 1841 | self.assertEquals(udf.node_id, str(node_id)) |
215 | 1845 | self.assertEquals(udf.suggested_path, u'~/MyUDF') | 1842 | self.assertEquals(udf.suggested_path, u'~/MyUDF') |
216 | @@ -1898,7 +1895,8 @@ | |||
217 | 1898 | def check_udf(info): | 1895 | def check_udf(info): |
218 | 1899 | """Check the udf attributes.""" | 1896 | """Check the udf attributes.""" |
219 | 1900 | deleted_udf = info['volume'] | 1897 | deleted_udf = info['volume'] |
221 | 1901 | self.assertEquals(abspath(deleted_udf.path), abspath(udf.path)) | 1898 | self.assertEquals(os.path.abspath(deleted_udf.path), |
222 | 1899 | os.path.abspath(udf.path)) | ||
223 | 1902 | self.assertEquals(deleted_udf.volume_id, udf.volume_id) | 1900 | self.assertEquals(deleted_udf.volume_id, udf.volume_id) |
224 | 1903 | self.assertEquals(deleted_udf.node_id, udf.node_id) | 1901 | self.assertEquals(deleted_udf.node_id, udf.node_id) |
225 | 1904 | self.assertEquals(deleted_udf.suggested_path, udf.suggested_path) | 1902 | self.assertEquals(deleted_udf.suggested_path, udf.suggested_path) |
226 | @@ -1912,7 +1910,7 @@ | |||
227 | 1912 | def check_share(info): | 1910 | def check_share(info): |
228 | 1913 | """Check the share attributes.""" | 1911 | """Check the share attributes.""" |
229 | 1914 | deleted_share = info['volume'] | 1912 | deleted_share = info['volume'] |
231 | 1915 | self.assertEquals(abspath(deleted_share.path), share.path) | 1913 | self.assertEquals(os.path.abspath(deleted_share.path), share.path) |
232 | 1916 | self.assertEquals(deleted_share.volume_id, share.volume_id) | 1914 | self.assertEquals(deleted_share.volume_id, share.volume_id) |
233 | 1917 | self.assertEquals(deleted_share.node_id, share.node_id) | 1915 | self.assertEquals(deleted_share.node_id, share.node_id) |
234 | 1918 | self.assertNotIn(deleted_share.volume_id, self.vm.shares) | 1916 | self.assertNotIn(deleted_share.volume_id, self.vm.shares) |
235 | @@ -2230,7 +2228,7 @@ | |||
236 | 2230 | def check(info): | 2228 | def check(info): |
237 | 2231 | """The callback""" | 2229 | """The callback""" |
238 | 2232 | udf = info['udf'] | 2230 | udf = info['udf'] |
240 | 2233 | self.assertEquals(abspath(udf.path), abspath(path)) | 2231 | self.assertEquals(os.path.abspath(udf.path), os.path.abspath(path)) |
241 | 2234 | self.assertEquals(udf.volume_id, str(udf_id)) | 2232 | self.assertEquals(udf.volume_id, str(udf_id)) |
242 | 2235 | self.assertEquals(udf.node_id, str(node_id)) | 2233 | self.assertEquals(udf.node_id, str(node_id)) |
243 | 2236 | self.assertEquals(0, len(self.vm.marker_udf_map)) | 2234 | self.assertEquals(0, len(self.vm.marker_udf_map)) |
244 | @@ -2276,7 +2274,8 @@ | |||
245 | 2276 | def check(info): | 2274 | def check(info): |
246 | 2277 | """Check the udf attributes.""" | 2275 | """Check the udf attributes.""" |
247 | 2278 | deleted_udf = info['volume'] | 2276 | deleted_udf = info['volume'] |
249 | 2279 | self.assertEquals(abspath(deleted_udf.path), abspath(udf.path)) | 2277 | self.assertEquals(os.path.abspath(deleted_udf.path), |
250 | 2278 | os.path.abspath(udf.path)) | ||
251 | 2280 | self.assertEquals(deleted_udf.volume_id, udf.volume_id) | 2279 | self.assertEquals(deleted_udf.volume_id, udf.volume_id) |
252 | 2281 | self.assertEquals(deleted_udf.node_id, udf.node_id) | 2280 | self.assertEquals(deleted_udf.node_id, udf.node_id) |
253 | 2282 | self.assertEquals(deleted_udf.suggested_path, udf.suggested_path) | 2281 | self.assertEquals(deleted_udf.suggested_path, udf.suggested_path) |
254 | @@ -3368,7 +3367,8 @@ | |||
255 | 3368 | mdobj = self.main.fs.get_by_path(udf.path) | 3367 | mdobj = self.main.fs.get_by_path(udf.path) |
256 | 3369 | self.assertEquals(udf.node_id, mdobj.node_id) | 3368 | self.assertEquals(udf.node_id, mdobj.node_id) |
257 | 3370 | self.assertEquals(udf.id, mdobj.share_id) | 3369 | self.assertEquals(udf.id, mdobj.share_id) |
259 | 3371 | self.assertEquals(abspath(udf.path), abspath(mdobj.path)) | 3370 | self.assertEquals(os.path.abspath(udf.path), |
260 | 3371 | os.path.abspath(mdobj.path)) | ||
261 | 3372 | 3372 | ||
262 | 3373 | @defer.inlineCallbacks | 3373 | @defer.inlineCallbacks |
263 | 3374 | def test_volumes_rescan_cb_active_udf(self): | 3374 | def test_volumes_rescan_cb_active_udf(self): |
264 | 3375 | 3375 | ||
265 | === modified file 'ubuntuone/platform/linux/__init__.py' | |||
266 | --- ubuntuone/platform/linux/__init__.py 2011-07-08 12:21:59 +0000 | |||
267 | +++ ubuntuone/platform/linux/__init__.py 2011-07-19 16:19:28 +0000 | |||
268 | @@ -26,7 +26,6 @@ | |||
269 | 26 | from dbus.mainloop.glib import DBusGMainLoop | 26 | from dbus.mainloop.glib import DBusGMainLoop |
270 | 27 | 27 | ||
271 | 28 | from ubuntuone.platform.linux.os_helper import ( | 28 | from ubuntuone.platform.linux.os_helper import ( |
272 | 29 | abspath, | ||
273 | 30 | access, | 29 | access, |
274 | 31 | allow_writes, | 30 | allow_writes, |
275 | 32 | can_write, | 31 | can_write, |
276 | 33 | 32 | ||
277 | === modified file 'ubuntuone/platform/linux/os_helper.py' | |||
278 | --- ubuntuone/platform/linux/os_helper.py 2011-06-24 01:45:01 +0000 | |||
279 | +++ ubuntuone/platform/linux/os_helper.py 2011-07-19 16:19:28 +0000 | |||
280 | @@ -169,11 +169,6 @@ | |||
281 | 169 | return os.path.abspath(path).split(os.path.sep) | 169 | return os.path.abspath(path).split(os.path.sep) |
282 | 170 | 170 | ||
283 | 171 | 171 | ||
284 | 172 | def abspath(path): | ||
285 | 173 | """Return an abspath.""" | ||
286 | 174 | return os.path.abspath(path) | ||
287 | 175 | |||
288 | 176 | |||
289 | 177 | def normpath(path): | 172 | def normpath(path): |
290 | 178 | """Normalize path, eliminating double slashes, etc.""" | 173 | """Normalize path, eliminating double slashes, etc.""" |
291 | 179 | return os.path.normpath(path) | 174 | return os.path.normpath(path) |
292 | 180 | \ No newline at end of file | 175 | \ No newline at end of file |
293 | 181 | 176 | ||
294 | === modified file 'ubuntuone/platform/windows/__init__.py' | |||
295 | --- ubuntuone/platform/windows/__init__.py 2011-07-08 12:21:59 +0000 | |||
296 | +++ ubuntuone/platform/windows/__init__.py 2011-07-19 16:19:28 +0000 | |||
297 | @@ -32,7 +32,6 @@ | |||
298 | 32 | 32 | ||
299 | 33 | 33 | ||
300 | 34 | from ubuntuone.platform.windows.os_helper import ( | 34 | from ubuntuone.platform.windows.os_helper import ( |
301 | 35 | abspath, | ||
302 | 36 | access, | 35 | access, |
303 | 37 | allow_writes, | 36 | allow_writes, |
304 | 38 | can_write, | 37 | can_write, |
305 | 39 | 38 | ||
306 | === modified file 'ubuntuone/platform/windows/os_helper.py' | |||
307 | --- ubuntuone/platform/windows/os_helper.py 2011-06-24 01:45:57 +0000 | |||
308 | +++ ubuntuone/platform/windows/os_helper.py 2011-07-19 16:19:28 +0000 | |||
309 | @@ -468,7 +468,7 @@ | |||
310 | 468 | path += '.lnk' | 468 | path += '.lnk' |
311 | 469 | shell = Dispatch('WScript.Shell') | 469 | shell = Dispatch('WScript.Shell') |
312 | 470 | shortcut = shell.CreateShortCut(path) | 470 | shortcut = shell.CreateShortCut(path) |
314 | 471 | return abspath(shortcut.Targetpath) | 471 | return os.path.abspath(shortcut.Targetpath) |
315 | 472 | 472 | ||
316 | 473 | 473 | ||
317 | 474 | @absparam(paths_indexes=[0]) | 474 | @absparam(paths_indexes=[0]) |
318 | @@ -599,16 +599,6 @@ | |||
319 | 599 | return list | 599 | return list |
320 | 600 | 600 | ||
321 | 601 | 601 | ||
322 | 602 | def abspath(path): | ||
323 | 603 | """Return an abspath.""" | ||
324 | 604 | # TODO: do we really need to do this, are the tests broken? | ||
325 | 605 | path = path.replace('/', '\\') | ||
326 | 606 | abs = os.path.abspath(remove_windows_illegal_chars(path)) | ||
327 | 607 | if not LONG_PATH_PREFIX in abs: | ||
328 | 608 | abs = LONG_PATH_PREFIX + abs | ||
329 | 609 | return abs | ||
330 | 610 | |||
331 | 611 | |||
332 | 612 | def normpath(path): | 602 | def normpath(path): |
333 | 613 | """Normalize path, eliminating double slashes, etc.""" | 603 | """Normalize path, eliminating double slashes, etc.""" |
334 | 614 | # the basic normpath does not work correctly with \\?\ which we use | 604 | # the basic normpath does not work correctly with \\?\ which we use |
335 | 615 | 605 | ||
336 | === modified file 'ubuntuone/syncdaemon/filesystem_manager.py' | |||
337 | --- ubuntuone/syncdaemon/filesystem_manager.py 2011-06-24 01:48:27 +0000 | |||
338 | +++ ubuntuone/syncdaemon/filesystem_manager.py 2011-07-19 16:19:28 +0000 | |||
339 | @@ -49,7 +49,6 @@ | |||
340 | 49 | set_file_readwrite, | 49 | set_file_readwrite, |
341 | 50 | stat_path, | 50 | stat_path, |
342 | 51 | ) | 51 | ) |
343 | 52 | from ubuntuone.platform import abspath as os_abspath | ||
344 | 53 | from ubuntuone.platform import open_file as os_open | 52 | from ubuntuone.platform import open_file as os_open |
345 | 54 | 53 | ||
346 | 55 | METADATA_VERSION = "6" | 54 | METADATA_VERSION = "6" |
347 | @@ -1305,7 +1304,7 @@ | |||
348 | 1305 | # the relaitve path is the fullpath | 1304 | # the relaitve path is the fullpath |
349 | 1306 | return share_path | 1305 | return share_path |
350 | 1307 | else: | 1306 | else: |
352 | 1308 | return os_abspath(os.path.join(share_path, path)) | 1307 | return os.path.abspath(os.path.join(share_path, path)) |
353 | 1309 | 1308 | ||
354 | 1310 | def _enable_share_write(self, share_id, path, recursive=False): | 1309 | def _enable_share_write(self, share_id, path, recursive=False): |
355 | 1311 | """Helper to create a EnableShareWrite context manager.""" | 1310 | """Helper to create a EnableShareWrite context manager.""" |
356 | 1312 | 1311 | ||
357 | === modified file 'ubuntuone/syncdaemon/volume_manager.py' | |||
358 | --- ubuntuone/syncdaemon/volume_manager.py 2011-07-08 12:21:59 +0000 | |||
359 | +++ ubuntuone/syncdaemon/volume_manager.py 2011-07-19 16:19:28 +0000 | |||
360 | @@ -27,14 +27,17 @@ | |||
361 | 27 | import sys | 27 | import sys |
362 | 28 | import shutil | 28 | import shutil |
363 | 29 | import stat | 29 | import stat |
364 | 30 | |||
365 | 30 | from itertools import ifilter | 31 | from itertools import ifilter |
366 | 31 | 32 | ||
367 | 33 | from twisted.internet import defer | ||
368 | 32 | from ubuntuone.storageprotocol import request | 34 | from ubuntuone.storageprotocol import request |
369 | 33 | from ubuntuone.storageprotocol.volumes import ( | 35 | from ubuntuone.storageprotocol.volumes import ( |
370 | 34 | ShareVolume, | 36 | ShareVolume, |
371 | 35 | UDFVolume, | 37 | UDFVolume, |
372 | 36 | RootVolume, | 38 | RootVolume, |
373 | 37 | ) | 39 | ) |
374 | 40 | |||
375 | 38 | from ubuntuone.syncdaemon.marker import MDMarker | 41 | from ubuntuone.syncdaemon.marker import MDMarker |
376 | 39 | from ubuntuone.syncdaemon.interfaces import IMarker | 42 | from ubuntuone.syncdaemon.interfaces import IMarker |
377 | 40 | from ubuntuone.syncdaemon import file_shelf, config | 43 | from ubuntuone.syncdaemon import file_shelf, config |
378 | @@ -57,10 +60,6 @@ | |||
379 | 57 | set_dir_readonly, | 60 | set_dir_readonly, |
380 | 58 | set_dir_readwrite | 61 | set_dir_readwrite |
381 | 59 | ) | 62 | ) |
382 | 60 | from ubuntuone.platform import abspath as os_abspath | ||
383 | 61 | |||
384 | 62 | from twisted.internet import defer | ||
385 | 63 | |||
386 | 64 | 63 | ||
387 | 65 | # tritcask row types | 64 | # tritcask row types |
388 | 66 | SHARE_ROW_TYPE = 3 | 65 | SHARE_ROW_TYPE = 3 |
389 | @@ -1501,8 +1500,8 @@ | |||
390 | 1501 | and os.path.exists(self._shared_md_dir): | 1500 | and os.path.exists(self._shared_md_dir): |
391 | 1502 | # we have shares and shared dirs | 1501 | # we have shares and shared dirs |
392 | 1503 | # md_version >= 1 | 1502 | # md_version >= 1 |
395 | 1504 | old_root_dir = os_abspath(os.path.join(self._root_dir, 'My Files')) | 1503 | old_root_dir = os.path.abspath(os.path.join(self._root_dir, 'My Files')) |
396 | 1505 | old_share_dir = os_abspath(os.path.join(self._root_dir, | 1504 | old_share_dir = os.path.abspath(os.path.join(self._root_dir, |
397 | 1506 | 'Shared With Me')) | 1505 | 'Shared With Me')) |
398 | 1507 | if os.path.exists(old_share_dir) and os.path.exists(old_root_dir) \ | 1506 | if os.path.exists(old_share_dir) and os.path.exists(old_root_dir) \ |
399 | 1508 | and not is_link(old_share_dir): | 1507 | and not is_link(old_share_dir): |
400 | @@ -1521,7 +1520,7 @@ | |||
401 | 1521 | except OSError: | 1520 | except OSError: |
402 | 1522 | target = None | 1521 | target = None |
403 | 1523 | if is_link(self._shares_dir_link) \ | 1522 | if is_link(self._shares_dir_link) \ |
405 | 1524 | and normpath(target) == os_abspath(self._shares_dir_link): | 1523 | and normpath(target) == os.path.abspath(self._shares_dir_link): |
406 | 1525 | # broken symlink, md_version = 4 | 1524 | # broken symlink, md_version = 4 |
407 | 1526 | md_version = '4' | 1525 | md_version = '4' |
408 | 1527 | else: | 1526 | else: |
Looks great. Thanks mandel and nessita!