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
1=== modified file 'tests/platform/test_filesystem_notifications.py'
2--- tests/platform/test_filesystem_notifications.py 2011-08-25 18:27:25 +0000
3+++ tests/platform/test_filesystem_notifications.py 2011-10-03 14:06:49 +0000
4@@ -20,9 +20,9 @@
5
6 import logging
7 import os
8-import unittest
9
10 from twisted.internet import defer, reactor
11+from twisted.trial import unittest
12 from ubuntuone.devtools.handlers import MementoHandler
13
14 from tests.platform import _GeneralINotifyProcessor
15@@ -36,6 +36,7 @@
16 from ubuntuone.syncdaemon import (
17 event_queue,
18 filesystem_manager,
19+ filesystem_notifications,
20 )
21
22 class IgnoreFileTests(unittest.TestCase):
23@@ -72,6 +73,17 @@
24 self.assertFalse(p.is_ignored("--foo--"))
25 self.assertFalse(p.is_ignored("otherstuff"))
26
27+ def test_is_ignored_uses_access(self):
28+ """Test that the right access function is called."""
29+ sample_path = "sample path"
30+ calls = []
31+ store_call = lambda *args: calls.append(args)
32+ self.patch(filesystem_notifications, "access", store_call)
33+ self.patch(filesystem_notifications, "path_exists", lambda _: True)
34+ p = _GeneralINotifyProcessor(None)
35+ p.is_ignored(sample_path)
36+ self.assertEqual(calls, [(sample_path,)])
37+
38
39 class BaseFSMonitorTestCase(BaseTwistedTestCase):
40 """Test the structures where we have the path/watch."""
41
42=== modified file 'tests/syncdaemon/test_config.py'
43--- tests/syncdaemon/test_config.py 2011-08-24 16:24:01 +0000
44+++ tests/syncdaemon/test_config.py 2011-10-03 14:06:49 +0000
45@@ -1,4 +1,5 @@
46-#
47+# encoding: utf-8
48+
49 # Author: Guillermo Gonzalez <guillermo.gonzalez@canonical.com>
50 #
51 # Copyright 2009 Canonical Ltd.
52@@ -19,10 +20,13 @@
53
54 import logging
55 import os
56+import sys
57
58 from ConfigParser import ConfigParser
59 from twisted.internet import defer
60+from twisted.trial.unittest import TestCase
61
62+from ubuntuone.devtools.testcase import skipIfOS
63 from ubuntuone.platform import open_file, path_exists
64 from ubuntu_sso.xdg_base_directory import (
65 xdg_data_home,
66@@ -471,6 +475,25 @@
67 self.assertEqual(conf.get_max_payload_size(), 666)
68
69
70+class UnicodePathsTestCase(TestCase):
71+ """Tests for unicode paths."""
72+
73+ @skipIfOS('linux2', 'On linux paths are bytes so this test does not apply')
74+ def test_get_config_files_path_encoding(self):
75+ """Check that get_config_files uses paths in the right encoding."""
76+ temp = self.mktemp()
77+ fake_path = os.path.join(temp, u"Ñandú")
78+ native_dir = fake_path.encode(sys.getfilesystemencoding())
79+ os.makedirs(native_dir)
80+ with open(os.path.join(native_dir, config.CONFIG_FILE), "w") as f:
81+ f.write("this is a fake config file")
82+ fake_load_config_paths = lambda _: [fake_path.encode("utf8")]
83+ self.patch(config, "load_config_paths", fake_load_config_paths)
84+ config_files = config.get_config_files()
85+ branch_config = os.path.join(native_dir, config.CONFIG_FILE)
86+ self.assertIn(branch_config, config_files)
87+
88+
89 class ConfigglueParsersTests(BaseTwistedTestCase):
90 """Tests for our custom configglue parsers."""
91
92
93=== modified file 'tests/syncdaemon/test_vm.py'
94--- tests/syncdaemon/test_vm.py 2011-09-06 17:13:11 +0000
95+++ tests/syncdaemon/test_vm.py 2011-10-03 14:06:49 +0000
96@@ -25,6 +25,7 @@
97 import inspect
98 import logging
99 import os
100+import sys
101 import uuid
102
103 from mocker import Mocker, MATCH
104@@ -35,6 +36,7 @@
105 FakeMain,
106 )
107 from ubuntuone.devtools.handlers import MementoHandler
108+from ubuntuone.devtools.testcase import skipIfOS
109 from ubuntuone.storageprotocol import volumes, request
110 from ubuntuone.storageprotocol.client import ListShares
111 from ubuntuone.storageprotocol.sharersp import (
112@@ -3887,6 +3889,39 @@
113 self.md_upgrader._upgrade_metadata_5(6)
114
115
116+@skipIfOS('linux2', 'On linux paths are bytes so this tests do not apply')
117+class MetadataVersionFileTestCase(MetadataTestCase):
118+ """Check that the metadata version file can have unicode characters."""
119+
120+ @defer.inlineCallbacks
121+ def setUp(self):
122+ """Initialize this testcase."""
123+ yield super(MetadataVersionFileTestCase, self).setUp()
124+ self.fake_version = "FAKE"
125+ self.patch(VolumeManager, "METADATA_VERSION", self.fake_version)
126+ self.temp_dir = os.path.join(self.mktemp(), u"Ñandú")
127+ self.version_file = os.path.join(self.temp_dir, ".version").encode(
128+ sys.getfilesystemencoding())
129+ self.md_upgrader = MetadataUpgrader(self.temp_dir.encode("utf-8"),
130+ "", "", "", "", "", "", None)
131+
132+ def test_metadata_version_write(self):
133+ """The metadata .version file is written on unicode paths."""
134+ self.md_upgrader.update_metadata_version()
135+
136+ with open(self.version_file) as fh:
137+ result = fh.read().strip()
138+ self.assertEqual(result, self.fake_version)
139+
140+ def test_metadata_version_read(self):
141+ """The metadata .version file is read from unicode paths."""
142+ with open(self.version_file, "w") as fh:
143+ fh.write(self.fake_version)
144+
145+ result = self.md_upgrader._get_md_version()
146+ self.assertEqual(result, self.fake_version)
147+
148+
149 class VMTritcaskShelfTests(BaseTwistedTestCase):
150 """Tests for VMTritcaskShelf."""
151
152
153=== modified file 'ubuntuone/platform/linux/__init__.py'
154--- ubuntuone/platform/linux/__init__.py 2011-08-17 12:43:42 +0000
155+++ ubuntuone/platform/linux/__init__.py 2011-10-03 14:06:49 +0000
156@@ -37,6 +37,7 @@
157 make_dir,
158 make_link,
159 move_to_trash,
160+ native_rename,
161 normpath,
162 open_file,
163 path_exists,
164
165=== modified file 'ubuntuone/platform/linux/os_helper.py'
166--- ubuntuone/platform/linux/os_helper.py 2011-08-22 13:31:56 +0000
167+++ ubuntuone/platform/linux/os_helper.py 2011-10-03 14:06:49 +0000
168@@ -115,6 +115,11 @@
169 os.rename(path_from, path_to)
170
171
172+def native_rename(path_from, path_to):
173+ """Rename a file or directory."""
174+ os.rename(path_from, path_to)
175+
176+
177 def recursive_move(path_from, path_to):
178 """Perform a recursive move."""
179 shutil.move(path_from, path_to)
180
181=== modified file 'ubuntuone/platform/windows/__init__.py'
182--- ubuntuone/platform/windows/__init__.py 2011-08-17 12:43:42 +0000
183+++ ubuntuone/platform/windows/__init__.py 2011-10-03 14:06:49 +0000
184@@ -36,6 +36,7 @@
185 make_dir,
186 make_link,
187 move_to_trash,
188+ native_rename,
189 normpath,
190 open_file,
191 path_exists,
192
193=== modified file 'ubuntuone/platform/windows/os_helper.py'
194--- ubuntuone/platform/windows/os_helper.py 2011-09-01 10:53:13 +0000
195+++ ubuntuone/platform/windows/os_helper.py 2011-10-03 14:06:49 +0000
196@@ -568,11 +568,11 @@
197 @windowspath(path_indexes=[0, 1])
198 def rename(path_from, path_to):
199 """Rename a file or directory."""
200- return _rename(path_from, path_to)
201-
202-
203-def _rename(path_from, path_to):
204- """Rename a file or directory."""
205+ return native_rename(path_from, path_to)
206+
207+
208+def native_rename(path_from, path_to):
209+ """Rename a file or directory, using native paths."""
210 # No need to do any specific handling for invalid characters since
211 # 'path_from' and 'path_to' are valid windows paths.
212 # Also, to ensure the same behaviors as on linux, use the MoveFileExW function
213@@ -598,7 +598,7 @@
214 if os.path.isdir(path_to):
215 path_to = os.path.join(path_to, os.path.basename(path_from))
216 try:
217- _rename(path_from, path_to)
218+ native_rename(path_from, path_to)
219 except OSError, e:
220 raise IOError(e.errno, str(e))
221 else:
222
223=== modified file 'ubuntuone/platform/xdg_base_directory/__init__.py'
224--- ubuntuone/platform/xdg_base_directory/__init__.py 2011-08-24 16:24:01 +0000
225+++ ubuntuone/platform/xdg_base_directory/__init__.py 2011-10-03 14:06:49 +0000
226@@ -18,8 +18,11 @@
227
228 import os
229
230-from ubuntu_sso.xdg_base_directory import xdg_cache_home
231+from ubuntu_sso.xdg_base_directory import xdg_cache_home, native_path
232
233+# All usage of the ubuntuone_log_dir is for native access,
234+# so we only change it here
235 ubuntuone_log_dir = os.path.join(xdg_cache_home, 'ubuntuone', 'log')
236+ubuntuone_log_dir = native_path(ubuntuone_log_dir)
237 if not os.path.exists(ubuntuone_log_dir):
238 os.makedirs(ubuntuone_log_dir)
239
240=== modified file 'ubuntuone/syncdaemon/config.py'
241--- ubuntuone/syncdaemon/config.py 2011-08-24 16:24:01 +0000
242+++ ubuntuone/syncdaemon/config.py 2011-10-03 14:06:49 +0000
243@@ -25,9 +25,15 @@
244
245 from ConfigParser import NoOptionError, NoSectionError
246 from optparse import OptionParser
247-from ubuntuone.platform import path_exists, rename
248+# We should not use standard functions from os_helper here,
249+# because the configglue superclasses do not use them.
250+# Instead, all paths used in this module should be "native",
251+# that is: utf8 str on linux, or (unicode or mbcs str) on windows
252+from ubuntuone.platform import native_rename
253 from ubuntu_sso.xdg_base_directory import (
254 load_config_paths,
255+ native_path,
256+ syncdaemon_path,
257 save_config_path,
258 xdg_data_home,
259 xdg_cache_home,
260@@ -70,7 +76,8 @@
261 logger = logging.getLogger('ubuntuone.SyncDaemon.config')
262
263 # get (and possibly create if don't exists) the user config file
264-_user_config_path = os.path.join(save_config_path('ubuntuone'), CONFIG_FILE)
265+_user_config_path = os.path.join(native_path(save_config_path('ubuntuone')),
266+ CONFIG_FILE)
267
268 # module private config instance.
269 # this object is the shared config
270@@ -85,7 +92,7 @@
271 Return the path using user home + value.
272
273 """
274- result = os.path.expanduser(path_from_unix(value))
275+ result = syncdaemon_path(os.path.expanduser(path_from_unix(value)))
276 assert isinstance(result, str)
277 return result
278
279@@ -151,12 +158,13 @@
280 """
281 config_files = []
282 for xdg_config_dir in load_config_paths('ubuntuone'):
283+ xdg_config_dir = native_path(xdg_config_dir)
284 config_file = os.path.join(xdg_config_dir, CONFIG_FILE)
285- if path_exists(config_file):
286+ if os.path.exists(config_file):
287 config_files.append(config_file)
288
289 config_logs = os.path.join(xdg_config_dir, CONFIG_LOGS)
290- if path_exists(config_logs):
291+ if os.path.exists(config_logs):
292 config_files.append(config_logs)
293
294 # reverse the list as load_config_paths returns the user dir first
295@@ -164,11 +172,11 @@
296 # if we are running from a branch, get the config files from it too
297 config_file = os.path.join(os.path.dirname(__file__), os.path.pardir,
298 os.path.pardir, 'data', CONFIG_FILE)
299- if path_exists(config_file):
300+ if os.path.exists(config_file):
301 config_files.append(config_file)
302
303 config_logs = os.path.join('data', CONFIG_LOGS)
304- if path_exists(config_logs):
305+ if os.path.exists(config_logs):
306 config_files.append(config_logs)
307
308 return config_files
309@@ -293,9 +301,9 @@
310 self.remove_section(section)
311 with open(self.config_file + '.new', 'w') as fp:
312 self.write(fp)
313- if path_exists(self.config_file):
314- rename(self.config_file, self.config_file + '.old')
315- rename(self.config_file + '.new', self.config_file)
316+ if os.path.exists(self.config_file):
317+ native_rename(self.config_file, self.config_file + '.old')
318+ native_rename(self.config_file + '.new', self.config_file)
319
320 def get_parsed(self, section, option):
321 """get that fallbacks to our custom defaults"""
322
323=== modified file 'ubuntuone/syncdaemon/filesystem_notifications.py'
324--- ubuntuone/syncdaemon/filesystem_notifications.py 2011-08-09 12:56:06 +0000
325+++ ubuntuone/syncdaemon/filesystem_notifications.py 2011-10-03 14:06:49 +0000
326@@ -19,7 +19,7 @@
327 import os
328 import re
329
330-from ubuntuone.platform import path_exists
331+from ubuntuone.platform import access, path_exists
332 from ubuntuone.syncdaemon.mute_filter import MuteFilter
333 from ubuntuone import logger
334 # our logging level
335@@ -97,7 +97,7 @@
336 # check first if the platform code knows hat to do with it
337 if not self.platform_is_ignored(path):
338 # check if we can read
339- if path_exists(path) and not os.access(path, os.R_OK):
340+ if path_exists(path) and not access(path):
341 self.log.warning("Ignoring path as we don't have enough "
342 "permissions to track it: %r", path)
343 return True
344
345=== modified file 'ubuntuone/syncdaemon/main.py'
346--- ubuntuone/syncdaemon/main.py 2011-08-25 20:20:23 +0000
347+++ ubuntuone/syncdaemon/main.py 2011-10-03 14:06:49 +0000
348@@ -24,6 +24,7 @@
349
350 from twisted.internet import defer, reactor, task
351
352+from ubuntu_sso.xdg_base_directory import native_path
353 from ubuntuone.syncdaemon import (
354 action_queue,
355 config,
356@@ -84,7 +85,7 @@
357 self.shares_dir_link = os.path.join(self.root_dir, shares_symlink_name)
358 self.data_dir = data_dir
359 self.partials_dir = partials_dir
360- self.tritcask_dir = os.path.join(self.data_dir, 'tritcask')
361+ tritcask_dir = os.path.join(self.data_dir, 'tritcask')
362 self.logger = logging.getLogger('ubuntuone.SyncDaemon.Main')
363 user_config = config.get_user_config()
364 if read_limit is None:
365@@ -99,7 +100,7 @@
366 self.logger.info("Using %r as root dir", self.root_dir)
367 self.logger.info("Using %r as data dir", self.data_dir)
368 self.logger.info("Using %r as shares root dir", self.shares_dir)
369- self.db = tritcask.Tritcask(self.tritcask_dir)
370+ self.db = tritcask.Tritcask(native_path(tritcask_dir))
371 self.vm = volume_manager.VolumeManager(self)
372 self.fs = filesystem_manager.FileSystemManager(
373 data_dir, partials_dir, self.vm, self.db)
374
375=== modified file 'ubuntuone/syncdaemon/volume_manager.py'
376--- ubuntuone/syncdaemon/volume_manager.py 2011-09-06 17:13:11 +0000
377+++ ubuntuone/syncdaemon/volume_manager.py 2011-10-03 14:06:49 +0000
378@@ -54,6 +54,7 @@
379 listdir,
380 make_dir,
381 normpath,
382+ open_file,
383 path_exists,
384 read_link,
385 recursive_move,
386@@ -1448,7 +1449,7 @@
387 make_dir(self._data_dir, recursive=True)
388 self.update_metadata_version()
389 elif path_exists(self._version_file):
390- with open(self._version_file) as fh:
391+ with open_file(self._version_file) as fh:
392 md_version = fh.read().strip()
393 if not md_version:
394 # we don't have a version of the metadata but a .version file?
395@@ -1464,7 +1465,7 @@
396 """Write the version of the metadata."""
397 if not path_exists(os.path.dirname(self._version_file)):
398 make_dir(os.path.dirname(self._version_file), recursive=True)
399- with open(self._version_file, 'w') as fd:
400+ with open_file(self._version_file, 'w') as fd:
401 fd.write(VolumeManager.METADATA_VERSION)
402 # make sure the data get to disk
403 fd.flush()

Subscribers

People subscribed via source and target branches