Merge lp:~mandel/ubuntuone-windows-installer/add_env_set_up into lp:ubuntuone-windows-installer/beta

Proposed by Manuel de la Peña
Status: Merged
Approved by: Rick McBride
Approved revision: 87
Merged at revision: 88
Proposed branch: lp:~mandel/ubuntuone-windows-installer/add_env_set_up
Merge into: lp:ubuntuone-windows-installer/beta
Prerequisite: lp:~mandel/ubuntuone-windows-installer/implement_sso_service_calls
Diff against target: 2185 lines (+1750/-25)
14 files modified
.bzrignore (+2/-2)
install/UbuntuOneXP.wxs (+844/-0)
main.build (+37/-16)
src/Canonical.Ubuntu.SSO/DPAPIDataProtector.cs (+41/-0)
src/Canonical.Ubuntu.SSO/Keyring.cs (+56/-1)
src/Canonical.Ubuntu.SSO/RegistryKeyWrapper.cs (+46/-0)
src/Canonical.Ubuntu.SSO/SSOCredentialsProvider.cs (+3/-0)
src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs (+0/-2)
src/Canonical.UbuntuOne.ProcessDispatcher/objects.xml (+3/-3)
src/UbuntuOneClient.Tests/ProgramFixture.cs (+1/-0)
src/UbuntuOneClient/objects.xml (+40/-1)
utils/BaseDirectory.py (+173/-0)
utils/env_setup.bat (+236/-0)
utils/logger.py (+268/-0)
To merge this branch: bzr merge lp:~mandel/ubuntuone-windows-installer/add_env_set_up
Reviewer Review Type Date Requested Status
Rick McBride (community) Approve
John Lenton (community) Approve
Review via email: mp+37005@code.launchpad.net

Description of the change

Fixes wix project for windows XP as well as provides an script that will allow to set up the devel environment.

To post a comment you must log in.
87. By Manuel de la Peña

Fixed issue when downloading easy_install, missing url.

