more portable DEVNULL definition
This commit is contained in:
parent
99b23ba1b7
commit
da4fe741b8
@ -41,7 +41,10 @@ def get_git_tags():
|
|||||||
return tags
|
return tags
|
||||||
|
|
||||||
def compress_sample(tag, sample):
|
def compress_sample(tag, sample):
|
||||||
from subprocess import DEVNULL
|
try:
|
||||||
|
from subprocess import DEVNULL # py3k
|
||||||
|
except ImportError:
|
||||||
|
DEVNULL = open(os.devnull, 'wb')
|
||||||
if subprocess.call(['./zstd.' + tag, '-f' , sample], stderr=DEVNULL)==0:
|
if subprocess.call(['./zstd.' + tag, '-f' , sample], stderr=DEVNULL)==0:
|
||||||
os.rename(sample + '.zst', sample + '_01_64_' + tag + '.zst')
|
os.rename(sample + '.zst', sample + '_01_64_' + tag + '.zst')
|
||||||
if subprocess.call(['./zstd.' + tag, '-5f' , sample], stderr=DEVNULL)==0:
|
if subprocess.call(['./zstd.' + tag, '-5f' , sample], stderr=DEVNULL)==0:
|
||||||
@ -76,7 +79,10 @@ def remove_duplicates():
|
|||||||
def decompress_zst(tag):
|
def decompress_zst(tag):
|
||||||
dec_error = 0
|
dec_error = 0
|
||||||
list_zst = sorted(glob.glob('*.zst'))
|
list_zst = sorted(glob.glob('*.zst'))
|
||||||
from subprocess import DEVNULL
|
try:
|
||||||
|
from subprocess import DEVNULL # py3k
|
||||||
|
except ImportError:
|
||||||
|
DEVNULL = open(os.devnull, 'wb')
|
||||||
for file_zst in list_zst:
|
for file_zst in list_zst:
|
||||||
print(file_zst, end=" ")
|
print(file_zst, end=" ")
|
||||||
print(tag, end=" ")
|
print(tag, end=" ")
|
||||||
@ -91,6 +97,7 @@ def decompress_zst(tag):
|
|||||||
print('command does not work')
|
print('command does not work')
|
||||||
return dec_error
|
return dec_error
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
error_code = 0
|
error_code = 0
|
||||||
base_dir = os.getcwd() + '/..' # /path/to/zstd
|
base_dir = os.getcwd() + '/..' # /path/to/zstd
|
||||||
|
Loading…
x
Reference in New Issue
Block a user