Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scripts for Windows #30

Open
elcojacobs opened this issue Apr 22, 2015 · 1 comment
Open

Update scripts for Windows #30

elcojacobs opened this issue Apr 22, 2015 · 1 comment

Comments

@elcojacobs
Copy link
Member

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.

@vanosg
Copy link
Collaborator

vanosg commented Apr 23, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants