Skip to contentSkip to conversation

genmanual: generates kconfiglib.pyc in Buildroot source tree

Buildroot Yann E. MORIN 3 participants 5 messages Dec 4, 2013 – Dec 5, 2013

lore
Share & tools
lore
#0 lore raw

Samuel, All,

When one runs 'make manual', python will create:
support/scripts/kconfiglib.pyc
in the Buildroot source tree.

Python will happily run, even if it is not able to generate that file (eg. because the source tree is read-only).

However, the file is not cleaned on 'make clean'. I'm a bit reluctant at adding it since it would try to remove a file outside of $(O), which could break parallel builds in multiple $(O) at the same time... Not sure what to do here.

Since we do not really care about speed, would it be possible to tell python not to generate it at all?

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw
Quoted 9 lines · Yann E. MORIN

Samuel, All,

When one runs 'make manual', python will create:
support/scripts/kconfiglib.pyc
in the Buildroot source tree.

Python will happily run, even if it is not able to generate that file (eg. because the source tree is read-only).

Quoted 7 lines

However, the file is not cleaned on 'make clean'. I'm a bit reluctant at adding it since it would try to remove a file outside of $(O), which could break parallel builds in multiple $(O) at the same time... Not sure what to do here.

Since we do not really care about speed, would it be possible to tell python not to generate it at all?

I do 'man python', and the first thing I see is

-B Don't write .py[co] files on import. See also PYTHONDONTWRITEBYTECODE.

I'd say, go for it! Unfortunately, you can't add it directly in the #!
line of the script because all the arguments are concatenated together. So I guess the PYTHONDONTWRITEBYTECODE environment variable should be set when calling the script.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw

Arnout, All,

On 2013-12-05 09:00 +0100, Arnout Vandecappelle spake thusly:

Quoted 15 lines · Yann E. MORIN
Quoted 14 lines

Samuel, All,

When one runs 'make manual', python will create:
support/scripts/kconfiglib.pyc
in the Buildroot source tree.

Python will happily run, even if it is not able to generate that file (eg. because the source tree is read-only).

However, the file is not cleaned on 'make clean'. I'm a bit reluctant at adding it since it would try to remove a file outside of $(O), which could break parallel builds in multiple $(O) at the same time... Not sure what to do here.

Quoted 6 lines
Quoted 2 lines

Since we do not really care about speed, would it be possible to tell python not to generate it at all?

I do 'man python', and the first thing I see is

-B Don't write .py[co] files on import. See also PYTHONDONTWRITEBYTECODE.

Hey! I read the manpage, but only greped for '\.pyc' not for this. Thanks for pointing it to me.

Quoted 4 lines

I'd say, go for it! Unfortunately, you can't add it directly in the #! line
of the script because all the arguments are concatenated together. So I guess the PYTHONDONTWRITEBYTECODE environment variable should be set when calling the script.

Patch on its way.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

Yann, Arnout, all,

2013/12/5 Yann E. MORIN <[email protected]>

Quoted 23 lines

Arnout, All,

On 2013-12-05 09:00 +0100, Arnout Vandecappelle spake thusly:

Quoted 20 lines · Yann E. MORIN
Quoted 9 lines

Samuel, All,

When one runs 'make manual', python will create:
support/scripts/kconfiglib.pyc
in the Buildroot source tree.

Python will happily run, even if it is not able to generate that file (eg. because the source tree is read-only).

Quoted 7 lines

However, the file is not cleaned on 'make clean'. I'm a bit reluctant at adding it since it would try to remove a file outside of $(O), which could break parallel builds in multiple $(O) at the same time... Not sure what to do here.

Since we do not really care about speed, would it be possible to tell python not to generate it at all?

I do 'man python', and the first thing I see is

Quoted 12 lines
Quoted 1 line

-B Don't write .py[co] files on import. See also

PYTHONDONTWRITEBYTECODE.

Hey! I read the manpage, but only greped for '\.pyc' not for this. Thanks for pointing it to me.

Quoted 1 line

I'd say, go for it! Unfortunately, you can't add it directly in the #!

line

Quoted 3 lines

of the script because all the arguments are concatenated together. So I guess the PYTHONDONTWRITEBYTECODE environment variable should be set when calling the script.

But, in manual.mk, you can explicitly call:
python -B $(TOPDIR)/support/scripts/gen-manual-lists.py

Quoted 1 line

Patch on its way.

Regards,

Signature · 4 lines
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20131205/4590a129/attachment.html>
#4 lore raw

Samuel, All,

On 2013-12-05 19:04 +0100, Samuel Martin spake thusly:

Quoted 31 lines

2013/12/5 Yann E. MORIN <[email protected]>

Quoted 29 lines

Arnout, All,

On 2013-12-05 09:00 +0100, Arnout Vandecappelle spake thusly:

Quoted 15 lines · Yann E. MORIN
Quoted 14 lines

Samuel, All,

When one runs 'make manual', python will create:
support/scripts/kconfiglib.pyc
in the Buildroot source tree.

Python will happily run, even if it is not able to generate that file (eg. because the source tree is read-only).

However, the file is not cleaned on 'make clean'. I'm a bit reluctant at adding it since it would try to remove a file outside of $(O), which could break parallel builds in multiple $(O) at the same time... Not sure what to do here.

Quoted 6 lines
Quoted 2 lines

Since we do not really care about speed, would it be possible to tell python not to generate it at all?

I do 'man python', and the first thing I see is

-B Don't write .py[co] files on import. See also

PYTHONDONTWRITEBYTECODE.

Hey! I read the manpage, but only greped for '\.pyc' not for this. Thanks for pointing it to me.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

I'd say, go for it! Unfortunately, you can't add it directly in the #!

line

Quoted 3 lines

of the script because all the arguments are concatenated together. So I guess the PYTHONDONTWRITEBYTECODE environment variable should be set when calling the script.

But, in manual.mk, you can explicitly call:
python -B $(TOPDIR)/support/scripts/gen-manual-lists.py

But currently, gen-manual-lists.py is using this sha-bang:
#!/usr/bin/env python

And the way the sha-bang is interpreted is that:
- #! <- the sha-bang
- an optional space
- the path to the interpreter

If there is a space after the interpreter, then whatever follows that space until the end of the line is passed as argv[1] to the interpreter. So, we can pass only one argument to the interpreter.

'python' is the first arg to 'env', and we can't pass any arg to python.

We could use "#!/usr/bin/python" but I don't want to change that. And passing PYTHONDONTWRITEBYTECODE is easy enough, and works (just tested it).

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'