Here are the examples of the python api sys.stdout.strip.split taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
8 Examples
0
Example 1
Project: qiime Source File: print_qiime_config.py
def test_uclust_supported_version(self):
"""uclust is in path and version is supported """
acceptable_version = (1, 2, 22)
self.assertTrue(which('uclust'),
"uclust not found. This may or may not be a problem depending on " +
"which components of QIIME you plan to use.")
command = 'uclust --version'
proc = Popen(command, shell=True, universal_newlines=True,
stdout=PIPE, stderr=STDOUT)
stdout = proc.stdout.read()
version_string = stdout.strip().split('v')[-1].strip('q')
try:
version = tuple(map(int, version_string.split('.')))
pass_test = version == acceptable_version
except ValueError:
pass_test = False
version_string = stdout
self.assertTrue(pass_test,
"Unsupported uclust version. %s is required, but running %s."
% ('.'.join(map(str, acceptable_version)), version_string))
0
Example 2
Project: qiime Source File: print_qiime_config.py
def test_blast_supported_version(self):
"""blast is in path and version is supported """
acceptable_version = (2, 2, 22)
self.assertTrue(which('blastall'),
"blast not found. This may or may not be a problem depending on " +
"which components of QIIME you plan to use.")
command = 'blastall | grep blastall'
proc = Popen(command, shell=True, universal_newlines=True,
stdout=PIPE, stderr=STDOUT)
stdout = proc.stdout.read()
version_string = stdout.strip().split(' ')[1].strip()
try:
version = tuple(map(int, version_string.split('.')))
pass_test = version == acceptable_version
except ValueError:
pass_test = False
version_string = stdout
self.assertTrue(pass_test,
"Unsupported blast version. %s is required, but running %s."
% ('.'.join(map(str, acceptable_version)), version_string))
0
Example 3
Project: qiime Source File: print_qiime_config.py
def test_cdbtools_supported_version(self):
"""cdbtools is in path and version is supported """
acceptable_version = (0, 99)
self.assertTrue(which('cdbfasta'),
"cdbtools not found. This may or may not be a problem depending on " +
"which components of QIIME you plan to use.")
command = "cdbfasta -v"
proc = Popen(command, shell=True, universal_newlines=True,
stdout=PIPE, stderr=STDOUT)
stdout = proc.stdout.read()
version_string = stdout.strip().split(' ')[2].strip()
try:
version = tuple(map(int, version_string.split('.')))
pass_test = version == acceptable_version
except ValueError:
pass_test = False
version_string = stdout
self.assertTrue(pass_test,
"Unsupported cdbtools version. %s is required, but running %s."
% ('.'.join(map(str, acceptable_version)), version_string))
0
Example 4
Project: qiime Source File: print_qiime_config.py
def test_INFERNAL_supported_version(self):
"""INFERNAL is in path and version is supported """
acceptable_version = (1, 0, 2)
self.assertTrue(which('cmbuild'),
"Infernal not found. This may or may not be a problem depending on " +
"which components of QIIME you plan to use.")
command = "cmbuild -h | grep INF"
proc = Popen(command, shell=True, universal_newlines=True,
stdout=PIPE, stderr=STDOUT)
stdout = proc.stdout.read()
version_string = stdout.strip().split(' ')[2].strip()
try:
version = tuple(map(int, version_string.split('.')))
pass_test = version == acceptable_version
except ValueError:
pass_test = False
version_string = stdout
self.assertTrue(pass_test,
"Unsupported INFERNAL version. %s is required, but running %s."
% ('.'.join(map(str, acceptable_version)), version_string))
0
Example 5
Project: qiime Source File: print_qiime_config.py
def test_muscle_supported_version(self):
"""muscle is in path and version is supported """
acceptable_version = (3, 8, 31)
self.assertTrue(which('muscle'),
"muscle not found. This may or may not be a problem depending on " +
"which components of QIIME you plan to use.")
command = "muscle -version"
proc = Popen(command, shell=True, universal_newlines=True,
stdout=PIPE, stderr=STDOUT)
stdout = proc.stdout.read()
version_string = stdout.strip().split(' ')[1].strip('v')
try:
version = tuple(map(int, version_string.split('.')))
pass_test = version == acceptable_version
except ValueError:
pass_test = False
version_string = stdout
self.assertTrue(pass_test,
"Unsupported muscle version. %s is required, but running %s."
% ('.'.join(map(str, acceptable_version)), version_string))
0
Example 6
Project: qiime Source File: print_qiime_config.py
def test_mothur_supported_version(self):
"""mothur is in path and version is supported """
acceptable_version = (1, 25, 0)
self.assertTrue(which('mothur'),
"mothur not found. This may or may not be a problem depending on " +
"which components of QIIME you plan to use.")
# mothur creates a log file in cwd, so create a tmp and cd there first
log_file = join(get_qiime_temp_dir(), 'mothur.log')
command = "mothur \"#set.logfile(name=%s)\" | grep '^mothur v'" % log_file
stdout, stderr, exit_Status = qiime_system_call(command)
# remove log file
remove_files([log_file], error_on_missing=False)
version_string = stdout.strip().split(' ')[1].strip('v.')
try:
version = tuple(map(int, version_string.split('.')))
pass_test = version == acceptable_version
except ValueError:
pass_test = False
version_string = stdout
self.assertTrue(pass_test,
"Unsupported mothur version. %s is required, but running %s."
% ('.'.join(map(str, acceptable_version)), version_string))
0
Example 7
Project: qiime Source File: print_qiime_config.py
def test_raxmlHPC_supported_version(self):
"""raxmlHPC is in path and version is supported """
acceptable_version = [(7, 3, 0), (7, 3, 0)]
self.assertTrue(which('raxmlHPC'),
"raxmlHPC not found. This may or may not be a problem depending on " +
"which components of QIIME you plan to use.")
command = "raxmlHPC -v | grep version"
proc = Popen(command, shell=True, universal_newlines=True,
stdout=PIPE, stderr=STDOUT)
stdout = proc.stdout.read()
version_string = stdout.strip().split(' ')[4].strip()
try:
version = tuple(map(int, version_string.split('.')))
pass_test = version in acceptable_version
except ValueError:
pass_test = False
version_string = stdout
self.assertTrue(pass_test,
"Unsupported raxmlHPC version. %s is required, but running %s."
% ('.'.join(map(str, acceptable_version)), version_string))
0
Example 8
Project: qiime Source File: print_qiime_config.py
def test_clearcut_supported_version(self):
"""clearcut is in path and version is supported """
acceptable_version = (1, 0, 9)
self.assertTrue(which('clearcut'),
"clearcut not found. This may or may not be a problem depending on " +
"which components of QIIME you plan to use.")
command = "clearcut -V"
proc = Popen(command, shell=True, universal_newlines=True,
stdout=PIPE, stderr=STDOUT)
stdout = proc.stdout.read()
version_string = stdout.strip().split(' ')[2].strip()
try:
version = tuple(map(int, version_string.split('.')))
pass_test = version == acceptable_version
except ValueError:
pass_test = False
version_string = stdout
self.assertTrue(pass_test,
"Unsupported clearcut version. %s is required, but running %s."
% ('.'.join(map(str, acceptable_version)), version_string))