~nataliabidart/ubuntuone-control-panel/webclient-shutdowns

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Natalia B. Bidart
  • Date: 2010-11-04 20:30:31 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: natalia.bidart@canonical.com-20101104203031-963fmi42j1shy4x9
Adding packaging bits.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
# setup.py - Build system for Ubuntu One Control Panel package
 
3
#
 
4
# Author: Natalia B. Bidart <natalia.bidart@canonical.com>
 
5
#
 
6
# Copyright 2010 Canonical Ltd.
 
7
#
 
8
# This program is free software: you can redistribute it and/or modify it
 
9
# under the terms of the GNU General Public License version 3, as published
 
10
# by the Free Software Foundation.
 
11
#
 
12
# This program is distributed in the hope that it will be useful, but
 
13
# WITHOUT ANY WARRANTY; without even the implied warranties of
 
14
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
15
# PURPOSE.  See the GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License along
 
18
# with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
"""Setup.py: build, distribute, clean."""
 
20
 
 
21
import os
 
22
import sys
 
23
 
 
24
try:
 
25
    import DistUtilsExtra.auto
 
26
    from DistUtilsExtra.command import build_extra
 
27
except ImportError:
 
28
    print >> sys.stderr, 'To build this program you need '\
 
29
                         'https://launchpad.net/python-distutils-extra'
 
30
    sys.exit(1)
 
31
assert DistUtilsExtra.auto.__version__ >= '2.18', \
 
32
       'needs DistUtilsExtra.auto >= 2.18'
 
33
 
 
34
from distutils.core import setup
 
35
from distutils.spawn import find_executable
 
36
from distutils.command import clean, build
 
37
 
 
38
POT_FILE = 'po/ubuntuone-control-panel.pot'
 
39
SERVICE_NAME = 'com.ubuntuone.controlpanel'
 
40
SERVICE_FILE = 'data/%s.service' % SERVICE_NAME
 
41
SERVICE_CONTENT = """[D-BUS Service]
 
42
Name=%s
 
43
Exec=/usr/lib/ubuntuone-control-panel-backend
 
44
""" % SERVICE_NAME
 
45
 
 
46
CLEANFILES = [SERVICE_FILE, POT_FILE]
 
47
 
 
48
 
 
49
class ControlPanelBuild(build_extra.build_extra):
 
50
    """Class to build the extra files."""
 
51
 
 
52
    description = 'build extra files needed by ubuntuone-control-panel'
 
53
 
 
54
    def run(self):
 
55
        """Do the build."""
 
56
 
 
57
        with open(SERVICE_FILE, 'w') as out_file:
 
58
            out_file.write(SERVICE_CONTENT)
 
59
 
 
60
        # Run the parent build command
 
61
        build_extra.build_extra.run(self)
 
62
 
 
63
 
 
64
class ControlPanelClean(clean.clean):
 
65
    """Class to clean up after the build."""
 
66
 
 
67
    description = 'Clean up built files.'
 
68
 
 
69
    def run(self):
 
70
        """Clean up the built files."""
 
71
        for built_file in CLEANFILES:
 
72
            if os.path.exists(built_file):
 
73
                os.unlink(built_file)
 
74
 
 
75
        # Run the parent clean command
 
76
        clean.clean.run(self)
 
77
 
 
78
 
 
79
DistUtilsExtra.auto.setup(
 
80
    name='ubuntuone-control-panel',
 
81
    version='0.0.1',
 
82
    license='GPL v3',
 
83
    author='Natalia Bidart',
 
84
    author_email='natalia.bidart@canonical.com',
 
85
    description='Ubuntu One Control Panel',
 
86
    long_description='Desktop application to manage a Ubuntu One account',
 
87
    url='https://launchpad.net/ubuntuone-control-panel',
 
88
    packages=['ubuntuone.controlpanel'],
 
89
    data_files=[
 
90
        ('share/dbus-1/services', ['data/com.ubuntuone.controlpanel.service']),
 
91
        ('lib/ubuntuone-client', ['bin/ubuntuone-control-panel',
 
92
                                  'bin/ubuntuone-control-panel-backend']),
 
93
        ('share/ubuntuone-client/data', ['data/*.ui'])],
 
94
    cmdclass={
 
95
        'build' : ControlPanelBuild,
 
96
        'clean' : ControlPanelClean})