From: Arfrever Frehtes Taifersar Arahesis Date: Sat, 12 May 2012 04:07:12 +0000 (+0200) Subject: Add portage.eapi.eapi_allows_dots_in_use_flags(). X-Git-Tag: v2.2.0_alpha105~52 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0098ee7395e2c9b35471a5c088eef1fa59946912;p=portage.git Add portage.eapi.eapi_allows_dots_in_use_flags(). --- diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 6770140e2..2e3444de5 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -39,7 +39,7 @@ portage.proxy.lazyimport.lazyimport(globals(), from portage import _unicode_decode from portage.eapi import eapi_has_slot_deps, eapi_has_src_uri_arrows, \ eapi_has_use_deps, eapi_has_strong_blocks, eapi_has_use_dep_defaults, \ - eapi_has_repo_deps, eapi_allows_dots_in_PN + eapi_has_repo_deps, eapi_allows_dots_in_PN, eapi_allows_dots_in_use_flags from portage.exception import InvalidAtom, InvalidData, InvalidDependString from portage.localization import _ from portage.versions import catpkgsplit, catsplit, \ @@ -642,8 +642,8 @@ def flatten(mylist): _usedep_re = { - "0": re.compile("^(?P[!-]?)(?P[A-Za-z0-9][A-Za-z0-9+_@-]*)(?P(\(\+\)|\(\-\))?)(?P[?=]?)$"), - "4-python": re.compile("^(?P[!-]?)(?P[A-Za-z0-9][A-Za-z0-9+_@.-]*)(?P(\(\+\)|\(\-\))?)(?P[?=]?)$"), + "dots_disallowed_in_use_flags": re.compile("^(?P[!-]?)(?P[A-Za-z0-9][A-Za-z0-9+_@-]*)(?P(\(\+\)|\(\-\))?)(?P[?=]?)$"), + "dots_allowed_in_use_flags": re.compile("^(?P[!-]?)(?P[A-Za-z0-9][A-Za-z0-9+_@.-]*)(?P(\(\+\)|\(\-\))?)(?P[?=]?)$"), } def _get_usedep_re(eapi): @@ -656,10 +656,10 @@ def _get_usedep_re(eapi): @return: A regular expression object that matches valid USE deps for the given eapi. """ - if eapi in (None, "4-python",): - return _usedep_re["4-python"] + if eapi is None or eapi_allows_dots_in_use_flags(eapi): + return _usedep_re["dots_allowed_in_use_flags"] else: - return _usedep_re["0"] + return _usedep_re["dots_disallowed_in_use_flags"] class _use_dep(object): @@ -1677,8 +1677,8 @@ def _get_atom_wildcard_re(eapi): return _atom_wildcard_re["dots_disallowed_in_PN"] _useflag_re = { - "0": re.compile(r'^[A-Za-z0-9][A-Za-z0-9+_@-]*$'), - "4-python": re.compile(r'^[A-Za-z0-9][A-Za-z0-9+_@.-]*$'), + "dots_disallowed_in_use_flags": re.compile(r'^[A-Za-z0-9][A-Za-z0-9+_@-]*$'), + "dots_allowed_in_use_flags": re.compile(r'^[A-Za-z0-9][A-Za-z0-9+_@.-]*$'), } def _get_useflag_re(eapi): @@ -1691,10 +1691,10 @@ def _get_useflag_re(eapi): @return: A regular expression object that matches valid USE flags for the given eapi. """ - if eapi in (None, "4-python",): - return _useflag_re["4-python"] + if eapi is None or eapi_allows_dots_in_use_flags(eapi): + return _useflag_re["dots_allowed_in_use_flags"] else: - return _useflag_re["0"] + return _useflag_re["dots_disallowed_in_use_flags"] def isvalidatom(atom, allow_blockers=False, allow_wildcard=False, allow_repo=False): """ diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py index f09052dab..79cf89118 100644 --- a/pym/portage/eapi.py +++ b/pym/portage/eapi.py @@ -57,3 +57,6 @@ def eapi_has_repo_deps(eapi): def eapi_allows_dots_in_PN(eapi): return eapi in ("4-python",) + +def eapi_allows_dots_in_use_flags(eapi): + return eapi in ("4-python",)