~ubuntu-branches/ubuntu/quantal/ubuntuone-control-panel/quantal

« back to all changes in this revision

Viewing changes to ubuntuone/controlpanel/utils/darwin.py

  • Committer: Package Import Robot
  • Author(s): Rodney Dawes
  • Date: 2012-08-23 15:19:03 UTC
  • mfrom: (1.1.36)
  • Revision ID: package-import@ubuntu.com-20120823151903-3xm1f1477ut3tqxc
Tags: 3.99.4-0ubuntu1
* New upstream release.
  - Show error for folder subscribe if local path already exists and is not
    a folder. (LP: #1033488)
* debian/copyright:
  - Update to be more in line with dep5.
* debian/patches:
  - Remove patches included upstream.
* debian/rules:
  - Update to allow building directly on older versions of Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
#
 
3
# Copyright 2012 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
"""Miscelaneous functions and constants for darwin."""
 
18
 
 
19
import os
 
20
import shutil
 
21
import sys
 
22
 
 
23
from twisted.internet import defer
 
24
 
 
25
from dirspec.basedir import save_config_path
 
26
from ubuntuone.controlpanel.logger import setup_logging
 
27
 
 
28
logger = setup_logging('utils.darwin')
 
29
AUTOUPDATE_BIN_NAME = 'autoupdate-darwin'
 
30
UNINSTALL_BIN_NAME = 'uninstall-darwin'
 
31
 
 
32
 
 
33
def add_to_autostart():
 
34
    """Add syncdaemon to the session's autostart."""
 
35
    # TODO
 
36
 
 
37
 
 
38
@defer.inlineCallbacks
 
39
def are_updates_present():
 
40
    """Return if there are updates for Ubuntu One."""
 
41
    result = False
 
42
    # TODO
 
43
    defer.returnValue(result)
 
44
 
 
45
 
 
46
def default_folders(user_home=None):
 
47
    """Return a list of the folders to add by default."""
 
48
    folders = []
 
49
    # TODO
 
50
    return folders
 
51
 
 
52
 
 
53
def install_config_and_daemons():
 
54
    """Install required data files and fsevents daemon.
 
55
 
 
56
    This function is a replacement for an installer. As such it is
 
57
    required on first-run, but it's also called every time we start
 
58
    up, in case anything has moved or been deleted.
 
59
    """
 
60
 
 
61
    # Do nothing if we are running from source:
 
62
    if getattr(sys, 'frozen', None) is None:
 
63
        return
 
64
 
 
65
    main_app_dir = ''.join(__file__.partition('.app')[:-1])
 
66
    main_app_resources_dir = os.path.join(main_app_dir,
 
67
                                          'Contents',
 
68
                                          'Resources')
 
69
 
 
70
    config_path = save_config_path('ubuntuone')
 
71
 
 
72
    conf_filenames = ['syncdaemon.conf',
 
73
                      'logging.conf']
 
74
    for conf_filename in conf_filenames:
 
75
        src_path = os.path.join(main_app_resources_dir,
 
76
                                conf_filename)
 
77
        dest_path = os.path.join(config_path,
 
78
                                 conf_filename)
 
79
 
 
80
        if not os.path.exists(dest_path):
 
81
            shutil.copyfile(src_path, dest_path)
 
82
 
 
83
 
 
84
def perform_update():
 
85
    """Spawn the autoupdate process and call the stop function."""
 
86
    # TODO
 
87
 
 
88
 
 
89
def uninstall_application():
 
90
    """Uninstall Ubuntu One."""
 
91
    # TODO