There’s a Python program that I update regularly. Every time I update the program, I need to modify a specific Python file to change its functionality. Instead of manually patching the file each time, I’d like to automate the process.

I’m looking for a way to automatically apply a patch to a Python file whenever the program updates or if the file doesn’t have the desired modifications.

Any advice or suggestions on how to automate this process would be greatly appreciated!

  • @wildbus8979
    link
    1723 days ago

    This is going to be quite dependent on the package manager and distribution you use…

    • Strit
      link
      fedilink
      423 days ago

      Yeah, it basically means maintaining the package yourself on your system.

      • @wildbus8979
        link
        723 days ago

        Not necessarily, you could add post install scripts, dpkg-divert, or other techniques.

        • Responsabilidade
          link
          fedilink
          723 days ago

          Agreed. In Arch you can run a post-script after update in pacman, so you can update the python file. But I don’t know how other package managers deal with it

      • @wildbus8979
        link
        10
        edit-2
        23 days ago

        I literally listed two ways this could be dependent on the package manager and distribution you’re using in the other comment. But hey evidently you know best as you already know the solution to this problem…