Revision history for this message
John Lenton (chipaca) :
review: Approve
Revision history for this message
Rick McBride (rmcbride) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2010-09-30 09:36:24 +0000
3+++ .bzrignore 2010-09-30 09:36:24 +0000
4@@ -1,6 +1,6 @@
5
6-install/UbuntuOne.wixobj
7-install/UbuntuOne.wixpdb
8+*.wixobj
9+*.wixpdb
10 install/build_results
11 src/UbuntuOne.5.1.ReSharper.user
12 src/UbuntuOne.sln.cache
13
14=== renamed file 'install/UbuntuOne.wxs' => 'install/UbuntuOne7.wxs'
15=== added file 'install/UbuntuOneXP.wxs'
16--- install/UbuntuOneXP.wxs 1970-01-01 00:00:00 +0000
17+++ install/UbuntuOneXP.wxs 2010-09-30 09:36:24 +0000
18@@ -0,0 +1,844 @@
19+<?xml version="1.0" encoding="windows-1252"?>
20+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
21+<!--
22+This file contains the wix installer definition that will be used to install Ubuntu One
23+on windows machines. The installer ensures that all the required dependencies that the
24+application requires are present in the system allowing the user to forget about dependecies
25+-->
26+ <Product Name="Ubuntu One"
27+ Id="13b7ee30-849c-11df-8395-0800200c9a66"
28+ UpgradeCode="1f5dcd90-849c-11df-8395-0800200c9a66"
29+ Language="1033"
30+ Codepage="1252"
31+ Version="1.0.0"
32+ Manufacturer="Canonical Ltd.">
33+
34+ <Package Id="*"
35+ Keywords="Installer"
36+ Description="Ubuntu One is the personal cloud service that
37+ simplifies your digital life. Imagine buying music and getting
38+ it delivered to the computers of your choice. Or synchronizing your
39+ files and notes and accessing them from anywhere.
40+ Or consolidating your computer and mobile phone contacts and safely
41+ sharing documents and pictures with them"
42+ Comments="UbuntuOne is a registered trademark of Canonical Ltd."
43+ Manufacturer="Canonical Ltd."
44+ InstallerVersion="350"
45+ Languages="1033"
46+ Compressed="yes"
47+ SummaryCodepage="1252" />
48+
49+ <Media Id="1"
50+ Cabinet="UbuntuOne.cab"
51+ EmbedCab="yes" />
52+
53+ <Property Id="UBUNTUONECLIENT_START_VIA_REGISTRY">1</Property>
54+
55+ <Directory Id="TARGETDIR"
56+ Name="SourceDir">
57+ <Directory Id="ProgramMenuFolder"
58+ Name="Programs" />
59+ <Directory Id="DesktopFolder"
60+ Name="Desktop" />
61+ <Directory Id="CommonAppDataFolder"
62+ Name="CommonAppDataFolder">
63+ <Directory Id="StoreageProtocol"
64+ Name="ubuntuone-storageprotocol">
65+ <Component Id="UbuntuOneGoDaddyCAComponent"
66+ Guid="84f40170-b5a1-11df-8d81-0800200c9a66">
67+ <File Id="UbuntuOne_Go_Daddy_CA"
68+ Name="UbuntuOne-Go_Daddy_CA.pem"
69+ DiskId="1"
70+ Source="build_results\data\UbuntuOne-Go_Daddy_CA.pem"
71+ KeyPath="yes"/>
72+ </Component>
73+ <Component Id="UbuntuOneGoDaddyClass2CAComponent"
74+ Guid="89d14680-b5a1-11df-8d81-0800200c9a66">
75+ <File Id="UbuntuOne_Go_Daddy_Class_2_CA"
76+ Name="UbuntuOne-Go_Daddy_Class_2_CA.pem"
77+ DiskId="1"
78+ Source="build_results\data\UbuntuOne-Go_Daddy_Class_2_CA.pem"
79+ KeyPath="yes"/>
80+ </Component>
81+ </Directory>
82+ </Directory>
83+ <Directory Id="ProgramFilesFolder"
84+ Name="ProgramFilesFolder">
85+ <Directory Id="Canonical"
86+ Name="Canonical">
87+ <Directory Id="U1Installdir"
88+ Name="UbuntuOne">
89+ <Directory Id="DaemonDir"
90+ Name="Daemon">
91+ <Component Id="DaemonCommonLibComponent"
92+ Guid="a609b650-94b5-11df-981c-0800200c9a66">
93+ <File Id="Canonical.UbuntuOne.Common.dll"
94+ Name="Canonical.UbuntuOne.Common.dll"
95+ DiskId="1"
96+ Source="build_results\Daemon\Canonical.UbuntuOne.Common.dll"
97+ KeyPath="yes"/>
98+ </Component>
99+ <Component Id="DaemonCommonPdbComponent"
100+ Guid="c4ddb5e0-94b5-11df-981c-0800200c9a66">
101+ <File Id="Canonical.UbuntuOne.Common.pdb"
102+ Name="Canonical.UbuntuOne.Common.pdb"
103+ DiskId="1"
104+ Source="build_results\Daemon\Canonical.UbuntuOne.Common.pdb"
105+ KeyPath="yes"/>
106+ </Component>
107+ <Component Id="DaemonProgramComponent"
108+ Guid="f2d91a70-94b5-11df-981c-0800200c9a66">
109+ <File Id="Canonical.UbuntuOne.ProcessDispatcher.exe"
110+ Name="Canonical.UbuntuOne.ProcessDispatcher.exe"
111+ DiskId="1"
112+ Source="build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.exe"
113+ KeyPath="yes"/>
114+ <!-- Install, start and stop service using the msi -->
115+ <ServiceInstall Id="ProcessDispatcher.exe"
116+ Name="UbuntuOne"
117+ DisplayName="Ubuntu One Sync Daemon"
118+ Type="ownProcess"
119+ Interactive="no"
120+ Start="auto"
121+ Vital="yes"
122+ ErrorControl="ignore"
123+ Description="Provides a central process that manages the Ubuntu One sync daemon." />
124+ <ServiceControl Id="ProcessDispatcherControl"
125+ Name="UbuntuOne"
126+ Start="install"
127+ Stop="uninstall"
128+ Remove="uninstall"
129+ Wait="yes" />
130+ </Component>
131+ <Component Id="DaemonProgramComponentConfig"
132+ Guid="6ac2f100-94bb-11df-981c-0800200c9a66">
133+ <File Id="Canonical.UbuntuOne.ProcessDispatcher.exe.config"
134+ Name="Canonical.UbuntuOne.ProcessDispatcher.exe.config"
135+ DiskId="1"
136+ Source="build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.exe.config"
137+ KeyPath="yes"/>
138+ </Component>
139+ <Component Id="DaemonProgramPdbComponent"
140+ Guid="052b3280-94b6-11df-981c-0800200c9a66">
141+ <File Id="Canonical.UbuntuOne.ProcessDispatcher.pdb"
142+ Name="Canonical.UbuntuOne.ProcessDispatcher.pdb"
143+ DiskId="1"
144+ Source="build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.pdb"
145+ KeyPath="yes"/>
146+ </Component>
147+ <Component Id="CommonLoggingComponent"
148+ Guid="24d7ded0-94b6-11df-981c-0800200c9a66">
149+ <File Id="Common.Logging.dll"
150+ Name="Common.Logging.dll"
151+ DiskId="1"
152+ Source="build_results\Daemon\Common.Logging.dll"
153+ KeyPath="yes"/>
154+ </Component>
155+ <Component Id="CommonLoggingLog4NetComponent"
156+ Guid="6ac0e8b0-967d-11df-981c-0800200c9a66">
157+ <File Id="Common.Logging.Log4Net.dll"
158+ Name="Common.Logging.Log4Net.dll"
159+ DiskId="1"
160+ Source="build_results\Daemon\Common.Logging.Log4Net.dll"
161+ KeyPath="yes"/>
162+ </Component>
163+ <Component Id="DotUpdaterLib"
164+ Guid="af217c90-967d-11df-981c-0800200c9a66">
165+ <File Id="DotUpdater.dll"
166+ Name="DotUpdater.dll"
167+ DiskId="1"
168+ Source="build_results\Daemon\DotUpdater.dll"
169+ KeyPath="yes"/>
170+ </Component>
171+ <Component Id="Log4NetComponent"
172+ Guid="0eafc310-94b7-11df-981c-0800200c9a66">
173+ <File Id="log4net.dll"
174+ Name="log4net.dll"
175+ DiskId="1"
176+ Source="build_results\Daemon\log4net.dll"
177+ KeyPath="yes"/>
178+ </Component>
179+ <Component Id="SpringAopComponent"
180+ Guid="5431cc80-94b7-11df-981c-0800200c9a66">
181+ <File Id="Spring.Aop.dll"
182+ Name="Spring.Aop.dll"
183+ DiskId="1"
184+ Source="build_results\Daemon\Spring.Aop.dll"
185+ KeyPath="yes"/>
186+ </Component>
187+ <Component Id="SpringAopConfigComponent"
188+ Guid="668e92f0-94b7-11df-981c-0800200c9a66">
189+ <File Id="Spring.Aop.xml"
190+ Name="Spring.Aop.xml"
191+ DiskId="1"
192+ Source="build_results\Daemon\Spring.Aop.xml"
193+ KeyPath="yes"/>
194+ </Component>
195+ <Component Id="SpringCoreComponent"
196+ Guid="7780a5d0-94b7-11df-981c-0800200c9a66">
197+ <File Id="Spring.Core.dll"
198+ Name="Spring.Core.dll"
199+ DiskId="1"
200+ Source="build_results\Daemon\Spring.Core.dll"
201+ KeyPath="yes"/>
202+ </Component>
203+ <Component Id="SpringCoreConfigComponent"
204+ Guid="8149fd00-94b7-11df-981c-0800200c9a66">
205+ <File Id="Spring.Core.xml"
206+ Name="Spring.Core.xml"
207+ DiskId="1"
208+ Source="build_results\Daemon\Spring.Core.xml"
209+ KeyPath="yes"/>
210+ </Component>
211+ <Component Id="SpringServicesComponent"
212+ Guid="fd27e7a0-98ce-11df-981c-0800200c9a66">
213+ <File Id="Spring.Services.dll"
214+ Name="Spring.Services.dll"
215+ DiskId="1"
216+ Source="build_results\Daemon\Spring.Services.dll"
217+ KeyPath="yes"/>
218+ </Component>
219+ <Component Id="SpringServicesConfigComponent"
220+ Guid="33b757b0-98cf-11df-981c-0800200c9a66">
221+ <File Id="Spring.Services.xml"
222+ Name="Spring.Services.xml"
223+ DiskId="1"
224+ Source="build_results\Daemon\Spring.Services.xml"
225+ KeyPath="yes"/>
226+ </Component>
227+ <Component Id="SpringDataComponent"
228+ Guid="e1736390-aac1-11df-94e2-0800200c9a66">
229+ <File Id="Spring.Data.dll"
230+ Name="Spring.Data.dll"
231+ DiskId="1"
232+ Source="build_results\Daemon\Spring.Data.dll"
233+ KeyPath="yes"/>
234+ </Component>
235+ <Component Id="SymstemDataSQLiteComponent"
236+ Guid="43573410-aac2-11df-94e2-0800200c9a66">
237+ <File Id="System.Data.SQLite.DLL"
238+ Name="System.Data.SQLite.DLL"
239+ DiskId="1"
240+ Source="build_results\Daemon\System.Data.SQLite.DLL"
241+ KeyPath="yes"/>
242+ </Component>
243+ <Directory Id="DaemonConfigDir"
244+ Name="Config">
245+ <Component Id="DaemonConfigLog4Net"
246+ Guid="306252c0-967e-11df-981c-0800200c9a66">
247+ <File Id="log4net.config"
248+ Name="log4net.config"
249+ DiskId="1"
250+ Source="build_results\Daemon\Config\log4net.config"
251+ KeyPath="yes"/>
252+ </Component>
253+ <Component Id="ServiceModelBehavioursConfig"
254+ Guid="5f9a6390-98cf-11df-981c-0800200c9a66">
255+ <File Id="serviceModel.behaviours.config"
256+ Name="serviceModel.behaviours.config"
257+ DiskId="1"
258+ Source="build_results\Daemon\Config\serviceModel.behaviours.config"
259+ KeyPath="yes"/>
260+ </Component>
261+ <Component Id="ServiceModelBindingsConfig"
262+ Guid="65aca630-98cf-11df-981c-0800200c9a66">
263+ <File Id="serviceModel.bindings.config"
264+ Name="serviceModel.bindings.config"
265+ DiskId="1"
266+ Source="build_results\Daemon\Config\serviceModel.bindings.config"
267+ KeyPath="yes"/>
268+ </Component>
269+ <Component Id="ServiceModelServicesConfig"
270+ Guid="6a7e5280-98cf-11df-981c-0800200c9a66">
271+ <File Id="serviceModel.services.config"
272+ Name="serviceModel.services.config"
273+ DiskId="1"
274+ Source="build_results\Daemon\Config\serviceModel.services.config"
275+ KeyPath="yes"/>
276+ </Component>
277+ </Directory>
278+ </Directory>
279+ <Directory Id="ClientDir"
280+ Name="Client">
281+ <!-- Auto-start via Registry -->
282+ <Component Id="UbuntuOneClietnAutostart"
283+ Guid="e3b224c0-9fa4-11df-981c-0800200c9a66">
284+ <RegistryValue Id="UbunntuOneClient.rst"
285+ Root="HKCU"
286+ Key="Software\Microsoft\Windows\CurrentVersion\Run"
287+ Name="Ubuntu One Client"
288+ Value="[ClientDir]UbuntuOneClient.exe"
289+ Type="string"/>
290+ <Condition>UBUNTUONECLIENT_START_VIA_REGISTRY</Condition>
291+ </Component>
292+ <Component Id="AvalonLib"
293+ Guid="99106520-9f9b-11df-981c-0800200c9a66">
294+ <File Id="AvalonLibrary.dll"
295+ Name="AvalonLibrary.dll"
296+ DiskId="1"
297+ Source="build_results\Client\AvalonLibrary.dll"
298+ KeyPath="yes"/>
299+ </Component>
300+ <Component Id="UbuntuSSO"
301+ Guid="c3de3ad0-c8f8-11df-bd3b-0800200c9a66">
302+ <File Id="Canonical.Ubuntu.SSO.dll"
303+ Name="Canonical.Ubuntu.SSO.dll"
304+ DiskId="1"
305+ Source="build_results\Client\Canonical.Ubuntu.SSO.dll"
306+ KeyPath="yes"/>
307+ </Component>
308+ <Component Id="UbuntuSSOViews"
309+ Guid="f12d0bb0-c8f8-11df-bd3b-0800200c9a66">
310+ <File Id="Canonical.Ubuntu.SSO.Views.dll"
311+ Name="Canonical.Ubuntu.SSO.Views.dll"
312+ DiskId="1"
313+ Source="build_results\Client\Canonical.Ubuntu.SSO.Views.dll"
314+ KeyPath="yes"/>
315+ </Component>
316+ <Component Id="Newtonsoft.Json"
317+ Guid="1a3ad780-c8f9-11df-bd3b-0800200c9a66">
318+ <File Id="Newtonsoft.Json.dll"
319+ Name="Newtonsoft.Json.dll"
320+ DiskId="1"
321+ Source="build_results\Client\Newtonsoft.Json.dll"
322+ KeyPath="yes"/>
323+ </Component>
324+ <Component Id="UbuntuOneClientLib"
325+ Guid="98ceabc0-9f9c-11df-981c-0800200c9a66">
326+ <File Id="Canonical.UbuntuOne.Client.dll"
327+ Name="Canonical.UbuntuOne.Client.dll"
328+ DiskId="1"
329+ Source="build_results\Client\Canonical.UbuntuOne.Client.dll"
330+ KeyPath="yes"/>
331+ </Component>
332+ <Component Id="UbuntuOneClientLibPdb"
333+ Guid="af68a6b0-9f9c-11df-981c-0800200c9a66">
334+ <File Id="Canonical.UbuntuOne.Client.pdb"
335+ Name="Canonical.UbuntuOne.Client.pdb"
336+ DiskId="1"
337+ Source="build_results\Client\Canonical.UbuntuOne.Client.pdb"
338+ KeyPath="yes"/>
339+ </Component>
340+ <Component Id="UbuntuOneClientViewsLib"
341+ Guid="ae68f9e0-9fb0-11df-981c-0800200c9a66">
342+ <File Id="Canonical.UbuntuOne.Client.Views.dll"
343+ Name="Canonical.UbuntuOne.Client.Views.dll"
344+ DiskId="1"
345+ Source="build_results\Client\Canonical.UbuntuOne.Client.Views.dll"
346+ KeyPath="yes"/>
347+ </Component>
348+ <Component Id="UbuntuOneClientViewsLibPdb"
349+ Guid="b4d54360-9fb0-11df-981c-0800200c9a66">
350+ <File Id="Canonical.UbuntuOne.Client.Views.pdb"
351+ Name="Canonical.UbuntuOne.Client.Views.pdb"
352+ DiskId="1"
353+ Source="build_results\Client\Canonical.UbuntuOne.Client.Views.pdb"
354+ KeyPath="yes"/>
355+ </Component>
356+ <Component Id="UbuntuOneCommonLib"
357+ Guid="cadc1620-9f9c-11df-981c-0800200c9a66">
358+ <File Id="Canonical.UbuntuOne.Common.dll_client"
359+ Name="Canonical.UbuntuOne.Common.dll"
360+ DiskId="1"
361+ Source="build_results\Client\Canonical.UbuntuOne.Common.dll"
362+ KeyPath="yes"/>
363+ </Component>
364+ <Component Id="UbuntuOneCommonLibPdb"
365+ Guid="eca5af00-9f9c-11df-981c-0800200c9a66">
366+ <File Id="Canonical.UbuntuOne.Common.pdb_client"
367+ Name="Canonical.UbuntuOne.Common.pdb"
368+ DiskId="1"
369+ Source="build_results\Client\Canonical.UbuntuOne.Common.pdb"
370+ KeyPath="yes"/>
371+ </Component>
372+ <Component Id="CommonLoggingComponentClient"
373+ Guid="12de88e0-9f9d-11df-981c-0800200c9a66">
374+ <File Id="Common.Logging.dll_client"
375+ Name="Common.Logging.dll"
376+ DiskId="1"
377+ Source="build_results\Client\Common.Logging.dll"
378+ KeyPath="yes"/>
379+ </Component>
380+ <Component Id="CommonLoggingLog4NetComponentClient"
381+ Guid="1a06f670-9f9d-11df-981c-0800200c9a66">
382+ <File Id="Common.Logging.Log4Net.dll_client"
383+ Name="Common.Logging.Log4Net.dll"
384+ DiskId="1"
385+ Source="build_results\Client\Common.Logging.Log4Net.dll"
386+ KeyPath="yes"/>
387+ </Component>
388+ <Component Id="DotUpdaterLibClient"
389+ Guid="31a4a5c0-9f9d-11df-981c-0800200c9a66">
390+ <File Id="DotUpdater.dll_client"
391+ Name="DotUpdater.dll"
392+ DiskId="1"
393+ Source="build_results\Client\DotUpdater.dll"
394+ KeyPath="yes"/>
395+ </Component>
396+ <Component Id="Log4NetComponentClient"
397+ Guid="5d2630b0-9f9d-11df-981c-0800200c9a66">
398+ <File Id="log4net.dll_client"
399+ Name="log4net.dll"
400+ DiskId="1"
401+ Source="build_results\Client\log4net.dll"
402+ KeyPath="yes"/>
403+ </Component>
404+ <Component Id="SpringAopComponentClient"
405+ Guid="8fbaf380-9f9d-11df-981c-0800200c9a66">
406+ <File Id="Spring.Aop.dll_client"
407+ Name="Spring.Aop.dll"
408+ DiskId="1"
409+ Source="build_results\Client\Spring.Aop.dll"
410+ KeyPath="yes"/>
411+ </Component>
412+ <Component Id="SpringAopConfigComponentClient"
413+ Guid="94fffb10-9f9d-11df-981c-0800200c9a66">
414+ <File Id="Spring.Aop.xml_client"
415+ Name="Spring.Aop.xml"
416+ DiskId="1"
417+ Source="build_results\Client\Spring.Aop.xml"
418+ KeyPath="yes"/>
419+ </Component>
420+ <Component Id="SpringCoreComponentClient"
421+ Guid="9a6a16d0-9f9d-11df-981c-0800200c9a66">
422+ <File Id="Spring.Core.dll_client"
423+ Name="Spring.Core.dll"
424+ DiskId="1"
425+ Source="build_results\Client\Spring.Core.dll"
426+ KeyPath="yes"/>
427+ </Component>
428+ <Component Id="SpringCoreConfigComponentClient"
429+ Guid="9fa7cb60-9f9d-11df-981c-0800200c9a66">
430+ <File Id="Spring.Core.xml_client"
431+ Name="Spring.Core.xml"
432+ DiskId="1"
433+ Source="build_results\Client\Spring.Core.xml"
434+ KeyPath="yes"/>
435+ </Component>
436+ <Component Id="UbuntuOneClient"
437+ Guid="bb893ee0-9f9d-11df-981c-0800200c9a66">
438+ <File Id="UbuntuOneClient.exe"
439+ Name="UbuntuOneClient.exe"
440+ DiskId="1"
441+ Source="build_results\Client\UbuntuOneClient.exe"
442+ KeyPath="yes"/>
443+ </Component>
444+ <Component Id="UbuntuOneClientConfig"
445+ Guid="da9e3f10-9f9d-11df-981c-0800200c9a66">
446+ <File Id="UbuntuOneClient.exe.config"
447+ Name="UbuntuOneClient.exe.config"
448+ DiskId="1"
449+ Source="build_results\Client\UbuntuOneClient.exe.config"
450+ KeyPath="yes"/>
451+ </Component>
452+ <Component Id="UbuntuOneClientPdb"
453+ Guid="fad020f0-9f9d-11df-981c-0800200c9a66">
454+ <File Id="UbuntuOneClient.pdb"
455+ Name="UbuntuOneClient.pdb"
456+ DiskId="1"
457+ Source="build_results\Client\UbuntuOneClient.pdb"
458+ KeyPath="yes"/>
459+ </Component>
460+ <Directory Id="ClientConfigDir"
461+ Name="Config">
462+ <Component Id="ClientConfigLog4Net"
463+ Guid="40cf49a0-9f9e-11df-981c-0800200c9a66">
464+ <File Id="log4net.config_client"
465+ Name="log4net.config"
466+ DiskId="1"
467+ Source="build_results\Client\Config\log4net.config"
468+ KeyPath="yes"/>
469+ </Component>
470+ </Directory>
471+ <Directory Id="U1SyncExecutable"
472+ Name="U1Sync">
473+ <Component Id="CTypesComponent"
474+ Guid="cc878310-b1ee-11df-94e2-0800200c9a66">
475+ <File Id="_ctypes.pyd"
476+ Name="_ctypes.pyd"
477+ DiskId="1"
478+ Source="build_results\u1sync\_ctypes.pyd"
479+ KeyPath="yes"/>
480+ </Component>
481+ <Component Id="HLibComponent"
482+ Guid="15848270-b1ef-11df-94e2-0800200c9a66">
483+ <File Id="_hashlib.pyd"
484+ Name="_hashlib.pyd"
485+ DiskId="1"
486+ Source="build_results\u1sync\_hashlib.pyd"
487+ KeyPath="yes"/>
488+ </Component>
489+ <Component Id="SocketComponent"
490+ Guid="37e5a060-b1ef-11df-94e2-0800200c9a66">
491+ <File Id="_socket.pyd"
492+ Name="_socket.pyd"
493+ DiskId="1"
494+ Source="build_results\u1sync\_socket.pyd"
495+ KeyPath="yes"/>
496+ </Component>
497+ <Component Id="SSLComponent"
498+ Guid="5df98d20-b1ef-11df-94e2-0800200c9a66">
499+ <File Id="_ssl.pyd"
500+ Name="_ssl.pyd"
501+ DiskId="1"
502+ Source="build_results\u1sync\_ssl.pyd"
503+ KeyPath="yes"/>
504+ </Component>
505+ <Component Id="SysLoaderComponent"
506+ Guid="85d149f0-b1ef-11df-94e2-0800200c9a66">
507+ <File Id="_win32sysloader.pyd"
508+ Name="_win32sysloader.pyd"
509+ DiskId="1"
510+ Source="build_results\u1sync\_win32sysloader.pyd"
511+ KeyPath="yes"/>
512+ </Component>
513+ <Component Id="Bz2Component"
514+ Guid="252ce1e0-b1f0-11df-94e2-0800200c9a66">
515+ <File Id="bz2.pyd"
516+ Name="bz2.pyd"
517+ DiskId="1"
518+ Source="build_results\u1sync\bz2.pyd"
519+ KeyPath="yes"/>
520+ </Component>
521+ <Component Id="Libeay32Component"
522+ Guid="252d08e9-b1f0-11df-94e2-0800200c9a66">
523+ <File Id="LIBEAY32.dll"
524+ Name="LIBEAY32.dll"
525+ DiskId="1"
526+ Source="build_results\u1sync\LIBEAY32.dll"
527+ KeyPath="yes"/>
528+ </Component>
529+ <Component Id="LibraryComponent"
530+ Guid="252d08ea-b1f0-11df-94e2-0800200c9a66">
531+ <File Id="library.zip"
532+ Name="library.zip"
533+ DiskId="1"
534+ Source="build_results\u1sync\library.zip"
535+ KeyPath="yes"/>
536+ </Component>
537+ <Component Id="U1SyncMainComponent"
538+ Guid="252d08eb-b1f0-11df-94e2-0800200c9a66">
539+ <File Id="main.exe"
540+ Name="main.exe"
541+ DiskId="1"
542+ Source="build_results\u1sync\main.exe"
543+ KeyPath="yes"/>
544+ </Component>
545+ <Component Id="OpenSSLCryptoComponent"
546+ Guid="bb15b4b1-b1f5-11df-94e2-0800200c9a66">
547+ <File Id="OpenSSL.crypto.pyd"
548+ Name="OpenSSL.crypto.pyd"
549+ DiskId="1"
550+ Source="build_results\u1sync\OpenSSL.crypto.pyd"
551+ KeyPath="yes"/>
552+ </Component>
553+ <Component Id="OpenSSLRandComponent"
554+ Guid="bb15b4b2-b1f5-11df-94e2-0800200c9a66">
555+ <File Id="OpenSSL.rand.pyd"
556+ Name="OpenSSL.rand.pyd"
557+ DiskId="1"
558+ Source="build_results\u1sync\OpenSSL.rand.pyd"
559+ KeyPath="yes"/>
560+ </Component>
561+ <Component Id="OpenSSLSSLComponent"
562+ Guid="bb15b4b3-b1f5-11df-94e2-0800200c9a66">
563+ <File Id="OpenSSL.SSL.pyd"
564+ Name="OpenSSL.SSL.pyd"
565+ DiskId="1"
566+ Source="build_results\u1sync\OpenSSL.SSL.pyd"
567+ KeyPath="yes"/>
568+ </Component>
569+ <Component Id="PoyexpactComponent"
570+ Guid="bb15b4b5-b1f5-11df-94e2-0800200c9a66">
571+ <File Id="pyexpat.pyd"
572+ Name="pyexpat.pyd"
573+ DiskId="1"
574+ Source="build_results\u1sync\pyexpat.pyd"
575+ KeyPath="yes"/>
576+ </Component>
577+ <Component Id="Python26Component"
578+ Guid="bb15dbc0-b1f5-11df-94e2-0800200c9a66">
579+ <File Id="python26.dll"
580+ Name="python26.dll"
581+ DiskId="1"
582+ Source="build_results\u1sync\python26.dll"
583+ KeyPath="yes"/>
584+ </Component>
585+ <Component Id="PythonCom26Component"
586+ Guid="bb15dbc1-b1f5-11df-94e2-0800200c9a66">
587+ <File Id="pythoncom26.dll"
588+ Name="pythoncom26.dll"
589+ DiskId="1"
590+ Source="build_results\u1sync\pythoncom26.dll"
591+ KeyPath="yes"/>
592+ </Component>
593+ <Component Id="PyWinTypeComponent"
594+ Guid="bb15dbc2-b1f5-11df-94e2-0800200c9a66">
595+ <File Id="pywintypes26.dll"
596+ Name="pywintypes26.dll"
597+ DiskId="1"
598+ Source="build_results\u1sync\pywintypes26.dll"
599+ KeyPath="yes"/>
600+ </Component>
601+ <Component Id="SelectComponent"
602+ Guid="bb15dbc3-b1f5-11df-94e2-0800200c9a66">
603+ <File Id="select.pyd"
604+ Name="select.pyd"
605+ DiskId="1"
606+ Source="build_results\u1sync\select.pyd"
607+ KeyPath="yes"/>
608+ </Component>
609+ <Component Id="Ssleay32Component"
610+ Guid="bb15dbc4-b1f5-11df-94e2-0800200c9a66">
611+ <File Id="SSLEAY32.dll"
612+ Name="SSLEAY32.dll"
613+ DiskId="1"
614+ Source="build_results\u1sync\SSLEAY32.dll"
615+ KeyPath="yes"/>
616+ </Component>
617+ <Component Id="TwistedComponent"
618+ Guid="bb15dbc5-b1f5-11df-94e2-0800200c9a66">
619+ <File Id="twisted.python._initgroups.pyd"
620+ Name="twisted.python._initgroups.pyd"
621+ DiskId="1"
622+ Source="build_results\u1sync\twisted.python._initgroups.pyd"
623+ KeyPath="yes"/>
624+ </Component>
625+ <Component Id="UnicodeDataComponent"
626+ Guid="bb15dbc6-b1f5-11df-94e2-0800200c9a66">
627+ <File Id="unicodedata.pyd"
628+ Name="unicodedata.pyd"
629+ DiskId="1"
630+ Source="build_results\u1sync\unicodedata.pyd"
631+ KeyPath="yes"/>
632+ </Component>
633+ <Component Id="W9xpopenComponent"
634+ Guid="bb15dbc7-b1f5-11df-94e2-0800200c9a66">
635+ <File Id="w9xpopen.exe"
636+ Name="w9xpopen.exe"
637+ DiskId="1"
638+ Source="build_results\u1sync\w9xpopen.exe"
639+ KeyPath="yes"/>
640+ </Component>
641+ <Component Id="Win32ApiComponent"
642+ Guid="bb15dbc8-b1f5-11df-94e2-0800200c9a66">
643+ <File Id="win32api.pyd"
644+ Name="win32api.pyd"
645+ DiskId="1"
646+ Source="build_results\u1sync\win32api.pyd"
647+ KeyPath="yes"/>
648+ </Component>
649+ <Component Id="Win32EventComponent"
650+ Guid="bb15dbca-b1f5-11df-94e2-0800200c9a66">
651+ <File Id="win32event.pyd"
652+ Name="win32event.pyd"
653+ DiskId="1"
654+ Source="build_results\u1sync\win32event.pyd"
655+ KeyPath="yes"/>
656+ </Component>
657+ <Component Id="Win32EventLogComponent"
658+ Guid="bb15dbcb-b1f5-11df-94e2-0800200c9a66">
659+ <File Id="win32evtlog.pyd"
660+ Name="win32evtlog.pyd"
661+ DiskId="1"
662+ Source="build_results\u1sync\win32evtlog.pyd"
663+ KeyPath="yes"/>
664+ </Component>
665+ <Component Id="Win32FileComponent"
666+ Guid="bb15dbcc-b1f5-11df-94e2-0800200c9a66">
667+ <File Id="win32file.pyd"
668+ Name="win32file.pyd"
669+ DiskId="1"
670+ Source="build_results\u1sync\win32file.pyd"
671+ KeyPath="yes"/>
672+ </Component>
673+ <Component Id="Win32PipeComponent"
674+ Guid="bb15dbcd-b1f5-11df-94e2-0800200c9a66">
675+ <File Id="win32pipe.pyd"
676+ Name="win32pipe.pyd"
677+ DiskId="1"
678+ Source="build_results\u1sync\win32pipe.pyd"
679+ KeyPath="yes"/>
680+ </Component>
681+ <Component Id="Win32ProcessComponent"
682+ Guid="bb15dbce-b1f5-11df-94e2-0800200c9a66">
683+ <File Id="win32process.pyd"
684+ Name="win32process.pyd"
685+ DiskId="1"
686+ Source="build_results\u1sync\win32process.pyd"
687+ KeyPath="yes"/>
688+ </Component>
689+ <Component Id="Win32SecurityComponent"
690+ Guid="bb15dbcf-b1f5-11df-94e2-0800200c9a66">
691+ <File Id="win32security.pyd"
692+ Name="win32security.pyd"
693+ DiskId="1"
694+ Source="build_results\u1sync\win32security.pyd"
695+ KeyPath="yes"/>
696+ </Component>
697+ <Component Id="Win32UIComponent"
698+ Guid="bb15dbd0-b1f5-11df-94e2-0800200c9a66">
699+ <File Id="win32ui.pyd"
700+ Name="win32ui.pyd"
701+ DiskId="1"
702+ Source="build_results\u1sync\win32ui.pyd"
703+ KeyPath="yes"/>
704+ </Component>
705+ <Component Id="Win32WnetComponent"
706+ Guid="bb15dbd1-b1f5-11df-94e2-0800200c9a66">
707+ <File Id="win32wnet.pyd"
708+ Name="win32wnet.pyd"
709+ DiskId="1"
710+ Source="build_results\u1sync\win32wnet.pyd"
711+ KeyPath="yes"/>
712+ </Component>
713+ <Component Id="ZopeInterfaceComponent"
714+ Guid="bb15dbd3-b1f5-11df-94e2-0800200c9a66">
715+ <File Id="zope.interface._zope_interface_coptimizations.pyd"
716+ Name="zope.interface._zope_interface_coptimizations.pyd"
717+ DiskId="1"
718+ Source="build_results\u1sync\zope.interface._zope_interface_coptimizations.pyd"
719+ KeyPath="yes"/>
720+ </Component>
721+ </Directory>
722+ </Directory>
723+ </Directory>
724+ </Directory>
725+ </Directory>
726+ </Directory>
727+
728+ <!-- Provide the different features to be installed -->
729+ <Feature Id="UbuntuOneCore"
730+ Level="1"
731+ Title="Ubuntu One"
732+ Description="Ubuntu One is the personal cloud service that simplifies your digital life.">
733+ <!-- common data -->
734+ <ComponentRef Id="UbuntuOneGoDaddyCAComponent" />
735+ <ComponentRef Id="UbuntuOneGoDaddyClass2CAComponent" />
736+ <!-- Daemon components -->
737+ <ComponentRef Id="DaemonCommonLibComponent" />
738+ <ComponentRef Id="DaemonCommonPdbComponent" />
739+ <ComponentRef Id="CommonLoggingComponent" />
740+ <ComponentRef Id="CommonLoggingLog4NetComponent" />
741+ <ComponentRef Id="DotUpdaterLib" />
742+ <ComponentRef Id="Log4NetComponent" />
743+ <ComponentRef Id="SpringAopComponent" />
744+ <ComponentRef Id="SpringAopConfigComponent" />
745+ <ComponentRef Id="SpringCoreComponent" />
746+ <ComponentRef Id="SpringCoreConfigComponent" />
747+ <ComponentRef Id="SpringServicesComponent" />
748+ <ComponentRef Id="SpringServicesConfigComponent" />
749+ <ComponentRef Id="DaemonProgramComponent" />
750+ <ComponentRef Id="DaemonProgramComponentConfig" />
751+ <ComponentRef Id="DaemonProgramPdbComponent" />
752+ <ComponentRef Id="DaemonConfigLog4Net" />
753+ <ComponentRef Id="ServiceModelBehavioursConfig" />
754+ <ComponentRef Id="ServiceModelBindingsConfig" />
755+ <ComponentRef Id="ServiceModelServicesConfig" />
756+ <ComponentRef Id="SpringDataComponent" />
757+ <ComponentRef Id="SymstemDataSQLiteComponent" />
758+ <!-- Client components -->
759+ <ComponentRef Id="AvalonLib" />
760+ <ComponentRef Id="UbuntuOneClientLib" />
761+ <ComponentRef Id="UbuntuOneClientLibPdb" />
762+ <ComponentRef Id="UbuntuOneClientViewsLib" />
763+ <ComponentRef Id="UbuntuOneClientViewsLibPdb" />
764+ <ComponentRef Id="UbuntuOneCommonLib" />
765+ <ComponentRef Id="UbuntuOneCommonLibPdb" />
766+ <ComponentRef Id="CommonLoggingComponentClient" />
767+ <ComponentRef Id="CommonLoggingLog4NetComponentClient" />
768+ <ComponentRef Id="DotUpdaterLibClient" />
769+ <ComponentRef Id="Log4NetComponentClient" />
770+ <ComponentRef Id="SpringAopComponentClient" />
771+ <ComponentRef Id="SpringAopConfigComponentClient" />
772+ <ComponentRef Id="SpringCoreComponentClient" />
773+ <ComponentRef Id="SpringCoreConfigComponentClient" />
774+ <ComponentRef Id="UbuntuOneClient" />
775+ <ComponentRef Id="UbuntuOneClientConfig" />
776+ <ComponentRef Id="UbuntuOneClientPdb" />
777+ <ComponentRef Id="ClientConfigLog4Net" />
778+ <!-- Client auto start -->
779+ <ComponentRef Id="UbuntuOneClietnAutostart" />
780+ <!-- U1Sync pacakge -->
781+ <ComponentRef Id="CTypesComponent" />
782+ <ComponentRef Id="HLibComponent" />
783+ <ComponentRef Id="SocketComponent" />
784+ <ComponentRef Id="SSLComponent" />
785+ <ComponentRef Id="SysLoaderComponent" />
786+ <ComponentRef Id="Bz2Component" />
787+ <ComponentRef Id="Libeay32Component" />
788+ <ComponentRef Id="LibraryComponent" />
789+ <ComponentRef Id="U1SyncMainComponent" />
790+ <ComponentRef Id="OpenSSLCryptoComponent" />
791+ <ComponentRef Id="OpenSSLRandComponent" />
792+ <ComponentRef Id="OpenSSLSSLComponent" />
793+ <ComponentRef Id="PoyexpactComponent" />
794+ <ComponentRef Id="Python26Component" />
795+ <ComponentRef Id="PythonCom26Component" />
796+ <ComponentRef Id="PyWinTypeComponent" />
797+ <ComponentRef Id="SelectComponent" />
798+ <ComponentRef Id="Ssleay32Component" />
799+ <ComponentRef Id="TwistedComponent" />
800+ <ComponentRef Id="UnicodeDataComponent" />
801+ <ComponentRef Id="W9xpopenComponent" />
802+ <ComponentRef Id="Win32ApiComponent" />
803+ <ComponentRef Id="Win32EventComponent" />
804+ <ComponentRef Id="Win32EventLogComponent" />
805+ <ComponentRef Id="Win32FileComponent" />
806+ <ComponentRef Id="Win32PipeComponent" />
807+ <ComponentRef Id="Win32ProcessComponent" />
808+ <ComponentRef Id="Win32SecurityComponent" />
809+ <ComponentRef Id="Win32UIComponent" />
810+ <ComponentRef Id="Win32WnetComponent" />
811+ <ComponentRef Id="ZopeInterfaceComponent" />
812+ <ComponentRef Id="UbuntuSSO" />
813+ <ComponentRef Id="UbuntuSSOViews" />
814+ <ComponentRef Id="Newtonsoft.Json" />
815+ </Feature>
816+
817+ <UI Id="WixUI_Minimal_No_License">
818+ <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
819+ <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
820+ <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
821+
822+ <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
823+ <Property Id="WixUI_Mode" Value="Minimal" />
824+
825+ <DialogRef Id="ErrorDlg" />
826+ <DialogRef Id="FatalError" />
827+ <DialogRef Id="FilesInUse" />
828+ <DialogRef Id="MsiRMFilesInUse" />
829+ <DialogRef Id="PrepareDlg" />
830+ <DialogRef Id="ProgressDlg" />
831+ <DialogRef Id="ResumeDlg" />
832+ <DialogRef Id="UserExit" />
833+ <DialogRef Id="WelcomeDlg" />
834+
835+ <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
836+
837+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
838+
839+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="PrepareDlg">1</Publish>
840+
841+ <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
842+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
843+ <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
844+
845+ <Property Id="ARPNOMODIFY" Value="1" />
846+ </UI>
847+
848+ <UIRef Id="WixUI_Common" />
849+ <UIRef Id="WixUI_Minimal_No_License"/>
850+ <UIRef Id="WixUI_ErrorProgressText" />
851+
852+ <!-- UI settings, to be defined by the design team -->
853+
854+ <!-- <WixVariable Id="WixUIBannerBmp" Value="path\banner.bmp" />
855+ <WixVariable Id="WixUIDialogBmp" Value="path\dialog.bmp" />
856+ <WixVariable Id="WixUIExclamationIco" Value="path\exclamation.ico" />
857+ <WixVariable Id="WixUIInfoIco" Value="path\information.ico" />
858+ <WixVariable Id="WixUINewIco" Value="path\new.ico" />
859+ <WixVariable Id="WixUIUpIco" Value="path\up.ico" /> -->
860+
861+ </Product>
862+</Wix>
863\ No newline at end of file
864
865=== modified file 'main.build'
866--- main.build 2010-09-30 09:36:24 +0000
867+++ main.build 2010-09-30 09:36:24 +0000
868@@ -16,7 +16,9 @@
869 <property name="python_path" value="C:\Python26" />
870 <!-- property that allows to pass the location to be used to update the package. -->
871 <property name="upload_path" value="http://s3.amazonaws.com/u1wintest/" />
872-
873+ <!-- get the os in which we are building -->
874+ <property name="os" value="${operating-system::to-string(environment::get-operating-system())}" />
875+
876 <target name="clean"
877 description="Removes all the different results of the last comilation if they exist">
878 <!-- delete all the different results from the previous build -->
879@@ -282,21 +284,40 @@
880 </fileset>
881 </copy>
882
883- <!-- wix compiler -->
884- <exec basedir="tools/Wix/bin"
885- managed="true"
886- workingdir="install"
887- program="candle.exe"
888- commandline="-ext WixUIExtension -ext WixUtilExtension UbuntuOne.wxs"/>
889-
890- <!-- wix linker -->
891- <exec basedir="tools/Wix/bin"
892- managed="true"
893- workingdir="install"
894- program="light.exe"
895- commandline="-out UbuntuOne.msi -ext WixUIExtension -ext WixUtilExtension UbuntuOne.wixobj"/>
896-
897-
898+ <if test="${string::contains(os, 'Microsoft Windows NT 6.1')}">
899+ <echo message="Building installer on Windows 7" />
900+ <!-- wix compiler -->
901+ <exec basedir="tools/Wix/bin"
902+ managed="true"
903+ workingdir="install"
904+ program="candle.exe"
905+ commandline="-ext WixUIExtension -ext WixUtilExtension UbuntuOne7.wxs"/>
906+
907+ <!-- wix linker -->
908+ <exec basedir="tools/Wix/bin"
909+ managed="true"
910+ workingdir="install"
911+ program="light.exe"
912+ commandline="-out UbuntuOne.msi -ext WixUIExtension -ext WixUtilExtension UbuntuOne7.wixobj"/>
913+ </if>
914+
915+ <if test="${string::contains(os, 'Microsoft Windows NT 5.1')}">
916+ <echo message="Building installer on Windows XP" />
917+ <!-- wix compiler -->
918+ <exec basedir="tools/Wix/bin"
919+ managed="true"
920+ workingdir="install"
921+ program="candle.exe"
922+ commandline="-ext WixUIExtension -ext WixUtilExtension UbuntuOneXP.wxs"/>
923+
924+ <!-- wix linker -->
925+ <exec basedir="tools/Wix/bin"
926+ managed="true"
927+ workingdir="install"
928+ program="light.exe"
929+ commandline="-out UbuntuOne.msi -ext WixUIExtension -ext WixUtilExtension UbuntuOneXP.wixobj"/>
930+ </if>
931+
932 </target>
933
934 <target name="bootstrapper"
935
936=== modified file 'src/Canonical.Ubuntu.SSO/DPAPIDataProtector.cs'
937--- src/Canonical.Ubuntu.SSO/DPAPIDataProtector.cs 2010-09-30 09:36:24 +0000
938+++ src/Canonical.Ubuntu.SSO/DPAPIDataProtector.cs 2010-09-30 09:36:24 +0000
939@@ -20,6 +20,7 @@
940
941 using System.Security.Cryptography;
942 using System.Text;
943+using log4net;
944
945 namespace Canonical.Ubuntu.SSO
946 {
947@@ -28,6 +29,40 @@
948 /// </summary>
949 public class DPAPIDataProtector : IDataProtector
950 {
951+ #region Variables
952+
953+ private ILog _logger;
954+ private readonly object _loggerLock = new object();
955+
956+ #endregion
957+
958+ #region DI properties
959+
960+ /// <summary>
961+ /// Gets and sets the logger that will be used to log the operation of the
962+ /// class.
963+ /// </summary>
964+ public ILog Logger
965+ {
966+ get
967+ {
968+ if (_logger == null)
969+ {
970+ lock (_loggerLock)
971+ {
972+ _logger = LogManager.GetLogger(typeof(Keyring));
973+ }
974+ }
975+ return _logger;
976+ }
977+ set
978+ {
979+ _logger = value;
980+ }
981+ }
982+
983+ #endregion
984+
985 #region Implementation of IDataProtector
986
987 /// <summary>
988@@ -39,6 +74,8 @@
989 /// <returns>A string representing the encrypted data.</returns>
990 public byte[] Protect(string userData, byte[] optionalEntropy, DataProtectionScope scope)
991 {
992+ // we do not use [DebugLogged] because it will compromise the security of the secrets in the logs
993+ Logger.DebugFormat("> ProtectData(\"****\", {0}, {1})", optionalEntropy, scope);
994 if(userData != null)
995 {
996 var userDataBytes = Encoding.UTF8.GetBytes(userData);
997@@ -46,6 +83,7 @@
998
999 return encryptedBytes;
1000 }
1001+ Logger.Info("User data is NULL");
1002 return null;
1003 }
1004
1005@@ -58,11 +96,14 @@
1006 /// <returns>A string representing the unprotected data.</returns>
1007 public string Unprotect(byte[] encryptedData, byte[] optionalEntropy, DataProtectionScope scope)
1008 {
1009+ // we do not use [DebugLogged] because it will compromise the security of the secrets in the logs
1010+ Logger.DebugFormat("> Unprotect({0}, {1}, {2})", encryptedData, optionalEntropy, scope);
1011 if (encryptedData != null)
1012 {
1013 var userDataBytes = ProtectedData.Unprotect(encryptedData, optionalEntropy, scope);
1014 return Encoding.UTF8.GetString(userDataBytes);
1015 }
1016+ Logger.Info("Encrypted data is NULL");
1017 return null;
1018 }
1019
1020
1021=== modified file 'src/Canonical.Ubuntu.SSO/Keyring.cs'
1022--- src/Canonical.Ubuntu.SSO/Keyring.cs 2010-09-30 09:36:24 +0000
1023+++ src/Canonical.Ubuntu.SSO/Keyring.cs 2010-09-30 09:36:24 +0000
1024@@ -21,6 +21,7 @@
1025 using System.Linq;
1026 using System.Security.Cryptography;
1027 using System.Text;
1028+using Canonical.UbuntuOne.Common.Aop;
1029 using Canonical.UbuntuOne.Common.Validation;
1030 using log4net;
1031 using Microsoft.Win32;
1032@@ -39,7 +40,7 @@
1033 private const int KeyringMaxNameLength = 255;
1034 private ILog _logger;
1035 private readonly object _loggerLock = new object();
1036- private bool _keyringsRootExists = false;
1037+ private bool _keyringsRootExists;
1038
1039 #endregion
1040
1041@@ -108,6 +109,12 @@
1042
1043 #region Helpers
1044
1045+ /// <summary>
1046+ /// Determines if the root used to store the keyrings does exist in the current user
1047+ /// registry key.
1048+ /// </summary>
1049+ /// <returns>A boolean flag that states if the root of the keyrings exists.</returns>
1050+ [DebugLogged]
1051 private bool KeyringsRootExists()
1052 {
1053 if (!_keyringsRootExists)
1054@@ -133,6 +140,12 @@
1055 return _keyringsRootExists;
1056 }
1057
1058+ /// <summary>
1059+ /// States if a keyring with the given name exists in the ssytem.
1060+ /// </summary>
1061+ /// <param name="keyring">The name of the keyring we are looking for.</param>
1062+ /// <returns>A flag stating if the keyring does exist.</returns>
1063+ [DebugLogged]
1064 private bool KeyringExist(string keyring)
1065 {
1066 // open the root keyring and then the subkeyring to ensure that the
1067@@ -149,12 +162,22 @@
1068 }
1069 }
1070
1071+ /// <summary>
1072+ /// Creates the root path used by the keyrings.
1073+ /// </summary>
1074+ /// <returns>The registry key that represents the root path of the keyrings.</returns>
1075+ [DebugLogged]
1076 private IRegistryKey CreateKeyringRootPath()
1077 {
1078 // create a key with the root path to be used
1079 return UserRegistry.CreateSubKey(RootPath);
1080 }
1081
1082+ /// <summary>
1083+ /// Creates a keyring with the given name.
1084+ /// </summary>
1085+ /// <param name="keyring">The registry key that is used to store the data in the keyring.</param>
1086+ [DebugLogged]
1087 private void CreateKeyring(string keyring)
1088 {
1089 using(var rootKey = (KeyringsRootExists())?
1090@@ -165,6 +188,12 @@
1091 }
1092 }
1093
1094+ /// <summary>
1095+ /// Allows to open a keyring with the given name.
1096+ /// </summary>
1097+ /// <param name="keyring">The name of the keyring to open.</param>
1098+ /// <returns>A keyring key that is used to manage the keyring.</returns>
1099+ [DebugLogged]
1100 private IRegistryKey OpenKeyring(string keyring)
1101 {
1102 using(var rootKey = UserRegistry.OpenSubKey(RootPath,RegistryKeyPermissionCheck.ReadWriteSubTree))
1103@@ -173,8 +202,17 @@
1104 }
1105 }
1106
1107+ /// <summary>
1108+ /// Allows to save a value in the keyring with the given name.
1109+ /// </summary>
1110+ /// <param name="keyringName">The name of the keyring in which the secret will be stored.</param>
1111+ /// <param name="applicationName">The name of the application that is storing the secret.</param>
1112+ /// <param name="secret">The secret to be stored.</param>
1113 private void SaveValue(string keyringName, string applicationName, string secret)
1114 {
1115+ // we do not use the [DebugLogged] because we will be printing the secret and therefore
1116+ // expose private data, instead with used the normal logging
1117+ Logger.DebugFormat("> SaveValue({0}, {1}, \"******\")", keyringName, applicationName);
1118 using(var keyring = OpenKeyring(keyringName))
1119 {
1120 var encryptedSecret = DataProtector.Protect(secret, Encoding.UTF8.GetBytes(Entropy),
1121@@ -183,11 +221,21 @@
1122 }
1123 }
1124
1125+ /// <summary>
1126+ /// Allows to retrieve a value from a given keyring.
1127+ /// </summary>
1128+ /// <param name="keyringName">The name of the keyring from which the value will be read.</param>
1129+ /// <param name="applicationName">The anme of the application whose secret we want to read.</param>
1130+ /// <returns>The secret that was read.</returns>
1131 private string GetValue(string keyringName, string applicationName)
1132 {
1133+ // we do not user [DbugLogged] because it will be printing the secret and therefore
1134+ // expose private data. insetead we use normal logging
1135+ Logger.DebugFormat("> GetValue({0}, {1})", keyringName, applicationName);
1136 using (var keyring = OpenKeyring(keyringName))
1137 {
1138 var secret = keyring.GetValue(applicationName) as byte[];
1139+ Logger.Debug("< GetValue(\"******\")");
1140 return DataProtector.Unprotect(secret, Encoding.UTF8.GetBytes(Entropy), DataProtectionScope.CurrentUser);
1141 }
1142 }
1143@@ -203,6 +251,7 @@
1144 /// <param name="keyringName">The name of the keyring where the secret will be stored.</param>
1145 /// <param name="applicationName">The name of the application whose secret will be stored.</param>
1146 /// <param name="secret">The secret to store in the keyring.</param>
1147+ [DebugLogged]
1148 public void CreateSecret(string keyringName, string applicationName, string secret)
1149 {
1150 ValidateArgs.Begin()
1151@@ -214,6 +263,7 @@
1152
1153 if (!KeyringExist(keyringName))
1154 {
1155+ Logger.InfoFormat("Keyring '{0}' does not exist.", keyringName);
1156 CreateKeyring(keyringName);
1157 Logger.InfoFormat("Creating keyring with name {0}", keyringName);
1158 }
1159@@ -226,6 +276,7 @@
1160 /// <param name="keyringName">The name of the keyring where the secret was stored.</param>
1161 /// <param name="applicationName">the name of the application that stored the secret.</param>
1162 /// <returns>An empty string if the secret does not exist, the secret otherwhise.</returns>
1163+ [DebugLogged]
1164 public string GetSecretByName(string keyringName, string applicationName)
1165 {
1166 ValidateArgs.Begin()
1167@@ -241,6 +292,7 @@
1168 /// Gets a lists with all the names of the available keyrings.
1169 /// </summary>
1170 /// <returns>An enumerable with all the names of the different keyrings.</returns>
1171+ [DebugLogged]
1172 public IEnumerable<string> GetKeyrings()
1173 {
1174 if(KeyringsRootExists())
1175@@ -250,6 +302,7 @@
1176 return keyringRoot.GetSubKeyNames();
1177 }
1178 }
1179+ Logger.Info("Keyrings root does not exist.");
1180 return new string[0];
1181 }
1182
1183@@ -258,6 +311,7 @@
1184 /// </summary>
1185 /// <param name="keyringName">The name of the keyring that is queried.</param>
1186 /// <returns>An enumerable with all the applications in the keyring.</returns>
1187+ [DebugLogged]
1188 public IEnumerable<string> GetApplications(string keyringName)
1189 {
1190 ValidateArgs.Begin()
1191@@ -274,6 +328,7 @@
1192 }
1193 }
1194 }
1195+ Logger.InfoFormat("Keyring '{0}' does not exist.", keyringName);
1196 return new string[0];
1197 }
1198
1199
1200=== modified file 'src/Canonical.Ubuntu.SSO/RegistryKeyWrapper.cs'
1201--- src/Canonical.Ubuntu.SSO/RegistryKeyWrapper.cs 2010-09-30 09:36:24 +0000
1202+++ src/Canonical.Ubuntu.SSO/RegistryKeyWrapper.cs 2010-09-30 09:36:24 +0000
1203@@ -19,6 +19,8 @@
1204 */
1205
1206 using System;
1207+using Canonical.UbuntuOne.Common.Aop;
1208+using log4net;
1209 using Microsoft.Win32;
1210
1211 namespace Canonical.Ubuntu.SSO
1212@@ -32,6 +34,35 @@
1213 #region Variables
1214
1215 private readonly RegistryKey _key;
1216+ private ILog _logger;
1217+ private readonly object _loggerLock = new object();
1218+
1219+ #endregion
1220+
1221+ #region DI properties
1222+
1223+ /// <summary>
1224+ /// Gets and sets the logger that will be used to log the operation of the
1225+ /// class.
1226+ /// </summary>
1227+ public ILog Logger
1228+ {
1229+ get
1230+ {
1231+ if (_logger == null)
1232+ {
1233+ lock (_loggerLock)
1234+ {
1235+ _logger = LogManager.GetLogger(typeof(Keyring));
1236+ }
1237+ }
1238+ return _logger;
1239+ }
1240+ set
1241+ {
1242+ _logger = value;
1243+ }
1244+ }
1245
1246 #endregion
1247
1248@@ -112,6 +143,7 @@
1249 /// </summary>
1250 /// <param name="name">The name or path of the subkey to create or open. </param>
1251 /// <returns>A sub key to work with.</returns>
1252+ [DebugLogged]
1253 public IRegistryKey CreateSubKey(string name)
1254 {
1255 return new RegistryKeyWrapper(_key.CreateSubKey(name));
1256@@ -125,6 +157,7 @@
1257 /// <param name="permissionCheck">One of the RegistryKeyPermissionCheck values that
1258 /// specifies whether the key is opened for read or read/write access.</param>
1259 /// <returns>A subkey to work with.</returns>
1260+ [DebugLogged]
1261 public IRegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck)
1262 {
1263 return new RegistryKeyWrapper(_key.CreateSubKey(subkey, permissionCheck));
1264@@ -134,6 +167,7 @@
1265 /// Deletes the specified subkey. The string subkey is not case-sensitive.
1266 /// </summary>
1267 /// <param name="subkey">The name of the subkey to delete. </param>
1268+ [DebugLogged]
1269 public void DeleteSubKey(string subkey)
1270 {
1271 _key.DeleteSubKey(subkey);
1272@@ -143,6 +177,7 @@
1273 /// Deletes the specified value from this key.
1274 /// </summary>
1275 /// <param name="name">The name of the value to delete.</param>
1276+ [DebugLogged]
1277 public void DeleteValue(string name)
1278 {
1279 _key.DeleteValue(name);
1280@@ -152,6 +187,7 @@
1281 /// Writes all the attributes of the specified open registry
1282 /// key into the registry.
1283 /// </summary>
1284+ [DebugLogged]
1285 public void Flush()
1286 {
1287 _key.Flush();
1288@@ -162,6 +198,7 @@
1289 /// </summary>
1290 /// <returns>An array of strings that contains the names of the
1291 /// subkeys for the current key.</returns>
1292+ [DebugLogged]
1293 public string[] GetSubKeyNames()
1294 {
1295 return _key.GetSubKeyNames();
1296@@ -175,6 +212,8 @@
1297 /// <returns>The value associated with name, or null if name is not found.</returns>
1298 public object GetValue(string name)
1299 {
1300+ // use norml logging because otherwhise it will expose user data
1301+ Logger.DebugFormat("> GetValue({0})", name);
1302 return _key.GetValue(name);
1303 }
1304
1305@@ -188,6 +227,7 @@
1306 /// environment variables left unexpanded, or defaultValue if name is not found.</returns>
1307 public object GetValue(string name, object defaultValue)
1308 {
1309+ Logger.DebugFormat("> GetValue({0}, {1})", name, defaultValue);
1310 return _key.GetValue(name, defaultValue);
1311 }
1312
1313@@ -197,6 +237,7 @@
1314 /// <param name="name">The name of the value whose registry data type is to be retrieved. </param>
1315 /// <returns>A RegistryValueKind value representing the registry
1316 /// data type of the value associated with name.</returns>
1317+ [DebugLogged]
1318 public RegistryValueKind GetValueKind(string name)
1319 {
1320 return _key.GetValueKind(name);
1321@@ -208,6 +249,7 @@
1322 /// </summary>
1323 /// <returns>An array of strings that contains
1324 /// the value names for the current key.</returns>
1325+ [DebugLogged]
1326 public string[] GetValueNames()
1327 {
1328 return _key.GetValueNames();
1329@@ -218,6 +260,7 @@
1330 /// </summary>
1331 /// <param name="name">The name or path of the subkey to open read-only. </param>
1332 /// <returns>The subkey requested, or null if the operation failed.</returns>
1333+ [DebugLogged]
1334 public IRegistryKey OpenSubKey(string name)
1335 {
1336 return new RegistryKeyWrapper(_key.OpenSubKey(name));
1337@@ -230,6 +273,7 @@
1338 /// <param name="permissionCheck">One of the RegistryKeyPermissionCheck values
1339 /// that specifies whether the key is opened for read or read/write access.</param>
1340 /// <returns></returns>
1341+ [DebugLogged]
1342 public IRegistryKey OpenSubKey(string name, RegistryKeyPermissionCheck permissionCheck)
1343 {
1344 return new RegistryKeyWrapper(_key.OpenSubKey(name, permissionCheck));
1345@@ -242,6 +286,7 @@
1346 /// <param name="value">The data to be stored.</param>
1347 public void SetValue(string name, object value)
1348 {
1349+ Logger.DebugFormat("> SetValue({0}, \"******\")", name);
1350 _key.SetValue(name, value);
1351 }
1352
1353@@ -253,6 +298,7 @@
1354 /// <param name="valueKind">The registry data type to use when storing the data</param>
1355 public void SetValue(string name, object value, RegistryValueKind valueKind)
1356 {
1357+ Logger.DebugFormat("> SetValue({0}, \"******\", {1})", name, valueKind);
1358 _key.SetValue(name, value, valueKind);
1359 }
1360
1361
1362=== modified file 'src/Canonical.Ubuntu.SSO/SSOCredentialsProvider.cs'
1363--- src/Canonical.Ubuntu.SSO/SSOCredentialsProvider.cs 2010-09-30 09:36:24 +0000
1364+++ src/Canonical.Ubuntu.SSO/SSOCredentialsProvider.cs 2010-09-30 09:36:24 +0000
1365@@ -19,6 +19,7 @@
1366 */
1367 using System;
1368 using System.Collections.Generic;
1369+using Canonical.UbuntuOne.Common.Aop;
1370
1371 namespace Canonical.Ubuntu.SSO
1372 {
1373@@ -52,6 +53,7 @@
1374 /// The result of this action will be notified through the use of the event handlers
1375 /// due to the fact that the call to the sso webservice is async.
1376 /// </summary>
1377+ [DebugLogged]
1378 public void LoginToGetCredentials()
1379 {
1380 // try to get the credentials from the keyring
1381@@ -68,6 +70,7 @@
1382 /// The result of this action will be notified through the use of the event handlers
1383 /// due to the fact that the call to the sso webservice is async.
1384 /// </summary>
1385+ [DebugLogged]
1386 public void LoginOrRegisterToGetCredentials()
1387 {
1388 }
1389
1390=== modified file 'src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs'
1391--- src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs 2010-09-30 09:36:24 +0000
1392+++ src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs 2010-09-30 09:36:24 +0000
1393@@ -19,8 +19,6 @@
1394 using System.Diagnostics;
1395 using System.IO;
1396 using System.Net;
1397-using System.Text;
1398-using System.Text.RegularExpressions;
1399 using System.Web;
1400 using System.Windows;
1401 using Canonical.Ubuntu.SSO;
1402
1403=== modified file 'src/Canonical.UbuntuOne.ProcessDispatcher/objects.xml'
1404--- src/Canonical.UbuntuOne.ProcessDispatcher/objects.xml 2010-07-26 15:56:11 +0000
1405+++ src/Canonical.UbuntuOne.ProcessDispatcher/objects.xml 2010-09-30 09:36:24 +0000
1406@@ -1,9 +1,9 @@
1407 <?xml version="1.0" encoding="utf-8" ?>
1408 <objects xmlns="http://www.springframework.net">
1409
1410- <!-- ###################################################################################################### -->
1411- <!-- Set up the aop code that will inject debugging logs when the solution has been deply in alpha and beta -->
1412- <!-- ###################################################################################################### -->
1413+ <!-- ####################################################################################################### -->
1414+ <!-- Set up the aop code that will inject debugging logs when the solution has been deploy in alpha and beta -->
1415+ <!-- ####################################################################################################### -->
1416
1417 <!-- Pointcut used for debugging method calls -->
1418
1419
1420=== modified file 'src/UbuntuOneClient.Tests/ProgramFixture.cs'
1421--- src/UbuntuOneClient.Tests/ProgramFixture.cs 2010-08-10 10:04:31 +0000
1422+++ src/UbuntuOneClient.Tests/ProgramFixture.cs 2010-09-30 09:36:24 +0000
1423@@ -125,6 +125,7 @@
1424 [Test]
1425 public void StartApplicationWithCheckUpdatesExceptionTest()
1426 {
1427+ Assert.Ignore("RhinoMocks does not support multithreaded tests and therefore this test will not be reliable");
1428 using (_mocks.Record())
1429 {
1430 _app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
1431
1432=== modified file 'src/UbuntuOneClient/objects.xml'
1433--- src/UbuntuOneClient/objects.xml 2010-08-19 16:54:57 +0000
1434+++ src/UbuntuOneClient/objects.xml 2010-09-30 09:36:24 +0000
1435@@ -1,6 +1,45 @@
1436 <?xml version="1.0" encoding="utf-8" ?>
1437 <objects xmlns="http://www.springframework.net">
1438- <!-- Define window that will be used as the start point of the app -->
1439+
1440+ <!-- ####################################################################################################### -->
1441+ <!-- Set up the aop code that will inject debugging logs when the solution has been deploy in alpha and beta -->
1442+ <!-- ####################################################################################################### -->
1443+
1444+ <!-- Pointcut used for debugging method calls -->
1445+
1446+ <!-- Provides logging before a method has been called -->
1447+ <object id="LogBeforeCall"
1448+ type="Spring.Aop.Support.AttributeMatchMethodPointcutAdvisor, Spring.Aop" >
1449+ <property name="advice">
1450+ <object type="Canonical.UbuntuOne.Common.Aop.DebugLogBeforeCallInterceptor, Canonical.UbuntuOne.Common" />
1451+ </property>
1452+ <property name="attribute"
1453+ value="Canonical.UbuntuOne.Common.Aop.DebugLoggedAttribute, Canonical.UbuntuOne.Common" />
1454+ </object>
1455+
1456+ <!-- Provides logging fater a method has been called -->
1457+ <object id="LofAfterCall"
1458+ type="Spring.Aop.Support.AttributeMatchMethodPointcutAdvisor, Spring.Aop" >
1459+ <property name="advice">
1460+ <object type="Canonical.UbuntuOne.Common.Aop.DebugLogAfterCallInterceptor, Canonical.UbuntuOne.Common" />
1461+ </property>
1462+ <property name="attribute"
1463+ value="Canonical.UbuntuOne.Common.Aop.DebugLoggedAttribute, Canonical.UbuntuOne.Common" />
1464+ </object>
1465+
1466+ <object id="LofAfterThrow"
1467+ type="Spring.Aop.Support.AttributeMatchMethodPointcutAdvisor, Spring.Aop" >
1468+ <property name="advice">
1469+ <object type="Canonical.UbuntuOne.Common.Aop.DebugLogAfterThrowInterceptor, Canonical.UbuntuOne.Common" />
1470+ </property>
1471+ <property name="attribute"
1472+ value="Canonical.UbuntuOne.Common.Aop.DebugLoggedAttribute, Canonical.UbuntuOne.Common" />
1473+ </object>
1474+
1475+ <!-- ############################################################### -->
1476+ <!-- Define window that will be used as the start point of the app -->
1477+ <!-- ############################################################### -->
1478+
1479 <object id="Updater"
1480 type="Canonical.UbuntuOne.Common.Update.Updater, Canonical.UbuntuOne.Common"
1481 autowire="autodetect">
1482
1483=== added file 'utils/BaseDirectory.py'
1484--- utils/BaseDirectory.py 1970-01-01 00:00:00 +0000
1485+++ utils/BaseDirectory.py 2010-09-30 09:36:24 +0000
1486@@ -0,0 +1,173 @@
1487+"""
1488+This module is based on a rox module (LGPL):
1489+
1490+http://cvs.sourceforge.net/viewcvs.py/rox/ROX-Lib2/python/rox/basedir.py?rev=1.9&view=log
1491+
1492+The freedesktop.org Base Directory specification provides a way for
1493+applications to locate shared data and configuration:
1494+
1495+ http://standards.freedesktop.org/basedir-spec/
1496+
1497+(based on version 0.6)
1498+
1499+This module can be used to load and save from and to these directories.
1500+
1501+Typical usage:
1502+
1503+ from rox import basedir
1504+
1505+ for dir in basedir.load_config_paths('mydomain.org', 'MyProg', 'Options'):
1506+ print "Load settings from", dir
1507+
1508+ dir = basedir.save_config_path('mydomain.org', 'MyProg')
1509+ print >>file(os.path.join(dir, 'Options'), 'w'), "foo=2"
1510+
1511+Note: see the rox.Options module for a higher-level API for managing options.
1512+"""
1513+
1514+from __future__ import generators
1515+import os
1516+import sys
1517+
1518+# we must chech which os we are using to ensure that the correct
1519+# paths are set
1520+if sys.platform == "win32":
1521+
1522+ def get_special_folders():
1523+
1524+ # Routine to grab all the Windows Shell Folder locations from the registry. If successful, returns dictionary
1525+ # of shell folder locations indexed on Windows keyword for each; otherwise, returns an empty dictionary.
1526+ import _winreg
1527+ special_folders = {}
1528+
1529+ # First open the registry hive
1530+ try:
1531+ Hive = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)
1532+ except WindowsError:
1533+ print "Can't connect to registry hive HKEY_CURRENT_USER."
1534+ return special_folders
1535+
1536+ # Then open the registry key where Windows stores the Shell Folder locations
1537+ try:
1538+ Key = _winreg.OpenKey(Hive, "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
1539+ except WindowsError:
1540+ print "Can't open registry key Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders."
1541+ _winreg.CloseKey(Hive)
1542+ return special_folders
1543+
1544+ # Nothing failed above, so enumerate through all the Shell Folder values and return in a dictionary
1545+ # This relies on error at end of
1546+ try:
1547+ #i = 0
1548+ #while 1:
1549+ for i in range(0, _winreg.QueryInfoKey(Key)[1]):
1550+ name, value, val_type = _winreg.EnumValue(Key, i)
1551+ special_folders[name] = value
1552+ i += 1
1553+ _winreg.CloseKey(Key) # Only use with for loop
1554+ _winreg.CloseKey(Hive) # Only use with for loop
1555+ return special_folders # Only use with for loop
1556+ except WindowsError:
1557+ # In case of failure before read completed, don't return partial results
1558+ _winreg.CloseKey(Key)
1559+ _winreg.CloseKey(Hive)
1560+ special_folders = {}
1561+
1562+ special_folders = get_special_folders()
1563+
1564+ home_path = special_folders['Personal']
1565+ app_local_data_path = special_folders['Local AppData']
1566+ app_global_data_path = special_folders['AppData']
1567+ app_roaming_data_path = special_folders['Cache']
1568+
1569+ # use the non romain app data
1570+ xdg_data_home = os.environ.get('XDG_DATA_HOME',
1571+ os.path.join(app_local_data_path, 'xdg'))
1572+
1573+ # we will use ; as the spearator because is the char used
1574+ # in the windows env variables
1575+ xdg_data_dirs = os.environ.get('XDG_DATA_DIRS',
1576+ '{0};{1};{2}'.format(app_local_data_path,
1577+ app_global_data_path, app_roaming_data_path)).split(';')
1578+
1579+ # we will return the roaming data wich is as close as we get in windows
1580+ # regarding caching.
1581+ xdg_cache_home = os.environ.get('XDG_CACHE_HOME',
1582+ app_roaming_data_path)
1583+
1584+ # point to the not roaming app data for the user
1585+ xdg_config_home = os.environ.get('XDG_CONFIG_HOME',
1586+ app_local_data_path)
1587+
1588+ xdg_config_dirs = [xdg_config_home] + \
1589+ os.environ.get('XDG_CONFIG_DIRS',
1590+ os.path.join(app_global_data_path, 'xdg')).split(':')
1591+
1592+else:
1593+ _home = os.environ.get('HOME', '/')
1594+ xdg_data_home = os.environ.get('XDG_DATA_HOME',
1595+ os.path.join(_home, '.local', 'share'))
1596+
1597+ xdg_data_dirs = [xdg_data_home] + \
1598+ os.environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':')
1599+
1600+ xdg_config_home = os.environ.get('XDG_CONFIG_HOME',
1601+ os.path.join(_home, '.config'))
1602+
1603+ xdg_config_dirs = [xdg_config_home] + \
1604+ os.environ.get('XDG_CONFIG_DIRS', '/etc/xdg').split(':')
1605+
1606+ xdg_cache_home = os.environ.get('XDG_CACHE_HOME',
1607+ os.path.join(_home, '.cache'))
1608+
1609+xdg_data_dirs = filter(lambda x: x, xdg_data_dirs)
1610+xdg_config_dirs = filter(lambda x: x, xdg_config_dirs)
1611+
1612+def save_config_path(*resource):
1613+ """Ensure $XDG_CONFIG_HOME/<resource>/ exists, and return its path.
1614+ 'resource' should normally be the name of your application. Use this
1615+ when SAVING configuration settings. Use the xdg_config_dirs variable
1616+ for loading."""
1617+ resource = os.path.join(*resource)
1618+ assert not resource.startswith('/')
1619+ path = os.path.join(xdg_config_home, resource)
1620+ if not os.path.isdir(path):
1621+ os.makedirs(path, 0700)
1622+ return path
1623+
1624+def save_data_path(*resource):
1625+ """Ensure $XDG_DATA_HOME/<resource>/ exists, and return its path.
1626+ 'resource' is the name of some shared resource. Use this when updating
1627+ a shared (between programs) database. Use the xdg_data_dirs variable
1628+ for loading."""
1629+ resource = os.path.join(*resource)
1630+ assert not resource.startswith('/')
1631+ path = os.path.join(xdg_data_home, resource)
1632+ if not os.path.isdir(path):
1633+ os.makedirs(path)
1634+ return path
1635+
1636+def load_config_paths(*resource):
1637+ """Returns an iterator which gives each directory named 'resource' in the
1638+ configuration search path. Information provided by earlier directories should
1639+ take precedence over later ones (ie, the user's config dir comes first)."""
1640+ resource = os.path.join(*resource)
1641+ for config_dir in xdg_config_dirs:
1642+ path = os.path.join(config_dir, resource)
1643+ if os.path.exists(path): yield path
1644+
1645+def load_first_config(*resource):
1646+ """Returns the first result from load_config_paths, or None if there is nothing
1647+ to load."""
1648+ for x in load_config_paths(*resource):
1649+ return x
1650+ return None
1651+
1652+def load_data_paths(*resource):
1653+ """Returns an iterator which gives each directory named 'resource' in the
1654+ shared data search path. Information provided by earlier directories should
1655+ take precedence over later ones."""
1656+ resource = os.path.join(*resource)
1657+ for data_dir in xdg_data_dirs:
1658+ path = os.path.join(data_dir, resource)
1659+ if os.path.exists(path): yield path
1660
1661=== added file 'utils/env_setup.bat'
1662--- utils/env_setup.bat 1970-01-01 00:00:00 +0000
1663+++ utils/env_setup.bat 2010-09-30 09:36:24 +0000
1664@@ -0,0 +1,236 @@
1665+@ECHO off
1666+:: Tell the user what the batch does.
1667+ECHO.
1668+ECHO This batch will set up your enviroment do that you can build the Windows Ubuntu One port.
1669+ECHO.
1670+ECHO The following actions will be taken:
1671+ECHO 1. Download and install python 2.6.
1672+ECHO 2. Install easy_install for windows.
1673+ECHO 3. Install python required libraries.
1674+ECHO 4. Install py2exe.
1675+ECHO 5. Install bazaar.
1676+ECHO 6. Install Ubuntu One Protocol
1677+ECHO.
1678+ECHO Quering OS architecture
1679+:: Get the first 3 chars of process identifier
1680+SET ARCH=%processor_identifier:~0,3%
1681+IF NOT %ARCH% == x86 GOTO :X64
1682+:: set the paths for the x86 packages
1683+ECHO Setting Install Congi for arch %ARCH%
1684+SET PYWIN32INSTALLER=pywin32-214.win32-py2.6.exe
1685+SET PYTHONDOWNLOAD=http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi
1686+SET EASYINSTALLDOWNLOAD=http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11.win32-py2.6.exe#md5=1509752c3c2e64b5d0f9589aafe053dc
1687+SET PY2EXEDOWNLOAD=http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/py2exe-0.6.9.win32-py2.6.exe/download
1688+SET PROTOCDOWNLOAD=http://protobuf.googlecode.com/files/protoc-2.3.0-win32.zip
1689+SET PROTOBUFDOWNLOAD=http://protobuf.googlecode.com/files/protobuf-2.3.0.zip
1690+SET PYOPENSSLDOWNLOAD=http://pypi.python.org/packages/2.6/p/pyOpenSSL/pyOpenSSL-0.10.winxp32-py2.6.msi#md5=90920217fb35d76524cab66c8c135cc8
1691+SET TWISTEDDOWNLOAD=http://tmrc.mit.edu/mirror/twisted/Twisted/10.1/Twisted-10.1.0.winxp32-py2.6.msi
1692+SET BZRDOWNLOAD=http://launchpad.net/bzr/2.2/2.2.0/+download/bzr-2.2.0.win32-py2.6.exe
1693+GOTO :STARTINSTALLATION
1694+:X64
1695+SET PYWIN32INSTALLER=pywin32-214.win-amd64-py2.6.exe
1696+SET PYTHONDOWNLOAD=http://www.python.org/ftp/python/2.6.6/python-2.6.6.amd64.msi
1697+SET EASYINSTALLDOWNLOAD=http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11.win32-py2.6.exe#md5=1509752c3c2e64b5d0f9589aafe053dc
1698+SET PY2EXEDOWNLOAD=http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/py2exe-0.6.9.win64-py2.6.amd64.exe/download
1699+SET PROTOCDOWNLOAD=http://protobuf.googlecode.com/files/protoc-2.3.0-win32.zip
1700+SET PROTOBUFDOWNLOAD=http://protobuf.googlecode.com/files/protobuf-2.3.0.zip
1701+SET PYOPENSSLDOWNLOAD=http://pypi.python.org/packages/2.6/p/pyOpenSSL/pyOpenSSL-0.10.winxp32-py2.6.msi#md5=90920217fb35d76524cab66c8c135cc8
1702+SET TWISTEDDOWNLOAD=http://tmrc.mit.edu/mirror/twisted/Twisted/10.1/Twisted-10.1.0.winxp32-py2.6.msi
1703+SET BZRDOWNLOAD=http://launchpad.net/bzr/2.2/2.2.0/+download/bzr-2.2.0.win32-py2.6.exe
1704+ECHO 64
1705+:STARTINSTALLATION
1706+ECHO Starting installation
1707+
1708+:: ============================================================================
1709+:: Set up temp directory
1710+:: ============================================================================
1711+ECHO.
1712+SET TEMPFILE=%TEMP%\ENV_SET_UP
1713+ECHO The file that will be used to store the downloaded data is:
1714+ECHO %TEMPFILE%
1715+:: If the dir does not exist we have not problem and continue
1716+:: otherwhise delete the dir and create it so that we do not
1717+:: have old data present
1718+IF NOT EXIST %TEMPFILE% GOTO :NOTEMPDIR
1719+:: Ask user if he wants to delete the dir, he might not want to
1720+CHOICE /C YN /M "The dir is already present. Do you want to delete it"
1721+IF ERRORLEVEL 1 GOTO :DELETEDIR
1722+:: User does not want to delete, we are not that smart!! bye!
1723+ECHO Please delete the dir manually
1724+ECHO Leaving installation
1725+EXIT
1726+:DELETEDIR
1727+RD /s /Q %TEMPFILE%
1728+:NOTEMPDIR
1729+MD %TEMPFILE%
1730+
1731+:: ============================================================================
1732+:: Set up python
1733+:: ============================================================================
1734+
1735+SET PYTHONPATH=""
1736+ECHO Checking if python2.6 is in the system
1737+:GETPYTHONPATH
1738+:: This is very anoying, FOR /F will work differently depending on the output
1739+:: of reg which is not consistent between os (xp, 7) we have to choose the tokens
1740+:: according to the os
1741+SET PYTHONPATHTOKENS=3
1742+VER | FIND "XP" > nul
1743+IF %ERRORLEVEL% == 0 SET PYTHONPATHTOKENS=4
1744+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve') DO @SET PYTHONPATH=%%A
1745+IF NOT %PYTHONPATH% == "" GOTO :PYTHONPRESENT
1746+:: donload python and install it
1747+ECHO Download python 2.6
1748+wget.exe -v --output-document=%TEMPFILE%\python.msi %PYTHONDOWNLOAD%
1749+ECHO Installing python...
1750+START /wait msiexec.exe /i %TEMPFILE%\python.msi
1751+:: Set the location of python
1752+GOTO :GETPYTHONPATH
1753+:PYTHONPRESENT
1754+:: Let user know we did find python 2.6
1755+ECHO Python is present!
1756+ECHO Python dir is %PYTHONPATH%
1757+
1758+:: ============================================================================
1759+:: Setup pywin32 extensions
1760+:: ============================================================================
1761+
1762+:: This should be downloaded, but I have issues with wget and sourceforge
1763+ECHO Installing pywin32 python extensions
1764+START /wait %PYWIN32INSTALLER%
1765+
1766+:: ============================================================================
1767+:: Set up easy_install
1768+:: ============================================================================
1769+
1770+ECHO Checking if easy_install is in the system
1771+IF EXIST %PYTHONPATH%\Scripts\easy_install.exe GOTO :EASYINSTALLPRESENT
1772+ECHO Download easy_install for Windows
1773+wget.exe -v --output-document=%TEMPFILE%\easy_install.exe %EASYINSTALLDOWNLOAD%
1774+ECHO Installing easy_install...
1775+START /wait %TEMPFILE%\easy_install.exe %EASYINSTALLDOWNLOAD%
1776+:EASYINSTALLPRESENT
1777+:: set the easy_install path, this is not superb since if the user changed
1778+:: the path of python, we have problems
1779+SET EASYINSTALLPATH=%PYTHONPATH%\Scripts\easy_install.exe
1780+ECHO easy_install is present!
1781+ECHO Python dir is %EASYINSTALLPATH%
1782+
1783+:: ============================================================================
1784+:: Set up dependencies
1785+:: ============================================================================
1786+
1787+
1788+ECHO The following dependencies will be installed using easy_install
1789+ECHO 1. zope.interface
1790+ECHO 2. oauth
1791+ECHO 4. boto
1792+ECHO 5. lazr.authentication
1793+ECHO 6. lazr.restfulclient
1794+ECHO 7. lazr.uri
1795+ECHO Installing dependencies
1796+%EASYINSTALLPATH% -Z -U zope.interface oauth boto lazr.authentication lazr.restfulclient lazr.uri
1797+ECHO.
1798+ECHO Python dependencies have been installed
1799+ECHO.
1800+
1801+:: ============================================================================
1802+:: Set up depedencies that cannot be install with easy_install
1803+::=============================================================================
1804+
1805+:: Install py2exe using an msi, the easy_install pacakage fails in systems such
1806+:: as XP
1807+ECHO Downloading py2exe for Windows
1808+wget.exe -v --output-document=%TEMPFILE%\py2exe.exe "%PY2EXEDOWNLOAD%"
1809+ECHO Installing py2exe
1810+%TEMPFILE%\py2exe.exe
1811+
1812+:: It is of extreme importance to install protoc before, otherwhise the protobuf
1813+:: module for python will not be correctly generated
1814+ECHO Downloading protobuf compiler for python
1815+wget.exe -v --output-document=%TEMPFILE%\protoc_compiler.zip %PROTOCDOWNLOAD%
1816+ECHO Extracting protobuf compiler
1817+IF NOT EXIST "%ProgramFiles%\Protoc" MD "%ProgramFiles%\Protoc"
1818+unzip -o %TEMPFILE%\protoc_compiler.zip -d "%ProgramFiles%\Protoc"
1819+
1820+
1821+:: distutils does not work with the pacakage correctly and we have to unxip ourselves
1822+ECHO Downloading Protobuf for Windows
1823+wget.exe -v --output-document=%TEMPFILE%\protoc.zip %PROTOBUFDOWNLOAD%
1824+unzip -o %TEMPFILE%\protoc.zip -d %TEMPFILE%\Protoc
1825+:: distutils.spawn.find_executable is used to find protoc but it does not do a
1826+:: a very good job on windows, although we have installer protoc in the
1827+:: %ProgramFiles% we are going to copy it to the current location so that
1828+:: python can find it... lame!
1829+COPY /B "%ProgramFiles%\Protoc\protoc.exe" %TEMPFILE%\Protoc\protobuf-2.3.0\python
1830+ECHO Installing Protobuf for Windows
1831+START /B "%PYTHONPATH%\pycdthon.exe" /D%TEMPFILE%\Protoc\protobuf-2.3.0\python setup.py install
1832+:: The setup.py from google creates an egg, but py2exe does notlike that, lets extract it
1833+unzip -o %PYTHONPATH%\Lib\site-packages\protobuf-2.3.0-py2.6.egg -d %PYTHONPATH%\Lib\site-packages
1834+
1835+:: The msi does not add an entry in the reg therefore we always install :(
1836+ECHO Downloading pyOpenSSl for Windows
1837+wget.exe -v --output-document=%TEMPFILE%\pyOpenSSL.msi %PYOPENSSLDOWNLOAD%
1838+ECHO Installing pyOpenSSL
1839+START /wait msiexec.exe /i %TEMPFILE%\pyOpenSSL.msi
1840+
1841+:: Twisted cannot be installer with easy_install on windows
1842+ECHO Downloading twisted for Windows
1843+wget.exe -v --output-document=%TEMPFILE%\twisted.msi %TWISTEDDOWNLOAD%
1844+ECHO Installing twisted
1845+START /wait msiexec.exe /i %TEMPFILE%\twisted.msi
1846+
1847+:: Install xdg.BaseDirectory for Windows
1848+ECHO Installing xdg.BaseDirectory
1849+IF NOT EXIST %PYTHONPATH%\Lib\site-packages\xdg MD %PYTHONPATH%\Lib\site-packages\xdg
1850+COPY BaseDirectory.py %PYTHONPATH%\Lib\site-packages\xdg
1851+ECHO. 2>%PYTHONPATH%\Lib\site-packages\xdg\__init__.py
1852+
1853+:: ============================================================================
1854+:: Set up bazaar
1855+:: ============================================================================
1856+
1857+ECHO Checking if bzr is in the system
1858+:GETBZRPATH
1859+SET BZRPATH = ""
1860+:: This is tricky since the Program Files dir has a space and does provide
1861+:: a problem because the delimeters are not correctly set, well is batch :(
1862+FOR /F "tokens=3-6" %%A IN ('REG QUERY HKLM\Software\Bazaar /v InstallPath') DO @SET BZRPATH=%%A %%B
1863+IF NOT BZRPATH == "" GOTO :BZRPRESENT
1864+ECHO Downloading bazaar
1865+wget.exe -v --output-document=%TEMPFILE%\bazaar.exe %BZRDOWNLOAD%
1866+ECHO Installing bazaar
1867+%TEMPFILE%\bazaar.exe
1868+:: get the path from reg
1869+GOTO :GETBZRPATH
1870+:BZRPRESENT
1871+ECHO bzr is present!
1872+ECHO bzr path is %BZRPATH%
1873+
1874+
1875+:: ============================================================================
1876+:: Set up ubuntuone-storage-protocol
1877+:: ============================================================================
1878+
1879+ECHO Branching ubuntuone-storage-protocol
1880+"%BZRPATH%\bzr.exe" branch lp:ubuntuone-storage-protocol %TEMPFILE%\ubuntuone-storage-protocol
1881+:: distutils.spawn.find_executable is used to find protoc but it does not do a
1882+:: a very good job on windows, although we have installer protoc in the
1883+:: %ProgramFiles% we are going to copy it to the current location so that
1884+:: python can find it... lame!
1885+COPY /B "%ProgramFiles%\Protoc\protoc.exe" %TEMPFILE%\ubuntuone-storage-protocol
1886+ECHO Installing ubuntuone-storage-protocol from source
1887+:: Use start, otherwhise we will not be able to set the execution dir and
1888+:: setup.py will complain about not being able to find the correct dirs
1889+:: to install
1890+START /B "%PYTHONPATH%\python.exe" /D%TEMPFILE%\ubuntuone-storage-protocol\ setup.py install
1891+:: ubuntuone.logger is in not pacakage, we just copy it from the utils dir
1892+COPY logger.py %PYTHONPATH%\Lib\site-packages\ubuntuone
1893+
1894+:: ============================================================================
1895+:: Clean up the downloaded data
1896+:: ============================================================================
1897+
1898+ECHO Cleaning Temp files
1899+RD /s /Q %TEMPFILE%
1900+ECHO Installation completed!!
1901\ No newline at end of file
1902
1903=== added file 'utils/logger.py'
1904--- utils/logger.py 1970-01-01 00:00:00 +0000
1905+++ utils/logger.py 2010-09-30 09:36:24 +0000
1906@@ -0,0 +1,268 @@
1907+# ubuntuone.syncdaemon.logger - logging utilities
1908+#
1909+# Author: Guillermo Gonzalez <guillermo.gonzalez@canonical.com>
1910+#
1911+# Copyright 2010 Canonical Ltd.
1912+#
1913+# This program is free software: you can redistribute it and/or modify it
1914+# under the terms of the GNU General Public License version 3, as published
1915+# by the Free Software Foundation.
1916+#
1917+# This program is distributed in the hope that it will be useful, but
1918+# WITHOUT ANY WARRANTY; without even the implied warranties of
1919+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1920+# PURPOSE. See the GNU General Public License for more details.
1921+#
1922+# You should have received a copy of the GNU General Public License along
1923+# with this program. If not, see <http://www.gnu.org/licenses/>.
1924+"""Ubuntuone client logging utilities and config. """
1925+from __future__ import with_statement
1926+
1927+import contextlib
1928+import logging
1929+import sys
1930+import os
1931+import re
1932+import weakref
1933+import functools
1934+import xdg.BaseDirectory
1935+
1936+from logging.handlers import TimedRotatingFileHandler
1937+
1938+# extra levels
1939+# be more verbose than logging.DEBUG(10)
1940+TRACE = 5
1941+# info that we almost always want to log (logging.ERROR - 1)
1942+NOTE = logging.ERROR - 1
1943+
1944+# map names to the extra levels
1945+levels = {'TRACE':TRACE, 'NOTE':NOTE}
1946+for k, v in levels.items():
1947+ logging.addLevelName(v, k)
1948+
1949+
1950+class Logger(logging.Logger):
1951+ """Logger that support out custom levels."""
1952+
1953+ def note(self, msg, *args, **kwargs):
1954+ """log at NOTE level"""
1955+ if self.isEnabledFor(NOTE):
1956+ self._log(NOTE, msg, args, **kwargs)
1957+
1958+ def trace(self, msg, *args, **kwargs):
1959+ """log at TRACE level"""
1960+ if self.isEnabledFor(TRACE):
1961+ self._log(TRACE, msg, args, **kwargs)
1962+
1963+
1964+class DayRotatingFileHandler(TimedRotatingFileHandler):
1965+ """A mix of TimedRotatingFileHandler and RotatingFileHandler configured for
1966+ daily rotation but that uses the suffix and extMatch of Hourly rotation, in
1967+ order to allow seconds based rotation on each startup.
1968+ The log file is also rotated when the specified size is reached.
1969+ """
1970+
1971+ def __init__(self, *args, **kwargs):
1972+ """ create the instance and override the suffix and extMatch.
1973+ Also accepts a maxBytes keyword arg to rotate the file when it reachs
1974+ maxBytes.
1975+ """
1976+ kwargs['when'] = 'D'
1977+ kwargs['backupCount'] = LOGBACKUP
1978+ # check if we are in 2.5, only for PQM
1979+ if sys.version_info[:2] >= (2, 6):
1980+ kwargs['delay'] = 1
1981+ if 'maxBytes' in kwargs:
1982+ self.maxBytes = kwargs.pop('maxBytes')
1983+ else:
1984+ self.maxBytes = 0
1985+ TimedRotatingFileHandler.__init__(self, *args, **kwargs)
1986+ # override suffix
1987+ self.suffix = "%Y-%m-%d_%H-%M-%S"
1988+ self.extMatch = re.compile(r"^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}$")
1989+
1990+ def shouldRollover(self, record):
1991+ """
1992+ Determine if rollover should occur.
1993+
1994+ Basically, see if TimedRotatingFileHandler.shouldRollover and if it's
1995+ False see if the supplied record would cause the file to exceed
1996+ the size limit we have.
1997+
1998+ The size based rotation are from logging.handlers.RotatingFileHandler
1999+ """
2000+ if TimedRotatingFileHandler.shouldRollover(self, record):
2001+ return 1
2002+ else:
2003+ # check the size
2004+ if self.stream is None: # delay was set...
2005+ self.stream = self._open()
2006+ if self.maxBytes > 0: # are we rolling over?
2007+ msg = "%s\n" % self.format(record)
2008+ self.stream.seek(0, 2) #due to non-posix-compliant Windows feature
2009+ if self.stream.tell() + len(msg) >= self.maxBytes:
2010+ return 1
2011+ return 0
2012+
2013+
2014+class MultiFilter(logging.Filter):
2015+ """Our own logging.Filter.
2016+
2017+ To allow filter by multiple names in a single handler or logger.
2018+
2019+ """
2020+
2021+ def __init__(self, names=None):
2022+ logging.Filter.__init__(self)
2023+ self.names = names or []
2024+ self.filters = []
2025+ for name in self.names:
2026+ self.filters.append(logging.Filter(name))
2027+
2028+ def filter(self, record):
2029+ """Determine if the specified record is to be logged.
2030+
2031+ This work a bit different from the standard logging.Filter, the
2032+ record is logged if at least one filter allows it.
2033+ If there are no filters, the record is allowed.
2034+
2035+ """
2036+ if not self.filters:
2037+ # no filters, allow the record
2038+ return True
2039+ for f in self.filters:
2040+ if f.filter(record):
2041+ return True
2042+ return False
2043+
2044+
2045+class DebugCapture(logging.Handler):
2046+ """
2047+ A context manager to capture debug logs.
2048+ """
2049+
2050+ def __init__(self, logger, raise_unhandled=False, on_error=True):
2051+ """Creates the instance.
2052+
2053+ @param logger: the logger to wrap
2054+ @param raise_unhandled: raise unhandled errors (which are alse logged)
2055+ @param on_error: if it's True (default) the captured debug info is
2056+ dumped if a record with log level >= ERROR is logged.
2057+ """
2058+ logging.Handler.__init__(self, logging.DEBUG)
2059+ self.on_error = on_error
2060+ self.dirty = False
2061+ self.raise_unhandled = raise_unhandled
2062+ self.records = []
2063+ # insert myself as the handler for the logger
2064+ self.logger = weakref.proxy(logger)
2065+ # store the logger log level
2066+ self.old_level = logger.level
2067+ # remove us from the Handler list and dict
2068+ self.close()
2069+
2070+ def emit_debug(self):
2071+ """emit stored records to the original logger handler(s)"""
2072+ enable_debug = self.enable_debug
2073+ for record in self.records:
2074+ for slave in self.slaves:
2075+ with enable_debug(slave):
2076+ slave.handle(record)
2077+
2078+ @contextlib.contextmanager
2079+ def enable_debug(self, obj):
2080+ """context manager that temporarily changes the level attribute of obj
2081+ to logging.DEBUG.
2082+ """
2083+ old_level = obj.level
2084+ obj.level = logging.DEBUG
2085+ yield obj
2086+ obj.level = old_level
2087+
2088+ def clear(self):
2089+ """cleanup the captured records"""
2090+ self.records = []
2091+
2092+ def install(self):
2093+ """Install the debug capture in the logger"""
2094+ self.slaves = self.logger.handlers
2095+ self.logger.handlers = [self]
2096+ # set the logger level in DEBUG
2097+ self.logger.setLevel(logging.DEBUG)
2098+
2099+ def uninstall(self):
2100+ """restore the logger original handlers"""
2101+ # restore the logger
2102+ self.logger.handlers = self.slaves
2103+ self.logger.setLevel(self.old_level)
2104+ self.clear()
2105+ self.dirty = False
2106+ self.slaves = []
2107+
2108+ def emit(self, record):
2109+ """A emit() that append the record to the record list"""
2110+ self.records.append(record)
2111+
2112+ def handle(self, record):
2113+ """ handle a record """
2114+ # if its a DEBUG level record then intercept otherwise
2115+ # pass through to the original logger handler(s)
2116+ if self.old_level <= logging.DEBUG:
2117+ return sum(slave.handle(record) for slave in self.slaves)
2118+ if record.levelno == logging.DEBUG:
2119+ return logging.Handler.handle(self, record)
2120+ elif self.on_error and record.levelno >= logging.ERROR and \
2121+ record.levelno != NOTE:
2122+ # if it's >= ERROR keep it, but mark the dirty falg
2123+ self.dirty = True
2124+ return logging.Handler.handle(self, record)
2125+ else:
2126+ return sum(slave.handle(record) for slave in self.slaves)
2127+
2128+ def __enter__(self):
2129+ """ContextManager API"""
2130+ self.install()
2131+ return self
2132+
2133+ def __exit__(self, exc_type, exc_value, traceback):
2134+ """ContextManager API"""
2135+ if exc_type is not None:
2136+ self.emit_debug()
2137+ self.on_error = False
2138+ self.logger.error('unhandled exception', exc_info=(exc_type,
2139+ exc_value, traceback))
2140+ elif self.dirty:
2141+ # emit all debug messages collected after the error
2142+ self.emit_debug()
2143+ self.uninstall()
2144+ if self.raise_unhandled and exc_type is not None:
2145+ raise exc_type, exc_value, traceback
2146+ else:
2147+ return True
2148+
2149+
2150+### configure the thing ###
2151+# define the location of the log folder
2152+home = xdg.BaseDirectory.xdg_cache_home
2153+LOGFOLDER = os.path.join(home, 'ubuntuone','log')
2154+if not os.path.exists(LOGFOLDER):
2155+ os.makedirs(LOGFOLDER)
2156+
2157+LOGBACKUP = 5 # the number of log files to keep around
2158+
2159+basic_formatter = logging.Formatter(fmt="%(asctime)s - %(name)s - " \
2160+ "%(levelname)s - %(message)s")
2161+debug_formatter = logging.Formatter(fmt="%(asctime)s %(name)s %(module)s " \
2162+ "%(lineno)s %(funcName)s %(message)s")
2163+
2164+# a constant to change the default DEBUG level value
2165+_DEBUG_LOG_LEVEL = logging.DEBUG
2166+
2167+
2168+# partial config of the handler to rotate when the file size is 1MB
2169+CustomRotatingFileHandler = functools.partial(DayRotatingFileHandler,
2170+ maxBytes=1048576)
2171+
2172+# use our logger as the default Logger class
2173+logging.setLoggerClass(Logger)
2174+
2175
2176=== added file 'utils/pywin32-214.win-amd64-py2.6.exe'
2177Binary files utils/pywin32-214.win-amd64-py2.6.exe 1970-01-01 00:00:00 +0000 and utils/pywin32-214.win-amd64-py2.6.exe 2010-09-30 09:36:24 +0000 differ
2178=== added file 'utils/pywin32-214.win32-py2.6.exe'
2179Binary files utils/pywin32-214.win32-py2.6.exe 1970-01-01 00:00:00 +0000 and utils/pywin32-214.win32-py2.6.exe 2010-09-30 09:36:24 +0000 differ
2180=== added file 'utils/unzip.exe'
2181Binary files utils/unzip.exe 1970-01-01 00:00:00 +0000 and utils/unzip.exe 2010-09-30 09:36:24 +0000 differ
2182=== added file 'utils/unzip32.dll'
2183Binary files utils/unzip32.dll 1970-01-01 00:00:00 +0000 and utils/unzip32.dll 2010-09-30 09:36:24 +0000 differ
2184=== added file 'utils/wget.exe'
2185Binary files utils/wget.exe 1970-01-01 00:00:00 +0000 and utils/wget.exe 2010-09-30 09:36:24 +0000 differ

Subscribers

People subscribed via source and target branches

to all changes: