Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] support/scripts: fix graph-depends when run with python3
@ 2016-04-17 21:41 Samuel Martin
  2016-04-17 22:32 ` Arnout Vandecappelle
  2016-04-18  9:35 ` Thomas Petazzoni
  0 siblings, 2 replies; 3+ messages in thread
From: Samuel Martin @ 2016-04-17 21:41 UTC (permalink / raw)
  To: buildroot

Make graph-depends script opening the output file in text mode since
only ascii characters will be written.

This change fixes the following error occuring when the default host
python interpreter is python3:

  make: Entering directory '/opt/buildroot'
  Getting targets
  Getting dependencies for ['toolchain-external', 'toolchain', 'busybox', ...]
  Getting dependencies for ['host-python3', 'host-pkgconf', 'host-gettext', ...]
  Getting dependencies for ['host-libxml2', 'host-swig', 'host-m4', ...]
  Getting version for ['toolchain-external', 'toolchain', 'busybox', ...]
  Traceback (most recent call last):
    File "/opt/buildroot/support/scripts/graph-depends", line 425, in <module>
      outfile.write("digraph G {\n")
  TypeError: a bytes-like object is required, not 'str'
  Makefile:807: recipe for target 'graph-depends' failed
  make[1]: *** [graph-depends] Error 1
  Makefile:84: recipe for target '_all' failed
  make: *** [_all] Error 2
  make: Leaving directory '/opt/buildroot'

While with python2, adding 'b' to the openning mode has no effect on
Linux (c.f. [2]), the above error is expected with python3 (c.f. [1]).

Therefore, just open the outfile in default (i.e. text) mode.

[1] https://docs.python.org/3/library/functions.html#open
[2] https://docs.python.org/2/library/functions.html#open

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
 support/scripts/graph-depends | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
index a00eb9d..cb00383 100755
--- a/support/scripts/graph-depends
+++ b/support/scripts/graph-depends
@@ -73,7 +73,7 @@ else:
     if check_only:
         sys.stderr.write("don't specify outfile and check-only at the same time\n")
         sys.exit(1)
-    outfile = open(args.outfile, "wb")
+    outfile = open(args.outfile, "w")
 
 if args.package is None:
     mode = MODE_FULL
-- 
2.8.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] support/scripts: fix graph-depends when run with python3
  2016-04-17 21:41 [Buildroot] [PATCH] support/scripts: fix graph-depends when run with python3 Samuel Martin
@ 2016-04-17 22:32 ` Arnout Vandecappelle
  2016-04-18  9:35 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Arnout Vandecappelle @ 2016-04-17 22:32 UTC (permalink / raw)
  To: buildroot

On 04/17/16 23:41, Samuel Martin wrote:
> Make graph-depends script opening the output file in text mode since
> only ascii characters will be written.
>
> This change fixes the following error occuring when the default host
> python interpreter is python3:
>
>    make: Entering directory '/opt/buildroot'
>    Getting targets
>    Getting dependencies for ['toolchain-external', 'toolchain', 'busybox', ...]
>    Getting dependencies for ['host-python3', 'host-pkgconf', 'host-gettext', ...]
>    Getting dependencies for ['host-libxml2', 'host-swig', 'host-m4', ...]
>    Getting version for ['toolchain-external', 'toolchain', 'busybox', ...]
>    Traceback (most recent call last):
>      File "/opt/buildroot/support/scripts/graph-depends", line 425, in <module>
>        outfile.write("digraph G {\n")
>    TypeError: a bytes-like object is required, not 'str'
>    Makefile:807: recipe for target 'graph-depends' failed
>    make[1]: *** [graph-depends] Error 1
>    Makefile:84: recipe for target '_all' failed
>    make: *** [_all] Error 2
>    make: Leaving directory '/opt/buildroot'
>
> While with python2, adding 'b' to the openning mode has no effect on
> Linux (c.f. [2]), the above error is expected with python3 (c.f. [1]).
>
> Therefore, just open the outfile in default (i.e. text) mode.
>
> [1] https://docs.python.org/3/library/functions.html#open
> [2] https://docs.python.org/2/library/functions.html#open
>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

  Regards,
  Arnout

> ---
>   support/scripts/graph-depends | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
> index a00eb9d..cb00383 100755
> --- a/support/scripts/graph-depends
> +++ b/support/scripts/graph-depends
> @@ -73,7 +73,7 @@ else:
>       if check_only:
>           sys.stderr.write("don't specify outfile and check-only at the same time\n")
>           sys.exit(1)
> -    outfile = open(args.outfile, "wb")
> +    outfile = open(args.outfile, "w")
>
>   if args.package is None:
>       mode = MODE_FULL
>


-- 
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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] support/scripts: fix graph-depends when run with python3
  2016-04-17 21:41 [Buildroot] [PATCH] support/scripts: fix graph-depends when run with python3 Samuel Martin
  2016-04-17 22:32 ` Arnout Vandecappelle
@ 2016-04-18  9:35 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2016-04-18  9:35 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 17 Apr 2016 23:41:48 +0200, Samuel Martin wrote:
> Make graph-depends script opening the output file in text mode since
> only ascii characters will be written.
> 
> This change fixes the following error occuring when the default host
> python interpreter is python3:
> 
>   make: Entering directory '/opt/buildroot'
>   Getting targets
>   Getting dependencies for ['toolchain-external', 'toolchain', 'busybox', ...]
>   Getting dependencies for ['host-python3', 'host-pkgconf', 'host-gettext', ...]
>   Getting dependencies for ['host-libxml2', 'host-swig', 'host-m4', ...]
>   Getting version for ['toolchain-external', 'toolchain', 'busybox', ...]
>   Traceback (most recent call last):
>     File "/opt/buildroot/support/scripts/graph-depends", line 425, in <module>
>       outfile.write("digraph G {\n")
>   TypeError: a bytes-like object is required, not 'str'
>   Makefile:807: recipe for target 'graph-depends' failed
>   make[1]: *** [graph-depends] Error 1
>   Makefile:84: recipe for target '_all' failed
>   make: *** [_all] Error 2
>   make: Leaving directory '/opt/buildroot'
> 
> While with python2, adding 'b' to the openning mode has no effect on
> Linux (c.f. [2]), the above error is expected with python3 (c.f. [1]).
> 
> Therefore, just open the outfile in default (i.e. text) mode.
> 
> [1] https://docs.python.org/3/library/functions.html#open
> [2] https://docs.python.org/2/library/functions.html#open
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> ---
>  support/scripts/graph-depends | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-18  9:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-17 21:41 [Buildroot] [PATCH] support/scripts: fix graph-depends when run with python3 Samuel Martin
2016-04-17 22:32 ` Arnout Vandecappelle
2016-04-18  9:35 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox