Windows Development

279 megtekintés
Ugrás az első olvasatlan üzenetre

Darryn Capes-Davis

olvasatlan,
2016. okt. 15. 3:32:082016. 10. 15.
– weewx-user
Hi All,

I have been working on changes required to run an out of the box Weewx installation on Windows. I have been able to achieve install using setup.py and running the simulator with minimal changes, the main being writing a syslog wrapper. See https://github.com/dcapslock/weewx/tree/windows for my working forked branch.

Steps

1. Install python 2.7 for Windows
2. Upgrade pip and setuptools to make getting modules easy. See https://packaging.python.org/installing/#install-pip-setuptools-and-wheel. easy_install will be installed with setuptools

python -m pip install -U pip setuptools

3. Install cheetah
easy_install cheetah
4. Install  Configobj
easy_install configobj
5. Install PIL (Pillow)
easy_install Pillow
6. Install pyserial
easy_install pyserial
7. Install pyusb
easy)install pysub
8. Warp syslog
This is the main part of work done. I have written a syslog wrapper then when placed in weewx bin directory will be used when syslog module does not exist, which is the case on Windows. The wrapper uses the python logging module and provides both a local rotating file logger as well as a syslog formatted message out to localhost on port 514, simulating what happens on a NIX box. I have used VisualSyslog (https://github.com/MaxBelkov/visualsyslog) to verify.
9. Fixes found so far running Simulator

cheetahgenerator.py - os.rename will not overwrite existing file on windows. So delete file before rename.
engine.py - No SIGHUP or SIGTERM on Windows. Need to not register but maybe find another way to raise a restart. 
setup.py - Need to create NamedTemporaryFile with delete=False. If further work not done this will leave some temp files around.Fixes 
10. Just for kicks, first 3 lines of syslog

Oct 15 17:33:47 ZEBRA weewx[3768]: engine: Initializing weewx version 3.6.1
Oct 15 17:33:47 ZEBRA weewx[3768]: engine: Using Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)]
Oct 15 17:33:47 ZEBRA weewx[3768]: engine: Platform Windows-10-10.0.10586

More to do like run as a service but that is for another day - should be pretty straightforward. Please feel free to use what I have found so far.

Regards

Darryn


Thomas Keffer

olvasatlan,
2016. okt. 15. 8:15:182016. 10. 15.
– weewx-user
That's encouraging! We'll see whether the drivers are so simple! :-)

Your port looks pretty straightforward. Any idea why the delete=False flag is needed in setup.py? Is that a Windows thing? 

I've been meaning to encapsulate the logging. The various weewx modules vary in how they handle it. Some use raw syslog, others use convenience functions. 

I am contemplating including the convenience function under weeutil, as a new module weeutil.log. For *nix, the logging would be implemented using syslog.

You have nicely emulated syslog, so that could be used for Windows. Alternatively, the convenience functions could just call the Python module logging directly.

I'll be interested to see where this goes!

-tk



--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Amanda & Darryn Capes-Davis

olvasatlan,
2016. okt. 15. 18:35:072016. 10. 15.
– weewx...@googlegroups.com
Tom,

Regarding delete=False, most like to do with the exclusive mode used on Windows, see https://bugs.python.org/issue14243.

For logging I would advocate for a or size fits all model. With Python logging you can also load config from a file, so this would allow developers to specify their own logging handlers and filters if so desired. 

I will most likely put this syslog wrapper out as it's own project once I fix up the logging mask. 

Shall we put the Windows branch into the main Git repo while playing with this? Can I create a pull request for that?

Things to do

- Setup defaults for binaries, DB, HTML files etc.
- try a driver or two (I have none of the regular devices)
- run as a service 

We should move to weewx-development

Cheers

Darryn
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/8M8qfrmrMfI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
Válasz mindenkinek
Válasz a szerzőnek
Továbbítás
0 új üzenet