4

Buildroot is a tool that can be used for building Linux images for embedded-system boards.

Buildroot comes with a predefined set of Python packages that can me selected from its menu.

In addition, Buildroot is added with a nice Python script that can import any package which is part of the PyPI repository, called "scanpypi".

However it seems the script is only adapted to Python2. When trying to import a newer package, errors appear, such as:

./support/scripts/scanpypi websockets -o package
buildroot package name for websockets: python-websockets
Package: python-websockets
Fetching package websockets
Downloading package websockets from https://pypi.python.org/packages/b6/12/6194aac840c65253e45a38912e318f9ac548f9ba86d75bdb8fe66841b335/websockets-4.0.1.tar.gz...
Traceback (most recent call last):
  File "./support/scripts/scanpypi", line 653, in <module>
    main()
  File "./support/scripts/scanpypi", line 604, in main
    package.load_setup()
  File "./support/scripts/scanpypi", line 250, in load_setup
    setup = imp.load_module('setup', s_file, s_path, s_desc)
  File "/tmp/scanpypi-qbY6eQ/python-websockets/websockets-4.0.1/setup.py", line 11, in <module>
TypeError: 'encoding' is an invalid keyword argument for this function

This one was failing for invalid keyword.

Also:

./support/scripts/scanpypi websocket-server -o package
buildroot package name for websocket-server: python-websocket-server
Package: python-websocket-server
Fetching package websocket-server
Downloading package websocket-server from https://pypi.python.org/packages/74/64/e86581ee7775a2e08aca530b41e1a1e3ee6b320233b1eff301dcb86d1636/websocket_server-0.4.tar.gz...
Traceback (most recent call last):
  File "./support/scripts/scanpypi", line 653, in <module>
    main()
  File "./support/scripts/scanpypi", line 604, in main
    package.load_setup()
  File "./support/scripts/scanpypi", line 247, in load_setup
    os.chdir(self.tmp_extract)
OSError: [Errno 2] No such file or directory: '/tmp/scanpypi-YXROmL/python-websocket-server/websocket-server-0.4'

This one was failing for package name containing underscore (_) instead of dash (-).

ishahak
  • 6,585
  • 5
  • 38
  • 56

1 Answers1

4

I have created a Python3 porting for scanpypi.

See https://github.com/ishahak/buildroot_scanpypi3

EDIT

By the request of @yegorich, I'm glad to inform that now scanpypi can be used for both Python 2/3!

My linked version can still be used for installing newer versions directly from GitHub.

ishahak
  • 6,585
  • 5
  • 38
  • 56
  • 2
    I've also converted scanpypi to Py3 (see this [patch](https://patchwork.ozlabs.org/patch/813447/)), but the final plan is to make scanpypi executable in both Py2 and Py3 environments. Patches are welcome! – yegorich Feb 19 '18 at 19:36
  • Well done! I have seen your work but didn't want to change my original python2 script, and didn't know your script's maturity. – ishahak Feb 19 '18 at 20:01
  • BTW I have noticed that having the package appear under ./package is not enough for seeing it within the Buildroot menu. I had to manually add a line in package/Config.in. Am I missing anything? – ishahak Feb 19 '18 at 20:03
  • 1
    You're not missing anything. For now you have to add the package to `package/Config.in` manually. – yegorich Feb 20 '18 at 07:54
  • 1
    Could you please test this [patch](http://patchwork.ozlabs.org/patch/876083/) and report your results to the BR's mailng list? Thanks. – yegorich Feb 21 '18 at 13:29
  • Could you please update your answer and state, that scanpypi can now be used with both Py2/3? Thanks. – yegorich Feb 28 '18 at 10:43