Rename output dir to archive name without extension.
This commit is contained in:
parent
be7d473b9e
commit
68b8a524e2
|
@ -11,6 +11,9 @@
|
||||||
* Generate standalone Windows .exe and Linux .rpm installer.
|
* Generate standalone Windows .exe and Linux .rpm installer.
|
||||||
* Initialize the internal MIME database correct on all platforms.
|
* Initialize the internal MIME database correct on all platforms.
|
||||||
* Improved option compatibility for the ar, cpio and tar programs.
|
* Improved option compatibility for the ar, cpio and tar programs.
|
||||||
|
* Rename the temporary output directory if it contains multiple files.
|
||||||
|
The name is the archive name without extension, which is more
|
||||||
|
readable than a random filename "UnpackXyz".
|
||||||
* Require and use Python >=2.5
|
* Require and use Python >=2.5
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -425,7 +425,7 @@ def make_user_readable (directory):
|
||||||
make_dir_readable(os.path.join(root, dirname))
|
make_dir_readable(os.path.join(root, dirname))
|
||||||
|
|
||||||
|
|
||||||
def cleanup_outdir (outdir):
|
def cleanup_outdir (outdir, archive):
|
||||||
"""Cleanup outdir after extraction and return target file name and
|
"""Cleanup outdir after extraction and return target file name and
|
||||||
result string."""
|
result string."""
|
||||||
make_user_readable(outdir)
|
make_user_readable(outdir)
|
||||||
|
@ -435,7 +435,11 @@ def cleanup_outdir (outdir):
|
||||||
# msg is a single directory or filename
|
# msg is a single directory or filename
|
||||||
return msg, "`%s'" % msg
|
return msg, "`%s'" % msg
|
||||||
# outdir remains unchanged
|
# outdir remains unchanged
|
||||||
return outdir, "`%s' (%s)" % (outdir, msg)
|
# rename it to something more user-friendly (basically the archive
|
||||||
|
# name without extension)
|
||||||
|
outdir2 = util.get_single_outfile("", archive)
|
||||||
|
os.rename(outdir, outdir2)
|
||||||
|
return outdir2, "`%s' (%s)" % (outdir2, msg)
|
||||||
|
|
||||||
|
|
||||||
def check_archive_arguments (archive, command, *args):
|
def check_archive_arguments (archive, command, *args):
|
||||||
|
@ -498,7 +502,7 @@ def _handle_archive (archive, command, *args, **kwargs):
|
||||||
run_archive_cmdlist(cmdlist)
|
run_archive_cmdlist(cmdlist)
|
||||||
if command == 'extract':
|
if command == 'extract':
|
||||||
if do_cleanup_outdir:
|
if do_cleanup_outdir:
|
||||||
target, msg = cleanup_outdir(cmd_kwargs["outdir"])
|
target, msg = cleanup_outdir(cmd_kwargs["outdir"], archive)
|
||||||
util.log_info("%s extracted to %s" % (archive, msg))
|
util.log_info("%s extracted to %s" % (archive, msg))
|
||||||
else:
|
else:
|
||||||
target, msg = cmd_kwargs["outdir"], "`%s'" % cmd_kwargs["outdir"]
|
target, msg = cmd_kwargs["outdir"], "`%s'" % cmd_kwargs["outdir"]
|
||||||
|
|
Loading…
Reference in New Issue