Thread: [Hamlib-developer] Python bindings for Python 3
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Phil <phi...@bi...> - 2017-02-28 02:10:34
|
I've recently resurrected some old C++ code and partially converted it to Python. I'm wondering if there is a move to rewrite the Python bindings for Python 3? -- Regards, Phil |
From: Nate B. <n0...@n0...> - 2017-02-28 02:53:56
|
* On 2017 27 Feb 20:12 -0600, Phil wrote: > I've recently resurrected some old C++ code and partially converted it > to Python. I'm wondering if there is a move to rewrite the Python > bindings for Python 3? My understanding is that the maintainer of the Arch packages has made a package for for Python3. I'm not sure if he monitors the list and would be able to present what changes were required, if any. So far I've not received any patches. 73, Nate -- "The optimist proclaims that we live in the best of all possible worlds. The pessimist fears this is true." Ham radio, Linux, bikes, and more: http://www.n0nb.us |
From: Ervin H. <ai...@gm...> - 2017-02-28 08:18:58
|
Hi Phil, On Tue, Feb 28, 2017 at 12:10:22PM +1000, Phil wrote: > I've recently resurrected some old C++ code and partially converted it > to Python. I'm wondering if there is a move to rewrite the Python > bindings for Python 3? yes, you can make the Hamlib binding for Python 3, but (as I know) only one version supported in same (compile) time. I'll see that how can we support the multiple versions. But now, here is the short intro, how can you build the binding for Python3. airween@vm:~/hamlib$ export PYTHON=/usr/bin/python3 airween@vm:~/hamlib$ autoreconf --install airween@vm:~/hamlib$ ./configure --with-python-binding ... ... airween@vm:~/hamlib$ make ... ... airween@vm:~/hamlib$ sudo make install ... ... airween@vm:~/hamlib$ cd bindings airween@vm:~/hamlib/bindings$ echo $LANG hu_HU.UTF-8 airween@vm:~/hamlib/bindings$ echo $LC_ALL C airween@vm:~/hamlib/bindings$ export LC_ALL=hu_HU.UTF-8 airween@vm:~/hamlib/bindings$ export PYTHONIOENCODING=utf-8 airween@vm:~/hamlib/bindings$ python3 py3test.py Python 3.4.2 test, Hamlib 3.2~git status(str): Command completed successfully get_conf: path = /dev/Rig, retry = 5, ITU region = 2 freq: 5700000000.0 mode: FM bandwidth: 15000 mode: CW bandwidth: 2400 ITU_region: 2 Backend copyright: LGPL Model: Dummy Manufacturer: Hamlib Backend version: 0.5 Backend license: LGPL Rig info: Nothing much (dummy) VOX level: 1 VOX level: 5 Setting AF to 12.340000.... status: 0 - Command completed successfully AF level: 12.34000015258789 strength: -23 status: 0 status(str): Command completed successfully get_channel status: 0 VFO: VFOB , 5700000000.0 Attenuators: [10, 20, 30, 0, 0, 0, 0, 0] Sending Morse, '73' Some static functions: Loc1: IN98XC -> -0.0417, 48.1042 -> IN98XC Loc2: DM33DX -> -113.7083, 33.9792 -> DM33DX Distance: 8765.814 km, azimuth 309.00, long path: 31266.186 km Longitude: -0.0417, 0° 2' 29" W recoded: -04 Latitude: 48.1042, 48° 6' 15" N recoded: 48.1042 Note, that the locale/lang environment settings need only, because my Python3 can't print the "degree" character (which is a unicode char) whithout that. May be you don't need that. I've made a new version of pytest.py for Python3, you can grab it from my Github repo: https://github.com/airween/hamlib/blob/py3/bindings/py3test.py Here is the full branch which is came from the Nate's master: https://github.com/airween/hamlib/tree/py3 Hope this helps, 73, Ervin HA2OS |
From: Phil <phi...@bi...> - 2017-02-28 09:11:09
|
On 28/02/17 18:18, Ervin Hegedüs wrote: > Hi Phil, > > On Tue, Feb 28, 2017 at 12:10:22PM +1000, Phil wrote: >> I've recently resurrected some old C++ code and partially converted it >> to Python. I'm wondering if there is a move to rewrite the Python >> bindings for Python 3? > > yes, you can make the Hamlib binding for Python 3, but (as I > know) only one version supported in same (compile) time. > > I'll see that how can we support the multiple versions. > > But now, here is the short intro, how can you build the binding > for Python3. > Thank you Ervin for the detailed information, it's been a long time since I've compiled hamlib. Instead I've taken the easy way out and installed the pre-compiled hamlib package which include the python 2 binding. -- Regards, Phil |