Generate shell hooks dynamically for Unix/Windows portability

An alternative approach to making the hook tests portable - rather than having separate test repos for Unix and Windows, instead generate the repo at runtime based on ```sys.platform```.