White listing files with install.py?

29 views
Skip to first unread message

Pat O'Brien

unread,
Sep 3, 2018, 4:46:55 PM9/3/18
to weewx-development
In case I've overlooked something - which is highly possible - is it possible to install files with install.py - but also "white list" certain files? Such that "if file exists, do not re-install (overwrite)"?

mwall

unread,
Sep 3, 2018, 5:00:53 PM9/3/18
to weewx-development
On Monday, September 3, 2018 at 4:46:55 PM UTC-4, Pat O'Brien wrote:
In case I've overlooked something - which is highly possible - is it possible to install files with install.py - but also "white list" certain files? Such that "if file exists, do not re-install (overwrite)"?

nope.  the installer will install each of the files that are enumerated.  the intent is to have all customizations happen in the configuration file.  if a user modifies python code or template files, then the user is responsible to back those up then merge later, since upgrading will overwrite them.

note also that uninstalling an extension will remove the files enumerated for the extension.

m

Pat O'Brien

unread,
Sep 3, 2018, 5:03:16 PM9/3/18
to weewx-development
Ok thanks. In the skin I've put out, there's an about page which has dynamic content. I have the user manage that using an about.inc file within the skins folder that gets included at run time. 

I've advised them to create this file - because if I include it with install.py, it gets overwritten. 

I guess this is a good litmus test to see who reads the instructions. 

Vince Skahan

unread,
Sep 3, 2018, 5:15:57 PM9/3/18
to weewx-development
On Monday, September 3, 2018 at 2:03:16 PM UTC-7, Pat O'Brien wrote:
Ok thanks. In the skin I've put out, there's an about page which has dynamic content. I have the user manage that using an about.inc file within the skins folder that gets included at run time. 

I've advised them to create this file - because if I include it with install.py, it gets overwritten. 


How about making it "about.inc.example" or the like so it can be safely overwritten by updates....

Alternately, have your include file be the defaults, and tweak your code to supersede it with a different file the user could cook up with just the variables they want to mess with.  Literally 'decades' ago, lots of software that was installed with configure did it that way....

Pat O'Brien

unread,
Sep 3, 2018, 6:11:09 PM9/3/18
to weewx-development
The about.inc.example is a good idea. I could include it and then have them rename it. 

Or I could use an SLE that does a simple get file contents, and if the file doesn't exist put some text in that SLE variable that says "please create about.inc".

Again, trying to keep it simple. Maybe the SLE is a good work-around. 
Reply all
Reply to author
Forward
0 new messages