From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 9462413888F for ; Fri, 9 Oct 2015 21:06:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AEDD721C010; Fri, 9 Oct 2015 21:06:50 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E4C3321C00D for ; Fri, 9 Oct 2015 21:06:49 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1ACE63406A7 for ; Fri, 9 Oct 2015 21:06:49 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id EB849DCF for ; Fri, 9 Oct 2015 21:06:46 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1444405161.761dbbd96691eb2c3897741e92acdc2ee7cd70e1.vapier@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/fileops.py X-VCS-Directories: catalyst/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 761dbbd96691eb2c3897741e92acdc2ee7cd70e1 X-VCS-Branch: master Date: Fri, 9 Oct 2015 21:06:46 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: a993e868-7870-43ef-9ef9-e13a5487c1df X-Archives-Hash: 12e69ce0d4a7fc9bc2641c935bbe8c05 commit: 761dbbd96691eb2c3897741e92acdc2ee7cd70e1 Author: Mike Frysinger gentoo org> AuthorDate: Fri Oct 9 15:39:21 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Fri Oct 9 15:39:21 2015 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=761dbbd9 fileops: convert to log module catalyst/fileops.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/catalyst/fileops.py b/catalyst/fileops.py index 2aa39f6..8fb2a36 100644 --- a/catalyst/fileops.py +++ b/catalyst/fileops.py @@ -20,6 +20,8 @@ from stat import ST_UID, ST_GID, ST_MODE from snakeoil.osutils import (ensure_dirs as snakeoil_ensure_dirs, pjoin, listdir_files) # pylint: enable=unused-import + +from catalyst import log from catalyst.support import CatalystError @@ -61,31 +63,31 @@ def clear_dir(target, mode=0o755, chg_flags=False, remove=False): @remove: boolean, passed through to clear_dir() @return boolean ''' - #print "fileops.clear_dir()" + log.debug('start: %s', target) if not target: - #print "fileops.clear_dir(), no target... returning" + log.debug('no target... returning') return False if os.path.isdir(target): - print "Emptying directory" , target + log.info('Emptying directory: %s', target) # stat the dir, delete the dir, recreate the dir and set # the proper perms and ownership try: - #print "fileops.clear_dir(), os.stat()" + log.debug('os.stat()') mystat=os.stat(target) # There's no easy way to change flags recursively in python if chg_flags and os.uname()[0] == "FreeBSD": os.system("chflags -R noschg " + target) - #print "fileops.clear_dir(), shutil.rmtree()" + log.debug('shutil.rmtree()') shutil.rmtree(target) if not remove: - #print "fileops.clear_dir(), ensure_dirs()" + log.debug('ensure_dirs()') ensure_dirs(target, mode=mode) os.chown(target, mystat[ST_UID], mystat[ST_GID]) os.chmod(target, mystat[ST_MODE]) - except Exception as e: - print CatalystError("clear_dir(); Exeption: %s" % str(e)) + except Exception: + log.error('clear_dir failed', exc_info=True) return False else: - print "fileops.clear_dir(), %s is not a directory" % (target) - #print "fileops.clear_dir(), DONE, returning True" + log.info('clear_dir failed: %s: is not a directory', target) + log.debug('DONE, returning True') return True