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 CF1391381FA for ; Thu, 5 Jun 2014 22:09:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E2600E0998; Thu, 5 Jun 2014 22:09:15 +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 E6FFFE097D for ; Thu, 5 Jun 2014 22:09:14 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id ADE9A33FE5C for ; Thu, 5 Jun 2014 22:09:13 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 251891830B for ; Thu, 5 Jun 2014 22:09:11 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1399425688.728b5d1c32773422f0b3e658d16116f6883ee9d2.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/util/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/util/fileio.py X-VCS-Directories: roverlay/util/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 728b5d1c32773422f0b3e658d16116f6883ee9d2 X-VCS-Branch: master Date: Thu, 5 Jun 2014 22:09:11 +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: 460760d9-83ea-4e4c-a98c-8a4abdfdfd41 X-Archives-Hash: b548c20f456c4bd1135d428341be8f8d commit: 728b5d1c32773422f0b3e658d16116f6883ee9d2 Author: André Erdmann mailerd de> AuthorDate: Wed May 7 01:21:28 2014 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed May 7 01:21:28 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=728b5d1c roverlay/util/fileio, write_text_file: accept str --- roverlay/util/fileio.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roverlay/util/fileio.py b/roverlay/util/fileio.py index 804aa9f..d4019d7 100644 --- a/roverlay/util/fileio.py +++ b/roverlay/util/fileio.py @@ -128,6 +128,7 @@ def write_text_file ( newline='\n' ): compress_open = get_compress_open ( compression ) if compression else None + lines_iter = ( lines, ) if isinstance ( lines, str ) else lines if create_dir: roverlay.util.common.dodir_for_file ( filepath ) @@ -135,7 +136,7 @@ def write_text_file ( if compress_open: NL = newline.encode() with compress_open ( filepath, mode.rstrip ( 'tu' ) ) as CH: - for line in lines: + for line in lines_iter: CH.write ( str ( line ).encode() ) if append_newlines: CH.write ( NL ) @@ -144,7 +145,7 @@ def write_text_file ( CH.write ( NL ) else: with open ( filepath, mode ) as FH: - for line in lines: + for line in lines_iter: FH.write ( str ( line ) ) if append_newlines: FH.write ( newline )