On Mon, Dec 28, 2020 at 8:09 PM Zac Medico <zmed...@gentoo.org> wrote: > > On 12/28/20 3:15 PM, Matt Turner wrote: > > +def apply_keyword_changes(ebuild: str, pathname: str, > > + changes: List[Tuple[Optional[str], > > + Optional[str]]]) -> int: > > + result: int = 0 > > + > > + # ekeyword will only modify files named *.ebuild, so make a symlink > > + ebuild_symlink: str = os.path.basename(pathname) > > + os.symlink(ebuild, ebuild_symlink) > > Are we sure that the current working directory is an entirely safe place > to create this symlink? A simple fix would be to use > tempfile.TemporaryDirectory to create a temporary directory to hold the > symlink. Or, we could change ekeyword to assume that an argument is an > ebuild if os.path.isfile(arg) succeeds.
Thanks, this is a good question. I've sent a v3 patch using tempfile.TemporaryDirectory. I think that's better than passing ".merge_file_SEd3R8" to ekeyword since the filename is printed and it's nice to see what file is being modified during the rebase.