How to pre-install a python module into a image?

I'm developing a router and need a python module snmp_passpersist to be pre-installed.

The original source is coded in python2, so I modified it as to adapt to python3, and need to pre-install into the product image.

I know how to install a python module onto a running live environment by means of pip and a
that come with original source, but now I'm in the buildroot env of OpenWRT.

I read through the customizing package overview, but it is for C language and binary executables.

It looks like that some more steps should be done with a python module/package instead of a cp command, e.g. compiling *.py file into *.pyc, and making a egg file with a lot of package info, etc.

Maybe it works to copy simply the egg file into the target lib folder, but I worry about there will be no version information in the PIP environment.

I want to known the correct/formal way.

after reading the above... you should check commit history for some recently added python modules, this will give a full picture

I can't understand you, Are you meaning that I should view the git history of this python module?
The last update time of this module is a few years ago.

  • search on github the openwrt / packages repo for python(3) then
  • click in commits
  • find one that adds a new module

bob is your uncle