An interpreted, interactive, object-oriented programming language
CentOS Sources
2017-08-01 71084d584ff953f5463757ec6536406320560b4d
commit | author | age
6e8c2f 1 diff -up Python-2.7.3/configure.ac.debug-build Python-2.7.3/configure.ac
CB 2 --- Python-2.7.3/configure.ac.debug-build    2012-04-18 19:46:22.066498521 -0400
3 +++ Python-2.7.3/configure.ac    2012-04-18 19:46:22.078498372 -0400
4 @@ -635,7 +635,7 @@ AC_SUBST(LIBRARY)
5  AC_MSG_CHECKING(LIBRARY)
6  if test -z "$LIBRARY"
7  then
8 -    LIBRARY='libpython$(VERSION).a'
9 +    LIBRARY='libpython$(VERSION)$(DEBUG_EXT).a'
10  fi
11  AC_MSG_RESULT($LIBRARY)
12  
13 @@ -780,8 +780,8 @@ if test $enable_shared = "yes"; then
14        INSTSONAME="$LDLIBRARY".$SOVERSION
15            ;;
16      Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
17 -      LDLIBRARY='libpython$(VERSION).so'
18 -      BLDLIBRARY='-L. -lpython$(VERSION)'
19 +      LDLIBRARY='libpython$(VERSION)$(DEBUG_EXT).so'
20 +      BLDLIBRARY='-L. -lpython$(VERSION)$(DEBUG_EXT)'
21        RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
22        case $ac_sys_system in
23            FreeBSD*)
24 @@ -905,6 +905,14 @@ else AC_MSG_RESULT(no); Py_DEBUG='false'
25  fi],
26  [AC_MSG_RESULT(no)])
27  
28 +if test "$Py_DEBUG" = 'true'
29 +then
30 +    DEBUG_EXT=_d
31 +    DEBUG_SUFFIX=-debug
32 +fi
33 +AC_SUBST(DEBUG_EXT)
34 +AC_SUBST(DEBUG_SUFFIX)
35 +
36  # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
37  # merged with this chunk of code?
38  
39 diff -up Python-2.7.3/Lib/distutils/command/build_ext.py.debug-build Python-2.7.3/Lib/distutils/command/build_ext.py
40 --- Python-2.7.3/Lib/distutils/command/build_ext.py.debug-build    2012-04-09 19:07:29.000000000 -0400
41 +++ Python-2.7.3/Lib/distutils/command/build_ext.py    2012-04-18 19:46:22.079498360 -0400
42 @@ -676,7 +676,10 @@ class build_ext (Command):
43          so_ext = get_config_var('SO')
44          if os.name == 'nt' and self.debug:
45              return os.path.join(*ext_path) + '_d' + so_ext
46 -        return os.path.join(*ext_path) + so_ext
47 +
48 +        # Similarly, extensions in debug mode are named 'module_d.so', to
49 +        # avoid adding the _d to the SO config variable:
50 +        return os.path.join(*ext_path) + (sys.pydebug and "_d" or "") + so_ext
51  
52      def get_export_symbols (self, ext):
53          """Return the list of symbols that a shared extension has to
54 @@ -761,6 +764,8 @@ class build_ext (Command):
55                  template = "python%d.%d"
56                  pythonlib = (template %
57                               (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
58 +                if sys.pydebug:
59 +                    pythonlib += '_d'
60                  return ext.libraries + [pythonlib]
61              else:
62                  return ext.libraries
63 diff -up Python-2.7.3/Lib/distutils/sysconfig.py.debug-build Python-2.7.3/Lib/distutils/sysconfig.py
64 --- Python-2.7.3/Lib/distutils/sysconfig.py.debug-build    2012-04-18 19:46:21.988499499 -0400
65 +++ Python-2.7.3/Lib/distutils/sysconfig.py    2012-04-18 19:46:22.080498348 -0400
66 @@ -85,7 +85,8 @@ def get_python_inc(plat_specific=0, pref
67                  # Include is located in the srcdir
68                  inc_dir = os.path.join(srcdir, "Include")
69              return inc_dir
70 -        return os.path.join(prefix, "include", "python" + get_python_version())
71 +        return os.path.join(prefix, "include",
72 +                            "python" + get_python_version() + (sys.pydebug and '-debug' or ''))
73      elif os.name == "nt":
74          return os.path.join(prefix, "include")
75      elif os.name == "os2":
76 @@ -250,7 +251,7 @@ def get_makefile_filename():
77      if python_build:
78          return os.path.join(project_base, "Makefile")
79      lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
80 -    return os.path.join(lib_dir, "config", "Makefile")
81 +    return os.path.join(lib_dir, "config" + (sys.pydebug and "-debug" or ""), "Makefile")
82  
83  
84  def parse_config_h(fp, g=None):
85 diff -up Python-2.7.3/Lib/distutils/tests/test_install.py.debug-build Python-2.7.3/Lib/distutils/tests/test_install.py
86 --- Python-2.7.3/Lib/distutils/tests/test_install.py.debug-build    2012-04-18 19:46:21.997499385 -0400
87 +++ Python-2.7.3/Lib/distutils/tests/test_install.py    2012-04-18 19:46:22.080498348 -0400
88 @@ -20,8 +20,9 @@ from distutils.tests import support
89  
90  
91  def _make_ext_name(modname):
92 -    if os.name == 'nt' and sys.executable.endswith('_d.exe'):
93 +    if sys.pydebug:
94          modname += '_d'
95 +    
96      return modname + sysconfig.get_config_var('SO')
97  
98  
99 diff -up Python-2.7.3/Makefile.pre.in.debug-build Python-2.7.3/Makefile.pre.in
100 --- Python-2.7.3/Makefile.pre.in.debug-build    2012-04-18 19:46:22.073498437 -0400
101 +++ Python-2.7.3/Makefile.pre.in    2012-04-18 19:48:46.336694896 -0400
102 @@ -102,8 +102,8 @@ SCRIPTDIR=    $(prefix)/lib64
103  # Detailed destination directories
104  BINLIBDEST=    $(LIBDIR)/python$(VERSION)
105  LIBDEST=    $(SCRIPTDIR)/python$(VERSION)
106 -INCLUDEPY=    $(INCLUDEDIR)/python$(VERSION)
107 -CONFINCLUDEPY=    $(CONFINCLUDEDIR)/python$(VERSION)
108 +INCLUDEPY=    $(INCLUDEDIR)/python$(VERSION)$(DEBUG_SUFFIX)
109 +CONFINCLUDEPY=    $(CONFINCLUDEDIR)/python$(VERSION)$(DEBUG_SUFFIX)
110  LIBP=        $(LIBDIR)/python$(VERSION)
111  
112  # Symbols used for using shared libraries
113 @@ -117,6 +117,12 @@ DESTSHARED=    $(BINLIBDEST)/lib-dynload
114  EXE=        @EXEEXT@
115  BUILDEXE=    @BUILDEXEEXT@
116  
117 +# DEBUG_EXT is used by ELF files (names and SONAMEs); it will be "_d" for a debug build
118 +# DEBUG_SUFFIX is used by filesystem paths; it will be "-debug" for a debug build
119 +# Both will be empty in an optimized build
120 +DEBUG_EXT=    @DEBUG_EXT@
121 +DEBUG_SUFFIX=    @DEBUG_SUFFIX@
122 +
123  # Short name and location for Mac OS X Python framework
124  UNIVERSALSDK=@UNIVERSALSDK@
125  PYTHONFRAMEWORK=    @PYTHONFRAMEWORK@
126 @@ -180,8 +186,8 @@ LIBOBJDIR=    Python/
127  LIBOBJS=    @LIBOBJS@
128  UNICODE_OBJS=   @UNICODE_OBJS@
129  
130 -PYTHON=        python$(EXE)
131 -BUILDPYTHON=    python$(BUILDEXE)
132 +PYTHON=        python$(DEBUG_SUFFIX)$(EXE)
133 +BUILDPYTHON=    python$(DEBUG_SUFFIX)$(BUILDEXE)
134  
135  PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
136  _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
137 @@ -413,7 +419,7 @@ sharedmods: $(BUILDPYTHON)
138      $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
139          $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
140  
141 -libpython$(VERSION).so: $(LIBRARY_OBJS)
142 +libpython$(VERSION)$(DEBUG_EXT).so: $(LIBRARY_OBJS)
143      if test $(INSTSONAME) != $(LDLIBRARY); then \
144          $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
145          $(LN) -f $(INSTSONAME) $@; \
146 @@ -796,18 +802,18 @@ bininstall:    altbininstall
147      then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
148      else true; \
149      fi
150 -    (cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(EXE) $(PYTHON))
151 -    -rm -f $(DESTDIR)$(BINDIR)/python2$(EXE)
152 -    (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python2$(EXE))
153 -    -rm -f $(DESTDIR)$(BINDIR)/python2-config
154 -    (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python2-config)
155 -    -rm -f $(DESTDIR)$(BINDIR)/python-config
156 -    (cd $(DESTDIR)$(BINDIR); $(LN) -s python2-config python-config)
157 +    (cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(DEBUG_SUFFIX)$(EXE) $(PYTHON))
158 +    -rm -f $(DESTDIR)$(BINDIR)/python2$(DEBUG_SUFFIX)$(EXE)
159 +    (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(DEBUG_SUFFIX)$(EXE) python2$(DEBUG_SUFFIX)$(EXE))
160 +    -rm -f $(DESTDIR)$(BINDIR)/python2$(DEBUG_SUFFIX)-config
161 +    (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(DEBUG_SUFFIX)-config python2$(DEBUG_SUFFIX)-config)
162 +    -rm -f $(DESTDIR)$(BINDIR)/python$(DEBUG_SUFFIX)-config
163 +    (cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(DEBUG_SUFFIX)-config python$(DEBUG_SUFFIX)-config)
164      -test -d $(DESTDIR)$(LIBPC) || $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC)
165 -    -rm -f $(DESTDIR)$(LIBPC)/python2.pc
166 -    (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python2.pc)
167 -    -rm -f $(DESTDIR)$(LIBPC)/python.pc
168 -    (cd $(DESTDIR)$(LIBPC); $(LN) -s python2.pc python.pc)
169 +    -rm -f $(DESTDIR)$(LIBPC)/python2$(DEBUG_SUFFIX).pc
170 +    (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)$(DEBUG_SUFFIX).pc python2$(DEBUG_SUFFIX).pc)
171 +    -rm -f $(DESTDIR)$(LIBPC)/python$(DEBUG_SUFFIX).pc
172 +    (cd $(DESTDIR)$(LIBPC); $(LN) -s python2$(DEBUG_SUFFIX).pc python$(DEBUG_SUFFIX).pc)
173  
174  # Install the interpreter with $(VERSION) affixed
175  # This goes into $(exec_prefix)
176 @@ -820,7 +826,7 @@ altbininstall:    $(BUILDPYTHON)
177          else    true; \
178          fi; \
179      done
180 -    $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
181 +    $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(DEBUG_SUFFIX)$(EXE)
182      if test -f $(LDLIBRARY); then \
183          if test -n "$(DLLLIBRARY)" ; then \
184              $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
185 @@ -970,10 +976,11 @@ $(srcdir)/Lib/$(PLATDIR):
186      fi; \
187      cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
188  
189 -python-config: $(srcdir)/Misc/python-config.in
190 +python$(DEBUG_SUFFIX)-config: $(srcdir)/Misc/python-config.in
191      # Substitution happens here, as the completely-expanded BINDIR
192      # is not available in configure
193 -    sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
194 +    sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(DEBUG_SUFFIX)$(EXE)," < $(srcdir)/Misc/python-config.in >python$(DEBUG_SUFFIX)-config
195 +
196  
197  # Install the include files
198  INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
199 @@ -994,13 +1001,13 @@ inclinstall:
200      $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
201  
202  # Install the library and miscellaneous stuff needed for extending/embedding
203 -# This goes into $(exec_prefix)
204 -LIBPL=        $(LIBP)/config
205 +# This goes into $(exec_prefix)$(DEBUG_SUFFIX)
206 +LIBPL=        $(LIBP)/config$(DEBUG_SUFFIX)
207  
208  # pkgconfig directory
209  LIBPC=        $(LIBDIR)/pkgconfig
210  
211 -libainstall:    all python-config
212 +libainstall:    all python$(DEBUG_SUFFIX)-config
213      @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
214      do \
215          if test ! -d $(DESTDIR)$$i; then \
216 @@ -1016,11 +1023,10 @@ libainstall:    all python-config
217      $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
218      $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
219      $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
220 -    $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
221 +    $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION)$(DEBUG_SUFFIX).pc
222      $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
223      $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
224 -    $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
225 -    rm python-config
226 +    $(INSTALL_SCRIPT) python$(DEBUG_SUFFIX)-config $(DESTDIR)$(BINDIR)/python$(VERSION)$(DEBUG_SUFFIX)-config
227      @if [ -s Modules/python.exp -a \
228          "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
229          echo; echo "Installing support files for building shared extension modules on AIX:"; \
230 diff -up Python-2.7.3/Misc/python-config.in.debug-build Python-2.7.3/Misc/python-config.in
231 --- Python-2.7.3/Misc/python-config.in.debug-build    2012-04-09 19:07:33.000000000 -0400
232 +++ Python-2.7.3/Misc/python-config.in    2012-04-18 19:46:22.082498324 -0400
233 @@ -45,7 +45,7 @@ for opt in opt_flags:
234  
235      elif opt in ('--libs', '--ldflags'):
236          libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
237 -        libs.append('-lpython'+pyver)
238 +        libs.append('-lpython' + pyver + (sys.pydebug and "_d" or ""))
239          # add the prefix/lib/pythonX.Y/config dir, but only if there is no
240          # shared library in prefix/lib/.
241          if opt == '--ldflags':
242 diff -up Python-2.7.3/Modules/makesetup.debug-build Python-2.7.3/Modules/makesetup
243 --- Python-2.7.3/Modules/makesetup.debug-build    2012-04-09 19:07:34.000000000 -0400
244 +++ Python-2.7.3/Modules/makesetup    2012-04-18 19:46:22.083498312 -0400
245 @@ -233,7 +233,7 @@ sed -e 's/[     ]*#.*//' -e '/^[     ]*$/d' |
246              *$mod.o*)    base=$mod;;
247              *)        base=${mod}module;;
248              esac
249 -            file="$srcdir/$base\$(SO)"
250 +            file="$srcdir/$base\$(DEBUG_EXT)\$(SO)"
251              case $doconfig in
252              no)    SHAREDMODS="$SHAREDMODS $file";;
253              esac
254 diff -up Python-2.7.3/Python/dynload_shlib.c.debug-build Python-2.7.3/Python/dynload_shlib.c
255 --- Python-2.7.3/Python/dynload_shlib.c.debug-build    2012-04-09 19:07:35.000000000 -0400
256 +++ Python-2.7.3/Python/dynload_shlib.c    2012-04-18 19:46:22.083498312 -0400
257 @@ -46,11 +46,16 @@ const struct filedescr _PyImport_DynLoad
258      {"module.exe", "rb", C_EXTENSION},
259      {"MODULE.EXE", "rb", C_EXTENSION},
260  #else
261 +#ifdef Py_DEBUG
262 +    {"_d.so", "rb", C_EXTENSION},
263 +    {"module_d.so", "rb", C_EXTENSION},
264 +#else
265      {".so", "rb", C_EXTENSION},
266      {"module.so", "rb", C_EXTENSION},
267 -#endif
268 -#endif
269 -#endif
270 +#endif /* Py_DEBUG */
271 +#endif /* __VMS */
272 +#endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */
273 +#endif /* __CYGWIN__ */
274      {0, 0}
275  };
276  
277 diff -up Python-2.7.3/Python/sysmodule.c.debug-build Python-2.7.3/Python/sysmodule.c
278 --- Python-2.7.3/Python/sysmodule.c.debug-build    2012-04-09 19:07:35.000000000 -0400
279 +++ Python-2.7.3/Python/sysmodule.c    2012-04-18 19:46:22.083498312 -0400
280 @@ -1506,6 +1506,12 @@ _PySys_Init(void)
281                          PyString_FromString("legacy"));
282  #endif
283  
284 +#ifdef Py_DEBUG
285 +    PyDict_SetItemString(sysdict, "pydebug", Py_True);
286 +#else
287 +    PyDict_SetItemString(sysdict, "pydebug", Py_False);
288 +#endif
289 +
290  #undef SET_SYS_FROM_STRING
291      if (PyErr_Occurred())
292          return NULL;