On Wed, 12 Jan 2022 16:54:46 +0100
Martin Liška <[email protected]> wrote:
> +def replace_file_in_changelog(lines, filename):
> + if not filename.endswith('.cc'):
> + return
> +
> + # consider all componenets of a path: gcc/ipa-icf.cc
> + while filename:
> + for i, line in enumerate(lines):
> + if filename in line:
> + line = line.replace(filename, filename[:-1])
> + lines[i] = line
> + return
> + parts = filename.split('/')
> + if len(parts) == 1:
> + return
> + filename = '/'.join(parts[1:])
> +
I think you mean os.sep instead of the hardcoded slash.
But i'd use os.path.split and os.path.join
thanks,