Merge lp:~nataliabidart/magicicada-client/snapping into lp:magicicada-client

Proposed by Natalia Bidart
Status: Work in progress
Proposed branch: lp:~nataliabidart/magicicada-client/snapping
Merge into: lp:magicicada-client
Diff against target: 526 lines (+69/-363)
11 files modified
.snapcraft.yaml (+33/-0)
HACKING (+1/-1)
data/com.ubuntuone.SyncDaemon.service.in (+0/-1)
data/logging.conf.in (+0/-13)
data/source_ubuntuone-client.py (+0/-61)
data/syncdaemon.conf (+1/-2)
data/ubuntuone-client-crashdb.conf (+0/-5)
dependencies.txt (+1/-1)
setup.py (+24/-250)
ubuntuone-client.pth (+0/-1)
ubuntuone/platform/os_helper/linux.py (+9/-28)
To merge this branch: bzr merge lp:~nataliabidart/magicicada-client/snapping
Reviewer Review Type Date Requested Status
chicharreros Pending
Review via email: mp+304417@code.launchpad.net

Commit message

- Initial work on snapping the client.

To post a comment you must log in.
1431. By Natalia Bidart

Debugging.

Unmerged revisions

1431. By Natalia Bidart

Debugging.

1430. By Natalia Bidart

