Merge lp:~alecu/ubuntuone-client/unicode-usernames into lp:ubuntuone-client

Proposed by Alejandro J. Cura
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 1141
Merged at revision: 1142
Proposed branch: lp:~alecu/ubuntuone-client/unicode-usernames
Merge into: lp:ubuntuone-client
Diff against target: 403 lines (+115/-25)
12 files modified
tests/platform/test_filesystem_notifications.py (+13/-1)
tests/syncdaemon/test_config.py (+24/-1)
tests/syncdaemon/test_vm.py (+35/-0)
ubuntuone/platform/linux/__init__.py (+1/-0)
ubuntuone/platform/linux/os_helper.py (+5/-0)
ubuntuone/platform/windows/__init__.py (+1/-0)
ubuntuone/platform/windows/os_helper.py (+6/-6)
ubuntuone/platform/xdg_base_directory/__init__.py (+4/-1)
ubuntuone/syncdaemon/config.py (+18/-10)
ubuntuone/syncdaemon/filesystem_notifications.py (+2/-2)
ubuntuone/syncdaemon/main.py (+3/-2)
ubuntuone/syncdaemon/volume_manager.py (+3/-2)
To merge this branch: bzr merge lp:~alecu/ubuntuone-client/unicode-usernames
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+76145@code.launchpad.net

Commit message

