Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] Fix PYC-only installation for Python3
@ 2013-01-27 19:03 Daniel Nelson
  2013-01-27 22:42 ` Arnout Vandecappelle
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Daniel Nelson @ 2013-01-27 19:03 UTC (permalink / raw)
  To: buildroot

All,

This is my first buildroot/open source submission. I'd appreciate some feedback.

Python3 changes the behavior of .pyc caching, breaking the PYC-only option in buildroot. The details are in http://www.python.org/dev/peps/pep-3147

I've added a configure flag to Python3, and corresponding logic in buildroot.

Thoughts?

Thanks,

Daniel Nelson

---
 ...ython3-3.3-012-support-pre-pep3147-stdlib.patch | 121 +++++++++++++++++++++
 package/python3/python3.mk                         |   4 +
 2 files changed, 125 insertions(+)
 create mode 100644 package/python3/python3-3.3-012-support-pre-pep3147-stdlib.patch

diff --git a/package/python3/python3-3.3-012-support-pre-pep3147-stdlib.patch b/package/python3/python3-3.3-012-support-pre-pep3147-stdlib.patch
new file mode 100644
index 0000000..fadd5e1
--- /dev/null
+++ b/package/python3/python3-3.3-012-support-pre-pep3147-stdlib.patch
@@ -0,0 +1,121 @@
+--- python3-3.3.0/configure.ac	2013-01-26 19:12:56.446601796 -0800
++++ python3-3.3.0-new/configure.ac	2013-01-26 19:11:31.632687123 -0800
+@@ -1827,6 +1828,28 @@
+     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
+ esac
+ 
++STDLIB_CACHE_FLAGS=
++STDLIB_CACHE_TYPE=pep3147
++AC_MSG_CHECKING(for --with-stdlib-cache)
++AC_ARG_WITH(stdlib-cache,
++    AS_HELP_STRING([--with-stdlib-cache=type], [select type of stdlib cache ("pep3147", or "old")]),
++[
++	AC_MSG_RESULT($withval)
++    STDLIB_CACHE_TYPE=$withval
++],
++[
++ 	AC_MSG_RESULT(${STDLIB_CACHE_TYPE})
++])
++case $STDLIB_CACHE_TYPE in
++    pep3147)
++        STDLIB_CACHE_FLAGS="" 
++        ;;
++    old)
++        STDLIB_CACHE_FLAGS="-b"
++        ;;
++esac
++AC_SUBST(STDLIB_CACHE_FLAGS)
++
+ AC_MSG_CHECKING(for --enable-framework)
+ if test "$enable_framework"
+ then
+--- python3-3.3.0/configure	2012-09-29 01:00:50.000000000 -0700
++++ python3-3.3.0-new/configure	2013-01-26 19:11:38.562839350 -0800
+@@ -633,6 +653,7 @@
+ LDCXXSHARED
+ LDSHARED
+ SO
++STDLIB_CACHE_FLAGS
+ LIBTOOL_CRUFT
+ OTHER_LIBTOOL_OPT
+ UNIVERSAL_ARCH_FLAGS
+@@ -765,6 +787,7 @@
+ enable_shared
+ enable_profiling
+ with_pydebug
++with_stdlib_cache
+ with_libs
+ with_system_expat
+ with_system_ffi
+@@ -1437,6 +1458,8 @@
+                           compiler
+   --with-suffix=.exe      set executable suffix
+   --with-pydebug          build with Py_DEBUG defined
++  --with-stdlib-cache=type
++                          select type of stdlib cache ("pep3147", or "old")
+   --with-libs='lib1 ...'  link against additional libs
+   --with-system-expat     build pyexpat module using an installed expat
+                           library
+@@ -8246,6 +8290,35 @@
+     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
+ esac
+ 
++STDLIB_CACHE_FLAGS=
++STDLIB_CACHE_TYPE=pep3147
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-stdlib-cache" >&5
++$as_echo_n "checking for --with-stdlib-cache... " >&6; }
++
++# Check whether --with-stdlib-cache was given.
++if test "${with_stdlib_cache+set}" = set; then :
++  withval=$with_stdlib_cache;
++	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
++$as_echo "$withval" >&6; }
++    STDLIB_CACHE_TYPE=$withval
++
++else
++
++ 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${STDLIB_CACHE_TYPE}" >&5
++$as_echo "${STDLIB_CACHE_TYPE}" >&6; }
++
++fi
++
++case $STDLIB_CACHE_TYPE in
++    pep3147)
++        STDLIB_CACHE_FLAGS=""
++        ;;
++    old)
++        STDLIB_CACHE_FLAGS="-b"
++        ;;
++esac
++
++
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-framework" >&5
+ $as_echo_n "checking for --enable-framework... " >&6; }
+ if test "$enable_framework"
+--- python3-3.3.0/Makefile.pre.in	2013-01-26 19:12:56.438601609 -0800
++++ python3-3.3.0-new/Makefile.pre.in	2013-01-26 19:10:22.466167415 -0800
+@@ -143,6 +143,9 @@
+ # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
+ OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
+ 
++# Option to enable old-style precompiled stdlib
++STDLIB_CACHE_FLAGS=@STDLIB_CACHE_FLAGS@
++
+ # Environment to run shared python without installed libraries
+ RUNSHARED=       @RUNSHARED@
+ 
+@@ -1079,12 +1082,12 @@
+ 	fi
+ 	-PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+ 		$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+-		-d $(LIBDEST) -f \
++		-d $(LIBDEST) -f $(STDLIB_CACHE_FLAGS) \
+ 		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+ 		$(DESTDIR)$(LIBDEST)
+ 	-PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+ 		$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+-		-d $(LIBDEST)/site-packages -f \
++		-d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
+ 		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+ 	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ 		$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
diff --git a/package/python3/python3.mk b/package/python3/python3.mk
index e7c0983..51fed51 100644
--- a/package/python3/python3.mk
+++ b/package/python3/python3.mk
@@ -70,6 +70,10 @@ else
 PYTHON3_CONF_OPT += --with-expat=none
 endif
 
+ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
+PYTHON3_CONF_OPT += --with-stdlib-cache=old
+endif
+
 ifeq ($(BR2_PACKAGE_PYTHON3_SQLITE),y)
 PYTHON3_DEPENDENCIES += sqlite
 endif
-- 
1.8.1

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

* [Buildroot] [PATCH] Fix PYC-only installation for Python3
  2013-01-27 19:03 [Buildroot] [PATCH] Fix PYC-only installation for Python3 Daniel Nelson
@ 2013-01-27 22:42 ` Arnout Vandecappelle
  2013-01-27 22:52   ` Daniel N
  2013-01-27 23:36 ` Arnout Vandecappelle
  2013-01-28  1:38 ` [Buildroot] [PATCHv2] python3: Fix pyc-only related runtime exceptions Daniel Nelson
  2 siblings, 1 reply; 9+ messages in thread
From: Arnout Vandecappelle @ 2013-01-27 22:42 UTC (permalink / raw)
  To: buildroot

On 27/01/13 20:03, Daniel Nelson wrote:
> All,
> 
> This is my first buildroot/open source submission. I'd appreciate some feedback.
> 
> Python3 changes the behavior of .pyc caching, breaking the PYC-only option in buildroot. The details are inhttp://www.python.org/dev/peps/pep-3147
> 
> I've added a configure flag to Python3, and corresponding logic in buildroot.

 Hasn't this been fixed in git 6ffab129 ?

 Regards,
 Arnout

commit 6ffab129a3ebc76caf7ae40caf1f6b0185f3e114
Author: Maxime Ripard <maxime.ripard@free-electrons.com>
Date:   Fri Jan 18 04:06:14 2013 +0000

    python3: Handle properly the pyc and py files on the target
    
    Fixes #5690
    
    Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
    Acked-by: Samuel Martin <s.martin49@gmail.com>
    Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>

diff --git a/package/python3/python3.mk b/package/python3/python3.mk
index 0d54162..e7c0983 100644
--- a/package/python3/python3.mk
+++ b/package/python3/python3.mk
@@ -155,5 +155,27 @@ endef
 ifneq ($(BR2_PACKAGE_PYTHON),y)
 PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_INSTALL_SYMLINK
 endif
+
+ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY),y)
+define PYTHON3_REMOVE_MODULES_FILES
+       for i in `find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) \
+                -name __pycache__` ; do \
+               rm -rf $$i ; \
+       done
+endef
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
+define PYTHON3_REMOVE_MODULES_FILES
+       for i in `find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) \
+                -name *.py` ; do \
+               rm -f $$i ; \
+       done
+endef
+endif
+
+PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_REMOVE_MODULES_FILES
+
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))


-- 
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

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

* [Buildroot] [PATCH] Fix PYC-only installation for Python3
  2013-01-27 22:42 ` Arnout Vandecappelle
