~nataliabidart/ubuntu/maverick/ubuntu-sso-client/ubuntu-sso-client-0.99.4

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Bazaar Package Importer
  • Author(s): Natalia Bidart (nessita)
  • Date: 2010-06-16 15:11:04 UTC
  • Revision ID: james.westby@ubuntu.com-20100616151104-emkh7klk9389j7im
Tags: upstream-0.0.3
ImportĀ upstreamĀ versionĀ 0.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
# setup.py - Build system for Ubuntu SSO Client package
 
3
#
 
4
# Copyright 2010 Canonical Ltd.
 
5
#
 
6
# This program is free software: you can redistribute it and/or modify it
 
7
# under the terms of the GNU General Public License version 3, as published
 
8
# by the Free Software Foundation.
 
9
#
 
10
# This program is distributed in the hope that it will be useful, but
 
11
# WITHOUT ANY WARRANTY; without even the implied warranties of
 
12
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
13
# PURPOSE.  See the GNU General Public License for more details.
 
14
#
 
15
# You should have received a copy of the GNU General Public License along
 
16
# with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
"""setup.py"""
 
18
 
 
19
import os
 
20
import sys
 
21
 
 
22
from distutils.core import setup
 
23
from distutils.spawn import find_executable
 
24
from distutils.command import clean, build
 
25
 
 
26
# Defining variables for various rules here, similar to a Makefile.am
 
27
CLEANFILES = ['data/com.ubuntu.sso.service']
 
28
 
 
29
# XXX: This needs some serious cleanup
 
30
class SSOBuild(build.build):
 
31
    """Class to build the extra files."""
 
32
 
 
33
    description = 'build extra files needed by ubuntu-sso-client'
 
34
 
 
35
    def run(self):
 
36
        """Do the build."""
 
37
        sed = find_executable('sed')
 
38
        if sed is None:
 
39
            sys.stderr.write('Cannont find sed; required to build')
 
40
            sys.exit(-1)
 
41
 
 
42
        in_file = 'data/com.ubuntu.sso.service.in'
 
43
        out_file = 'data/com.ubuntu.sso.service'
 
44
        replaced_path = '/usr/lib/ubuntu-sso-client'
 
45
 
 
46
        os.system("%(cmd)s -e 's|\@libexecdir\@|%(rep)s|g' < %(in)s > %(out)s" %
 
47
                  {'cmd' : sed,
 
48
                   'rep' : replaced_path,
 
49
                   'in' : in_file,
 
50
                   'out' : out_file,
 
51
                   }
 
52
                  )
 
53
 
 
54
        # Run the parent build command
 
55
        build.build.run(self)
 
56
 
 
57
 
 
58
class SSOClean(clean.clean):
 
59
    """Class to clean up after the build."""
 
60
 
 
61
    description = 'Clean up built files.'
 
62
 
 
63
    def run(self):
 
64
        """Clean up the built files."""
 
65
        for built_file in CLEANFILES:
 
66
            os.unlink(built_file)
 
67
 
 
68
        # Run the parent clean command
 
69
        clean.clean.run(self)
 
70
 
 
71
 
 
72
setup(
 
73
    name='ubuntu-sso-client',
 
74
    version='0.0.3',
 
75
    license='GPL v3',
 
76
    author='Natalia Bidart',
 
77
    author_email='natalia.bidart@canonical.com',
 
78
    description='Ubuntu Single Sign-On client',
 
79
    long_description='Desktop service to allow applications to sign in' \
 
80
        'to Ubuntu services via SSO',
 
81
    url='https://launchpad.net/ubuntu-sso-client',
 
82
    packages=['ubuntu_sso'],
 
83
    data_files=[('share/dbus-1/services',
 
84
                 ['data/com.ubuntu.sso.service',]),
 
85
                ('/etc/xdg/ubuntu-sso/',
 
86
                 ['data/oauth_urls',]),
 
87
                ('/etc/xdg/ubuntu-sso/oauth_registration.d',
 
88
                 ['data/oauth_registration.d/ubuntuone',]),
 
89
                ('lib/ubuntu-sso-client',
 
90
                 ['bin/ubuntu-sso-login',]),
 
91
                ],
 
92
 
 
93
    cmdclass = {
 
94
        'build' : SSOBuild,
 
95
        'clean' : SSOClean,
 
96
        },
 
97
    )