Blame view

buildroot/buildroot-2016.08.1/package/python3/0005-Add-infrastructure-to-disable-the-build-of-certain-e.patch 3.73 KB
6b13f685e   김민수   BSP 최초 추가
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
  From 3a9f4aa255909ed152883eee787313efd20dbc58 Mon Sep 17 00:00:00 2001
  From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  Date: Wed, 23 Dec 2015 11:31:08 +0100
  Subject: [PATCH] Add infrastructure to disable the build of certain extensions
  
  Some of the extensions part of the Python core have dependencies on
  external libraries (sqlite, tk, etc.) or are relatively big and not
  necessarly always useful (CJK codecs for example). By extensions, we
  mean part of Python modules that are written in C and therefore
  compiled to binary code.
  
  Therefore, we introduce a small infrastructure that allows to disable
  some of those extensions. This can be done inside the configure.ac by
  adding values to the DISABLED_EXTENSIONS variable (which is a
  word-separated list of extensions).
  
  The implementation works as follow :
  
   * configure.ac defines a DISABLED_EXTENSIONS variable, which is
     substituted (so that when Makefile.pre is generated from
     Makefile.pre.in, the value of the variable is substituted). For
     now, this DISABLED_EXTENSIONS variable is empty, later patches will
     use it.
  
   * Makefile.pre.in passes the DISABLED_EXTENSIONS value down to the
     variables passed in the environment when calling the setup.py
     script that actually builds and installs those extensions.
  
   * setup.py is modified so that the existing "disabled_module_list" is
     filled with those pre-disabled extensions listed in
     DISABLED_EXTENSIONS.
  
  Patch ported to python2.7 by Maxime Ripard <ripard@archos.com>, and
  then extended by Thomas Petazzoni
  <thomas.petazzoni@free-electrons.com>.
  
  Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  ---
   Makefile.pre.in | 6 +++++-
   configure.ac    | 2 ++
   setup.py        | 5 ++++-
   3 files changed, 11 insertions(+), 2 deletions(-)
  
  diff --git a/Makefile.pre.in b/Makefile.pre.in
  index 272f312..9420860 100644
  --- a/Makefile.pre.in
  +++ b/Makefile.pre.in
  @@ -182,6 +182,8 @@ FILEMODE=	644
   # configure script arguments
   CONFIG_ARGS=	@CONFIG_ARGS@
   
  +# disabled extensions
  +DISABLED_EXTENSIONS=	@DISABLED_EXTENSIONS@
   
   # Subdirectories with code
   SRCDIRS= 	@SRCDIRS@
  @@ -600,6 +602,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt
   	esac; \
   	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
   		_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
  +		DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
   		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
   
   # Build static library
  @@ -1425,7 +1428,8 @@ libainstall:	all python-config
   # Install the dynamically loadable modules
   # This goes into $(exec_prefix)
   sharedinstall: sharedmods
  -	$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
  +	$(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
  +		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
   	   	--prefix=$(prefix) \
   		--install-scripts=$(BINDIR) \
   		--install-platlib=$(DESTSHARED) \
  diff --git a/configure.ac b/configure.ac
  index c492594..bfb599e 100644
  --- a/configure.ac
  +++ b/configure.ac
  @@ -2588,6 +2588,8 @@ LIBS="$withval $LIBS"
   
   PKG_PROG_PKG_CONFIG
   
  +AC_SUBST(DISABLED_EXTENSIONS)
  +
   # Check for use of the system expat library
   AC_MSG_CHECKING(for --with-system-expat)
   AC_ARG_WITH(system_expat,
  diff --git a/setup.py b/setup.py
  index dbd2a3c..1ebfa50 100644
  --- a/setup.py
  +++ b/setup.py
  @@ -44,7 +44,10 @@ host_platform = get_platform()
   COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
   
   # This global variable is used to hold the list of modules to be disabled.
  -disabled_module_list = []
  +try:
  +    disabled_module_list = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ")
  +except KeyError:
  +    disabled_module_list = list()
   
   def add_dir_to_list(dirlist, dir):
       """Add the directory 'dir' to the list 'dirlist' (after any relative
  -- 
  2.6.4