How does Inline Python Variable Expansion work?

naseeam
naseeam used Ask the Experts™
on
Attached is a section from "BitBake User's Manual" that uses inline Python variable expansion to set variables.
Please explain in detail how the DATE variable is set.
python.PNG
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Engineer
Distinguished Expert 2018
Commented:
1:   the ${@......} items are from something else, nothing to do with python... (bitbake maybe..?)...

This is the python part:     time.strftime('%Y%m%d', time.gmtime())
time is a module, containing the member function  strftime.
Which expects   a format string and a date structure.

The datastructure is provided by the time module's  gmtime() function , which returns the current time as GMT timezone time.
So the time.gmtime() is called its return value and the format string are then fed to the time.strftime() function.
Which yields  in this case datestamp  of Year, Month, Date.

See also: https://www.tutorialspoint.com/python/time_strftime.htm  etc.

Author

Commented:
Thank you for detailed explanation.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial