mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-04-16 12:51:08 +00:00
ubuntu-iso: Convert to PEP-8.
This commit is contained in:
parent
5144644ba0
commit
4c6ee076c2
47
ubuntu-iso
47
ubuntu-iso
@ -24,37 +24,38 @@ import sys
|
||||
import subprocess
|
||||
|
||||
def extract(iso, path):
|
||||
command = ['isoinfo', '-R', '-i', iso, '-x', path]
|
||||
pipe = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
stdout, stderr = pipe.communicate()
|
||||
command = ['isoinfo', '-R', '-i', iso, '-x', path]
|
||||
pipe = subprocess.Popen(command, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
stdout, stderr = pipe.communicate()
|
||||
|
||||
if pipe.returncode != 0:
|
||||
raise Exception, stderr
|
||||
if pipe.returncode != 0:
|
||||
raise Exception, stderr
|
||||
|
||||
return stdout
|
||||
return stdout
|
||||
|
||||
def main():
|
||||
isos = sys.argv[1:]
|
||||
err = False
|
||||
isos = sys.argv[1:]
|
||||
err = False
|
||||
|
||||
for iso in isos:
|
||||
if len(isos) > 1:
|
||||
prefix = '%s:' % iso
|
||||
else:
|
||||
prefix = ''
|
||||
for iso in isos:
|
||||
if len(isos) > 1:
|
||||
prefix = '%s:' % iso
|
||||
else:
|
||||
prefix = ''
|
||||
|
||||
version = extract(iso, '/.disk/info')
|
||||
version = extract(iso, '/.disk/info')
|
||||
|
||||
if len(version) == 0:
|
||||
print >>sys.stderr, '%s does not appear to be an Ubuntu ISO' % iso
|
||||
err = True
|
||||
continue
|
||||
if len(version) == 0:
|
||||
print >>sys.stderr, '%s does not appear to be an Ubuntu ISO' % iso
|
||||
err = True
|
||||
continue
|
||||
|
||||
print prefix + version
|
||||
print prefix + version
|
||||
|
||||
if err:
|
||||
sys.exit(1)
|
||||
if err:
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
sys.exit(0)
|
||||
main()
|
||||
sys.exit(0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user