Initial work on snapping the client.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file '.snapcraft.yaml'
--- .snapcraft.yaml 1970-01-01 00:00:00 +0000
+++ .snapcraft.yaml 2016-09-02 00:06:46 +0000
@@ -0,0 +1,33 @@
1name: magicicada-client
2version: 0.1
3summary: The client for the Magicicada filesync service (ex-Ubuntu One).
4description: Magicicada is an open source fork of the original Ubuntu One filesync service.
5confinement: devmode
6
7apps:
8 syncdaemon:
9 command: ./bin/ubuntuone-syncdaemon
10 daemon: simple
11
12parts:
13 magicicada-protocol:
14 plugin: python2
15 source: lp:magicicada-protocol
16 build-packages:
17 - protobuf-compiler
18 magicicada-client:
19 plugin: python2
20 source: .
21 stage-packages:
22 - gir1.2-notify-0.7
23 - gir1.2-soup-2.4
24 - python-configglue
25 - python-dirspec
26 - python-distutils-extra
27 - python-gi
28 - python-httplib2
29 - python-protobuf
30 - python-pyinotify
31 - python-qt4-dbus
32 - python-qt4reactor
33 - python-twisted
034
=== modified file 'HACKING'
--- HACKING 2015-09-29 21:05:26 +0000
+++ HACKING 2016-09-02 00:06:46 +0000
@@ -5,7 +5,7 @@
55
6Or you can simply bootstrap and everything will happen automagically:6Or you can simply bootstrap and everything will happen automagically:
77
8$: make boostrap8$: make bootstrap
99
10After configuring, in order to run the tests, all you need to do is run10After configuring, in order to run the tests, all you need to do is run
11make check.11make check.
1212
=== modified file 'data/com.ubuntuone.SyncDaemon.service.in'
--- data/com.ubuntuone.SyncDaemon.service.in 2009-06-17 16:08:17 +0000
+++ data/com.ubuntuone.SyncDaemon.service.in 2016-09-02 00:06:46 +0000
@@ -1,4 +1,3 @@
1[D-BUS Service]1[D-BUS Service]
2Name=com.ubuntuone.SyncDaemon2Name=com.ubuntuone.SyncDaemon
3Exec=@libexecdir@/ubuntuone-syncdaemon3Exec=@libexecdir@/ubuntuone-syncdaemon
4
54
=== removed file 'data/logging.conf.in'
--- data/logging.conf.in 2009-12-23 22:05:44 +0000
+++ data/logging.conf.in 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
1[logging]
2level.default = @LOG_LEVEL@
3level.parser = log_level
4level.help = Set the log level (TRACE, DEBUG, INFO, WARNING, ERROR, NOTE
5 CRITICAL, FATAL)
6
7file_size.default = @LOG_FILE_SIZE@
8file_size.parser = int
9file_size.help = max file size (the file will be rotated)
10
11backup_count.default = 5
12backup_count.parser = int
13backup_count.help = number of rotated log files to keep around.
140
=== removed file 'data/source_ubuntuone-client.py'
--- data/source_ubuntuone-client.py 2013-01-31 20:35:21 +0000
+++ data/source_ubuntuone-client.py 1970-01-01 00:00:00 +0000
@@ -1,61 +0,0 @@
1# Copyright 2009-2013 Canonical Ltd.
2#
3# This program is free software: you can redistribute it and/or modify it
4# under the terms of the GNU General Public License version 3, as published
5# by the Free Software Foundation.
6#
7# This program is distributed in the hope that it will be useful, but
8# WITHOUT ANY WARRANTY; without even the implied warranties of
9# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
10# PURPOSE. See the GNU General Public License for more details.
11#
12# You should have received a copy of the GNU General Public License along
13# with this program. If not, see <http://www.gnu.org/licenses/>.
14#
15# In addition, as a special exception, the copyright holders give
16# permission to link the code of portions of this program with the
17# OpenSSL library under certain conditions as described in each
18# individual source file, and distribute linked combinations
19# including the two.
20# You must obey the GNU General Public License in all respects
21# for all of the code used other than OpenSSL. If you modify
22# file(s) with this exception, you may extend this exception to your
23# version of the file(s), but you are not obligated to do so. If you
24# do not wish to do so, delete this exception statement from your
25# version. If you delete this exception statement from all source
26# files in the program, then also delete it here.
27"""Stub for Apport"""
28
29from __future__ import print_function, unicode_literals
30
31import apport
32import os
33
34from apport.hookutils import attach_file_if_exists
35from dirspec.basedir import xdg_cache_home, xdg_config_home
36
37# Paths where things we might want live
38u1_log_path = os.path.join(xdg_cache_home, b"ubuntuone", b"log")
39u1_user_config_path = os.path.join(xdg_config_home, b"ubuntuone")
40# things we may want to collect for the report
41u1_client_log = os.path.join(u1_log_path, b"syncdaemon.log")
42u1_except_log = os.path.join(u1_log_path, b"syncdaemon-exceptions.log")
43u1_invalidnames_log = os.path.join(u1_log_path, b"syncdaemon-invalid-names.log")
44u1_sd_conf = os.path.join(b"etc", b"xdg", b"ubuntuone", b"syncdaemon.conf")
45u1_usersd_conf = os.path.join(u1_user_config_path, b"syncdaemon.conf")
46
47
48def add_info(report):
49 """add report info"""
50 attach_file_if_exists(report, u1_except_log,
51 "UbuntuOneSyncdaemonExceptionsLog")
52 attach_file_if_exists(report, u1_invalidnames_log,
53 "UbuntuOneSyncdaemonInvalidNamesLog")
54 attach_file_if_exists(report, u1_usersd_conf,
55 "UbuntuOneUserSyncdaemonConfig")
56 attach_file_if_exists(report, u1_sd_conf,
57 "UbuntuOneSyncdaemonConfig")
58
59 if not apport.packaging.is_distro_package(report['Package'].split()[0]):
60 report['ThirdParty'] = 'True'
61 report['CrashDB'] = 'ubuntuone'
620
=== modified file 'data/syncdaemon.conf'
--- data/syncdaemon.conf 2015-09-29 02:25:44 +0000
+++ data/syncdaemon.conf 2016-09-02 00:06:46 +0000
@@ -52,8 +52,7 @@
52send_events_over_dbus.default = False52send_events_over_dbus.default = False
53send_events_over_dbus.parser = bool53send_events_over_dbus.parser = bool
54send_events_over_dbus.action = store_true54send_events_over_dbus.action = store_true
55send_events_over_dbus.help = Enable sending "Event" singals for each internal 55send_events_over_dbus.help = Enable sending "Event" singals for each internal event
56 event
5756
58handshake_timeout.default = 5057handshake_timeout.default = 50
59handshake_timeout.parser = int58handshake_timeout.parser = int
6059
=== removed file 'data/ubuntuone-client-crashdb.conf'
--- data/ubuntuone-client-crashdb.conf 2009-08-05 18:01:19 +0000
+++ data/ubuntuone-client-crashdb.conf 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
1ubuntuone = {
2 'impl' : 'launchpad',
3 'project' : 'ubuntuone-client',
4 'bug_pattern_base' : None,
5}
60
=== modified file 'dependencies.txt'
--- dependencies.txt 2016-07-13 22:12:48 +0000
+++ dependencies.txt 2016-09-02 00:06:46 +0000
@@ -1,4 +1,4 @@
1gir1.2-notify1gir1.2-notify-0.7
2gir1.2-soup-2.42gir1.2-soup-2.4
3protobuf-compiler3protobuf-compiler
4python-configglue4python-configglue
55
=== modified file 'setup.py' (properties changed: +x to -x)
--- setup.py 2016-08-06 20:02:14 +0000
+++ setup.py 2016-09-02 00:06:46 +0000
@@ -1,252 +1,26 @@
1#!/usr/bin/python
2#
3# Copyright 2013 Canonical Ltd.
4#
5# This program is free software: you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 3, as published
7# by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranties of
11# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12# PURPOSE. See the GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with this program. If not, see <http://www.gnu.org/licenses/>.
16#
17# In addition, as a special exception, the copyright holders give
18# permission to link the code of portions of this program with the
19# OpenSSL library under certain conditions as described in each
20# individual source file, and distribute linked combinations
21# including the two.
22# You must obey the GNU General Public License in all respects
23# for all of the code used other than OpenSSL. If you modify
24# file(s) with this exception, you may extend this exception to your
25# version of the file(s), but you are not obligated to do so. If you
26# do not wish to do so, delete this exception statement from your
27# version. If you delete this exception statement from all source
28# files in the program, then also delete it here.
29"""Setup.py: build, distribute, clean."""
30
31import os1import os
32import sys2
333from setuptools import setup, find_packages
34try:4
35 from DistUtilsExtra.command import build_extra, build_i18n5# Utility function to read the README file.
36 import DistUtilsExtra.auto6# Used for the long_description. It's nice, because now 1) we have a top level
37except ImportError:7# README file and 2) it's easier to type in the README file than to put a raw
38 print >> sys.stderr, 'To build this program you need '\8# string in below ...
39 'https://launchpad.net/python-distutils-extra'9def read(fname):
40 raise10 return open(os.path.join(os.path.dirname(__file__), fname)).read()
41assert DistUtilsExtra.auto.__version__ >= '2.18', \11
42 'needs DistUtilsExtra.auto >= 2.18'12
4313setup(
4414 name='magicicada-client',
45PROJECT_NAME = 'magicicada-client'15 version='0.1',
46VERSION = '1.0'
47
48POT_FILE = 'po/%s.pot' % PROJECT_NAME
49SERVICE_FILES = ['data/com.ubuntuone.Credentials.service',
50 'data/com.ubuntuone.SyncDaemon.service']
51CONFIG_FILES = ['data/logging.conf']
52CLIENTDEFS = 'ubuntuone/clientdefs.py'
53
54BUILD_FILES = [CLIENTDEFS] + CONFIG_FILES
55CLEANFILES = [POT_FILE, 'MANIFEST'] + BUILD_FILES + SERVICE_FILES
56
57if int(VERSION.split('.')[1]) % 2 != 0:
58 LOG_LEVEL = 'DEBUG'
59 LOG_FILE_SIZE = '10485760'
60else:
61 LOG_LEVEL = 'INFO'
62 LOG_FILE_SIZE = '1048576'
63
64
65def replace_variables(files_to_replace, prefix=None, *args, **kwargs):
66 """Replace the @VERSION@ in the constants file with the actual version."""
67 for fname in files_to_replace:
68 with open(fname + '.in') as in_file:
69 content = in_file.read()
70 with open(fname, 'w') as out_file:
71 content = content.replace('@VERSION@', VERSION)
72 content = content.replace('@PROJECT_NAME@', PROJECT_NAME)
73 content = content.replace('@GETTEXT_PACKAGE@', PROJECT_NAME)
74 content = content.replace('@LOG_LEVEL@', LOG_LEVEL)
75 content = content.replace('@LOG_FILE_SIZE@', LOG_FILE_SIZE)
76 if prefix is not None:
77 content = content.replace(
78 '@localedir@', os.path.join(prefix,
79 'share', 'locale'))
80 content = content.replace(
81 '@libexecdir@', os.path.join(prefix,
82 'lib', PROJECT_NAME))
83 out_file.write(content)
84
85
86class Install(DistUtilsExtra.auto.install_auto):
87 """Class to install proper files."""
88
89 def run(self):
90 """Do the install.
91
92 Read from *.service.in and generate .service files by replacing
93 @prefix@ by self.prefix.
94
95 """
96
97 # Remove the contrib and tests packages from the packages list
98 # as they are not meant to be installed to the system.
99 pkgs = [x for x in self.distribution.packages if not (
100 x.startswith('contrib') or x.startswith('tests'))]
101 self.distribution.packages = pkgs
102
103 # Remove the input and dev files from the data files list,
104 # as they are not meant to be installed.
105 data_files = [x for x in self.distribution.data_files if not (
106 x[1][0].endswith('.in') or x[1][0].endswith('-dev.conf'))]
107 self.distribution.data_files = data_files
108
109 # Get just the prefix value, without the root
110 prefix = self.install_data.replace(
111 self.root if self.root is not None else '', '')
112 replace_variables(SERVICE_FILES, prefix)
113 DistUtilsExtra.auto.install_auto.run(self)
114 # Replace the CLIENTDEFS paths here, so that we can do it directly in
115 # the installed copy, rather than the lcoal copy. This allows us to
116 # have a semi-generated version for use in tests, and a full version
117 # for use in installed systems.
118 with open(CLIENTDEFS) as in_file:
119 content = in_file.read()
120 with open(os.path.join(self.install_purelib,
121 PROJECT_NAME,
122 CLIENTDEFS), 'w') as out_file:
123 content = content.replace(
124 '@localedir@', os.path.join(prefix, 'share', 'locale'))
125 content = content.replace(
126 '@libexecdir@', os.path.join(prefix, 'lib', PROJECT_NAME))
127 out_file.write(content)
128
129
130class Build(build_extra.build_extra):
131 """Build PyQt (.ui) files and resources."""
132
133 description = "build PyQt GUIs (.ui) and resources (.qrc)"
134
135 def run(self):
136 """Execute the command."""
137 replace_variables(BUILD_FILES)
138 build_extra.build_extra.run(self)
139
140
141class Clean(DistUtilsExtra.auto.clean_build_tree):
142 """Class to clean up after the build."""
143
144 def run(self):
145 """Clean up the built files."""
146 for built_file in CLEANFILES:
147 if os.path.exists(built_file):
148 os.unlink(built_file)
149
150 DistUtilsExtra.auto.clean_build_tree.run(self)
151
152
153class BuildLocale(build_i18n.build_i18n):
154 """Work around a bug in DistUtilsExtra."""
155
156 def run(self):
157 """Magic."""
158 build_i18n.build_i18n.run(self)
159 i = 0
160 for df in self.distribution.data_files:
161 if df[0].startswith('etc/xdg/'):
162 if sys.platform not in ('darwin', 'win32'):
163 new_df = (df[0].replace('etc/xdg/', '/etc/xdg/'), df[1])
164 self.distribution.data_files[i] = new_df
165 else:
166 self.distribution.data_files.pop(i)
167 i += 1
168
169
170def set_py2exe_paths():
171 """Set the path so that py2exe finds the required modules."""
172 # Pylint does not understand same spaced imports
173 import win32com
174 try:
175 import py2exe.mf as modulefinder
176 except ImportError:
177 import modulefinder
178
179 # py2exe 0.6.4 introduced a replacement modulefinder.
180 # This means we have to add package paths there,
181 # not to the built-in one. If this new modulefinder gets
182 # integrated into Python, then we might be able to revert
183 # this some day. If this doesn't work, try import modulefinder
184 for package_path in win32com.__path__[1:]:
185 modulefinder.AddPackagePath("win32com", package_path)
186 for extra_mod in ["win32com.server", "win32com.client"]:
187 __import__(extra_mod)
188 module = sys.modules[extra_mod]
189 for module_path in module.__path__[1:]:
190 modulefinder.AddPackagePath(extra_mod, module_path)
191
192
193cmdclass = {
194 'install': Install,
195 'build': Build,
196 'clean': Clean,
197 'build_i18n': BuildLocale,
198}
199
200bin_scripts = [
201 'bin/u1sdtool',
202 'bin/ubuntuone-launch',
203]
204
205libexec_scripts = [
206 'bin/ubuntuone-proxy-tunnel',
207 'bin/ubuntuone-syncdaemon',
208]
209
210data_files = []
211scripts = []
212
213if sys.platform == 'win32':
214 set_py2exe_paths()
215 extra = {
216 'options': {
217 'py2exe': {
218 'bundle_files': 1,
219 'skip_archive': 0,
220 'optimize': 1,
221 'dll_excludes': ["mswsock.dll", "powrprof.dll"],
222 },
223 },
224 # add the console script so that py2exe compiles it
225 'console': bin_scripts + libexec_scripts,
226 'zipfile': None,
227 }
228else:
229 data_files.extend([
230 ('lib/%s' % PROJECT_NAME, libexec_scripts),
231 ('share/dbus-1/services', SERVICE_FILES),
232 ('/etc/xdg/ubuntuone', CONFIG_FILES + ['data/syncdaemon.conf']),
233 ('/etc/apport/crashdb.conf.d', ['data/ubuntuone-client-crashdb.conf']),
234 ('share/apport/package-hooks', ['data/source_ubuntuone-client.py']),
235 ('share/man/man1', ['docs/man/u1sdtool.1']),
236 ])
237 scripts.extend(bin_scripts)
238 extra = {}
239
240DistUtilsExtra.auto.setup(
241 name=PROJECT_NAME,
242 version=VERSION,
243 license='GPL v3',
244 author='Chicharreros',16 author='Chicharreros',
245 author_email='magicicada-hackers@@lists.launchpad.net',17 author_email='magicicada-hackers@lists.launchpad.net',
246 description='Magicicada file synchronization client',18 description='Magicicada filesync client',
247 url='https://launchpad.net/%s' % PROJECT_NAME,19 license='GPL',
248 extra_path=PROJECT_NAME,20 keywords='filesync',
249 scripts=scripts,21 url='https://launchpad.net/magicicada',
250 data_files=data_files,22 packages=find_packages(),
251 cmdclass=cmdclass,23 long_description=read('README'),
252 **extra)24 include_package_data=True,
25 scripts=['bin/ubuntuone-syncdaemon', 'bin/u1sdtool'],
26)
25327
=== removed file 'ubuntuone-client.pth'
--- ubuntuone-client.pth 2013-06-10 19:27:21 +0000
+++ ubuntuone-client.pth 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
1ubuntuone-client
20
=== modified file 'ubuntuone/platform/os_helper/linux.py'
--- ubuntuone/platform/os_helper/linux.py 2013-02-12 23:15:48 +0000
+++ ubuntuone/platform/os_helper/linux.py 2016-09-02 00:06:46 +0000
@@ -36,12 +36,7 @@
36import os36import os
37import shutil37import shutil
3838
39try:39from gi.repository import GLib, GObject, Gio
40 from gi.repository import Gio, GLib
41 has_gi = True
42except ImportError:
43 import gio
44 has_gi = False
4540
46from ubuntuone.platform.os_helper import unix41from ubuntuone.platform.os_helper import unix
4742
@@ -55,22 +50,13 @@
5550
56 If had any error, or the system can't do it, just remove it.51 If had any error, or the system can't do it, just remove it.
57 """52 """
58 if has_gi:53 not_supported = Gio.IOErrorEnum.NOT_SUPPORTED
59 not_supported = Gio.IOErrorEnum.NOT_SUPPORTED54 try:
60 try:55 return_code = Gio.File.new_for_path(path).trash(None)
61 return_code = Gio.File.new_for_path(path).trash(None)56 except GLib.GError:
62 except GLib.GError:57 exc = OSError()
63 exc = OSError()58 exc.errno = errno.ENOENT
64 exc.errno = errno.ENOENT59 raise exc
65 raise exc
66 else:
67 not_supported = gio.ERROR_NOT_SUPPORTED
68 try:
69 return_code = gio.File(path).trash()
70 except gio.Error:
71 exc = OSError()
72 exc.errno = errno.ENOENT
73 raise exc
7460
75 if not return_code or return_code == not_supported:61 if not return_code or return_code == not_supported:
76 logger.warning("Problems moving to trash! (%s) Removing anyway: %r",62 logger.warning("Problems moving to trash! (%s) Removing anyway: %r",
@@ -83,12 +69,7 @@
8369
84def set_application_name(app_name):70def set_application_name(app_name):
85 """Set the name of the application."""71 """Set the name of the application."""
86 if has_gi:72 GObject.set_application_name(app_name)
87 from gi.repository import GObject
88 GObject.set_application_name(app_name)
89 else:
90 import gobject
91 gobject.set_application_name(app_name)
9273
9374
94set_no_rights = unix.set_no_rights75set_no_rights = unix.set_no_rights

Subscribers

People subscribed via source and target branches

to all changes: