I'm trying to test a basic fix (adding a test for the path before the xdg-desktop-menu lines, also indenting the xdg-desktop-menu lines and the the blank line after those to make those lines execute contingent on the if statement). It's almost like make_deb_package.py is using the old postinst script, despite copying the correct file to the temporary directory used to build the package. So my coding syntax has got to be wrong.
Here's the line I'm adding:
if os.path.exists('/usr/share/desktop-directories'):
Other than the correct indentation to delineate the codeblock, what could be the issue? Could it actually be using the old script? Am I not allowed to supply literal string values?
The Python code you added looks correct to me. The problem is that the temporary directory gets recreated from dpkgfiles each time you run make_deb_package.py. So if you are copying to or modifying the file in the temporary directory instead of dpkgfiles, it will get overwritten when you run make_deb_package.py. So if you aren't doing it already, you should modify the postinst in dpkgfiles and then try running make_deb_package.py.