From ff5599c8f1fb0d78bcf3488adc33c2be6944c3fb Mon Sep 17 00:00:00 2001 From: Mathias Klette Date: Thu, 13 Jun 2013 11:40:42 +0200 Subject: [PATCH] debian_build: compatibility for 'remotes' objects in git library between squeeze and wheezy thanks to tobias, see https://redmine.pb.local/issues/356 --- debian_build.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/debian_build.py b/debian_build.py index ea7b2b9..a9a5d53 100755 --- a/debian_build.py +++ b/debian_build.py @@ -114,17 +114,20 @@ if __name__ == '__main__': # .. repository related gitrepo = git.Repo('.') - # this should be part of 'git' lib, but it isn't right now - gitrepo.remotes = {} - for remote in gitrepo.git.remote('-v').split('\n'): - name, url, type = remote.split() - type = type.strip('()') - if not gitrepo.remotes.has_key(name): - gitrepo.remotes.update({name: {type: url}}) - else: - gitrepo.remotes[name].update({type: url}) - # this would also be helpful, but is not yet included in git lib - gitrepo.name = gitrepo.remotes['origin']['fetch'].split('/')[-1] + if not has_attr(gitrepo,'remotes'): + # this should be part of 'git' lib, but it isn't right now + gitrepo.remotes = {} + for remote in gitrepo.git.remote('-v').split('\n'): + name, url, type = remote.split() + type = type.strip('()') + if not gitrepo.remotes.has_key(name): + gitrepo.remotes.update({name: {type: url}}) + else: + gitrepo.remotes[name].update({type: url}) + # this would also be helpful, but is not yet included in git lib + gitrepo.name = gitrepo.remotes['origin']['fetch'].split('/')[-1].strip('.git') + else: + gitrepo.name = gitrepo.remotes.origin.url.split('/')[-1].strip('.git') # .. some local variables daily_date = BUILD_START.strftime('%Y%m%d%H%M%S') -- 2.39.5