This seems to show how to set up a post install script, but I am still unclear on how to use it to add the installed directory to the path.
Which values (and where can I find them) do I need to get from the install and how can I refer to them in the post install script itself?
Here is what I have so far, all stolen from other places and stuck together, don't know how to make it work:
import _winreg
import os
from distutils.core import setup
from distutils.command.install import install as _install
REG_PATH = r"SOFTWARE\my_program\Settings"
def _post_install(dir):
    if os.name == 'nt':
        try:
            _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, REG_PATH)
            registry_key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, REG_PATH, 0,
                                           _winreg.KEY_WRITE)
            _winreg.SetValueEx(registry_key, name, 0, _winreg.REG_SZ, value)
            _winreg.CloseKey(registry_key)
            return True
        except WindowsError:
            return False
class install(_install):
    def run(self):
        _install.run(self)
        self.execute(_post_install, (self.install_lib,),
                     msg="Running post install task...")
setup(cmdclass={'install': install})
 
    