Suggest python-simplejson | python (>= 2.7) and complain if they are missing in pull-debian-debdiff

This commit is contained in:
Stefano Rivera 2010-12-25 18:06:18 +02:00
parent 18d02c4c39
commit b5274624ac
2 changed files with 16 additions and 6 deletions

3
debian/control vendored
View File

@ -16,7 +16,6 @@ Build-Depends: dctrl-tools,
python-apt (>= 0.7.93~),
python-debian (>= 0.1.15),
python-gnupginterface,
python-simplejson,
python-launchpadlib (>= 1.5.7),
python-magic,
python-setuptools,
@ -57,7 +56,7 @@ Recommends: bzr,
python-magic,
python-soappy,
reportbug (>= 3.39ubuntu1)
Suggests: qemu-kvm-extras-static
Suggests: python-simplejson | python (>= 2.7), qemu-kvm-extras-static
Breaks: ${python:Breaks}
Description: useful tools for Ubuntu developers
This is a collection of useful tools that Ubuntu developers use to make their

View File

@ -25,10 +25,6 @@ import sys
import urllib2
import debian.changelog
try:
import json
except ImportError:
import simplejson as json
from ubuntutools.config import UDTConfig
from ubuntutools.logger import Logger
@ -63,6 +59,15 @@ def pull(package, version, unpack=False):
def pull_from_snapshot(package, version, unpack=False):
"Download Debian source package version version from snapshot.debian.org"
try:
import json
except ImportError:
import simplejson as json
except ImportError:
Logger.error("Require python-simplejson or python >= 2.7 to be "
"installed for snapshot.debian.org support")
sys.exit(1)
try:
srcfiles = json.load(urllib2.urlopen(
'http://snapshot.debian.org/mr/package/%s/%s/srcfiles'
@ -71,6 +76,7 @@ def pull_from_snapshot(package, version, unpack=False):
Logger.error('Version %s of %s not found on snapshot.debian.org',
version, package)
return False
for hash_ in srcfiles['result']:
hash_ = hash_['hash']
@ -167,6 +173,11 @@ def main():
version = args[1]
distance = args[2] if len(args) > 2 else 1
if not os.path.exists('/usr/bin/dget'):
Logger.error("dget is not installed. "
"Please install the 'devscripts' package.")
sys.exit(1)
config = UDTConfig(opts.no_conf)
if opts.debian_mirror is None:
opts.debian_mirror = config.get_value('DEBIAN_MIRROR')