@ 2013-01-27 22:52   ` Daniel N
  2013-01-27 23:15     ` Arnout Vandecappelle
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel N @ 2013-01-27 22:52 UTC (permalink / raw)
  To: buildroot

Arnout,

Not quite. The commit you reference _does_ remove .py files on PYC_ONLY
installations, but the logic in python3 will not look for a .pyc file in
the __pycache__ directory if the parent .py file is not present. Thus, in
its current incarnation, the PYC_ONLY option breaks python3 at runtime.

python3 does fall back to looking for a .pyc file in the directory that it
expects the .py to be in.

http://www.python.org/dev/peps/pep-3147/#flow-chart

Daniel


On Sun, Jan 27, 2013 at 2:42 PM, Arnout Vandecappelle <arnout@mind.be>wrote:

> On 27/01/13 20:03, Daniel Nelson wrote:
> > All,
> >
> > This is my first buildroot/open source submission. I'd appreciate some
> feedback.
> >
> > Python3 changes the behavior of .pyc caching, breaking the PYC-only
> option in buildroot. The details are inhttp://
> www.python.org/dev/peps/pep-3147
> >
> > I've added a configure flag to Python3, and corresponding logic in
> buildroot.
>
>  Hasn't this been fixed in git 6ffab129 ?
>
>  Regards,
>  Arnout
>
> commit 6ffab129a3ebc76caf7ae40caf1f6b0185f3e114
> Author: Maxime Ripard <maxime.ripard@free-electrons.com>
> Date:   Fri Jan 18 04:06:14 2013 +0000
>
>     python3: Handle properly the pyc and py files on the target
>
>     Fixes #5690
>
>     Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>     Acked-by: Samuel Martin <s.martin49@gmail.com>
>     Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
>
> diff --git a/package/python3/python3.mk b/package/python3/python3.mk
> index 0d54162..e7c0983 100644
> --- a/package/python3/python3.mk
> +++ b/package/python3/python3.mk
> @@ -155,5 +155,27 @@ endef
>  ifneq ($(BR2_PACKAGE_PYTHON),y)
>  PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_INSTALL_SYMLINK
>  endif
> +
> +ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY),y)
> +define PYTHON3_REMOVE_MODULES_FILES
> +       for i in `find
> $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) \
> +                -name __pycache__` ; do \
> +               rm -rf $$i ; \
> +       done
> +endef
> +endif
> +
> +ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
> +define PYTHON3_REMOVE_MODULES_FILES
> +       for i in `find
> $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) \
> +                -name *.py` ; do \
> +               rm -f $$i ; \
> +       done
> +endef
> +endif
> +
> +PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_REMOVE_MODULES_FILES
> +
> +
>  $(eval $(autotools-package))
>  $(eval $(host-autotools-package))
>
>
> --
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130127/0ee59202/attachment.html>

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

