It’s a bit of work but I straighten and pull the staples to get the seal off when painting a hood. Putting the seal back on takes a bit of time to as the staples have to go thru their original holes and then get bent over without scratching the paint. When installing a new seal, the holes for the staples get drilled from the inside of the hood thru the existing holes thru the rubber. Super glue and some clamps will hold down any high spots on the outside.
On one motor which was getting a new seal, I tried the yellow 3M weather strip adhesive but it made a mess. A bit of it got on the fresh paint and melted the paint. That meant more body work and a repaint.