Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar-jhbuild
blob: 41c6e3a213be30167720b7efdf372883a9780292 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python

import __builtin__
import os
import sys
import subprocess


if os.getuid() == 0 or os.geteuid() == 0:
    print 'Refusing to run as root.'
    sys.exit(3)

base_dir = os.path.abspath(os.path.dirname(__file__))

sjhbuild_dir = os.path.join(base_dir, 'sjhbuild')
sys.path.append(sjhbuild_dir)

jhbuild_dir = os.path.join(base_dir, 'jhbuild')
sys.path.append(jhbuild_dir)

__builtin__.__dict__['PKGDATADIR'] = None
__builtin__.__dict__['DATADIR'] = None
__builtin__.__dict__['SRCDIR'] = jhbuild_dir

args = sys.argv[1:]

if os.path.exists(jhbuild_dir):
    if (not args or 'build' in args or 'update' in args) and not \
        ('-n' in args or '--help' in args or '-h' in args or
        '--no-network' in args):
        print 'Updating sugar-jhbuild...'

        retcode = subprocess.call(['git', 'pull'])
        if retcode:
            print 'Failed to update sugar-jhbuild.'

        cwd = os.getcwd()
        os.chdir(jhbuild_dir)

        print 'Updating upstream jhbuild...'

        retcode = subprocess.call(['git', 'pull'])
        if retcode:
            print 'Failed to update upstream jhbuild.'

        os.chdir(cwd)
else:
    cwd = os.getcwd()
    os.chdir(base_dir)

    print 'Cloning upstream jhbuild'
    jhbuild_repo = 'git://git.gnome.org/jhbuild'
    retcode = subprocess.call(['git', 'clone', jhbuild_repo])
    if retcode:
        print 'Failed to clone upstream jhbuild.'

    os.chdir(cwd)

import main

sys.exit(main.main(base_dir, sys.argv[1:]))