* [Buildroot] [PATCH] Fix PYC-only installation for Python3
  2013-01-27 22:52   ` Daniel N
@ 2013-01-27 23:15     ` Arnout Vandecappelle
  0 siblings, 0 replies; 9+ messages in thread
From: Arnout Vandecappelle @ 2013-01-27 23:15 UTC (permalink / raw)
  To: buildroot

On 27/01/13 23:52, Daniel N wrote:
> Arnout,
>
> Not quite. The commit you reference _does_ remove .py files on PYC_ONLY
> installations, but the logic in python3 will not look for a .pyc file in
> the __pycache__ directory if the parent .py file is not present. Thus, in
> its current incarnation, the PYC_ONLY option breaks python3 at runtime.
>
> python3 does fall back to looking for a .pyc file in the directory that
> it expects the .py to be in.
>
> http://www.python.org/dev/peps/pep-3147/#flow-chart

  Okay, in that case your patch looks good.


  Regards,
  Arnout

  PS Please avoid top-posting.

>
> Daniel
>
>
> On Sun, Jan 27, 2013 at 2:42 PM, Arnout Vandecappelle <arnout@mind.be
> <mailto:arnout@mind.be>> wrote:
>
>     On 27/01/13 20:03, Daniel Nelson wrote:
>      > All,
>      >
>      > This is my first buildroot/open source submission. I'd appreciate
>     some feedback.
>      >
>      > Python3 changes the behavior of .pyc caching, breaking the
>     PYC-only option in buildroot. The details are
>     inhttp://www.python.org/dev/peps/pep-3147
>     <http://www.python.org/dev/peps/pep-3147>
>      >
>      > I've added a configure flag to Python3, and corresponding logic in
>     buildroot.
>
>       Hasn't this been fixed in git 6ffab129 ?
[snip]


