Makefile example for python and python modules

Hello,

I want to create a package which in the essence is an init-script wrapper for the python (2.x) app which requires some modules. Is there an existing package which Makefile I could use as an example to:

  1. Grab the python package code, either a tar.gz release or clone the master from github and move it somewhere on the router?
  2. Grab each required python module (there's about a dozen) and install it on the router?

Also, when I do procd_set_param command python script.py, the /etc/init.d/servicename stop doesn't actually kill that python process. Is there something I should do inside stop_service or set the procd_set_param differently?

Thanks!

Hi @stangri ,
I normally have a look at the Makefiles in the packages from "packages" starting with "python-" in the lang directory for example lang/python3-bottle/Makefile.
I'm pretty sure you will either need to either:

  • install pip to pull down packages for example using a requirement file (will only work for modules that are entirely written in python)
  • or create a Makefile for each of your dependencies and use the DEPENDS part of your Makefile (will be needed if your modules need compiling)

Also, regarding the command script, I shebang the python interpreter, make sure the main file is executable and call it directly.
Hope that helps!

2 Likes