On Sat, 14 Jul 2018 22:05:55 -0700 Zac Medico <zmed...@gentoo.org> wrote:
> Optimize config to stat profile.bashrc files once in the constructor, > in order to avoid repeated stat calls in the setcpv method. > > Bug: https://bugs.gentoo.org/649806 > --- > pym/portage/package/ebuild/config.py | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/pym/portage/package/ebuild/config.py > b/pym/portage/package/ebuild/config.py index 88acac5cc..320d9f6c0 > 100644 --- a/pym/portage/package/ebuild/config.py > +++ b/pym/portage/package/ebuild/config.py > @@ -274,6 +274,7 @@ class config(object): > self.mycpv = clone.mycpv > self._setcpv_args_hash = > clone._setcpv_args_hash self._soname_provided = clone._soname_provided > + self._profile_bashrc = clone._profile_bashrc > > # immutable attributes (internal policy > ensures lack of mutation) self._locations_manager = > clone._locations_manager @@ -725,6 +726,10 @@ class config(object): > self._license_manager.extract_global_changes( \ > > self.configdict["conf"].get("ACCEPT_LICENSE", > "")) > + # profile.bashrc > + self._profile_bashrc = > tuple(os.path.isfile(os.path.join(profile.location, 'profile.bashrc')) > + for profile in profiles_complex) > + > if local_config: > #package.properties > propdict = > grabdict_package(os.path.join( @@ -1596,11 +1601,9 @@ class > config(object): > bashrc_files = [] > > - for profile in > self._locations_manager.profiles_complex: > - profile_bashrc = > os.path.join(profile.location, > - 'profile.bashrc') > - if os.path.exists(profile_bashrc): > - bashrc_files.append(profile_bashrc) > + for profile, profile_bashrc in > zip(self._locations_manager.profiles_complex, self._profile_bashrc): > + if profile_bashrc: > + > bashrc_files.append(os.path.join(profile.location, 'profile.bashrc')) > if profile in self._pbashrcdict: cpdict = > self._pbashrcdict[profile].get(cp) if cpdict: looks good -- Brian Dolbec <dolsen>