-- 
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

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

* [Buildroot] [PATCH] Fix PYC-only installation for Python3
  2013-01-27 19:03 [Buildroot] [PATCH] Fix PYC-only installation for Python3 Daniel Nelson
  2013-01-27 22:42 ` Arnout Vandecappelle
@ 2013-01-27 23:36 ` Arnout Vandecappelle
  2013-01-27 23:43   ` Daniel N
  2013-01-28  1:38 ` [Buildroot] [PATCHv2] python3: Fix pyc-only related runtime exceptions Daniel Nelson
  2 siblings, 1 reply; 9+ messages in thread
From: Arnout Vandecappelle @ 2013-01-27 23:36 UTC (permalink / raw)
  To: buildroot

On 27/01/13 20:03, Daniel Nelson wrote:
> All,
>
> This is my first buildroot/open source submission. I'd appreciate some feedback.
>
> Python3 changes the behavior of .pyc caching, breaking the PYC-only option in buildroot. The details are in http://www.python.org/dev/peps/pep-3147
>
> I've added a configure flag to Python3, and corresponding logic in buildroot.
>
> Thoughts?
>
> Thanks,
>
> Daniel Nelson

  This message will end up in the git log, but it's not appropriate for 
that. Please create a proper commit message, and make sure it is 
line-wrapped at 80 columns. If you want to give additional comments  that 
should not go into the git log (like the 'this is my first open source 
submission'), add them below the ---.

  Also, we require you to add a Signed-off-by line for yourself. This is 
a short way for you to assert that you are entitled to contribute the 
patch under buildroot's GPL license. See
http://elinux.org/Developer_Certificate_Of_Origin
for more details.


  More minor comments below - but they're just optional, so:
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
  (untested)

(If you repost this patch, with or without the proposed modifications, 
you can add my Acked-by line below your Signed-off-by line.)


> ---
>   ...ython3-3.3-012-support-pre-pep3147-stdlib.patch | 121 +++++++++++++++++++++
>   package/python3/python3.mk                         |   4 +
>   2 files changed, 125 insertions(+)
>   create mode 100644 package/python3/python3-3.3-012-support-pre-pep3147-stdlib.patch
>
> diff --git a/package/python3/python3-3.3-012-support-pre-pep3147-stdlib.patch b/package/python3/python3-3.3-012-support-pre-pep3147-stdlib.patch
> new file mode 100644
> index 0000000..fadd5e1
> --- /dev/null
> +++ b/package/python3/python3-3.3-012-support-pre-pep3147-stdlib.patch
> @@ -0,0 +1,121 @@
> +--- python3-3.3.0/configure.ac	2013-01-26 19:12:56.446601796 -0800
> ++++ python3-3.3.0-new/configure.ac	2013-01-26 19:11:31.632687123 -0800
> +@@ -1827,6 +1828,28 @@
> +     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
> + esac
> +
> ++STDLIB_CACHE_FLAGS=
> ++STDLIB_CACHE_TYPE=pep3147
> ++AC_MSG_CHECKING(for --with-stdlib-cache)
> ++AC_ARG_WITH(stdlib-cache,

  Since there are only two options, an AC_ARG_ENABLE seems more 
appropriate. That also makes the implementation slightly smaller because 
you don't need the STDLIB_CACHE_TYPE, just:

AC_ARG_ENABLE(old-stdlib-cache,
     AS_HELP_STRING(...),
     [
     if [ "$enableval" = "yes" ]; then
        STDLIB_CACHE_FLAGS="-b"
     else
        STDLIB_CACHE_FLAGS=""
     fi
     ],
     [STDLIB_CACHE_FLAGS=""])

> ++    AS_HELP_STRING([--with-stdlib-cache=type], [select type of stdlib cache ("pep3147", or "old")]),
> ++[
> ++	AC_MSG_RESULT($withval)
> ++    STDLIB_CACHE_TYPE=$withval
> ++],
> ++[
> ++ 	AC_MSG_RESULT(${STDLIB_CACHE_TYPE})
> ++])
> ++case $STDLIB_CACHE_TYPE in
> ++    pep3147)
> ++        STDLIB_CACHE_FLAGS=""
> ++        ;;
> ++    old)
> ++        STDLIB_CACHE_FLAGS="-b"
> ++        ;;
> ++esac
> ++AC_SUBST(STDLIB_CACHE_FLAGS)
> ++
> + AC_MSG_CHECKING(for --enable-framework)
> + if test "$enable_framework"
> + then
> +--- python3-3.3.0/configure	2012-09-29 01:00:50.000000000 -0700
> ++++ python3-3.3.0-new/configure	2013-01-26 19:11:38.562839350 -0800

  Since we run autoreconf, it's not necessary to patch the configure 
