Browse Source

fix packaging bug, reported by joerg

loading of python modules must be disabled, otherwise
they are renamed/disabled. To disable modules we need to
patch setup.py, PYTHON_DIABLED_MODULES are no longer recognized.
Waldemar Brodkorb 15 năm trước cách đây
mục cha
commit
d48b7c670c

+ 4 - 6
package/python2/Makefile

@@ -9,6 +9,7 @@ PKG_RELEASE:=		1
 PKG_MD5SUM:=		35f56b092ecf39a6bd59d64f142aae0f
 PKG_DESCR:=		Python scripting language (Version 2)
 PKG_SECTION:=		lang
+PKG_DEPENDS:=		libpthread
 PKG_URL:=		http://www.python.org/
 PKG_SITES:=		http://www.python.org/ftp/python/${PKG_VERSION}/
 
@@ -17,16 +18,13 @@ PKG_HOST_DEPENDS:=	!netbsd !openbsd !cygwin
 DISTFILES=		Python-${PKG_VERSION}.tgz
 WRKDIST=		${WRKDIR}/Python-${PKG_VERSION}
 
-DISMOD:=		readline _curses _curses_panel _tkinter nis
-
 include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,PYTHON2,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
 MAKE_ENV+=		OPT="$(TARGET_CFLAGS)" \
 			HOSTPYTHON=./hostpython \
-			HOSTPGEN=./Parser/hostpgen \
-			PYTHON_DISABLE_MODULES="$(DISMOD)"
+			HOSTPGEN=./Parser/hostpgen
 CONFIGURE_ENV+=		OPT="$(TARGET_CFLAGS)" \
 			ac_cv_have_long_long_format=yes
 CONFIGURE_ARGS:=	--with-threads \
@@ -49,11 +47,11 @@ pre-configure:
 post-install:
 	${INSTALL_DIR} ${IDIR_PYTHON2}/usr/bin ${IDIR_PYTHON2}/usr/lib
 	${INSTALL_DIR} ${IDIR_PYTHON2}/usr/lib/python2.7
