Re: [PATCH] Add caching to use_reduce, vercmp, and catpkgsplit
Zac Medico <[email protected]>
| Newsgroups | gmane.linux.gentoo.portage.devel |
|---|---|
| Message-ID | <[email protected]> |
On 7/9/20 12:03 AM, Chun-Yu Shei wrote:
> +def use_reduce(depstr, uselist=(), masklist=(), matchall=False, excludeall=(), is_src_uri=False, \
> + eapi=None, opconvert=False, flat=False, is_valid_flag=None, token_class=None, matchnone=False,
> + subset=None):
> + """
> + Takes a dep string and reduces the use? conditionals out, leaving an array
> + with subarrays. All redundant brackets are removed.
> +
> + @param depstr: depstring
> + @type depstr: String
> + @param uselist: Sequence of use enabled flags
> + @type uselist: Sequence
> + @param masklist: Sequence of masked flags (always treated as disabled)
> + @type masklist: Sequence
> + @param matchall: Treat all conditionals as active. Used by repoman.
> + @type matchall: Bool
> + @param excludeall: Sequence of flags for which negated conditionals are always treated as inactive.
> + @type excludeall: Sequence
> + @param is_src_uri: Indicates if depstr represents a SRC_URI
> + @type is_src_uri: Bool
> + @param eapi: Indicates the EAPI the dep string has to comply to
> + @type eapi: String
> + @param opconvert: Put every operator as first element into it's argument list
> + @type opconvert: Bool
> + @param flat: Create a flat list of all tokens
> + @type flat: Bool
> + @param is_valid_flag: Function that decides if a given use flag might be used in use conditionals
> + @type is_valid_flag: Function
> + @param token_class: Convert all non operator tokens into this class
> + @type token_class: Class
> + @param matchnone: Treat all conditionals as inactive. Used by digestgen().
> + @type matchnone: Bool
> + @param subset: Select a subset of dependencies conditional on the given flags
> + @type subset: Sequence
> + @rtype: List
> + @return: The use reduced depend array
> + """
> + if isinstance(depstr, list):
> + if portage._internal_caller:
> + warnings.warn(_("Passing paren_reduced dep arrays to %s is deprecated. " + \
> + "Pass the original dep string instead.") % \
> + ('portage.dep.use_reduce',), DeprecationWarning, stacklevel=2)
> + depstr = paren_enclose(depstr)
> +
> + if uselist is not None:
> + uselist = tuple(uselist)
> + if masklist is not None:
> + masklist = tuple(masklist)
> + if excludeall is not None:
> + excludeall = tuple(excludeall)
> + if subset is not None:
> + subset = tuple(subset)
The patch looks great, but maybe it's better if we use frozenset instead
of tuple for these.
--
Thanks,
Zac
signature.asc
(application/pgp-signature, 981 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQKTBAEBCgB9FiEE8OgXaltWzqgSupCu0HX7jBBKPSAFAl8LhMlfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEYw RTgxNzZBNUI1NkNFQTgxMkJBOTBBRUQwNzVGQjhDMTA0QTNEMjAACgkQ0HX7jBBK PSCsog/+MpYt2NAhGfyY8NJDm8/DTrb9PEKnJq5SzkOCdgN+ZqhCaTFjOCq1Dfcb bY7UvtpbYfpDI6divADoXVgI8C95in9ksSTB0sHPFwG5LEEyUrcv5Psbr3+tz6B6 g9/UNTkMzKlmIuvEPLWMtYFtE/27nptlAFBk8faD/AfxIAdEbXviRPvFC7mfKuRN n3XY9zNX1NgPjUKsZyzR/aswtB5WJn+Ibj1e382DrvvS3wwyAO9gSH2odR4ghil8 Xbf5nM+M0XzA1ELr0y03iIMcR7H+aJU2kSCtVFeFeCv7JwkFJJPV8xEi0CXIY5A5 H0zG8aJoiYon1Cba639LQZO5yOzd1cDbUyGJk01Abf97mXSE2cWtbb9WqvZYbSxV LlyN3QHwnlIPyxZUwl6SEDB+uCFm/ll6JXS/n0CkFFfw+G5/DKjCW77mxGZxFZHG 8W4cod4HZJDGJu6jnwBRH1hla8+o9VKWsd1idjktSRINsvn4RvecHpLnguoKwtoH 4uTnwyd/KF1eicuzIOkXEtMGw5vV5NUHPQ40kSuAnzQL9qXL5T8iD6IH/ysZI5aH uzgffW1HpX16mTr+SwBqJc/RGBH++a72rWlTg76BGAml82X4RUVE27noQ1/2Mt3A oHTFNyUUOI0NJnJLoZ3BbJkvvO2ZEtNX+JgwU7dRPPQ199f8G8g= =odqu -----END PGP SIGNATURE-----