[OpenWrt-Devel] Question regarding call python script

Jason Wu jason.wu.misc at gmail.com
Thu Mar 10 22:49:51 EST 2016


Hi John,

There are two scripts that i am thinking about.

1. generate fitimage.its that is able to generate mufti-configuration 
its file with multiple kernel/dtb/rootfs. One of the benefit of using 
python is that it is easier to implement from my point of view. But have 
to said it can done with shell as well.

2. dts/dtb modification existing dts file. e.g append/replace a the 
existing dts parameters, or add a subnode to a node and etc, this one 
will be harder to do it in shell but it can be done with shell+awk.

In both case, i am thinking to use nested 
array(shell)/dictionary(python) to create the database. each 
array/dictionary representing a node the key benefit of using python is 
that nested dictionary is much easier to handle than bash's associated 
array.

The other reason is that I got a existing python script does similar 
thing but more specific to my own purpose. Just though it will be easier 
to modify it to suit the need with OpenWrt.

There is no reason why the script can't be implemented in shell. That's 
why i ask.

Best regards,

jason

On 11/03/2016 7:12 AM, John Crispin wrote:
>
>
> On 10/03/2016 22:11, Alexandru Ardelean wrote:
>>
>>
>> On Thu, Mar 10, 2016 at 6:38 PM, Jo-Philipp Wich <jow at openwrt.org
>> <mailto:jow at openwrt.org>> wrote:
>>
>>      Hi Jason,
>>
>>      no reason against it per se but it would introduce a new build prereq I
>>      suppose. If possible we'd like to stick to things we already require
>>      (perl, awk, shell).
>>
>>
>>      Regards, Jo
>>      _______________________________________________
>>      openwrt-devel mailing list
>>      openwrt-devel at lists.openwrt.org <mailto:openwrt-devel at lists.openwrt.org>
>>      https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>>
>>
>> As far as I know, python is already required by the OpenWRT build system.
>> The build stops if there is no /usr/bin/python (not 100% sure about this
>> anymore)
>>
>> And in rules.mk <http://rules.mk> there's
>> PYTHON:=python
>> (and this is not related in any way to the Python package in the feeds)
>>
>> So, I guess Python is fine.
>>
>
> depends on what you want to do. i dont really see anything that cannot
> be handled using shell. what exactly do you want to write in python ?
>
>
>
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list