#!/usr/bin/python # ubuntuiso - tool to examine Ubuntu CD (ISO) installation media # Copyright (C) 2008 Canonical Ltd. # Author: Matt Zimmerman # # ################################################################## # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # See file /usr/share/common-licenses/GPL for more details. # # ################################################################## 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() if pipe.returncode != 0: raise Exception, stderr return stdout def main(): iso = sys.argv[1] version = extract(iso, '/.disk/info') print version if __name__ == '__main__': main() sys.exit(0)