It's fundamentally a wrong choice to write a debhelper command that re-implements Dh_Lib instead of using it. It requires you to constantly play catchup, and means your users have to constantly deal with a poor emulation. And I'll bet your command would not be 700 lines long if it used the library (average debhelper command is 128 lines including man page). A good way to handle this is to write a non-debhelper-specific tool, with a proper, stable interface, containing all the interesting stuff (in whatever language you want) and then letting a regular debhelper command use that tool.
Regarding this bug report, debhelper commands should fail on unknown options in v8 and above, but only warn about them in v7 and below. dh_python2 and dh_python3 also don't handle -O properly, which makes it impossible to pass options to them from dh. And, they don't treat DH_OPTIONS specially; uknown options there should always be only a warning. -- see shy jo
signature.asc
Description: Digital signature