~bzr/ubuntu/karmic/bzr-gtk/bzr-ppa

« back to all changes in this revision

Viewing changes to debian/update-deps.py

  • Committer: Max Bowsher
  • Date: 2011-02-04 22:58:36 UTC
  • mfrom: (0.1.674 maverick)
  • mto: This revision was merged to the branch mainline in revision 61.
  • Revision ID: maxb@f2s.com-20110204225836-ohftrz72glsdrdhg
Tags: 0.99.1+bzr705-1~bazaar1~lucid1
MergeĀ 0.99.1+bzr705

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# Update dependencies based on info.py
 
3
# Copyright (C) 2010 Jelmer Vernooij <jelmer@debian.org>
 
4
# Licensed under the GNU GPL, version 2 or later.
 
5
 
 
6
from debian.deb822 import Deb822, PkgRelation
 
7
import os, sys
 
8
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
 
9
 
 
10
from info import bzr_minimum_version, bzr_maximum_version
 
11
 
 
12
def update_relation(l, pkg, kind, version):
 
13
    found = False
 
14
    for pr in l:
 
15
        for e in pr:
 
16
            if e["name"] == pkg and e["version"] and e["version"][0] == kind:
 
17
                e["version"] = (kind, version)
 
18
                found = True
 
19
    if not found:
 
20
        l.append([{"version": (kind, version), "name": pkg, "arch": None}])
 
21
 
 
22
f = open('debian/control', 'r')
 
23
 
 
24
source = Deb822(f)
 
25
 
 
26
def update_deps(control, field):
 
27
    bdi = PkgRelation.parse_relations(control[field])
 
28
    update_relation(bdi, "bzr", ">=", "%d.%d~" % bzr_minimum_version[:2])
 
29
    update_relation(bdi, "bzr", "<<", "%d.%d~" % (bzr_maximum_version[0], bzr_maximum_version[1]+1))
 
30
    control[field] = PkgRelation.str(bdi)
 
31
 
 
32
update_deps(source, "Build-Depends-Indep")
 
33
 
 
34
bzr_gtk_binary = Deb822(f)
 
35
update_deps(bzr_gtk_binary, "Depends")
 
36
 
 
37
nautilus_bzr_binary = Deb822(f)
 
38
 
 
39
f = open("debian/control", "w+")
 
40
try:
 
41
    source.dump(f)
 
42
    f.write("\n")
 
43
    bzr_gtk_binary.dump(f)
 
44
    f.write("\n")
 
45
    nautilus_bzr_binary.dump(f)
 
46
finally:
 
47
    f.close()