[issue19214] shutil.make_archive should recognize extensions in filenames

Andreas Hilboll report at bugs.python.org
Thu Oct 10 10:50:37 CEST 2013


New submission from Andreas Hilboll:

shutil.make_archive should be able to automatically determine the desired *format* from the given filename. It would make life easier, because the programmer wouldn't need to strip the extension from the filename before passing it to make_archive. I'm think of something along the lines of

        if base_path.lower().endswith(".zip"):
            fmt = "zip"
            base_path = base_path[:-4]
        elif base_path.lower().endswith(".tar.gz") or base_path.lower().endswith(".tgz"):
            fmt = "gztar"
            base_path = base_path[:-7]
        elif base_path.lower().endswith(".tar.bz2"):
            fmt = "bztar"
            base_path = base_path[:-8]
        elif base_path.lower().endswith(".tar"):
            fmt = "tar"
            base_path = base_path[:-4]

----------
messages: 199373
nosy: andreas-h
priority: normal
severity: normal
status: open
title: shutil.make_archive should recognize extensions in filenames
type: enhancement
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19214>
_______________________________________


More information about the Python-bugs-list mailing list