def _show_couchdb_database_dir_content(): database_dir = couchdb.get_database_dir() print '===== couchdb database list' for filename in database_dir: db_directory = database_dir[filename] print '=== {}'.format(db_directory) print helpers.cmd_exec('ls -l {}'.format(db_directory))['stdout']
def exec_and_print(command_line, text=None): if text is None: text = command_line result = helpers.cmd_exec(command_line) print '===== {}'.format(text) print _clean_result(result['stderr']) print _clean_result(result['stdout'])
def check_lsb_codename(): codename = helpers.cmd_exec('lsb_release -cs')['stdout'].rstrip('\n') if codename not in ['jessie', 'trusty']: print '[KO] you need to install Cozy on Debian jessie or Ubuntu trusty' print '!!!! If you continue, we can\'t support your installation.' return -1 else: return 0
def update(): print 'Updating weboob configuration' result = cmd_exec('weboob-config update') if (result['error']): print result['stderr'] print 'Update failed' else: print 'Update succeeded'
def install(): ''' Install weboob system-wide ''' tmp_weboob_dir = '/tmp/weboob' # Check that the directory does not already exists while (os.path.exists(tmp_weboob_dir)): tmp_weboob_dir += '1' # Clone the repository print 'Fetching sources in temporary dir {}'.format(tmp_weboob_dir) result = cmd_exec('git clone {} {}'.format(WEBOOB_REPO, tmp_weboob_dir)) if (result['error']): print result['stderr'] print 'Weboob installation failed: could not clone repository' exit() print 'Sources fetched, will now process to installation' # Launch the installation result = cmd_exec('cd {} && ./setup.py install'.format(tmp_weboob_dir)) # Remove the weboob directory shutil.rmtree(tmp_weboob_dir) if (result['error']): print result['stderr'] print 'Weboob installation failed: setup failed' exit() print result['stdout'] # Check weboob version weboob_version = get_weboob_version() if (not weboob_version): print 'Weboob installation failed: version not detected' exit() print 'Weboob (version: {}) installation succeeded'.format(weboob_version) update()
def get_weboob_version(): result = cmd_exec('weboob-cli --version') if (not result['error']): return result['stdout'].rstrip() return None