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!

  • snake_case_lover@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    6 months ago

    host the version on the Internet. Make the script check for update before running. You can cache it on the filesystem too if you want

    • CoderSupreme@programming.devOP
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      6 months ago

      I don’t really understand what you mean, but this gave me an idea. I can save the version of the software to a file after applying the patch, and then set up a cron job to check if the new software has a different version. If it does, the cron job will apply the patch and update the file with the new version.