aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-06-10 15:43:40 -0700
committerZac Medico <zmedico@gentoo.org>2012-06-10 15:43:40 -0700
commit997ad61268b950ad3ae2ead88327d8bc71fedeb5 (patch)
tree9195796fed5bd5d426f91d58d1ce1030a489ffdc /pym/portage/dep
parent_get_atom_wildcard_re: use _eapi_attrs (diff)
downloadportage-997ad61268b950ad3ae2ead88327d8bc71fedeb5.tar.gz
portage-997ad61268b950ad3ae2ead88327d8bc71fedeb5.tar.bz2
portage-997ad61268b950ad3ae2ead88327d8bc71fedeb5.zip
dep: move regex constants to top of file
Diffstat (limited to 'pym/portage/dep')
-rw-r--r--pym/portage/dep/__init__.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 5e747a1f9..d985486e1 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -55,6 +55,23 @@ if sys.hexversion >= 0x3000000:
# stable keywords, make these warnings unconditional.
_internal_warnings = False
+# \w is [a-zA-Z0-9_]
+
+# PMS 3.1.3: A slot name may contain any of the characters [A-Za-z0-9+_.-].
+# It must not begin with a hyphen or a dot.
+_slot_separator = ":"
+_slot = r'([\w+][\w+.-]*)'
+_slot_re = re.compile('^' + _slot + '$', re.VERBOSE)
+
+_use = r'\[.*\]'
+_op = r'([=~]|[><]=?)'
+
+_repo_separator = "::"
+_repo_name = r'[\w][\w-]*'
+_repo = r'(?:' + _repo_separator + '(' + _repo_name + ')' + ')?'
+
+_extended_cat = r'[\w+*][\w+.*-]*'
+
_eapi_attrs = collections.namedtuple('_eapi_attrs',
'dots_in_PN dots_in_use_flags repo_deps slot_deps '
'strong_blocks use_deps use_dep_defaults')
@@ -1761,22 +1778,6 @@ def dep_getusedeps( depend ):
open_bracket = depend.find( '[', open_bracket+1 )
return tuple(use_list)
-# \w is [a-zA-Z0-9_]
-
-# 2.1.3 A slot name may contain any of the characters [A-Za-z0-9+_.-].
-# It must not begin with a hyphen or a dot.
-_slot_separator = ":"
-_slot = r'([\w+][\w+.-]*)'
-_slot_re = re.compile('^' + _slot + '$', re.VERBOSE)
-
-_use = r'\[.*\]'
-_op = r'([=~]|[><]=?)'
-_repo_separator = "::"
-_repo_name = r'[\w][\w-]*'
-_repo = r'(?:' + _repo_separator + '(' + _repo_name + ')' + ')?'
-
-_extended_cat = r'[\w+*][\w+.*-]*'
-
def isvalidatom(atom, allow_blockers=False, allow_wildcard=False, allow_repo=False):
"""
Check to see if a depend atom is valid