<s> import subprocess <EOL> from rospkg . os_detect import OS_OPENSUSE <EOL> from . source import SOURCE_INSTALLER <EOL> from . . installers import PackageManagerInstaller <EOL> ZYPPER_INSTALLER = '<STR_LIT>' <EOL> def register_installers ( context ) : <EOL> context . set_installer ( ZYPPER_INSTALLER , ZypperInstaller ( ) ) <EOL> def register_platforms ( context ) : <EOL> context . add_os_installer_key ( OS_OPENSUSE , SOURCE_INSTALLER ) <EOL> context . add_os_installer_key ( OS_OPENSUSE , ZYPPER_INSTALLER ) <EOL> context . set_default_os_installer_key ( OS_OPENSUSE , lambda self : ZYPPER_INSTALLER ) <EOL> def rpm_detect ( packages ) : <EOL> installed = [ ] <EOL> for p in packages : <EOL> if not subprocess . call ( [ '<STR_LIT>' , '<STR_LIT>' , p ] ) : <EOL> installed . append ( p ) <EOL> return installed <EOL> class ZypperInstaller ( PackageManagerInstaller ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> super ( ZypperInstaller , self ) . __init__ ( rpm_detect ) <EOL> def get_install_command ( self , resolved , interactive = True , reinstall = False , quiet = False ) : <EOL> packages = self . get_packages_to_install ( resolved , reinstall = reinstall ) <EOL> if not packages : <EOL> return [ ] <EOL> if not interactive : <EOL> return [ self . elevate_priv ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) + packages ] <EOL> else : <EOL> return [ self . elevate_priv ( [ '<STR_LIT>' , '<STR_LIT>' ] ) + packages ] </s>
