~xubuntu-dev/ubuntu-cdimage/xubuntu-base

1076 by Colin Watson
download-live-filesystems: convert to Python
1
#! /usr/bin/python
2
3
# Copyright (C) 2013 Canonical Ltd.
4
# Author: Colin Watson <cjwatson@ubuntu.com>
5
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; version 3 of the License.
9
#
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18
"""Download live filesystem files."""
19
20
from __future__ import print_function
21
22
from optparse import OptionParser
23
import os
24
import sys
25
26
sys.path.insert(0, os.path.join(sys.path[0], os.pardir, "lib"))
1215 by Colin Watson
cdimage.config: remove the pre-instantiated config object; this was initially convenient, but proved to make it painful to override anything that affects the default set of architectures
27
from cdimage.config import Config
1076 by Colin Watson
download-live-filesystems: convert to Python
28
from cdimage.livefs import NoFilesystemImages, download_live_filesystems
29
30
31
def main():
32
    parser = OptionParser("%prog")
33
    parser.parse_args()
1215 by Colin Watson
cdimage.config: remove the pre-instantiated config object; this was initially convenient, but proved to make it painful to override anything that affects the default set of architectures
34
    config = Config()
1076 by Colin Watson
download-live-filesystems: convert to Python
35
    try:
36
        download_live_filesystems(config)
37
    except NoFilesystemImages as e:
38
        print(e, file=sys.stderr)
39
        sys.exit(1)
40
41
42
if __name__ == "__main__":
43
    main()