-	${INSTALL_DIR} ${IDIR_PYTHON2}/usr/include/python2.7
+	#${INSTALL_DIR} ${IDIR_PYTHON2}/usr/include/python2.7
 	${INSTALL_BIN} ${WRKINST}/usr/bin/python ${IDIR_PYTHON2}/usr/bin
 	${CP} ${WRKINST}/usr/lib/libpython*.so* ${IDIR_PYTHON2}/usr/lib
 	${CP} ${WRKINST}/usr/lib/python2.7/* ${IDIR_PYTHON2}/usr/lib/python2.7
-	${CP} ${WRKINST}/usr/include/python2.7/* ${IDIR_PYTHON2}/usr/include/python2.7
+	#${CP} ${WRKINST}/usr/include/python2.7/* ${IDIR_PYTHON2}/usr/include/python2.7
 	-find ${IDIR_PYTHON2} -name \*.pyo -exec rm {} \;
 
 include ${TOPDIR}/mk/pkg-bottom.mk

+ 7 - 6
package/python2/patches/patch-Makefile_pre_in

@@ -1,5 +1,5 @@
 --- Python-2.7.orig/Makefile.pre.in	2010-04-12 02:10:46.000000000 +0200
-+++ Python-2.7/Makefile.pre.in	2010-09-20 02:37:52.537806065 +0200
++++ Python-2.7/Makefile.pre.in	2010-09-25 21:11:15.584089025 +0200
 @@ -179,6 +179,7 @@ UNICODE_OBJS=   @UNICODE_OBJS@
  
  PYTHON=		python$(EXE)
@@ -104,16 +104,17 @@
  
  # Create the PLATDIR source directory, if one wasn't distributed..
  $(srcdir)/Lib/$(PLATDIR):
-@@ -1043,7 +1045,7 @@ libainstall:	all python-config
+@@ -1043,7 +1045,8 @@ libainstall:	all python-config
  # Install the dynamically loadable modules
  # This goes into $(exec_prefix)
  sharedinstall:
 -	$(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
++	CROSS_COMPILE='$(CROSS_COMPILE)' \
 +	$(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
  	   	--prefix=$(prefix) \
  		--install-scripts=$(BINDIR) \
  		--install-platlib=$(DESTSHARED) \
-@@ -1081,7 +1083,7 @@ frameworkinstallstructure:	$(LDLIBRARY)
+@@ -1081,7 +1084,7 @@ frameworkinstallstructure:	$(LDLIBRARY)
  		fi; \
  	done
  	$(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
@@ -122,7 +123,7 @@
  	$(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
  	$(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
  	$(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
-@@ -1116,7 +1118,7 @@ frameworkinstallextras:
+@@ -1116,7 +1119,7 @@ frameworkinstallextras:
  # This installs a few of the useful scripts in Tools/scripts
  scriptsinstall:
  	SRCDIR=$(srcdir) $(RUNSHARED) \
@@ -131,7 +132,7 @@
  	--prefix=$(prefix) \
  	--install-scripts=$(BINDIR) \
  	--root=/$(DESTDIR)
-@@ -1138,7 +1140,7 @@ config.status:	$(srcdir)/configure
+@@ -1138,7 +1141,7 @@ config.status:	$(srcdir)/configure
  
  # Run reindent on the library
  reindent:
@@ -140,7 +141,7 @@
  
  # Rerun configure with the same options as it was run last time,
  # provided the config.status script exists
-@@ -1238,7 +1240,7 @@ funny:
+@@ -1238,7 +1241,7 @@ funny:
  
  # Perform some verification checks on any modified files.
  patchcheck:

+ 48 - 0
package/python2/patches/patch-setup_py

@@ -0,0 +1,48 @@
+--- Python-2.7.orig/setup.py	2010-06-27 14:36:16.000000000 +0200
++++ Python-2.7/setup.py	2010-09-25 22:04:01.234088816 +0200
+@@ -21,7 +21,7 @@ from distutils.spawn import find_executa
+ COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')
+ 
+ # This global variable is used to hold the list of modules to be disabled.
+-disabled_module_list = []
++disabled_module_list = ['nis', 'bz2']
+ 
+ def add_dir_to_list(dirlist, dir):
+     """Add the directory 'dir' to the list 'dirlist' (at the front) if
+@@ -307,36 +307,6 @@ class PyBuildExt(build_ext):
+         ext_filename = os.path.join(
+             self.build_lib,
+             self.get_ext_filename(self.get_ext_fullname(ext.name)))
+-        try:
+-            imp.load_dynamic(ext.name, ext_filename)
+-        except ImportError, why:
+-            self.failed.append(ext.name)
+-            self.announce('*** WARNING: renaming "%s" since importing it'
+-                          ' failed: %s' % (ext.name, why), level=3)
+-            assert not self.inplace
+-            basename, tail = os.path.splitext(ext_filename)
+-            newname = basename + "_failed" + tail
+-            if os.path.exists(newname):
+-                os.remove(newname)
+-            os.rename(ext_filename, newname)
+-
+-            # XXX -- This relies on a Vile HACK in
+-            # distutils.command.build_ext.build_extension().  The
+-            # _built_objects attribute is stored there strictly for
+-            # use here.
+-            # If there is a failure, _built_objects may not be there,
+-            # so catch the AttributeError and move on.
+-            try:
+-                for filename in self._built_objects:
+-                    os.remove(filename)
+-            except AttributeError:
+-                self.announce('unable to remove files (ignored)')
+-        except:
+-            exc_type, why, tb = sys.exc_info()
+-            self.announce('*** WARNING: importing extension "%s" '
+-                          'failed with %s: %s' % (ext.name, exc_type, why),
+-                          level=3)
+-            self.failed.append(ext.name)
+ 
+     def get_platform(self):
+         # Get value of sys.platform