forked from OpenZWave/python-openzwave
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDEVEL.html
More file actions
128 lines (122 loc) · 7.29 KB
/
Copy pathDEVEL.html
File metadata and controls
128 lines (122 loc) · 7.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<div class="section" id="developers-information">
<h1>Developers information</h1>
<div class="section" id="how-to-develop-for-python-openzwave">
<h2>How to develop for python-openzwave</h2>
<p>Get the sources</p>
<div class="highlight-bash"><div class="highlight"><pre>git clone https://github.com/OpenZWave/python-openzwave
</pre></div>
</div>
<p>You must now install python-openzwave in develop mode</p>
<div class="highlight-bash"><div class="highlight"><pre>make develop
</pre></div>
</div>
<p>Your password will be asked (by sudo) for installing eggs in your local directory.</p>
<p>Develop, test, debug, test, ... :)</p>
<p>Update the documentation if needed. You surely found the documentation useful, so please keep it up to date.</p>
<p>You can create an account on travis or docker to run the tests.</p>
<p>At last but not least, submit your request.</p>
</div>
<div class="section" id="how-to-develop-for-libopenzwave-was-python-openzwave-lib">
<h2>How to develop for libopenzwave (was python-openzwave-lib)</h2>
<p>After updating the pyx, you need to reinstall it. Otherwise, your changes will not be applied :</p>
<div class="highlight-bash"><div class="highlight"><pre>make develop
</pre></div>
</div>
</div>
<div class="section" id="tests">
<h2>Tests</h2>
<p>Travis-ci, Docker Hub, nosetests and pylint are used to test quality of code. There reports are here :</p>
<blockquote>
<div><ul class="simple">
<li>Docker : <a class="reference external" href="https://registry.hub.docker.com/u/bibi21000/python-openzwave/">https://registry.hub.docker.com/u/bibi21000/python-openzwave/</a></li>
<li>Travis : <a class="reference external" href="https://travis-ci.org/bibi21000/python-openzwave">https://travis-ci.org/bibi21000/python-openzwave</a></li>
<li><a class="reference external" href="file:../nosetests/nosetests.html">Nosetests report</a></li>
<li><a class="reference external" href="file:../coverage/index.html">Coverage report</a></li>
<li><a class="reference external" href="file:../pylint/report.html">Pylint report</a></li>
</ul>
</div></blockquote>
<p>Some tests don’t need a ZWave Stick to be launched, so they can be run on the autobuilders (travis, docker, ...). Place them in the autobuild directory.</p>
<p>Some tests need manual operations (ie to add a node, to remove one, ...). For example, to test the remove node, use :</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nb">export </span><span class="nv">MANUALSKIP</span><span class="o">=</span><span class="s1">'False'</span> <span class="o">&&</span> /usr/local/bin/nosetests --verbosity<span class="o">=</span>2 tests/api/test_controller_command.py -m test_150 <span class="o">&&</span> <span class="nb">unset </span>MANUALSKIP
test_150_command_remove_node_and_wait_for_user <span class="o">(</span>tests.api.test_controller_command.TestControllerCommand<span class="o">)</span> ... ok
----------------------------------------------------------------------
Ran 1 <span class="nb">test </span>in 16.031s
OK
</pre></div>
</div>
<p>You should push the inclusion button of the node before the end of the test.</p>
</div>
<div class="section" id="documentation">
<h2>Documentation</h2>
<p>Documentation is managed with sphinx.
Don’t utpdate txt files (README, INSTALL, ...), update the RST sources in docs.
Use the following commands to generate all docs files (txt, html and joomla)</p>
<p>You need to have installed python-openzwave (in either develop or install mode) before generating the documentation.</p>
<div class="highlight-bash"><div class="highlight"><pre>make docs
</pre></div>
</div>
</div>
<div class="section" id="static-vs-dynamic-or-shared">
<h2>Static vs dynamic (or shared)</h2>
<p>The openzwave (c++) lib needs to run as a singleton : it means that it MUST have only one instance of the manager running on your computer.</p>
<p>There is 2 ways of linking libraries with a program :</p>
<blockquote>
<div><ul class="simple">
<li>static : includes a copy of the library in your binary program.
This means that your program has its own instance of the library.
This the way the install.sh runs.
So you CAN’T have another program (like the control-panel) running when using the python-openzwave library</li>
<li>dynamic or shared : includes a link to the library in your binary program.
This means that your program share the library with other programs.
In this case, the instance is owned directly by the library.
This the way the debian package works. So you CAN have another program running when using the python-openzwave library.
Of course, this program MUST use the shared library too.</li>
</ul>
</div></blockquote>
</div>
<div class="section" id="about-sudo">
<h2>About sudo</h2>
<p>If you are like me and don’t like root (and sudo), you can use the following tip to install packages via pip :</p>
<p>Look at your python local library, it should looks like :</p>
<div class="highlight-bash"><div class="highlight"><pre>ls -lisa /usr/local/lib/python2.7/dist-packages/
total 2428
1445174 12 drwxrwsr-x 115 root staff 12288 avril 9 21:35 .
1445172 4 drwxrwsr-x 4 root staff 4096 mai 2 2014 ..
1457164 4 drwxr-sr-x 5 root staff 4096 nov. 26 2013 actdiag
1715480 4 drwxr-sr-x 2 root staff 4096 nov. 26 2013 actdiag-0.5.1.egg-info
1457163 4 -rw-r--r-- 1 root staff 1004 nov. 26 2013 actdiag_sphinxhelper.py
1457172 4 -rw-r--r-- 1 root staff 620 nov. 26 2013 actdiag_sphinxhelper.pyc
....
</pre></div>
</div>
<p>So, add your common user to the staff group :</p>
<div class="highlight-bash"><div class="highlight"><pre>sudo usermod -a -G staff userName
</pre></div>
</div>
<p>Add the write right to the group staff</p>
<div class="highlight-bash"><div class="highlight"><pre>sudo chmod -Rf g+w /usr/local/lib/python2.7/dist-packages/
</pre></div>
</div>
<p>And now, it’s time log off and log on. Groups are checked when you open the session.</p>
<p>You can now install your packages without sudo.</p>
</div>
<div class="section" id="python3-and-virtualenv">
<h2>Python3 and virtualenv</h2>
<p>Python 3 is actually not supported.</p>
<p>A branch (python3) has been created with a special Dockerfile. It build python-openzwave and launch some tests.
This branch is automatically merged from master at “make commit”.</p>
<p>So please, do not directly push under python3 branch. Make your developments under master or another branch.</p>
<p>It’s important for me have python2/python3 compatibilty in the master branch.
cython can help for this : <a class="reference external" href="http://docs.cython.org/src/tutorial/strings.html">http://docs.cython.org/src/tutorial/strings.html</a></p>
<p>The Makefile sill try to automatically configure your version of python (running python –version).</p>
<p>If you want to install python-openzwave in a python virtual environnement, you should use something like :</p>
<div class="highlight-bash"><div class="highlight"><pre>make <span class="nv">VIRTUAL_ENV</span><span class="o">=</span>/path/to/my/venv ...
</pre></div>
</div>
<p>If you use python 3 and your python executable is called python3 :</p>
<div class="highlight-bash"><div class="highlight"><pre>make <span class="nv">PYTHON_EXEC</span><span class="o">=</span>python3 ...
</pre></div>
</div>
<p>You can also put these variables in a CONFIG.make file instead of passing them to the command line</p>
</div>
</div>