Open elcojacobs opened 9 years ago
I thought I commented on this earlier in another issue, but I can't seem to find it- must have been in chat. There are two basic trains of thought on this- one is to surround each incidence of linux-only usage with an "if not Windows:" type expression- easier, but lots of extra coding. The 'more right' way to go about this, and also the way that is extensible as this program grows, is to write the linux-oriented methods in their own linux_func.py file, and then also write the equivalent code for Windows in a win_func.py file - with both modules exporting the same-named methods.
ie - linux.py has a function that does chmod, and windows.py has a function that does GetSecurityDescriptorDacl - but both those commands are exported as setFilePerms(). Then, in the main script, you do if Windows: import windows.py; else import linux.py . Then, you just call setFilePerms() and the appropriate OS code is run.
In order to make this easy to scale as you increase windows support, I'd recommend the second option. This makes it so that you don't have to skip commands in Windows, but can actually run an alternate set without messy if Windows: all throughout the code. Happy to code it up upon request.
Our update script does a few things that are very much oriented at Linux. On Windows, we could skip those parts, but the git actions to update the repo and updating the controller should still work.
The update script can check on which platform it is running and still do most of the actions when not running on Linux.