How to patch via patch file # e.g. setup.py

This is the key part here. patch is by default called with -p1, which expects to strip a single directory component off of the two paths in these lines:

    --- setup.py   2021-07-23 15:15:33.318385825 +0200
    +++ setup.py   2021-07-23 15:15:33.318385825 +0200
        ^^^^^^^^

If you change the lines to a/setup.py and b/setup.py respectively, like in the diffs that git produces, it will work. The actual value of this first component is arbitrary though, it doesn’t have to be a and b. Often you’ll see somepkg-1.2.3-orig/... and somepkg-1.2.3/....

1 Like