Page MenuHomeFreeBSD

[NEW PORT]: comms/py-xmodem: XMODEM protocol implementation
ClosedPublic

Authored by loader on Dec 21 2018, 7:46 AM.

Details

Summary

Proposed commit log message:

[NEW PORT]: comms/py-xmodem: XMODEM protocol implementation

Python XMODEM protocol implementation

This is a literal implementation of XMODEM.TXT, XMODEM1K.TXT and
XMODMCRC.TXT, support for YMODEM and ZMODEM is pending. YMODEM should
be fairly easy to implement as it is a hack on top of the XMODEM
protocol using sequence bytes ``0x00`` for sending file names (and some
meta data).

WWW: https://github.com/tehmaze/xmodem

Reviewed_by: koobs
Approved by: koobs (mentor)
Differential_Revision: D18626
Test Plan
  • portlint: OK (looks fine.)
  • testport: OK (poudriere: 1300004, [armv7, aarch64], 'BUILD_ALL_PYTHON_FLAVORS=1', [py27, py35, py36, py37] tested)
  • unittest: OK (

Python2.7 on aarch64: 19 passed in 15.45 seconds
Python3.5 on aarch64: 19 passed in 10.90 seconds
Python3.6 on aarch64: 19 passed in 11.77 seconds
Python3.7 on aarch64: 19 passed in 11.22 seconds
)

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Test files are missing in CHEESESHOP sdist xmodem-0.4.5.tar.gz, and GitHub is used for this port.

koobs added inline comments.
comms/py-xmodem/Makefile
11 ↗(On Diff #52211)

Please ask upstream to commit and distribute a LICENSE file

16 ↗(On Diff #52211)

Where does this come from? Is it recommended by upstream, picked by us?

This revision is now accepted and ready to land.Dec 21 2018, 10:54 AM
loader added inline comments.
comms/py-xmodem/Makefile
16 ↗(On Diff #52211)

lrzsz is required by the unit tests to verify its Python implementation:

https://github.com/tehmaze/xmodem/blob/master/test/functional/accessories.py#L14

14  def _get_recv_program():
15      bin_path = _multi_which(('rb', 'lrb'))
16      assert bin_path is not None, (
17          "program required: {0!r}.  "
18          "Try installing lrzsz package.".format(bin_path))
19      return bin_path

https://github.com/tehmaze/xmodem/blob/master/test/functional/test_xmodem.py#L70

70  def test_xmodem_send():
71      """ Using external program for receive, verify XMODEM.send(). """
72      # Given,
73      _, recv_filename = tempfile.mkstemp()
74      try:
75          proc = subprocess.Popen(
76              (recv_prog, '--xmodem', '--verbose', recv_filename),
77              stdin=subprocess.PIPE, stdout=subprocess.PIPE, bufsize=0)
78  
79          getc = functools.partial(_proc_getc, proc=proc)
80          putc = functools.partial(_proc_putc, proc=proc)
81  
82          xmodem = XMODEM(getc, putc, pad=b'\xbb')
83          stream = fill_binary_data(BytesIO())
84  
85          # Exercise,
86          status = xmodem.send(stream, timeout=5, callback=_send_callback)
87  
88          # Verify,
89          assert status is True
90          verify_binary_data(stream, padding=b'\xbb')
91          verify_binary_data(open(recv_filename, 'rb'), padding=b'\xbb')
92          proc.wait()
93          assert proc.returncode == 0
loader added inline comments.
comms/py-xmodem/Makefile
11 ↗(On Diff #52211)

Previous were just questions, thanks for commenting. Review previously (and still) accepted

This revision was automatically updated to reflect the committed changes.