From 997ad61268b950ad3ae2ead88327d8bc71fedeb5 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 10 Jun 2012 15:43:40 -0700 Subject: dep: move regex constants to top of file --- pym/portage/dep/__init__.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'pym/portage/dep') 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 -- cgit v1.2.3-1-g7c22