script - it will anyway be overwritten.



  Regards,
  Arnout

[snip]


-- 
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

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

* [Buildroot] [PATCH] Fix PYC-only installation for Python3
  2013-01-27 23:36 ` Arnout Vandecappelle
@ 2013-01-27 23:43   ` Daniel N
  2013-01-27 23:49     ` Arnout Vandecappelle
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel N @ 2013-01-27 23:43 UTC (permalink / raw)
  To: buildroot

On Sun, Jan 27, 2013 at 3:36 PM, Arnout Vandecappelle <arnout@mind.be>wrote:

> On 27/01/13 20:03, Daniel Nelson wrote:
>
>> All,
>>
>> This is my first buildroot/open source submission. I'd appreciate some
>> feedback.
>>
>> Python3 changes the behavior of .pyc caching, breaking the PYC-only
>> option in buildroot. The details are in http://www.python.org/dev/**
>> peps/pep-3147 <http://www.python.org/dev/peps/pep-3147>
>>
>> I've added a configure flag to Python3, and corresponding logic in
>> buildroot.
>>
>> Thoughts?
>>
>> Thanks,
>>
>> Daniel Nelson
>>
>
>  This message will end up in the git log, but it's not appropriate for
> that. Please create a proper commit message, and make sure it is
> line-wrapped at 80 columns. If you want to give additional comments  that
> should not go into the git log (like the 'this is my first open source
> submission'), add them below the ---.
>
>  Also, we require you to add a Signed-off-by line for yourself. This is a
> short way for you to assert that you are entitled to contribute the patch
> under buildroot's GPL license. See
> http://elinux.org/Developer_**Certificate_Of_Origin<http://elinux.org/Developer_Certificate_Of_Origin>
> for more details.
>
>
I edited the patch file before `git send-email` to include the above text,
so the above text will not be in the commit message. I'll provide a correct
commit message in the next version of the patch.


>
>  More minor comments below - but they're just optional, so:
> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
>  (untested)
>
> (If you repost this patch, with or without the proposed modifications, you
> can add my Acked-by line below your Signed-off-by line.)


I will. Thanks.


>
>
>
>  ---
>>   ...ython3-3.3-012-support-pre-**pep3147-stdlib.patch | 121
>> +++++++++++++++++++++
>>   package/python3/python3.mk                         |   4 +
>>   2 files changed, 125 insertions(+)
>>   create mode 100644 package/python3/python3-3.3-**
>> 012-support-pre-pep3147-**stdlib.patch
>>
>> diff --git a/package/python3/python3-3.3-**012-support-pre-pep3147-**stdlib.patch
>> b/package/python3/python3-3.3-**012-support-pre-pep3147-**stdlib.patch
>> new file mode 100644
>> index 0000000..fadd5e1
>> --- /dev/null
>> +++ b/package/python3/python3-3.3-**012-support-pre-pep3147-**
>> stdlib.patch
>> @@ -0,0 +1,121 @@
>> +--- python3-3.3.0/configure.ac 2013-01-26 19:12:56.446601796 -0800
>> ++++ python3-3.3.0-new/configure.ac     2013-01-26 19:11:31.632687123
>> -0800
>> +@@ -1827,6 +1828,28 @@
>> +     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION)
>> -current_version $(VERSION)';;
>> + esac
>> +
>> ++STDLIB_CACHE_FLAGS=
>> ++STDLIB_CACHE_TYPE=pep3147
>> ++AC_MSG_CHECKING(for --with-stdlib-cache)
>> ++AC_ARG_WITH(stdlib-cache,
>>
>
>  Since there are only two options, an AC_ARG_ENABLE seems more
> appropriate. That also makes the implementation slightly smaller because
> you don't need the STDLIB_CACHE_TYPE, just:
>
> AC_ARG_ENABLE(old-stdlib-**cache,
>     AS_HELP_STRING(...),
>     [
>     if [ "$enableval" = "yes" ]; then
>        STDLIB_CACHE_FLAGS="-b"
>     else
>        STDLIB_CACHE_FLAGS=""
>     fi
>     ],
>     [STDLIB_CACHE_FLAGS=""])
>
>
Will do.


>
>  ++    AS_HELP_STRING([--with-stdlib-**cache=type], [select type of
>> stdlib cache ("pep3147", or "old")]),
>> ++[
>> ++      AC_MSG_RESULT($withval)
>> ++    STDLIB_CACHE_TYPE=$withval
>> ++],
>> ++[
>> ++      AC_MSG_RESULT(${STDLIB_CACHE_**TYPE})
>> ++])
>> ++case $STDLIB_CACHE_TYPE in
>> ++    pep3147)
>> ++        STDLIB_CACHE_FLAGS=""
>> ++        ;;
>> ++    old)
>> ++        STDLIB_CACHE_FLAGS="-b"
>> ++        ;;
>> ++esac
>> ++AC_SUBST(STDLIB_CACHE_FLAGS)
>> ++
>> + AC_MSG_CHECKING(for --enable-framework)
>> + if test "$enable_framework"
>> + then
>> +--- python3-3.3.0/configure    2012-09-29 01:00:50.000000000 -0700
>> ++++ python3-3.3.0-new/configure        2013-01-26 19:11:38.562839350
>> -0800
>>
>
>  Since we run autoreconf, it's not necessary to patch the configure script
> - it will anyway be overwritten.
>
>
Acked. I'll make the modifications and resubmit.

Thanks,

Daniel


>
>
>  Regards,
>  Arnout
>
>
> [snip]
>
>
> --
> 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<http://www.linkedin.com/in/arnoutvandecappelle>
> GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130127/64a1b71e/attachment.html>

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

* [Buildroot] [PATCH] Fix PYC-only installation for Python3
  2013-01-27 23:43   ` Daniel N