Support for unicode usernames (LP: #846373)

Description of the change

Support for unicode usernames (LP: #846373)
This branch *REQUIRES* this other branch: lp:~alecu/ubuntu-sso-client/unicode-usernames

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Revision history for this message
Manuel de la Peña (mandel) :
review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (34.3 KiB)

The attempt to merge lp:~alecu/ubuntuone-client/unicode-usernames into lp:ubuntuone-client failed. Below is the output from the failed tests.

/usr/bin/gnome-autogen.sh
checking for autoconf >= 2.53...
  testing autoconf2.50... not found.
  testing autoconf... found 2.67
checking for automake >= 1.10...
  testing automake-1.11... found 1.11.1
checking for libtool >= 1.5...
  testing libtoolize... found 2.2.6b
checking for intltool >= 0.30...
  testing intltoolize... found 0.41.1
checking for pkg-config >= 0.14.0...
  testing pkg-config... found 0.25
checking for gtk-doc >= 1.0...
  testing gtkdocize... found 1.17
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running libtoolize...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
Running gtkdocize...
Running aclocal-1.11...
Running autoconf...
Running autoheader...
Running automake-1.11...
Running ./configure --enable-gtk-doc --enable-debug ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to ...

Revision history for this message
Alejandro J. Cura (alecu) wrote :

It seems like tarmac is not picking up the changes from sso, but instead it's using the sso packaged in nightlies.

Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (34.3 KiB)

The attempt to merge lp:~alecu/ubuntuone-client/unicode-usernames into lp:ubuntuone-client failed. Below is the output from the failed tests.

/usr/bin/gnome-autogen.sh
checking for autoconf >= 2.53...
  testing autoconf2.50... not found.
  testing autoconf... found 2.67
checking for automake >= 1.10...
  testing automake-1.11... found 1.11.1
checking for libtool >= 1.5...
  testing libtoolize... found 2.2.6b
checking for intltool >= 0.30...
  testing intltoolize... found 0.41.1
checking for pkg-config >= 0.14.0...
  testing pkg-config... found 0.25
checking for gtk-doc >= 1.0...
  testing gtkdocize... found 1.17
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running libtoolize...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
Running gtkdocize...
Running aclocal-1.11...
Running autoconf...
Running autoheader...
Running automake-1.11...
Running ./configure --enable-gtk-doc --enable-debug ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to ...

Revision history for this message
Alejandro J. Cura (alecu) wrote :

Let's try once more.

Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (34.3 KiB)

The attempt to merge lp:~alecu/ubuntuone-client/unicode-usernames into lp:ubuntuone-client failed. Below is the output from the failed tests.

/usr/bin/gnome-autogen.sh
checking for autoconf >= 2.53...
  testing autoconf2.50... not found.
  testing autoconf... found 2.67
checking for automake >= 1.10...
  testing automake-1.11... found 1.11.1
checking for libtool >= 1.5...
  testing libtoolize... found 2.2.6b
checking for intltool >= 0.30...
  testing intltoolize... found 0.41.1
checking for pkg-config >= 0.14.0...
  testing pkg-config... found 0.25
checking for gtk-doc >= 1.0...
  testing gtkdocize... found 1.17
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running libtoolize...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
Running gtkdocize...
Running aclocal-1.11...
Running autoconf...
Running autoheader...
Running automake-1.11...
Running ./configure --enable-gtk-doc --enable-debug ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to ...

Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (369.3 KiB)

The attempt to merge lp:~alecu/ubuntuone-client/unicode-usernames into lp:ubuntuone-client failed. Below is the output from the failed tests.

/usr/bin/gnome-autogen.sh
checking for autoconf >= 2.53...
  testing autoconf2.50... not found.
  testing autoconf... found 2.67
checking for automake >= 1.10...
  testing automake-1.11... found 1.11.1
checking for libtool >= 1.5...
  testing libtoolize... found 2.2.6b
checking for intltool >= 0.30...
  testing intltoolize... found 0.41.1
checking for pkg-config >= 0.14.0...
  testing pkg-config... found 0.25
checking for gtk-doc >= 1.0...
  testing gtkdocize... found 1.17
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running libtoolize...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
Running gtkdocize...
Running aclocal-1.11...
Running autoconf...
Running autoheader...
Running automake-1.11...
Running ./configure --enable-gtk-doc --enable-debug ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to ...

1139. By Alejandro J. Cura

merged trunk in

1140. By Alejandro J. Cura

skip Unicode tests on linux

1141. By Alejandro J. Cura

merged with trunk

Revision history for this message
Alejandro J. Cura (alecu) wrote :

Since paths and environment variables are always "bytes" on linux, we've decided to only run the tests for this fixes on windows.

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-08-25 18:27:25 +0000
+++ tests/platform/test_filesystem_notifications.py 2011-10-03 14:06:49 +0000
@@ -20,9 +20,9 @@
2020
21import logging21import logging
22import os22import os
23import unittest
2423
25from twisted.internet import defer, reactor24from twisted.internet import defer, reactor
25from twisted.trial import unittest
26from ubuntuone.devtools.handlers import MementoHandler26from ubuntuone.devtools.handlers import MementoHandler
2727
28from tests.platform import _GeneralINotifyProcessor28from tests.platform import _GeneralINotifyProcessor
@@ -36,6 +36,7 @@
36from ubuntuone.syncdaemon import (36from ubuntuone.syncdaemon import (
37 event_queue,37 event_queue,
38 filesystem_manager,38 filesystem_manager,
39 filesystem_notifications,
39)40)
4041
41class IgnoreFileTests(unittest.TestCase):42class IgnoreFileTests(unittest.TestCase):
@@ -72,6 +73,17 @@
72 self.assertFalse(p.is_ignored("--foo--"))73 self.assertFalse(p.is_ignored("--foo--"))
73 self.assertFalse(p.is_ignored("otherstuff"))74 self.assertFalse(p.is_ignored("otherstuff"))
7475
76 def test_is_ignored_uses_access(self):
77 """Test that the right access function is called."""
78 sample_path = "sample path"
79 calls = []
80 store_call = lambda *args: calls.append(args)
81 self.patch(filesystem_notifications, "access", store_call)
82 self.patch(filesystem_notifications, "path_exists", lambda _: True)
83 p = _GeneralINotifyProcessor(None)
84 p.is_ignored(sample_path)
85 self.assertEqual(calls, [(sample_path,)])
86
7587
76class BaseFSMonitorTestCase(BaseTwistedTestCase):88class BaseFSMonitorTestCase(BaseTwistedTestCase):
77 """Test the structures where we have the path/watch."""89 """Test the structures where we have the path/watch."""
7890
=== modified file 'tests/syncdaemon/test_config.py'
--- tests/syncdaemon/test_config.py 2011-08-24 16:24:01 +0000
+++ tests/syncdaemon/test_config.py 2011-10-03 14:06:49 +0000
@@ -1,4 +1,5 @@
1#1# encoding: utf-8
2
2# Author: Guillermo Gonzalez <guillermo.gonzalez@canonical.com>3# Author: Guillermo Gonzalez <guillermo.gonzalez@canonical.com>
3#4#
4# Copyright 2009 Canonical Ltd.5# Copyright 2009 Canonical Ltd.
@@ -19,10 +20,13 @@
1920
20import logging21import logging
21import os22import os
23import sys
2224
23from ConfigParser import ConfigParser25from ConfigParser import ConfigParser
24from twisted.internet import defer26from twisted.internet import defer
27from twisted.trial.unittest import TestCase
2528
29from ubuntuone.devtools.testcase import skipIfOS
26from ubuntuone.platform import open_file, path_exists30from ubuntuone.platform import open_file, path_exists
27from ubuntu_sso.xdg_base_directory import (31from ubuntu_sso.xdg_base_directory import (
28 xdg_data_home,32 xdg_data_home,
@@ -471,6 +475,25 @@
471 self.assertEqual(conf.get_max_payload_size(), 666)475 self.assertEqual(conf.get_max_payload_size(), 666)
472476
473477
478class UnicodePathsTestCase(TestCase):
479 """Tests for unicode paths."""
480
481 @skipIfOS('linux2', 'On linux paths are bytes so this test does not apply')
482 def test_get_config_files_path_encoding(self):
483 """Check that get_config_files uses paths in the right encoding."""
484 temp = self.mktemp()
485 fake_path = os.path.join(temp, u"Ñandú")
486 native_dir = fake_path.encode(sys.getfilesystemencoding())
487 os.makedirs(native_dir)
488 with open(os.path.join(native_dir, config.CONFIG_FILE), "w") as f:
489 f.write("this is a fake config file")
490 fake_load_config_paths = lambda _: [fake_path.encode("utf8")]
491 self.patch(config, "load_config_paths", fake_load_config_paths)
492 config_files = config.get_config_files()
493 branch_config = os.path.join(native_dir, config.CONFIG_FILE)
494 self.assertIn(branch_config, config_files)
495
496
474class ConfigglueParsersTests(BaseTwistedTestCase):497class ConfigglueParsersTests(BaseTwistedTestCase):
475 """Tests for our custom configglue parsers."""498 """Tests for our custom configglue parsers."""
476499
477500
=== modified file 'tests/syncdaemon/test_vm.py'
--- tests/syncdaemon/test_vm.py 2011-09-06 17:13:11 +0000
+++ tests/syncdaemon/test_vm.py 2011-10-03 14:06:49 +0000
@@ -25,6 +25,7 @@
25import inspect25import inspect
26import logging26import logging
27import os27import os
28import sys
28import uuid29import uuid
2930
30from mocker import Mocker, MATCH31from mocker import Mocker, MATCH
@@ -35,6 +36,7 @@
35 FakeMain,36 FakeMain,
36)37)
37from ubuntuone.devtools.handlers import MementoHandler38from ubuntuone.devtools.handlers import MementoHandler
39from ubuntuone.devtools.testcase import skipIfOS
38from ubuntuone.storageprotocol import volumes, request40from ubuntuone.storageprotocol import volumes, request
39from ubuntuone.storageprotocol.client import ListShares41from ubuntuone.storageprotocol.client import ListShares
40from ubuntuone.storageprotocol.sharersp import (42from ubuntuone.storageprotocol.sharersp import (
@@ -3887,6 +3889,39 @@
3887 self.md_upgrader._upgrade_metadata_5(6)3889 self.md_upgrader._upgrade_metadata_5(6)
38883890
38893891
3892@skipIfOS('linux2', 'On linux paths are bytes so this tests do not apply')
3893class MetadataVersionFileTestCase(MetadataTestCase):
3894 """Check that the metadata version file can have unicode characters."""
3895
3896 @defer.inlineCallbacks
3897 def setUp(self):
3898 """Initialize this testcase."""
3899 yield super(MetadataVersionFileTestCase, self).setUp()
3900 self.fake_version = "FAKE"
3901 self.patch(VolumeManager, "METADATA_VERSION", self.fake_version)
3902 self.temp_dir = os.path.join(self.mktemp(), u"Ñandú")
3903 self.version_file = os.path.join(self.temp_dir, ".version").encode(
3904 sys.getfilesystemencoding())
3905 self.md_upgrader = MetadataUpgrader(self.temp_dir.encode("utf-8"),
3906 "", "", "", "", "", "", None)
3907
3908 def test_metadata_version_write(self):
3909 """The metadata .version file is written on unicode paths."""
3910 self.md_upgrader.update_metadata_version()
3911
3912 with open(self.version_file) as fh:
3913 result = fh.read().strip()
3914 self.assertEqual(result, self.fake_version)
3915
3916 def test_metadata_version_read(self):
3917 """The metadata .version file is read from unicode paths."""
3918 with open(self.version_file, "w") as fh:
3919 fh.write(self.fake_version)
3920
3921 result = self.md_upgrader._get_md_version()
3922 self.assertEqual(result, self.fake_version)
3923
3924
3890class VMTritcaskShelfTests(BaseTwistedTestCase):3925class VMTritcaskShelfTests(BaseTwistedTestCase):
3891 """Tests for VMTritcaskShelf."""3926 """Tests for VMTritcaskShelf."""
38923927
38933928
=== modified file 'ubuntuone/platform/linux/__init__.py'
--- ubuntuone/platform/linux/__init__.py 2011-08-17 12:43:42 +0000
+++ ubuntuone/platform/linux/__init__.py 2011-10-03 14:06:49 +0000
@@ -37,6 +37,7 @@
37 make_dir,37 make_dir,
38 make_link,38 make_link,
39 move_to_trash,39 move_to_trash,
40 native_rename,
40 normpath,41 normpath,
41 open_file,42 open_file,
42 path_exists,43 path_exists,
4344
=== modified file 'ubuntuone/platform/linux/os_helper.py'
--- ubuntuone/platform/linux/os_helper.py 2011-08-22 13:31:56 +0000
+++ ubuntuone/platform/linux/os_helper.py 2011-10-03 14:06:49 +0000
@@ -115,6 +115,11 @@
115 os.rename(path_from, path_to)115 os.rename(path_from, path_to)
116116
117117
118def native_rename(path_from, path_to):
119 """Rename a file or directory."""
120 os.rename(path_from, path_to)
121
122
118def recursive_move(path_from, path_to):123def recursive_move(path_from, path_to):
119 """Perform a recursive move."""124 """Perform a recursive move."""
120 shutil.move(path_from, path_to)125 shutil.move(path_from, path_to)
121126
=== modified file 'ubuntuone/platform/windows/__init__.py'
--- ubuntuone/platform/windows/__init__.py 2011-08-17 12:43:42 +0000
+++ ubuntuone/platform/windows/__init__.py 2011-10-03 14:06:49 +0000
@@ -36,6 +36,7 @@
36 make_dir,36 make_dir,
37 make_link,37 make_link,
38 move_to_trash,38 move_to_trash,
39 native_rename,
39 normpath,40 normpath,
40 open_file,41 open_file,
41 path_exists,42 path_exists,
4243
=== modified file 'ubuntuone/platform/windows/os_helper.py'
--- ubuntuone/platform/windows/os_helper.py 2011-09-01 10:53:13 +0000
+++ ubuntuone/platform/windows/os_helper.py 2011-10-03 14:06:49 +0000
@@ -568,11 +568,11 @@
568@windowspath(path_indexes=[0, 1])568@windowspath(path_indexes=[0, 1])
569def rename(path_from, path_to):569def rename(path_from, path_to):
570 """Rename a file or directory."""570 """Rename a file or directory."""
571 return _rename(path_from, path_to)571 return native_rename(path_from, path_to)
572572
573573
574def _rename(path_from, path_to):574def native_rename(path_from, path_to):
575 """Rename a file or directory."""575 """Rename a file or directory, using native paths."""
576 # No need to do any specific handling for invalid characters since576 # No need to do any specific handling for invalid characters since
577 # 'path_from' and 'path_to' are valid windows paths.577 # 'path_from' and 'path_to' are valid windows paths.
578 # Also, to ensure the same behaviors as on linux, use the MoveFileExW function578 # Also, to ensure the same behaviors as on linux, use the MoveFileExW function
@@ -598,7 +598,7 @@
598 if os.path.isdir(path_to):598 if os.path.isdir(path_to):
599 path_to = os.path.join(path_to, os.path.basename(path_from))599 path_to = os.path.join(path_to, os.path.basename(path_from))
600 try:600 try:
601 _rename(path_from, path_to)601 native_rename(path_from, path_to)
602 except OSError, e:602 except OSError, e:
603 raise IOError(e.errno, str(e))603 raise IOError(e.errno, str(e))
604 else:604 else:
605605
=== modified file 'ubuntuone/platform/xdg_base_directory/__init__.py'
--- ubuntuone/platform/xdg_base_directory/__init__.py 2011-08-24 16:24:01 +0000
+++ ubuntuone/platform/xdg_base_directory/__init__.py 2011-10-03 14:06:49 +0000
@@ -18,8 +18,11 @@
1818
19import os19import os
2020
21from ubuntu_sso.xdg_base_directory import xdg_cache_home21from ubuntu_sso.xdg_base_directory import xdg_cache_home, native_path
2222
23# All usage of the ubuntuone_log_dir is for native access,
24# so we only change it here
23ubuntuone_log_dir = os.path.join(xdg_cache_home, 'ubuntuone', 'log')25ubuntuone_log_dir = os.path.join(xdg_cache_home, 'ubuntuone', 'log')
26ubuntuone_log_dir = native_path(ubuntuone_log_dir)
24if not os.path.exists(ubuntuone_log_dir):27if not os.path.exists(ubuntuone_log_dir):
25 os.makedirs(ubuntuone_log_dir)28 os.makedirs(ubuntuone_log_dir)
2629
=== modified file 'ubuntuone/syncdaemon/config.py'
--- ubuntuone/syncdaemon/config.py 2011-08-24 16:24:01 +0000
+++ ubuntuone/syncdaemon/config.py 2011-10-03 14:06:49 +0000
@@ -25,9 +25,15 @@
2525
26from ConfigParser import NoOptionError, NoSectionError26from ConfigParser import NoOptionError, NoSectionError
27from optparse import OptionParser27from optparse import OptionParser
28from ubuntuone.platform import path_exists, rename28# We should not use standard functions from os_helper here,
29# because the configglue superclasses do not use them.
30# Instead, all paths used in this module should be "native",
31# that is: utf8 str on linux, or (unicode or mbcs str) on windows
32from ubuntuone.platform import native_rename
29from ubuntu_sso.xdg_base_directory import (33from ubuntu_sso.xdg_base_directory import (
30 load_config_paths,34 load_config_paths,
35 native_path,
36 syncdaemon_path,
31 save_config_path,37 save_config_path,
32 xdg_data_home,38 xdg_data_home,
33 xdg_cache_home,39 xdg_cache_home,
@@ -70,7 +76,8 @@
70logger = logging.getLogger('ubuntuone.SyncDaemon.config')76logger = logging.getLogger('ubuntuone.SyncDaemon.config')
7177
72# get (and possibly create if don't exists) the user config file78# get (and possibly create if don't exists) the user config file
73_user_config_path = os.path.join(save_config_path('ubuntuone'), CONFIG_FILE)79_user_config_path = os.path.join(native_path(save_config_path('ubuntuone')),
80 CONFIG_FILE)
7481
75# module private config instance.82# module private config instance.
76# this object is the shared config83# this object is the shared config
@@ -85,7 +92,7 @@
85 Return the path using user home + value.92 Return the path using user home + value.
8693
87 """94 """
88 result = os.path.expanduser(path_from_unix(value))95 result = syncdaemon_path(os.path.expanduser(path_from_unix(value)))
89 assert isinstance(result, str)96 assert isinstance(result, str)
90 return result97 return result
9198
@@ -151,12 +158,13 @@
151 """158 """
152 config_files = []159 config_files = []
153 for xdg_config_dir in load_config_paths('ubuntuone'):160 for xdg_config_dir in load_config_paths('ubuntuone'):
161 xdg_config_dir = native_path(xdg_config_dir)
154 config_file = os.path.join(xdg_config_dir, CONFIG_FILE)162 config_file = os.path.join(xdg_config_dir, CONFIG_FILE)
155 if path_exists(config_file):163 if os.path.exists(config_file):
156 config_files.append(config_file)164 config_files.append(config_file)
157165
158 config_logs = os.path.join(xdg_config_dir, CONFIG_LOGS)166 config_logs = os.path.join(xdg_config_dir, CONFIG_LOGS)
159 if path_exists(config_logs):167 if os.path.exists(config_logs):
160 config_files.append(config_logs)168 config_files.append(config_logs)
161169
162 # reverse the list as load_config_paths returns the user dir first170 # reverse the list as load_config_paths returns the user dir first
@@ -164,11 +172,11 @@
164 # if we are running from a branch, get the config files from it too172 # if we are running from a branch, get the config files from it too
165 config_file = os.path.join(os.path.dirname(__file__), os.path.pardir,173 config_file = os.path.join(os.path.dirname(__file__), os.path.pardir,
166 os.path.pardir, 'data', CONFIG_FILE)174 os.path.pardir, 'data', CONFIG_FILE)
167 if path_exists(config_file):175 if os.path.exists(config_file):
168 config_files.append(config_file)176 config_files.append(config_file)
169177
170 config_logs = os.path.join('data', CONFIG_LOGS)178 config_logs = os.path.join('data', CONFIG_LOGS)
171 if path_exists(config_logs):179 if os.path.exists(config_logs):
172 config_files.append(config_logs)180 config_files.append(config_logs)
173181
174 return config_files182 return config_files
@@ -293,9 +301,9 @@
293 self.remove_section(section)301 self.remove_section(section)
294 with open(self.config_file + '.new', 'w') as fp:302 with open(self.config_file + '.new', 'w') as fp:
295 self.write(fp)303 self.write(fp)
296 if path_exists(self.config_file):304 if os.path.exists(self.config_file):
297 rename(self.config_file, self.config_file + '.old')305 native_rename(self.config_file, self.config_file + '.old')
298 rename(self.config_file + '.new', self.config_file)306 native_rename(self.config_file + '.new', self.config_file)
299307
300 def get_parsed(self, section, option):308 def get_parsed(self, section, option):
301 """get that fallbacks to our custom defaults"""309 """get that fallbacks to our custom defaults"""
302310
=== modified file 'ubuntuone/syncdaemon/filesystem_notifications.py'
--- ubuntuone/syncdaemon/filesystem_notifications.py 2011-08-09 12:56:06 +0000
+++ ubuntuone/syncdaemon/filesystem_notifications.py 2011-10-03 14:06:49 +0000
@@ -19,7 +19,7 @@
19import os19import os
20import re20import re
2121
22from ubuntuone.platform import path_exists22from ubuntuone.platform import access, path_exists
23from ubuntuone.syncdaemon.mute_filter import MuteFilter23from ubuntuone.syncdaemon.mute_filter import MuteFilter
24from ubuntuone import logger24from ubuntuone import logger
25# our logging level25# our logging level
@@ -97,7 +97,7 @@
97 # check first if the platform code knows hat to do with it97 # check first if the platform code knows hat to do with it
98 if not self.platform_is_ignored(path):98 if not self.platform_is_ignored(path):
99 # check if we can read99 # check if we can read
100 if path_exists(path) and not os.access(path, os.R_OK):100 if path_exists(path) and not access(path):
101 self.log.warning("Ignoring path as we don't have enough "101 self.log.warning("Ignoring path as we don't have enough "
102 "permissions to track it: %r", path)102 "permissions to track it: %r", path)
103 return True103 return True
104104
=== modified file 'ubuntuone/syncdaemon/main.py'
--- ubuntuone/syncdaemon/main.py 2011-08-25 20:20:23 +0000
+++ ubuntuone/syncdaemon/main.py 2011-10-03 14:06:49 +0000
@@ -24,6 +24,7 @@
2424
25from twisted.internet import defer, reactor, task25from twisted.internet import defer, reactor, task
2626
27from ubuntu_sso.xdg_base_directory import native_path
27from ubuntuone.syncdaemon import (28from ubuntuone.syncdaemon import (
28 action_queue,29 action_queue,
29 config,30 config,
@@ -84,7 +85,7 @@
84 self.shares_dir_link = os.path.join(self.root_dir, shares_symlink_name)85 self.shares_dir_link = os.path.join(self.root_dir, shares_symlink_name)
85 self.data_dir = data_dir86 self.data_dir = data_dir
86 self.partials_dir = partials_dir87 self.partials_dir = partials_dir
87 self.tritcask_dir = os.path.join(self.data_dir, 'tritcask')88 tritcask_dir = os.path.join(self.data_dir, 'tritcask')
88 self.logger = logging.getLogger('ubuntuone.SyncDaemon.Main')89 self.logger = logging.getLogger('ubuntuone.SyncDaemon.Main')
89 user_config = config.get_user_config()90 user_config = config.get_user_config()
90 if read_limit is None:91 if read_limit is None:
@@ -99,7 +100,7 @@
99 self.logger.info("Using %r as root dir", self.root_dir)100 self.logger.info("Using %r as root dir", self.root_dir)
100 self.logger.info("Using %r as data dir", self.data_dir)101 self.logger.info("Using %r as data dir", self.data_dir)
101 self.logger.info("Using %r as shares root dir", self.shares_dir)102 self.logger.info("Using %r as shares root dir", self.shares_dir)
102 self.db = tritcask.Tritcask(self.tritcask_dir)103 self.db = tritcask.Tritcask(native_path(tritcask_dir))
103 self.vm = volume_manager.VolumeManager(self)104 self.vm = volume_manager.VolumeManager(self)
104 self.fs = filesystem_manager.FileSystemManager(105 self.fs = filesystem_manager.FileSystemManager(
105 data_dir, partials_dir, self.vm, self.db)106 data_dir, partials_dir, self.vm, self.db)
106107
=== modified file 'ubuntuone/syncdaemon/volume_manager.py'
--- ubuntuone/syncdaemon/volume_manager.py 2011-09-06 17:13:11 +0000
+++ ubuntuone/syncdaemon/volume_manager.py 2011-10-03 14:06:49 +0000
@@ -54,6 +54,7 @@
54 listdir,54 listdir,
55 make_dir,55 make_dir,
56 normpath,56 normpath,
57 open_file,
57 path_exists,58 path_exists,
58 read_link,59 read_link,
59 recursive_move,60 recursive_move,
@@ -1448,7 +1449,7 @@
1448 make_dir(self._data_dir, recursive=True)1449 make_dir(self._data_dir, recursive=True)
1449 self.update_metadata_version()1450 self.update_metadata_version()
1450 elif path_exists(self._version_file):1451 elif path_exists(self._version_file):
1451 with open(self._version_file) as fh:1452 with open_file(self._version_file) as fh:
1452 md_version = fh.read().strip()1453 md_version = fh.read().strip()
1453 if not md_version:1454 if not md_version:
1454 # we don't have a version of the metadata but a .version file?1455 # we don't have a version of the metadata but a .version file?
@@ -1464,7 +1465,7 @@
1464 """Write the version of the metadata."""1465 """Write the version of the metadata."""
1465 if not path_exists(os.path.dirname(self._version_file)):1466 if not path_exists(os.path.dirname(self._version_file)):
1466 make_dir(os.path.dirname(self._version_file), recursive=True)1467 make_dir(os.path.dirname(self._version_file), recursive=True)
1467 with open(self._version_file, 'w') as fd:1468 with open_file(self._version_file, 'w') as fd:
1468 fd.write(VolumeManager.METADATA_VERSION)1469 fd.write(VolumeManager.METADATA_VERSION)
1469 # make sure the data get to disk1470 # make sure the data get to disk
1470 fd.flush()1471 fd.flush()

Subscribers

People subscribed via source and target branches