本文整理汇总了Python中migasfree_client.utils.execute函数的典型用法代码示例。如果您正苦于以下问题:Python execute函数的具体用法?Python execute怎么用?Python execute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了execute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clean_all
def clean_all(self):
"""
bool clean_all(void)
"""
self._cmd = '{0} clean'.format(self._pms)
logging.debug(self._cmd)
if execute(self._cmd)[0] == 0:
self._cmd = '{0} -o Acquire::Languages=none --assume-yes update'.format(self._pms)
logging.debug(self._cmd)
return execute(self._cmd)[0] == 0
return False
示例2: clean_all
def clean_all(self):
'''
bool clean_all(void)
'''
self._cmd = '%s clean all' % self._pms
logging.debug(self._cmd)
if execute(self._cmd)[0] == 0:
self._cmd = '%s --assumeyes check-update' % self._pms
logging.debug(self._cmd)
return (execute(self._cmd)[0] == 0)
return False
示例3: clean_all
def clean_all(self):
"""
bool clean_all(void)
"""
self._cmd = '{0} clean all'.format(self._pms)
logging.debug(self._cmd)
if execute(self._cmd)[0] == 0:
self._cmd = '{0} --assumeyes check-update'.format(self._pms)
logging.debug(self._cmd)
ret, _, _ = execute(self._cmd)
return ret == 0 or ret == 100
return False
示例4: remove_silent
def remove_silent(self, package_set):
"""
(bool, string) remove_silent(list package_set)
"""
if not isinstance(package_set, list):
return False, 'package_set is not a list: %s' % package_set
for pkg in package_set[:]:
if not self.is_installed(pkg):
package_set.remove(pkg)
if not package_set:
return True, None
self._cmd = '{0} {1} purge {2}'.format(
self._pms,
self._silent_options,
' '.join(package_set)
)
logging.debug(self._cmd)
_ret, _, _error = execute(
self._cmd,
interactive=False,
verbose=True
)
return _ret == 0, _error
示例5: update_silent
def update_silent(self):
"""
(bool, string) update_silent(void)
"""
self._cmd = '%s --non-interactive update --no-force-resolution "*"' % self._pms
logging.debug(self._cmd)
_ret, _output, _error = execute(self._cmd, interactive=False, verbose=True)
if _ret != 0:
return (False, "%s\n%s\n%s" % (str(_ret), _output, _error))
self._cmd = "%s lu -a" % self._pms
logging.debug(self._cmd)
_ret, _output, _error = execute(self._cmd, interactive=False, verbose=True)
return (_ret == 0, "%s\n%s\n%s" % (str(_ret), _output, _error))
示例6: install_silent
def install_silent(self, package_set):
"""
(bool, string) install_silent(list package_set)
"""
if not isinstance(package_set, list):
return False, 'package_set is not a list: %s' % package_set
for pkg in package_set[:]:
if self.is_installed(pkg):
package_set.remove(pkg)
if not package_set:
return True, None
self._cmd = '{0} --non-interactive install --no-force-resolution {1}'.format(
self._pms,
' '.join(package_set)
)
logging.debug(self._cmd)
_ret, _output, _error = execute(
self._cmd,
interactive=False,
verbose=True
)
return _ret == 0, '{0}\n{1}\n{2}'.format(_ret, _output, _error)
示例7: install_silent
def install_silent(self, package_set):
'''
(bool, string) install_silent(list package_set)
'''
if not type(package_set) is list:
return (False, 'package_set is not a list: %s' % package_set)
for pkg in package_set[:]:
if self.is_installed(pkg):
package_set.remove(pkg)
if not package_set:
return (True, None)
self._cmd = '%s --assumeyes install %s' % (
self._pms,
' '.join(package_set)
)
logging.debug(self._cmd)
_ret, _output, _error = execute(
self._cmd,
interactive=False,
verbose=True
)
return (_ret == 0, _error)
示例8: import_server_key
def import_server_key(self, file_key):
"""
bool import_server_key( file )
"""
self._cmd = "rpm --import %s > /dev/null" % file_key
logging.debug(self._cmd)
return execute(self._cmd)[0] == 0
示例9: import_server_key
def import_server_key(self, file_key):
"""
bool import_server_key(string file_key)
"""
self._cmd = 'apt-key add {0} >/dev/null'.format(file_key)
logging.debug(self._cmd)
return execute(self._cmd)[0] == 0
示例10: is_installed
def is_installed(self, package):
"""
bool is_installed(string package)
"""
self._cmd = "%s -q %s" % (self._pm, package.strip())
logging.debug(self._cmd)
return execute(self._cmd, interactive=False)[0] == 0
示例11: search
def search(self, pattern):
'''
bool search(string pattern)
'''
self._cmd = '%s search %s' % (self._pms, pattern.strip())
logging.debug(self._cmd)
return (execute(self._cmd)[0] == 0)
示例12: remove
def remove(self, package):
'''
bool remove(string package)
'''
self._cmd = '%s remove %s' % (self._pms, package.strip())
logging.debug(self._cmd)
return (execute(self._cmd)[0] == 0)
示例13: install
def install(self, package):
'''
bool install(string package)
'''
self._cmd = '%s install %s' % (self._pms, package.strip())
logging.debug(self._cmd)
return (execute(self._cmd)[0] == 0)
示例14: install
def install(self, package):
"""
bool install(string package)
"""
self._cmd = '{0} install {1}'.format(self._pms, package.strip())
logging.debug(self._cmd)
return execute(self._cmd)[0] == 0
示例15: search
def search(self, pattern):
"""
bool search(string pattern)
"""
self._cmd = '{0} search {1}'.format(self._pms, pattern.strip())
logging.debug(self._cmd)
return execute(self._cmd)[0] == 0