@ 2013-01-27 23:49     ` Arnout Vandecappelle
  0 siblings, 0 replies; 9+ messages in thread
From: Arnout Vandecappelle @ 2013-01-27 23:49 UTC (permalink / raw)
  To: buildroot

On 28/01/13 00:43, Daniel N wrote:
> Acked. I'll make the modifications and resubmit.

  Could you also CC
Maxime Ripard <maxime.ripard@free-electrons.com>

He has done the most work on python3 so he should be able to runtime test 
it (I can do a compile test but that doesn't help much).

  Regards,
  Arnout

-- 
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

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

* [Buildroot] [PATCHv2] python3: Fix pyc-only related runtime exceptions
  2013-01-27 19:03 [Buildroot] [PATCH] Fix PYC-only installation for Python3 Daniel Nelson
  2013-01-27 22:42 ` Arnout Vandecappelle
  2013-01-27 23:36 ` Arnout Vandecappelle
@ 2013-01-28  1:38 ` Daniel Nelson
  2013-01-28 21:04   ` Peter Korsgaard
  2 siblings, 1 reply; 9+ messages in thread
From: Daniel Nelson @ 2013-01-28  1:38 UTC (permalink / raw)
  To: buildroot

Python3 changes the pyc lookup strategy, ignoring the
__pycache__ directory if the .py file is missing. Change
install location to enable use of .pyc without their parent .py

See http://www.python.org/dev/peps/pep-3147

Signed-off-by: Daniel Nelson <daniel@sigpwr.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
  (untested)
---
 .../python3/python3-3.3-012-old-stdlib-cache.patch | 53 ++++++++++++++++++++++
 package/python3/python3.mk                         |  4 ++
 2 files changed, 57 insertions(+)
 create mode 100644 package/python3/python3-3.3-012-old-stdlib-cache.patch

diff --git a/package/python3/python3-3.3-012-old-stdlib-cache.patch b/package/python3/python3-3.3-012-old-stdlib-cache.patch
new file mode 100644
index 0000000..23171d5
--- /dev/null
+++ b/package/python3/python3-3.3-012-old-stdlib-cache.patch
@@ -0,0 +1,53 @@
+--- python3-3.3.0/configure.ac	2013-01-27 16:35:52.429067797 -0800
++++ python3-3.3.0/configure.ac	2013-01-27 16:43:43.528601443 -0800
+@@ -1827,6 +1827,23 @@
+     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
+ esac
+ 
++STDLIB_CACHE_FLAGS=
++AC_MSG_CHECKING(for --enable-old-stdlib-cache)
++AC_ARG_ENABLE(old-stdlib-cache,
++    AS_HELP_STRING([--enable-old-stdlib-cache], [enable pre-pep3147 stdlib cache]),
++[
++    if test "$enableval" = "yes"
++    then
++        STDLIB_CACHE_FLAGS="-b"
++    else
++        STDLIB_CACHE_FLAGS="" 
++    fi
++],
++[
++    STDLIB_CACHE_FLAGS="" 
++])
++AC_SUBST(STDLIB_CACHE_FLAGS)
++
+ AC_MSG_CHECKING(for --enable-framework)
+ if test "$enable_framework"
+ then
+--- python3-3.3.0/Makefile.pre.in	2013-01-27 16:35:52.422067642 -0800
++++ python3-3.3.0/Makefile.pre.in	2013-01-27 16:37:03.710650439 -0800
+@@ -143,6 +143,9 @@
+ # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
+ OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
+ 
++# Option to enable old-style precompiled stdlib
++STDLIB_CACHE_FLAGS=@STDLIB_CACHE_FLAGS@
++
+ # Environment to run shared python without installed libraries
+ RUNSHARED=       @RUNSHARED@
+ 
+@@ -1079,12 +1082,12 @@
+ 	fi
+ 	-PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+ 		$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+-		-d $(LIBDEST) -f \
++		-d $(LIBDEST) -f $(STDLIB_CACHE_FLAGS) \
+ 		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+ 		$(DESTDIR)$(LIBDEST)
+ 	-PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+ 		$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+-		-d $(LIBDEST)/site-packages -f \
++		-d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
+ 		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+ 	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ 		$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
diff --git a/package/python3/python3.mk b/package/python3/python3.mk
index e7c0983..7551a7b 100644
--- a/package/python3/python3.mk
+++ b/package/python3/python3.mk
@@ -70,6 +70,10 @@ else
 PYTHON3_CONF_OPT += --with-expat=none
 endif
 
+ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
+PYTHON3_CONF_OPT += --enable-old-stdlib-cache
+endif
+
 ifeq ($(BR2_PACKAGE_PYTHON3_SQLITE),y)
 PYTHON3_DEPENDENCIES += sqlite
 endif
-- 
1.8.1

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

* [Buildroot] [PATCHv2] python3: Fix pyc-only related runtime exceptions
  2013-01-28  1:38 ` [Buildroot] [PATCHv2] python3: Fix pyc-only related runtime exceptions Daniel Nelson
