def _clean_directory(self, version): self._logger.info('start clean directory') ######################################## # if delete-src is True, delete src dir # src_dir = os.path.join(self._llvmenv_home, 'llvm_build', version , 'llvm') if self._options.delete_src: common.remove_dir(src_dir) ######################################## # if delete-obj is True, delete build # build_dir = os.path.join(self._llvmenv_home, 'llvm_build', version , 'build') if self._options.delete_obj: common.remove_dir(build_dir) return
def run(self): """ run command """ ######################################## # get env and option # target_version = self._options.version llvmenv_home = os.getenv('LLVMENV_HOME') self._logger.info('uninstall version %s' % target_version) ######################################## # check intalled version # installed = os.listdir(llvmenv_home + '/llvms/') if not target_version in installed: self._logger.error('%s is not installed yet' % target_version) return False ######################################## # remove installed directory # self._logger.info('remove intalled directory of version %s' % target_version) common.remove_dir(os.path.join(llvmenv_home , 'llvms', target_version)) ######################################## # remove src directory # self._logger.info('remove src directory of version %s' % target_version) common.remove_dir(os.path.join(llvmenv_home , 'llvm_build', target_version, 'llvm')) ######################################## # remove build directory # self._logger.info('remove build directory of version %s' % target_version) common.remove_dir(os.path.join(llvmenv_home , 'llvm_build', target_version)) return True