Merge lp:~diegosarmentero/ubuntuone-client/darwin-os-helper into lp:ubuntuone-client
| Status: | Merged |
|---|---|
| Approved by: | Manuel de la Peña on 2012-05-21 |
| Approved revision: | 1261 |
| Merged at revision: | 1246 |
| Proposed branch: | lp:~diegosarmentero/ubuntuone-client/darwin-os-helper |
| Merge into: | lp:ubuntuone-client |
| Diff against target: |
1108 lines (+777/-149) 20 files modified
Makefile.am (+3/-3) run-mac-tests (+47/-0) run-tests.bat (+2/-2) tests/platform/__init__.py (+5/-2) tests/platform/ipc/test_darwin.py (+65/-0) tests/platform/os_helper/test_darwin.py (+104/-0) ubuntuone/platform/filesystem_notifications/__init__.py (+4/-0) ubuntuone/platform/filesystem_notifications/darwin.py (+37/-0) ubuntuone/platform/ipc/__init__.py (+3/-0) ubuntuone/platform/ipc/darwin.py (+44/-0) ubuntuone/platform/logger/__init__.py (+3/-0) ubuntuone/platform/logger/darwin.py (+37/-0) ubuntuone/platform/os_helper/__init__.py (+3/-0) ubuntuone/platform/os_helper/darwin.py (+110/-0) ubuntuone/platform/os_helper/linux.py (+28/-142) ubuntuone/platform/os_helper/unix.py (+186/-0) ubuntuone/platform/session/__init__.py (+3/-0) ubuntuone/platform/session/darwin.py (+43/-0) ubuntuone/platform/tools/__init__.py (+3/-0) ubuntuone/platform/tools/darwin.py (+47/-0) |
| To merge this branch: | bzr merge lp:~diegosarmentero/ubuntuone-client/darwin-os-helper |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Manuel de la Peña (community) | Approve on 2012-05-21 | ||
| Mike McCracken (community) | 2012-05-16 | Approve on 2012-05-17 | |
|
Review via email:
|
|||
Commit Message
- Adding MAC OS implementation for platform/os_helper
Description of the Change
To run the tests on MAC OS you need to install ubuntuone-
./run-mac-tests tests/platform/
os_helper is the only thing that is working in mac right now, the other modules have dummy implementations to avoid failures with the imports.
- 1257. By Diego Sarmentero on 2012-05-16
-
reverting and modifying run-tests.bat file
| Manuel de la Peña (mandel) wrote : | # |
Adding to the great comments from Mike. I think using the name common is a little misleading, what about unix.py or nix.py to state that is for the *nix flavors of the code.
There are a number of copyrights that are wrong, for example:
115 +# Copyright 2009-2012 Canonical Ltd.
But test_darwin was not there until 2012, or were you hiding it? :)
- 1258. By Diego Sarmentero on 2012-05-17
-
Improving move_to_trash, adding new tests
- 1259. By Diego Sarmentero on 2012-05-17
-
Fixing Files header.
- 1260. By Diego Sarmentero on 2012-05-17
-
Fixing move_to_trash not existing file test
| Diego Sarmentero (diegosarmentero) wrote : | # |
> Adding to the great comments from Mike. I think using the name common is a
> little misleading, what about unix.py or nix.py to state that is for the *nix
> flavors of the code.
>
> There are a number of copyrights that are wrong, for example:
>
> 115 +# Copyright 2009-2012 Canonical Ltd.
>
> But test_darwin was not there until 2012, or were you hiding it? :)
Fixed
- 1261. By Diego Sarmentero on 2012-05-17
-
Fixing os_helper tests
| Diego Sarmentero (diegosarmentero) wrote : | # |
> Two things:
>
> 1. the docstring for common.py still says it's for linux
>
> 2. os_helper/darwin.py :
> move_to_trash() currently always moves to ~/.Trash, which is OK if the file is
> on the root filesystem, but if it's mounted on a separate volume, it should go
> into that volume's .Trashes directory at
> /Volumes/
>
> This will be useful for folders outside home. I believe it's possible to have
> home on a separately mounted drive, but I doubt that too many people do that.
>
> It also needs a check for non-existent paths, or else it'll catch the IOError
> in shutil.move() and try to os.remove() a non-existent path.
>
> Might also want a test for non-existent name handling.
>
> I wrote a version of move_to_trash with /Volumes/ handling a while ago that I
> never ran because of all the test errors. It had BUGS. I just fixed it, added
> throwing a useful exception on nonexistent paths, and posted it here:
> http://
> it should plug right in, if you'd like to use it.
Fixed
| Manuel de la Peña (mandel) wrote : | # |
Looks good but I wonder if there is a nicer way to do the following:
529 +set_no_rights = unix.set_no_rights
530 +set_file_readonly = unix.set_
531 +set_file_readwrite = unix.set_
532 +set_dir_readonly = unix.set_
533 +set_dir_readwrite = unix.set_
534 +allow_writes = unix.allow_writes
535 +remove_file = unix.remove_file
536 +remove_tree = unix.remove_tree
537 +remove_dir = unix.remove_dir
538 +path_exists = unix.path_exists
539 +make_dir = unix.make_dir
540 +open_file = unix.open_file
541 +rename = unix.rename
542 +native_rename = unix.native_rename
543 +recursive_move = unix.recursive_move
544 +make_link = unix.make_link
545 +read_link = unix.read_link
546 +is_link = unix.is_link
547 +remove_link = unix.remove_link
548 +listdir = unix.listdir
549 +walk = unix.walk
550 +access = unix.access
551 +can_write = unix.can_write
552 +stat_path = unix.stat_path
553 +is_root = unix.is_root
554 +get_path_list = unix.get_path_list
555 +normpath = unix.normpath
I know that simply importing the functions will make them accessible via the darwin package, is there a reason why you are doing it this way? (pyflakes maybe?)
| Diego Sarmentero (diegosarmentero) wrote : | # |
> Looks good but I wonder if there is a nicer way to do the following:
>
> 529 +set_no_rights = unix.set_no_rights
> 530 +set_file_readonly = unix.set_
> 531 +set_file_readwrite = unix.set_
> 532 +set_dir_readonly = unix.set_
> 533 +set_dir_readwrite = unix.set_
> 534 +allow_writes = unix.allow_writes
> 535 +remove_file = unix.remove_file
> 536 +remove_tree = unix.remove_tree
> 537 +remove_dir = unix.remove_dir
> 538 +path_exists = unix.path_exists
> 539 +make_dir = unix.make_dir
> 540 +open_file = unix.open_file
> 541 +rename = unix.rename
> 542 +native_rename = unix.native_rename
> 543 +recursive_move = unix.recursive_move
> 544 +make_link = unix.make_link
> 545 +read_link = unix.read_link
> 546 +is_link = unix.is_link
> 547 +remove_link = unix.remove_link
> 548 +listdir = unix.listdir
> 549 +walk = unix.walk
> 550 +access = unix.access
> 551 +can_write = unix.can_write
> 552 +stat_path = unix.stat_path
> 553 +is_root = unix.is_root
> 554 +get_path_list = unix.get_path_list
> 555 +normpath = unix.normpath
>
> I know that simply importing the functions will make them accessible via the
> darwin package, is there a reason why you are doing it this way? (pyflakes
> maybe?)
Yes, pyflakes will say something like:
./ubuntuone/
51: 'rename' imported but unused
51: 'walk' imported but unused
51: 'set_dir_readwrite' imported but unused
51: 'allow_writes' imported but unused
51: 'is_link' imported but unused
51: 'set_file_
51: 'path_exists' imported but unused
51: 'open_file' imported but unused
51: 'set_no_rights' imported but unused
51: 'access' imported but unused
51: 'read_link' imported but unused
51: 'remove_dir' imported but unused
51: 'set_file_readonly' imported but unused
51: 'listdir' imported but unused
51: 'can_write' imported but unused
51: 'remove_tree' imported but unused
51: 'make_link' imported but unused
51: 'make_dir' imported but unused
51: 'native_rename' imported but unused
51: 'get_path_list' imported but unused
51: 'recursive_move' imported but unused
51: 'is_root' imported but unused
51: 'remove_link' imported but unused
51: 'normpath' imported but unused
51: 'set_dir_readonly' imported but unused
51: 'remove_file' imported but unused
51: 'stat_path' imported but unused
make: *** [lint] Error 53


Two things:
1. the docstring for common.py still says it's for linux
2. os_helper/darwin.py : volume_ name_goes_ here/.Trashes/ my_uid_ here/file.
move_to_trash() currently always moves to ~/.Trash, which is OK if the file is on the root filesystem, but if it's mounted on a separate volume, it should go into that volume's .Trashes directory at /Volumes/
This will be useful for folders outside home. I believe it's possible to have home on a separately mounted drive, but I doubt that too many people do that.
It also needs a check for non-existent paths, or else it'll catch the IOError in shutil.move() and try to os.remove() a non-existent path.
Might also want a test for non-existent name handling.
I wrote a version of move_to_trash with /Volumes/ handling a while ago that I never ran because of all the test errors. It had BUGS. I just fixed it, added throwing a useful exception on nonexistent paths, and posted it here: http:// paste.ubuntu. com/991189/
it should plug right in, if you'd like to use it.