~didrocks/ubuntuone-client/dont-suffer-zg-crash

« back to all changes in this revision

Viewing changes to setup.py.in

  • Committer: Bazaar Package Importer
  • Author(s): Rodney Dawes
  • Date: 2009-06-30 12:00:00 UTC
  • Revision ID: james.westby@ubuntu.com-20090630120000-by806ovmw3193qe8
Tags: upstream-0.90.3
ImportĀ upstreamĀ versionĀ 0.90.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
"""setup.py"""
 
3
 
 
4
import os, sys
 
5
from distutils.core import setup, Command
 
6
from distutils.command import clean
 
7
# pylint: disable-msg=F0401
 
8
from DistUtilsExtra.command import build_extra
 
9
from contrib import build_icons, check
 
10
 
 
11
import subprocess
 
12
 
 
13
class UbuntuOneBuildu1fsfsm(Command):
 
14
    """Class to build u1fsfsm.py from the ods file."""
 
15
 
 
16
    description = "build the u1fsfsm.py file"
 
17
 
 
18
    user_options = []
 
19
 
 
20
    def initialize_options(self):
 
21
        """Initialize some options."""
 
22
 
 
23
    def finalize_options(self):
 
24
        """Finaliaze the options."""
 
25
 
 
26
    def run(self):
 
27
        """Do the build."""
 
28
        sdpath = os.path.join("canonical", "ubuntuone",
 
29
                              "storage", "syncdaemon")
 
30
 
 
31
        command1 = ["python", "-t",
 
32
                    os.path.join(sdpath, "fsm", "fsm_parser.py"),
 
33
                    "-o", os.path.join(sdpath, "u1fsfsm.py"),
 
34
                    os.path.join(sdpath, "u1fsfsm.ods")]
 
35
        command2 = ["python", "-t",
 
36
                    os.path.join(sdpath, "fsm", "fsm.py"),
 
37
                    os.path.join(sdpath, "u1fsfsm.py")]
 
38
 
 
39
        xdg_cache = os.path.join(os.getcwd(), "_trial_temp", "xdg_cache")
 
40
        if not os.path.exists(xdg_cache):
 
41
            os.makedirs(xdg_cache)
 
42
 
 
43
        env = { "PYTHONPATH" : os.getcwd(),
 
44
                "HAS_OOFFICE" : "true",
 
45
                "XDG_CACHE_HOME" : xdg_cache }
 
46
 
 
47
        ret1 = subprocess.call(command1, env=env)
 
48
        ret2 = subprocess.call(command2, env=env)
 
49
 
 
50
        if ret1 != 0 or ret2 != 0:
 
51
            sys.stderr.write("[ERROR] Failed to build u1fsfsm.py.\n")
 
52
            sys.exit(1)
 
53
 
 
54
setup(name='ubuntuone-client',
 
55
      version = '@VERSION@',
 
56
 
 
57
      data_files = [],
 
58
 
 
59
      cmdclass = {
 
60
        'build' : build_extra.build_extra,
 
61
        'build_icons' : build_icons.build_icons,
 
62
        'check' : check.check,
 
63
        'build_u1fsfsm' : UbuntuOneBuildu1fsfsm,
 
64
        }
 
65
      )
 
66