public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: Re: [gentoo-portage-dev] [PATCH v2] Move INSTALL_MASK handling into merging
Date: Sun, 12 Jun 2016 01:41:55 -0700	[thread overview]
Message-ID: <575D2053.6070809@gentoo.org> (raw)
In-Reply-To: <20160522082110.31696-1-mgorny@gentoo.org>

On 05/22/2016 01:21 AM, Michał Górny wrote:
> +	def _is_install_masked(self, relative_path):
> +		ret = False
> +		for pattern in self.settings.install_mask:
> +			# absolute path pattern
> +			if pattern.startswith('/'):
> +				# match either exact path or one of parent dirs
> +				# the latter is done via matching pattern/*
> +				if (fnmatch.fnmatch(relative_path, pattern[1:])
> +						or fnmatch.fnmatch(relative_path, pattern[1:] + '/*')):
> +					ret = True
> +					break
> +			# filename
> +			else:
> +				if fnmatch.fnmatch(os.path.basename(relative_path), pattern):
> +					ret = True
> +					break
> +		return ret
> +

This is a hot spot, so it should use a pre-compiled regular expression,
using | to join the results of fnmatch.translate(pattern) calls for each
pattern.
-- 
Thanks,
Zac


  reply	other threads:[~2016-06-12  8:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-22  6:56 [gentoo-portage-dev] [PATCH 0/3] INSTALL_MASK redesign, part I Michał Górny
2016-05-22  6:56 ` [gentoo-portage-dev] [PATCH 1/3] portage.package.ebuild.config: Move FEATURES=no* handling there Michał Górny
2016-06-12  7:19   ` Zac Medico
2016-06-12  7:28     ` Zac Medico
2016-06-12  9:33       ` Michał Górny
2016-05-22  6:56 ` [gentoo-portage-dev] [PATCH 2/3] Move INSTALL_MASK handling into merging Michał Górny
2016-05-22  8:14   ` Michał Górny
2016-05-22  8:21   ` [gentoo-portage-dev] [PATCH v2] " Michał Górny
2016-06-12  8:41     ` Zac Medico [this message]
2016-06-12  9:10     ` Zac Medico
2016-06-12  9:28       ` Michał Górny
2016-06-12  9:49         ` Zac Medico
2016-06-12 10:05           ` Michał Górny
2016-06-12 10:28             ` Zac Medico
2016-06-12 20:29     ` Zac Medico
2016-06-12 20:43       ` Zac Medico
2016-06-12 20:52         ` Zac Medico
2016-05-22  6:56 ` [gentoo-portage-dev] [PATCH 3/3] portage.dbapi.vartree: Support exclusions in INSTALL_MASK Michał Górny
2016-06-12  9:20   ` Zac Medico
2016-06-12  9:31     ` Michał Górny
2016-06-12  9:43       ` Zac Medico
2016-06-12 10:03         ` Michał Górny
2016-06-12 10:23           ` Zac Medico
2016-05-31 15:58 ` [gentoo-portage-dev] [PATCH 4/3] portage.package.ebuild.config: Support path groups from install-mask.conf Michał Górny
2016-06-10 21:50   ` Michał Górny

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=575D2053.6070809@gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    --cc=mgorny@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