Merge lp:~nataliabidart/ubuntuone-client/no-custom-abspath into lp:ubuntuone-client

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
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).

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
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Looks great. Thanks mandel and nessita!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/platform/test_filesystem_notifications.py'
--- tests/platform/test_filesystem_notifications.py 2011-04-19 15:33:42 +0000
+++ tests/platform/test_filesystem_notifications.py 2011-07-19 16:19:28 +0000
@@ -84,7 +84,6 @@
84 self.root_dir = platform_mangled_path(self.mktemp('root_dir'))84 self.root_dir = platform_mangled_path(self.mktemp('root_dir'))
85 self.home_dir = platform_mangled_path(self.mktemp('home_dir'))85 self.home_dir = platform_mangled_path(self.mktemp('home_dir'))
86 self.vm = testcase.FakeVolumeManager(self.root_dir)86 self.vm = testcase.FakeVolumeManager(self.root_dir)
87 # FIXME: Trictask cannot deal with \\\\?\\ infornt of files
88 self.tritcask_dir = self.mktemp("tritcask_dir")87 self.tritcask_dir = self.mktemp("tritcask_dir")
89 self.db = Tritcask(self.tritcask_dir)88 self.db = Tritcask(self.tritcask_dir)
90 self.fs = filesystem_manager.FileSystemManager(fsmdir, partials_dir,89 self.fs = filesystem_manager.FileSystemManager(fsmdir, partials_dir,
9190
=== modified file 'tests/syncdaemon/test_vm.py'
--- tests/syncdaemon/test_vm.py 2011-07-08 12:21:59 +0000
+++ tests/syncdaemon/test_vm.py 2011-07-19 16:19:28 +0000
@@ -59,7 +59,6 @@
59 VolumeDoesNotExist,59 VolumeDoesNotExist,
60)60)
61from ubuntuone.platform import (61from ubuntuone.platform import (
62 abspath,
63 get_udf_path,62 get_udf_path,
64 make_link,63 make_link,
65 make_dir,64 make_dir,
@@ -576,7 +575,7 @@
576 'Modify')575 'Modify')
577 # initialize the the root576 # initialize the the root
578 self.vm._got_root('root_uuid')577 self.vm._got_root('root_uuid')
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'))
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)
581 self.main.fs.set_node_id(shared_dir, shared_response.subtree)580 self.main.fs.set_node_id(shared_dir, shared_response.subtree)
582 response = ListShares(None)581 response = ListShares(None)
@@ -628,7 +627,7 @@
628 self.assertEquals('View', access_level)627 self.assertEquals('View', access_level)
629 self.assertTrue(marker is not None)628 self.assertTrue(marker is not None)
630 share = self.vm.marker_share_map[marker]629 share = self.vm.marker_share_map[marker]
631 self.assertEquals(abspath(path), share.path)630 self.assertEquals(os.path.abspath(path), share.path)
632 self.assertEquals('View', share.access_level)631 self.assertEquals('View', share.access_level)
633 self.assertEquals(marker, share.volume_id)632 self.assertEquals(marker, share.volume_id)
634 self.assertEquals('fake_user', share.other_username)633 self.assertEquals('fake_user', share.other_username)
@@ -654,7 +653,7 @@
654 @defer.inlineCallbacks653 @defer.inlineCallbacks
655 def test_create_share_missing_node_id(self):654 def test_create_share_missing_node_id(self):
656 """Test VolumeManager.create_share in the case of missing node_id."""655 """Test VolumeManager.create_share in the case of missing node_id."""
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'))
658 self.main.fs.create(path, "")657 self.main.fs.create(path, "")
659 expected_node_id = uuid.uuid4()658 expected_node_id = uuid.uuid4()
660 expected_share_id = uuid.uuid4()659 expected_share_id = uuid.uuid4()
@@ -877,9 +876,7 @@
877 for path in paths:876 for path in paths:
878 self.assertTrue(self.main.event_q.has_watch(path))877 self.assertTrue(self.main.event_q.has_watch(path))
879 # remove the watches878 # remove the watches
880 # TODO: because tritcask does not work well with \\?\ we are adding it879 self.vm._remove_watches(os.path.abspath(self.root_dir))
881 # here rather than in mktemp which is the correct place to do it
882 self.vm._remove_watches(abspath(self.root_dir))
883 for path in paths:880 for path in paths:
884 self.assertFalse(self.main.event_q.has_watch(path), path)881 self.assertFalse(self.main.event_q.has_watch(path), path)
885882
@@ -893,16 +890,14 @@
893890
894 os.rename(path, path+'.old')891 os.rename(path, path+'.old')
895 # remove the watches892 # remove the watches
896 # TODO: because tritcask does not work well with \\?\ we are adding it893 self.vm._remove_watches(os.path.abspath(self.root_dir))
897 # here rather than in mktemp which is the correct place to do it
898 self.vm._remove_watches(abspath(self.root_dir))
899894
900 self.assertFalse(self.main.event_q.has_watch(path),895 self.assertFalse(self.main.event_q.has_watch(path),
901 'watch should not be present')896 'watch should not be present')
902897
903 def test_delete_fsm_object(self):898 def test_delete_fsm_object(self):
904 """Test for VolumeManager._delete_fsm_object"""899 """Test for VolumeManager._delete_fsm_object"""
905 path = abspath(os.path.join(self.root_dir, 'dir'))900 path = os.path.abspath(os.path.join(self.root_dir, 'dir'))
906 make_dir(path, recursive=True)901 make_dir(path, recursive=True)
907 self.main.fs.create(path, "", is_dir=True)902 self.main.fs.create(path, "", is_dir=True)
908 self.main.fs.set_node_id(path, 'dir_node_id')903 self.main.fs.set_node_id(path, 'dir_node_id')
@@ -1217,7 +1212,7 @@
1217 dirs = ['dir', os.path.join('dir','subdir'),1212 dirs = ['dir', os.path.join('dir','subdir'),
1218 os.path.join('dir', 'empty_dir')]1213 os.path.join('dir', 'empty_dir')]
1219 for i, dir in enumerate(dirs):1214 for i, dir in enumerate(dirs):
1220 path = abspath(os.path.join(share.path, dir))1215 path = os.path.abspath(os.path.join(share.path, dir))
1221 with allow_writes(os.path.split(share.path)[0]):1216 with allow_writes(os.path.split(share.path)[0]):
1222 with allow_writes(share.path):1217 with allow_writes(share.path):
1223 if not os.path.exists(path):1218 if not os.path.exists(path):
@@ -1227,7 +1222,7 @@
1227 files = ['a_file', os.path.join('dir', 'file'),1222 files = ['a_file', os.path.join('dir', 'file'),
1228 os.path.join('dir', 'subdir', 'file')]1223 os.path.join('dir', 'subdir', 'file')]
1229 for i, path in enumerate(files):1224 for i, path in enumerate(files):
1230 path = abspath(os.path.join(share.path, path))1225 path = os.path.abspath(os.path.join(share.path, path))
1231 with allow_writes(os.path.split(share.path)[0]):1226 with allow_writes(os.path.split(share.path)[0]):
1232 with allow_writes(share.path):1227 with allow_writes(share.path):
1233 open(path, 'w').close()1228 open(path, 'w').close()
@@ -1292,7 +1287,7 @@
1292 share = self.vm.shares['share_id']1287 share = self.vm.shares['share_id']
1293 shouldbe_dir = os.path.join(self.shares_dir,1288 shouldbe_dir = os.path.join(self.shares_dir,
1294 get_share_dir_name(share_response))1289 get_share_dir_name(share_response))
1295 self.assertEquals(abspath(shouldbe_dir), share.path)1290 self.assertEquals(os.path.abspath(shouldbe_dir), share.path)
12961291
1297 def test_handle_SHARES_visible_username(self):1292 def test_handle_SHARES_visible_username(self):
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."""
@@ -1311,7 +1306,7 @@
1311 share = self.vm.shares['share_id']1306 share = self.vm.shares['share_id']
1312 shouldbe_dir = os.path.join(self.shares_dir,1307 shouldbe_dir = os.path.join(self.shares_dir,
1313 get_share_dir_name(share_response))1308 get_share_dir_name(share_response))
1314 self.assertEquals(abspath(shouldbe_dir), share.path)1309 self.assertEquals(os.path.abspath(shouldbe_dir), share.path)
13151310
1316 def test_handle_SV_SHARE_CHANGED_sharename(self):1311 def test_handle_SV_SHARE_CHANGED_sharename(self):
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."""
@@ -1323,8 +1318,8 @@
1323 self.vm.handle_SV_SHARE_CHANGED(info=share_holder)1318 self.vm.handle_SV_SHARE_CHANGED(info=share_holder)
1324 shouldbe_dir = os.path.join(self.shares_dir,1319 shouldbe_dir = os.path.join(self.shares_dir,
1325 get_share_dir_name(share_holder))1320 get_share_dir_name(share_holder))
1326 self.assertEquals(abspath(shouldbe_dir),1321 self.assertEquals(os.path.abspath(shouldbe_dir),
1327 abspath(self.vm.shares['share_id'].path))1322 os.path.abspath(self.vm.shares['share_id'].path))
13281323
1329 def test_handle_SV_SHARE_CHANGED_visible(self):1324 def test_handle_SV_SHARE_CHANGED_visible(self):
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."""
@@ -1336,8 +1331,8 @@
1336 self.vm.handle_SV_SHARE_CHANGED(info=share_holder)1331 self.vm.handle_SV_SHARE_CHANGED(info=share_holder)
1337 shouldbe_dir = os.path.join(self.shares_dir,1332 shouldbe_dir = os.path.join(self.shares_dir,
1338 get_share_dir_name(share_holder))1333 get_share_dir_name(share_holder))
1339 self.assertEquals(abspath(shouldbe_dir),1334 self.assertEquals(os.path.abspath(shouldbe_dir),
1340 abspath(self.vm.shares['share_id'].path))1335 os.path.abspath(self.vm.shares['share_id'].path))
13411336
13421337
1343class VolumeManagerVolumesTests(BaseVolumeManagerTests):1338class VolumeManagerVolumesTests(BaseVolumeManagerTests):
@@ -1358,7 +1353,8 @@
13581353
1359 with environ('HOME', self.home_dir):1354 with environ('HOME', self.home_dir):
1360 udf = self._create_udf(suggested_path=suggested_path)1355 udf = self._create_udf(suggested_path=suggested_path)
1361 self.assertEquals(map(abspath, map(os.path.expanduser, expected)),1356 self.assertEquals(map(os.path.abspath,
1357 map(os.path.expanduser, expected)),
1362 udf.ancestors)1358 udf.ancestors)
13631359
1364 @defer.inlineCallbacks1360 @defer.inlineCallbacks
@@ -1368,8 +1364,8 @@
1368 udf = self._create_udf(suggested_path='~/' + suggested_path,1364 udf = self._create_udf(suggested_path='~/' + suggested_path,
1369 subscribed=False)1365 subscribed=False)
1370 yield self.vm.add_udf(udf)1366 yield self.vm.add_udf(udf)
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)),
1372 abspath(udf.path))1368 os.path.abspath(udf.path))
1373 self.assertEquals(1, len(self.vm.udfs))1369 self.assertEquals(1, len(self.vm.udfs))
1374 # check that the UDF is in the fsm metadata1370 # check that the UDF is in the fsm metadata
1375 mdobj = self.main.fs.get_by_path(udf.path)1371 mdobj = self.main.fs.get_by_path(udf.path)
@@ -1383,8 +1379,8 @@
1383 # add it again, but this time with subscribed = True1379 # add it again, but this time with subscribed = True
1384 udf.subscribed = True1380 udf.subscribed = True
1385 yield self.vm.add_udf(udf)1381 yield self.vm.add_udf(udf)
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)),
1387 abspath(udf.path))1383 os.path.abspath(udf.path))
1388 self.assertEquals(1, len(self.vm.udfs))1384 self.assertEquals(1, len(self.vm.udfs))
1389 # check that the UDF is in the fsm metadata1385 # check that the UDF is in the fsm metadata
1390 mdobj = self.main.fs.get_by_path(udf.path)1386 mdobj = self.main.fs.get_by_path(udf.path)
@@ -1531,8 +1527,8 @@
1531 self.assertEqual('fake_share_uuid', share.node_id)1527 self.assertEqual('fake_share_uuid', share.node_id)
1532 udf = self.vm.udfs[str(udf_id)]1528 udf = self.vm.udfs[str(udf_id)]
1533 self.assertEqual('udf_uuid', udf.node_id)1529 self.assertEqual('udf_uuid', udf.node_id)
1534 self.assertEqual(abspath(os.path.join(self.home_dir, 'UDF')),1530 self.assertEqual(os.path.abspath(os.path.join(self.home_dir, 'UDF')),
1535 abspath(udf.path))1531 os.path.abspath(udf.path))
1536 # check that the root it's there, have right node_id and generation1532 # check that the root it's there, have right node_id and generation
1537 self.assertIn(request.ROOT, self.vm.shares)1533 self.assertIn(request.ROOT, self.vm.shares)
1538 root = self.vm.shares[request.ROOT]1534 root = self.vm.shares[request.ROOT]
@@ -1599,9 +1595,9 @@
1599 self.assertEqual('fake_share_uuid', share.node_id)1595 self.assertEqual('fake_share_uuid', share.node_id)
1600 udf = self.vm.udfs[str(udf_id)]1596 udf = self.vm.udfs[str(udf_id)]
1601 self.assertEqual('udf_uuid', udf.node_id)1597 self.assertEqual('udf_uuid', udf.node_id)
1602 self.assertEqual(abspath(os.path.join(self.home_dir,1598 self.assertEqual(os.path.abspath(os.path.join(self.home_dir,
1603 u'ñoño'.encode("utf8"))),1599 u'ñoño'.encode("utf8"))),
1604 abspath(udf.path))1600 os.path.abspath(udf.path))
16051601
1606 def test_handle_AQ_LIST_VOLUMES_root(self):1602 def test_handle_AQ_LIST_VOLUMES_root(self):
1607 """Test the handling of the AQ_LIST_VOLUMES event."""1603 """Test the handling of the AQ_LIST_VOLUMES event."""
@@ -1778,8 +1774,8 @@
1778 self.assertIn(str(udf_id), self.vm.udfs)1774 self.assertIn(str(udf_id), self.vm.udfs)
1779 udf = self.vm.udfs[str(udf_id)]1775 udf = self.vm.udfs[str(udf_id)]
1780 self.assertEqual('udf_uuid', udf.node_id)1776 self.assertEqual('udf_uuid', udf.node_id)
1781 self.assertEqual(abspath(os.path.join(self.home_dir, 'UDF')),1777 self.assertEqual(os.path.abspath(os.path.join(self.home_dir, 'UDF')),
1782 abspath(udf.path))1778 os.path.abspath(udf.path))
1783 if auto_subscribe:1779 if auto_subscribe:
1784 # root and udf1780 # root and udf
1785 self.assertEqual(2, len(list(self.vm.get_volumes())))1781 self.assertEqual(2, len(list(self.vm.get_volumes())))
@@ -1839,7 +1835,8 @@
1839 def check(info):1835 def check(info):
1840 """Check the udf attributes."""1836 """Check the udf attributes."""
1841 udf = info['udf']1837 udf = info['udf']
1842 self.assertEquals(abspath(udf.path), abspath(path))1838 self.assertEquals(os.path.abspath(udf.path),
1839 os.path.abspath(path))
1843 self.assertEquals(udf.volume_id, str(udf_id))1840 self.assertEquals(udf.volume_id, str(udf_id))
1844 self.assertEquals(udf.node_id, str(node_id))1841 self.assertEquals(udf.node_id, str(node_id))
1845 self.assertEquals(udf.suggested_path, u'~/MyUDF')1842 self.assertEquals(udf.suggested_path, u'~/MyUDF')
@@ -1898,7 +1895,8 @@
1898 def check_udf(info):1895 def check_udf(info):
1899 """Check the udf attributes."""1896 """Check the udf attributes."""
1900 deleted_udf = info['volume']1897 deleted_udf = info['volume']
1901 self.assertEquals(abspath(deleted_udf.path), abspath(udf.path))1898 self.assertEquals(os.path.abspath(deleted_udf.path),
1899 os.path.abspath(udf.path))
1902 self.assertEquals(deleted_udf.volume_id, udf.volume_id)1900 self.assertEquals(deleted_udf.volume_id, udf.volume_id)
1903 self.assertEquals(deleted_udf.node_id, udf.node_id)1901 self.assertEquals(deleted_udf.node_id, udf.node_id)
1904 self.assertEquals(deleted_udf.suggested_path, udf.suggested_path)1902 self.assertEquals(deleted_udf.suggested_path, udf.suggested_path)
@@ -1912,7 +1910,7 @@
1912 def check_share(info):1910 def check_share(info):
1913 """Check the share attributes."""1911 """Check the share attributes."""
1914 deleted_share = info['volume']1912 deleted_share = info['volume']
1915 self.assertEquals(abspath(deleted_share.path), share.path)1913 self.assertEquals(os.path.abspath(deleted_share.path), share.path)
1916 self.assertEquals(deleted_share.volume_id, share.volume_id)1914 self.assertEquals(deleted_share.volume_id, share.volume_id)
1917 self.assertEquals(deleted_share.node_id, share.node_id)1915 self.assertEquals(deleted_share.node_id, share.node_id)
1918 self.assertNotIn(deleted_share.volume_id, self.vm.shares)1916 self.assertNotIn(deleted_share.volume_id, self.vm.shares)
@@ -2230,7 +2228,7 @@
2230 def check(info):2228 def check(info):
2231 """The callback"""2229 """The callback"""
2232 udf = info['udf']2230 udf = info['udf']
2233 self.assertEquals(abspath(udf.path), abspath(path))2231 self.assertEquals(os.path.abspath(udf.path), os.path.abspath(path))
2234 self.assertEquals(udf.volume_id, str(udf_id))2232 self.assertEquals(udf.volume_id, str(udf_id))
2235 self.assertEquals(udf.node_id, str(node_id))2233 self.assertEquals(udf.node_id, str(node_id))
2236 self.assertEquals(0, len(self.vm.marker_udf_map))2234 self.assertEquals(0, len(self.vm.marker_udf_map))
@@ -2276,7 +2274,8 @@
2276 def check(info):2274 def check(info):
2277 """Check the udf attributes."""2275 """Check the udf attributes."""
2278 deleted_udf = info['volume']2276 deleted_udf = info['volume']
2279 self.assertEquals(abspath(deleted_udf.path), abspath(udf.path))2277 self.assertEquals(os.path.abspath(deleted_udf.path),
2278 os.path.abspath(udf.path))
2280 self.assertEquals(deleted_udf.volume_id, udf.volume_id)2279 self.assertEquals(deleted_udf.volume_id, udf.volume_id)
2281 self.assertEquals(deleted_udf.node_id, udf.node_id)2280 self.assertEquals(deleted_udf.node_id, udf.node_id)
2282 self.assertEquals(deleted_udf.suggested_path, udf.suggested_path)2281 self.assertEquals(deleted_udf.suggested_path, udf.suggested_path)
@@ -3368,7 +3367,8 @@
3368 mdobj = self.main.fs.get_by_path(udf.path)3367 mdobj = self.main.fs.get_by_path(udf.path)
3369 self.assertEquals(udf.node_id, mdobj.node_id)3368 self.assertEquals(udf.node_id, mdobj.node_id)
3370 self.assertEquals(udf.id, mdobj.share_id)3369 self.assertEquals(udf.id, mdobj.share_id)
3371 self.assertEquals(abspath(udf.path), abspath(mdobj.path))3370 self.assertEquals(os.path.abspath(udf.path),
3371 os.path.abspath(mdobj.path))
33723372
3373 @defer.inlineCallbacks3373 @defer.inlineCallbacks
3374 def test_volumes_rescan_cb_active_udf(self):3374 def test_volumes_rescan_cb_active_udf(self):
33753375
=== modified file 'ubuntuone/platform/linux/__init__.py'
--- ubuntuone/platform/linux/__init__.py 2011-07-08 12:21:59 +0000
+++ ubuntuone/platform/linux/__init__.py 2011-07-19 16:19:28 +0000
@@ -26,7 +26,6 @@
26from dbus.mainloop.glib import DBusGMainLoop26from dbus.mainloop.glib import DBusGMainLoop
2727
28from ubuntuone.platform.linux.os_helper import (28from ubuntuone.platform.linux.os_helper import (
29 abspath,
30 access,29 access,
31 allow_writes,30 allow_writes,
32 can_write,31 can_write,
3332
=== modified file 'ubuntuone/platform/linux/os_helper.py'
--- ubuntuone/platform/linux/os_helper.py 2011-06-24 01:45:01 +0000
+++ ubuntuone/platform/linux/os_helper.py 2011-07-19 16:19:28 +0000
@@ -169,11 +169,6 @@
169 return os.path.abspath(path).split(os.path.sep)169 return os.path.abspath(path).split(os.path.sep)
170170
171171
172def abspath(path):
173 """Return an abspath."""
174 return os.path.abspath(path)
175
176
177def normpath(path):172def normpath(path):
178 """Normalize path, eliminating double slashes, etc."""173 """Normalize path, eliminating double slashes, etc."""
179 return os.path.normpath(path)174 return os.path.normpath(path)
180\ No newline at end of file175\ No newline at end of file
181176
=== modified file 'ubuntuone/platform/windows/__init__.py'
--- ubuntuone/platform/windows/__init__.py 2011-07-08 12:21:59 +0000
+++ ubuntuone/platform/windows/__init__.py 2011-07-19 16:19:28 +0000
@@ -32,7 +32,6 @@
3232
3333
34from ubuntuone.platform.windows.os_helper import (34from ubuntuone.platform.windows.os_helper import (
35 abspath,
36 access,35 access,
37 allow_writes,36 allow_writes,
38 can_write,37 can_write,
3938
=== modified file 'ubuntuone/platform/windows/os_helper.py'
--- ubuntuone/platform/windows/os_helper.py 2011-06-24 01:45:57 +0000
+++ ubuntuone/platform/windows/os_helper.py 2011-07-19 16:19:28 +0000
@@ -468,7 +468,7 @@
468 path += '.lnk'468 path += '.lnk'
469 shell = Dispatch('WScript.Shell')469 shell = Dispatch('WScript.Shell')
470 shortcut = shell.CreateShortCut(path)470 shortcut = shell.CreateShortCut(path)
471 return abspath(shortcut.Targetpath)471 return os.path.abspath(shortcut.Targetpath)
472472
473473
474@absparam(paths_indexes=[0])474@absparam(paths_indexes=[0])
@@ -599,16 +599,6 @@
599 return list599 return list
600600
601601
602def abspath(path):
603 """Return an abspath."""
604 # TODO: do we really need to do this, are the tests broken?
605 path = path.replace('/', '\\')
606 abs = os.path.abspath(remove_windows_illegal_chars(path))
607 if not LONG_PATH_PREFIX in abs:
608 abs = LONG_PATH_PREFIX + abs
609 return abs
610
611
612def normpath(path):602def normpath(path):
613 """Normalize path, eliminating double slashes, etc."""603 """Normalize path, eliminating double slashes, etc."""
614 # the basic normpath does not work correctly with \\?\ which we use604 # the basic normpath does not work correctly with \\?\ which we use
615605
=== modified file 'ubuntuone/syncdaemon/filesystem_manager.py'
--- ubuntuone/syncdaemon/filesystem_manager.py 2011-06-24 01:48:27 +0000
+++ ubuntuone/syncdaemon/filesystem_manager.py 2011-07-19 16:19:28 +0000
@@ -49,7 +49,6 @@
49 set_file_readwrite,49 set_file_readwrite,
50 stat_path,50 stat_path,
51)51)
52from ubuntuone.platform import abspath as os_abspath
53from ubuntuone.platform import open_file as os_open52from ubuntuone.platform import open_file as os_open
5453
55METADATA_VERSION = "6"54METADATA_VERSION = "6"
@@ -1305,7 +1304,7 @@
1305 # the relaitve path is the fullpath1304 # the relaitve path is the fullpath
1306 return share_path1305 return share_path
1307 else:1306 else:
1308 return os_abspath(os.path.join(share_path, path))1307 return os.path.abspath(os.path.join(share_path, path))
13091308
1310 def _enable_share_write(self, share_id, path, recursive=False):1309 def _enable_share_write(self, share_id, path, recursive=False):
1311 """Helper to create a EnableShareWrite context manager."""1310 """Helper to create a EnableShareWrite context manager."""
13121311
=== modified file 'ubuntuone/syncdaemon/volume_manager.py'
--- ubuntuone/syncdaemon/volume_manager.py 2011-07-08 12:21:59 +0000
+++ ubuntuone/syncdaemon/volume_manager.py 2011-07-19 16:19:28 +0000
@@ -27,14 +27,17 @@
27import sys27import sys
28import shutil28import shutil
29import stat29import stat
30
30from itertools import ifilter31from itertools import ifilter
3132
33from twisted.internet import defer
32from ubuntuone.storageprotocol import request34from ubuntuone.storageprotocol import request
33from ubuntuone.storageprotocol.volumes import (35from ubuntuone.storageprotocol.volumes import (
34 ShareVolume,36 ShareVolume,
35 UDFVolume,37 UDFVolume,
36 RootVolume,38 RootVolume,
37)39)
40
38from ubuntuone.syncdaemon.marker import MDMarker41from ubuntuone.syncdaemon.marker import MDMarker
39from ubuntuone.syncdaemon.interfaces import IMarker42from ubuntuone.syncdaemon.interfaces import IMarker
40from ubuntuone.syncdaemon import file_shelf, config43from ubuntuone.syncdaemon import file_shelf, config
@@ -57,10 +60,6 @@
57 set_dir_readonly,60 set_dir_readonly,
58 set_dir_readwrite61 set_dir_readwrite
59)62)
60from ubuntuone.platform import abspath as os_abspath
61
62from twisted.internet import defer
63
6463
65# tritcask row types64# tritcask row types
66SHARE_ROW_TYPE = 365SHARE_ROW_TYPE = 3
@@ -1501,8 +1500,8 @@
1501 and os.path.exists(self._shared_md_dir):1500 and os.path.exists(self._shared_md_dir):
1502 # we have shares and shared dirs1501 # we have shares and shared dirs
1503 # md_version >= 11502 # md_version >= 1
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'))
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,
1506 'Shared With Me'))1505 'Shared With Me'))
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) \
1508 and not is_link(old_share_dir):1507 and not is_link(old_share_dir):
@@ -1521,7 +1520,7 @@
1521 except OSError:1520 except OSError:
1522 target = None1521 target = None
1523 if is_link(self._shares_dir_link) \1522 if is_link(self._shares_dir_link) \
1524 and normpath(target) == os_abspath(self._shares_dir_link):1523 and normpath(target) == os.path.abspath(self._shares_dir_link):
1525 # broken symlink, md_version = 41524 # broken symlink, md_version = 4
1526 md_version = '4'1525 md_version = '4'
1527 else:1526 else:

Subscribers

People subscribed via source and target branches