Re: archive-installer backend: initial review requested

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Does more in fewer lines, though the nested tuples are a little
dense to read.  :)  Tested with NFS, HTTP, and FTP as before.

def archiveFormat(filename):
    # this should be updated with whatever archive and compression
    # formats are supported in the future
    formatkeys = (
        (('.tar.gz', '.tgz', '.tar.Z'), ('tar', 'gz')),
        (('.tar.bz2', '.tbz2'), ('tar', 'bz2')),
        (('.tar.xz', 'txz'), ('tar', 'xz')),
        (('.tar',), ('tar', '')),
        (('.cpio.gz', '.cpio.Z'), ('cpio', 'gz')),
        (('.cpio.bz2',), ('cpio', 'bz2')),
        (('.cpio.xz',), ('cpio', 'xz')),
        (('.cpio',), ('cpio', '')),
    )
    for extensions, formats in formatkeys:
        for extension in extensions:
            if filename.endswith(extension):
                return formats
    return False

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux