~ubuntu-branches/ubuntu/raring/hplip/raring

« back to all changes in this revision

Viewing changes to debian/local/pyppd/pyppd/compressor.py

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2012-10-06 15:03:44 UTC
  • mfrom: (1.6.1) (20.1.16 quantal)
  • Revision ID: package-import@ubuntu.com-20121006150344-2p3xz26br0t3hu2q
Tags: 3.12.10-1
* New upstream release
  - Fixes "Network scanning fails (Closes: #683033)
* quilt refresh hplip-syslog-fix-debug-messages-to-error.dpatch
* Fix "error in clean build env" updated debian/rules (Closes: #687129)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from subprocess import Popen, PIPE
2
 
 
3
 
def compress(value):
4
 
    """Compresses a string with the xz binary"""
5
 
 
6
 
    process = Popen(["xz", "--compress", "--force"], stdin=PIPE, stdout=PIPE)
7
 
    return process.communicate(value)[0]
8
 
 
9
 
def decompress(value):
10
 
    """Decompresses a string with the xz binary"""
11
 
 
12
 
    process = Popen(["xz", "--decompress", "--stdout", "--force"],
13
 
                    stdin=PIPE, stdout=PIPE)
14
 
    return process.communicate(value)[0]
15
 
 
16
 
def compress_file(path):
17
 
    """Compress the file at 'path' with the xz binary"""
18
 
 
19
 
    process = Popen(["xz", "--compress", "--force", "--stdout", path], stdout=PIPE)
20
 
    return process.communicate()[0]