@ 2013-01-28 21:04   ` Peter Korsgaard
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Korsgaard @ 2013-01-28 21:04 UTC (permalink / raw)
  To: buildroot

>>>>> "Daniel" == Daniel Nelson <daniel@sigpwr.com> writes:

 Daniel> Python3 changes the pyc lookup strategy, ignoring the
 Daniel> __pycache__ directory if the .py file is missing. Change
 Daniel> install location to enable use of .pyc without their parent .py

 Daniel> See http://www.python.org/dev/peps/pep-3147

 Daniel> Signed-off-by: Daniel Nelson <daniel@sigpwr.com>
 Daniel> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
 Daniel>   (untested)
 Daniel> ---
 Daniel>  .../python3/python3-3.3-012-old-stdlib-cache.patch | 53 ++++++++++++++++++++++
 Daniel>  package/python3/python3.mk                         |  4 ++
 Daniel>  2 files changed, 57 insertions(+)
 Daniel>  create mode 100644 package/python3/python3-3.3-012-old-stdlib-cache.patch

 Daniel> diff --git a/package/python3/python3-3.3-012-old-stdlib-cache.patch b/package/python3/python3-3.3-012-old-stdlib-cache.patch
 Daniel> new file mode 100644
 Daniel> index 0000000..23171d5
 Daniel> --- /dev/null
 Daniel> +++ b/package/python3/python3-3.3-012-old-stdlib-cache.patch

You forgot to add a patch header describing what it does. I've copied
your commit message to here and committed, thanks.

-- 
Bye, Peter Korsgaard

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

end of thread, other threads:[~2013-01-28 21:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-27 19:03 [Buildroot] [PATCH] Fix PYC-only installation for Python3 Daniel Nelson
2013-01-27 22:42 ` Arnout Vandecappelle
2013-01-27 22:52   ` Daniel N
2013-01-27 23:15     ` Arnout Vandecappelle
2013-01-27 23:36 ` Arnout Vandecappelle
2013-01-27 23:43   ` Daniel N
2013-01-27 23:49     ` Arnout Vandecappelle
2013-01-28  1:38 ` [Buildroot] [PATCHv2] python3: Fix pyc-only related runtime exceptions Daniel Nelson
2013-01-28 21:04   ` Peter Korsgaard

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