public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arfrever Frehtes Taifersar Arahesis" <arfrever@apache.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/_sets/
Date: Wed, 10 Dec 2014 20:14:08 +0000 (UTC)	[thread overview]
Message-ID: <1418242014.9e7fda6c40a3588d56aae74c6b769d5c651fe890.arfrever@gentoo> (raw)

commit:     9e7fda6c40a3588d56aae74c6b769d5c651fe890
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Wed Dec 10 20:06:54 2014 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever <AT> apache <DOT> org>
CommitDate: Wed Dec 10 20:06:54 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9e7fda6c

Update loading of configuration of sets.

- Ignore VCS directories.
- Ignore directories and files whose names start with "." or end with "~".
- Fix "BytesWarning: Comparison between bytes and string", which was occurring
  when any directory in /etc/portage/sets exists.

---
 pym/portage/_sets/__init__.py | 9 +++++++--
 pym/portage/_sets/files.py    | 9 +++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/pym/portage/_sets/__init__.py b/pym/portage/_sets/__init__.py
index a652227..5e4a9dc 100644
--- a/pym/portage/_sets/__init__.py
+++ b/pym/portage/_sets/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2007-2012 Gentoo Foundation
+# Copyright 2007-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import print_function
@@ -24,6 +24,7 @@ from portage import _unicode_decode
 from portage import _unicode_encode
 from portage import _encodings
 from portage.const import USER_CONFIG_PATH, GLOBAL_CONFIG_PATH
+from portage.const import VCS_DIRS
 from portage.const import _ENABLE_SET_CONFIG
 from portage.exception import PackageSetNotFound
 from portage.localization import _
@@ -307,10 +308,14 @@ def load_default_config(settings, trees):
 	if portage.const.EPREFIX:
 		global_config_path = os.path.join(portage.const.EPREFIX,
 			GLOBAL_CONFIG_PATH.lstrip(os.sep))
+	vcs_dirs = [_unicode_encode(x, encoding=_encodings['fs']) for x in VCS_DIRS]
 	def _getfiles():
 		for path, dirs, files in os.walk(os.path.join(global_config_path, "sets")):
+			for d in dirs:
+				if d in vcs_dirs or d.startswith(b".") or d.endswith(b"~"):
+					dirs.remove(d)
 			for f in files:
-				if not f.startswith(b'.'):
+				if not f.startswith(b".") and not f.endswith(b"~"):
 					yield os.path.join(path, f)
 
 		dbapi = trees["porttree"].dbapi

diff --git a/pym/portage/_sets/files.py b/pym/portage/_sets/files.py
index 379ca30..9d25280 100644
--- a/pym/portage/_sets/files.py
+++ b/pym/portage/_sets/files.py
@@ -1,4 +1,4 @@
-# Copyright 2007-2013 Gentoo Foundation
+# Copyright 2007-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import errno
@@ -10,7 +10,7 @@ from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
 from portage.util import grabfile, write_atomic, ensure_dirs, normalize_path
-from portage.const import USER_CONFIG_PATH, WORLD_FILE, WORLD_SETS_FILE
+from portage.const import USER_CONFIG_PATH, VCS_DIRS, WORLD_FILE, WORLD_SETS_FILE
 from portage.localization import _
 from portage.locks import lockfile, unlockfile
 from portage import portage_gid
@@ -142,6 +142,7 @@ class StaticFileSet(EditablePackageSet):
 				_("Directory path contains invalid character(s) for encoding '%s': '%s'") \
 				% (_encodings['fs'], directory))
 
+		vcs_dirs = [_unicode_encode(x, encoding=_encodings['fs']) for x in VCS_DIRS]
 		if os.path.isdir(directory):
 			directory = normalize_path(directory)
 
@@ -152,7 +153,7 @@ class StaticFileSet(EditablePackageSet):
 				except UnicodeDecodeError:
 					continue
 				for d in dirs[:]:
-					if d[:1] == '.':
+					if d in vcs_dirs or d.startswith(b".") or d.endswith(b"~"):
 						dirs.remove(d)
 				for filename in files:
 					try:
@@ -160,7 +161,7 @@ class StaticFileSet(EditablePackageSet):
 							encoding=_encodings['fs'], errors='strict')
 					except UnicodeDecodeError:
 						continue
-					if filename[:1] == '.':
+					if filename.startswith(".") or filename.endswith("~"):
 						continue
 					if filename.endswith(".metadata"):
 						continue


             reply	other threads:[~2014-12-11  1:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 20:14 Arfrever Frehtes Taifersar Arahesis [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-12-09  4:25 [gentoo-commits] proj/portage:master commit in: pym/portage/_sets/ Zac Medico
2015-03-09 19:53 Zac Medico
2015-02-11 19:11 Brian Dolbec
2015-02-11 16:17 Brian Dolbec
2014-12-08  0:42 Zac Medico
2014-05-12 10:13 Alexander Berntsen
2012-10-18  3:12 Zac Medico
2012-10-18  3:06 Zac Medico
2012-10-18  3:02 Zac Medico
2012-10-18  2:52 Zac Medico
2012-09-05 20:37 Zac Medico
2012-09-04 20:41 Zac Medico
2012-09-04 20:41 Zac Medico
2012-09-02 22:32 Zac Medico
2012-09-02 20:19 Zac Medico
2012-09-01  4:29 Zac Medico
2012-05-14  1:02 Zac Medico
2012-05-14  0:51 Zac Medico
2011-10-28  7:21 Zac Medico
2011-07-24  1:35 Zac Medico
2011-07-21 16:15 Zac Medico
2011-06-06  2:01 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1418242014.9e7fda6c40a3588d56aae74c6b769d5c651fe890.arfrever@gentoo \
    --to=arfrever@apache.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox