diff options
author | Florian Pritz <bluewind@xinu.at> | 2014-04-13 21:43:44 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2014-04-13 21:43:44 +0200 |
commit | 2469d49396a13aeef8e26d8f12162e3be91c445a (patch) | |
tree | e58eefae83393536fddb2b22c256a1ba29b0870a /a | |
parent | c11ef74879171dc631ceb227e53d6403719b5c38 (diff) | |
download | bin-2469d49396a13aeef8e26d8f12162e3be91c445a.tar.gz bin-2469d49396a13aeef8e26d8f12162e3be91c445a.tar.xz |
remove a; using apack from atool now
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'a')
-rwxr-xr-x | a | 76 |
1 files changed, 0 insertions, 76 deletions
@@ -1,76 +0,0 @@ -#!/usr/bin/python -#---------------------------------------------------- -# Version: 0.3.0 -# Author: Florian "Bluewind" Pritz <flo@xssn.at> -# -# Licensed under WTFPL v2 -# (see COPYING for full license text) -# -#---------------------------------------------------- -# simple archive script -#---------------------------------------------------- -# got bored and a.sh has some problems with spaces -#---------------------------------------------------- - -import sys -import os -from optparse import OptionParser -from subprocess import Popen, PIPE - -def main(): - usage = "usage: %prog [options] <files>" - p = OptionParser(usage) - p.add_option("-f", "--file", dest="tarname", default=False, - help="use <file>.tar.gz instead of $1.tar.gz", metavar="<file>") - p.add_option("--force", action="store_true", dest="force", default=False, - help="overwrite existing target files") - p.add_option("-b", "--bzip2", action="store_true", dest="bz2", default=False, - help="use bzip2 compression") - p.add_option("-u", "--uncompressed", action="store_true", dest="uncompressed", default=False, - help="don't use compression at all") - p.add_option("-x", "--xz", action="store_true", dest="xz", default=False, - help="use xz compression") - - (options, args) = p.parse_args() - - - if len(sys.argv) == 1: - p.print_help() - sys.exit() - - if options.tarname: - tarname = options.tarname - else: - tarname = args[0]+".tar" - tarcmd = ['bsdtar', '-c'] - - if options.bz2: - tarname += ".bz2" - tarcmd.extend(['-jf', tarname]) - elif options.uncompressed: - tarcmd.extend(['-f', tarname]) - elif options.xz: - tarname += ".xz" - tarcmd.extend(['-Jf', tarname]) - else: - tarname += ".gz" - tarcmd.extend(['-zf', tarname]) - - if not options.force: - file_exists(tarname) - Popen(merge([tarcmd, args]), stdout=PIPE).communicate()[0] - -def merge(seq): - merged = [] - for s in seq: - for x in s: - merged.append(x) - return merged - -def file_exists(filename): - if os.path.exists(filename): - sys.stderr.write('Target "'+filename+'" already exists. Use --force to overwrite.\n') - sys.exit(1) - -if __name__ == '__main__': - main() |