[chirp_devel] python2/3 MemoryMap?

Dan Clemmensen
Sun Feb 17 15:53:14 PST 2019


now I'm confused (my usual state...) I am in fact running the identical
driver on both branches and it is running as part of chirpw and chirpc. I
fixed the syntax errors in run_tests on the py3 branch and stripped almost
all drivers out of the drivers directory. That's what I've been running to
pass the unit test on the py3 branch since you told me how:
dgc at vivomini /export/srcs/CHIRP3/chirp.hg/tests $ ./run_tests -d
Yaesu_FT-4XR
Failed to import /export/srcs/CHIRP3/chirp.hg/chirp/drivers/rfinder:
invalid syntax (rfinder.py, line 290)
    Yaesu FT-4XR        Clone       PASSED: All tests
    Yaesu FT-4XR        Edges       PASSED: All tests
    Yaesu FT-4XR        BruteForce  PASSED: All tests
    Yaesu FT-4XR        CopyAll     PASSED: All tests
    Yaesu FT-4XR        Banks       PASSED: All tests
    Yaesu FT-4XR        Detect      PASSED: All tests
    Yaesu FT-4XR        Settings    PASSED: All tests
----------------------------------------------------------------------
Results:
  TOTAL  : 7
  PASSED : 7
  SKIPPED: 0
  FAILED : 0
  CRASHED: 0


On Sun, Feb 17, 2019 at 3:24 PM Dan Smith via chirp_devel <
chirp_devel at intrepid.danplanet.com> wrote:

> > OK, I did in fact make my driver work on both py3 and the (py2) main
> branch. I built my image into a bytearray, then converted to bytes,
> > use MemoryMap:
> >        bytearraymmap = bytearray(radio._imagesize)
> >        readimageinto bytearray(bytearraymmap)
> >        self._mmap= memmap.MemoryMap(bytes(bytearraymmap))
>
> You might be able to run stuff against your driver in the main branch, but
> you can't run the whole app, and the run_tests.py file isn't even
> syntax-compatible under python3:
>
> > $ python3 tests/run_tests.py
> >   File "tests/run_tests.py", line 134
> >     except Exception, e:
> >                     ^
> > SyntaxError: invalid syntax
>
> > This code works in both places. The py3 version will eventually need to
> be cleaned up to use the MemoryMapBytes, simply to avoid the
> > array copy, but that's minor. We could add a stub version of
> MemoryMapBytes to py2 to simplify the transition.
>
>
> If you meant the same driver file can work on the default and py3 branch,
> then sure, that's just not what I meant.
>
> --Dan
> _______________________________________________
> chirp_devel mailing list
> chirp_devel at intrepid.danplanet.com
> http://intrepid.danplanet.com/mailman/listinfo/chirp_devel
> Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20190217/92faf9fb/attachment-0001.html 


More information about the chirp_devel mailing list