~ubuntu-branches/ubuntu/saucy/solfege/saucy

« back to all changes in this revision

Viewing changes to tools/get-gtk-files.py

  • Committer: Bazaar Package Importer
  • Author(s): Tom Cato Amundsen
  • Date: 2010-03-28 06:34:28 UTC
  • mfrom: (1.1.10 upstream) (2.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100328063428-wg2bqvoce2aq4xfb
Tags: 3.15.9-1
* New upstream release.
* Redo packaging. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
import sys
 
3
import urllib
 
4
import os
 
5
import zipfile
 
6
import glob
 
7
cachedir = "../pkg-cache"
 
8
srcdir = "../src-cache"
 
9
 
 
10
 
 
11
def gnome_bin_url(app, ver):
 
12
    short_ver = "%s.%s" % (ver.split(".")[0], ver.split(".")[1])
 
13
    return "http://ftp.gnome.org/pub/gnome/binaries/win32/%(app)s/%(short_ver)s/%(app)s_%(ver)s_win32.zip" % locals()
 
14
 
 
15
def gnome_src_url(app, ver):
 
16
    short_ver = "%s.%s" % (ver.split(".")[0], ver.split(".")[1])
 
17
    ver = ver.split("-")[0]
 
18
    return"http://ftp.gnome.org/pub/gnome/sources/%(app)s/%(short_ver)s/%(app)s-%(ver)s.tar.bz2" % locals()
 
19
 
 
20
urls = {}
 
21
for app, ver in (("glib", "2.22.3-1"),
 
22
     ("gtk+", "2.18.5-1"),
 
23
     ("pango", "1.26.1-1"),
 
24
     ("atk", "1.28.0-1")):
 
25
    urls[app] = {'bin': gnome_bin_url(app, ver),
 
26
                 'src': gnome_src_url(app, ver)}
 
27
urls['cairo'] = {
 
28
    'bin': "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/cairo_1.8.8-3_win32.zip",
 
29
    'src': "http://cairographics.org/releases/cairo-1.8.8.tar.gz"}
 
30
urls['zlib'] = {
 
31
    'bin': "http://www.zlib.net/zlib124-dll.zip",
 
32
    'src': "http://www.zlib.net/zlib-1.2.4.tar.gz",
 
33
}
 
34
urls['fontconfig'] = {
 
35
    'bin': "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/fontconfig_2.8.0-1_win32.zip",
 
36
    'src': "http://www.fontconfig.org/release/fontconfig-2.8.0.tar.gz",
 
37
}
 
38
urls['freetype'] = {
 
39
    'bin': "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/freetype_2.3.11-1_win32.zip",
 
40
    'src': "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/freetype-2.3.9.tar.bz2",
 
41
}
 
42
urls['expat'] = {
 
43
    'bin': "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/expat_2.0.1-1_win32.zip",
 
44
    'src': "http://downloads.sourceforge.net/project/expat/expat/2.0.1/expat-2.0.1.tar.gz",
 
45
}
 
46
urls['gettext-runtime'] = {
 
47
  'bin': "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime-0.17-1.zip",
 
48
  'src': "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-0.17.tar.gz"}
 
49
urls['libpng'] = {
 
50
    'bin': "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libpng_1.2.39-1_win32.zip",
 
51
    'src': "http://download.sourceforge.net/libpng/libpng-1.2.39.tar.gz"
 
52
}
 
53
urls['libtiff'] = {
 
54
    'bin': "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libtiff-3.8.2.zip",
 
55
    'src': "ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.9.1.tar.gz"
 
56
}
 
57
 
 
58
 
 
59
def get_files(key, savedir):
 
60
    if not os.path.exists(savedir):
 
61
        os.mkdir(savedir)
 
62
    for app in urls:
 
63
        if key not in urls[app]:
 
64
            continue
 
65
        url = urls[app][key]
 
66
        fn = os.path.join(savedir, url.split("/")[-1])
 
67
        if not os.path.exists(fn):
 
68
            print "Downloading:", fn
 
69
            sys.stdout.flush()
 
70
            urllib.urlretrieve(url, fn)
 
71
        else:
 
72
            print "File already here:", fn
 
73
 
 
74
def unpack():
 
75
    for app in urls:
 
76
        f = os.path.join(cachedir, urls[app]['bin'].split("/")[-1])
 
77
        print "unzipping:", f
 
78
        sys.stdout.flush()
 
79
        z = zipfile.ZipFile(f)
 
80
        for n in z.namelist():
 
81
            if n.endswith("/"):
 
82
                continue
 
83
            dir = os.path.join("win32", os.path.dirname(n))
 
84
            if not os.path.exists(dir):
 
85
                os.makedirs(dir)
 
86
            outfile = open(os.path.join("win32", n), 'wb')
 
87
            outfile.write(z.read(n))
 
88
            outfile.close()
 
89
 
 
90
if sys.argv[1] == 'bin':
 
91
    get_files('bin', cachedir)
 
92
elif sys.argv[1] == 'src':
 
93
    get_files('src', srcdir)
 
94
elif sys.argv[1] == 'unpack':
 
95
    unpack()
 
96