summaryrefslogtreecommitdiff
path: root/package/python2
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2011-10-15 17:58:20 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2011-10-15 17:58:20 +0200
commitcf64ca8e62ed3a8efc23cf2d49cd54954fe8d81c (patch)
treee88dd2e29cddd675b13569e83fafeb319ed54ffa /package/python2
parentd74e014d023453860d140a7455022424c80d4f0c (diff)
add package virtinst and dependencies
Diffstat (limited to 'package/python2')
-rw-r--r--package/python2/Makefile4
-rw-r--r--package/python2/files/build_scripts.py99
-rw-r--r--package/python2/patches/patch-Makefile_pre_in23
-rw-r--r--package/python2/patches/patch-configure4
-rw-r--r--package/python2/patches/patch-setup_py4
5 files changed, 117 insertions, 17 deletions
diff --git a/package/python2/Makefile b/package/python2/Makefile
index 53e770f2d..2aed3ed49 100644
--- a/package/python2/Makefile
+++ b/package/python2/Makefile
@@ -46,9 +46,10 @@ post-extract:
$(CP) ./files/setup.py ${WRKBUILD}/setup.py
$(CP) ./files/posixmodule.c ${WRKBUILD}/Modules/posixmodule.c
$(CP) ./files/python-config.in ${WRKBUILD}/Misc/python-config.in
+ $(CP) ./files/build_scripts.py ${WRKBUILD}/Lib/distutils/command/build_scripts.py
(cd ${WRKBUILD}; rm -rf config.{cache,status} ; \
OPT="$(CFLAGS_FOR_BUILD)" \
- ./configure --without-cxx-main --without-threads \
+ ./configure --without-cxx-main --with-threads \
--prefix=$(STAGING_HOST_DIR)/usr \
);
$(MAKE) -C ${WRKBUILD} python Parser/pgen
@@ -62,6 +63,7 @@ post-extract:
pre-configure:
$(SED) "s#@@CPU_ARCH@@#$(CPU_ARCH)#" ${WRKBUILD}/configure
+ $(SED) "s#@@STAGING_DIR@@#$(STAGING_DIR)#" ${WRKBUILD}/setup.py
post-install:
${INSTALL_DIR} ${IDIR_PYTHON2}/usr/bin ${IDIR_PYTHON2}/usr/lib
diff --git a/package/python2/files/build_scripts.py b/package/python2/files/build_scripts.py
new file mode 100644
index 000000000..fe81a5341
--- /dev/null
+++ b/package/python2/files/build_scripts.py
@@ -0,0 +1,99 @@
+"""distutils.command.build_scripts
+
+Implements the Distutils 'build_scripts' command."""
+
+__revision__ = "$Id: build_scripts.py 77704 2010-01-23 09:23:15Z tarek.ziade $"
+
+import os, re
+from stat import ST_MODE
+from distutils.core import Command
+from distutils.dep_util import newer
+from distutils.util import convert_path
+from distutils import log
+
+# check if Python is called on the first line with this expression
+first_line_re = re.compile('^#!.*python[0-9.]*([ \t].*)?$')
+
+class build_scripts (Command):
+
+ description = "\"build\" scripts (copy and fixup #! line)"
+
+ user_options = [
+ ('build-dir=', 'd', "directory to \"build\" (copy) to"),
+ ('force', 'f', "forcibly build everything (ignore file timestamps"),
+ ('executable=', 'e', "specify final destination interpreter path"),
+ ]
+
+ boolean_options = ['force']
+
+
+ def initialize_options (self):
+ self.build_dir = None
+ self.scripts = None
+ self.force = None
+ self.executable = None
+ self.outfiles = None
+
+ def finalize_options (self):
+ self.set_undefined_options('build',
+ ('build_scripts', 'build_dir'),
+ ('force', 'force'),
+ ('executable', 'executable'))
+ self.scripts = self.distribution.scripts
+
+ def get_source_files(self):
+ return self.scripts
+
+ def run (self):
+ if not self.scripts:
+ return
+ self.copy_scripts()
+
+
+ def copy_scripts (self):
+ """Copy each script listed in 'self.scripts'; if it's marked as a
+ Python script in the Unix way (first line matches 'first_line_re',
+ ie. starts with "\#!" and contains "python"), then adjust the first
+ line to refer to the current Python interpreter as we copy.
+ """
+ _sysconfig = __import__('sysconfig')
+ self.mkpath(self.build_dir)
+ outfiles = []
+ for script in self.scripts:
+ adjust = 0
+ script = convert_path(script)
+ outfile = os.path.join(self.build_dir, os.path.basename(script))
+ outfiles.append(outfile)
+
+ if not self.force and not newer(script, outfile):
+ log.debug("not copying %s (up-to-date)", script)
+ continue
+
+ # Always open the file, but ignore failures in dry-run mode --
+ # that way, we'll get accurate feedback if we can read the
+ # script.
+ try:
+ f = open(script, "r")
+ except IOError:
+ if not self.dry_run:
+ raise
+ f = None
+ if f:
+ f.close()
+ self.copy_file(script, outfile)
+
+ if os.name == 'posix':
+ for file in outfiles:
+ if self.dry_run:
+ log.info("changing mode of %s", file)
+ else:
+ oldmode = os.stat(file)[ST_MODE] & 07777
+ newmode = (oldmode | 0555) & 07777
+ if newmode != oldmode:
+ log.info("changing mode of %s from %o to %o",
+ file, oldmode, newmode)
+ os.chmod(file, newmode)
+
+ # copy_scripts ()
+
+# class build_scripts
diff --git a/package/python2/patches/patch-Makefile_pre_in b/package/python2/patches/patch-Makefile_pre_in
index d3737ae3e..694518173 100644
--- a/package/python2/patches/patch-Makefile_pre_in
+++ b/package/python2/patches/patch-Makefile_pre_in
@@ -1,6 +1,6 @@
diff -Nur Python-2.7.1.orig/Makefile.pre.in Python-2.7.1/Makefile.pre.in
--- Python-2.7.1.orig/Makefile.pre.in 2010-10-14 13:37:30.000000000 +0200
-+++ Python-2.7.1/Makefile.pre.in 2011-01-20 22:13:22.464906869 +0100
++++ Python-2.7.1/Makefile.pre.in 2011-10-15 16:09:58.000000000 +0200
@@ -59,7 +59,7 @@ MAKESETUP= $(srcdir)/Modules/makese
# Compiler options
OPT= @OPT@
@@ -35,7 +35,7 @@ diff -Nur Python-2.7.1.orig/Makefile.pre.in Python-2.7.1/Makefile.pre.in
build_all_use_profile:
$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
-@@ -398,14 +400,14 @@ $(BUILDPYTHON): Modules/python.o $(LIBRA
+@@ -398,14 +400,13 @@ $(BUILDPYTHON): Modules/python.o $(LIBRA
$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
platform: $(BUILDPYTHON)
@@ -48,12 +48,11 @@ diff -Nur Python-2.7.1.orig/Makefile.pre.in Python-2.7.1/Makefile.pre.in
@case $$MAKEFLAGS in \
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
-+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
esac
# Build static library
-@@ -538,7 +540,7 @@ Modules/python.o: $(srcdir)/Modules/pyth
+@@ -538,7 +539,7 @@ Modules/python.o: $(srcdir)/Modules/pyth
$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
-@$(INSTALL) -d Include
@@ -62,7 +61,7 @@ diff -Nur Python-2.7.1.orig/Makefile.pre.in Python-2.7.1/Makefile.pre.in
$(PGEN): $(PGENOBJS)
$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
-@@ -702,7 +704,7 @@ $(LIBRARY_OBJS) $(MODOBJS) Modules/pytho
+@@ -702,7 +703,7 @@ $(LIBRARY_OBJS) $(MODOBJS) Modules/pytho
TESTOPTS= -l $(EXTRATESTOPTS)
TESTPROG= $(srcdir)/Lib/test/regrtest.py
@@ -71,7 +70,7 @@ diff -Nur Python-2.7.1.orig/Makefile.pre.in Python-2.7.1/Makefile.pre.in
test: all platform
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
-@@ -725,7 +727,7 @@ testuniversal: all platform
+@@ -725,7 +726,7 @@ testuniversal: all platform
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
-$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
@@ -80,7 +79,7 @@ diff -Nur Python-2.7.1.orig/Makefile.pre.in Python-2.7.1/Makefile.pre.in
# Like testall, but with a single pass only
-@@ -920,26 +922,26 @@ libinstall: build_all $(srcdir)/Lib/$(PL
+@@ -920,26 +921,26 @@ libinstall: build_all $(srcdir)/Lib/$(PL
done; \
done
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
@@ -114,7 +113,7 @@ diff -Nur Python-2.7.1.orig/Makefile.pre.in Python-2.7.1/Makefile.pre.in
# Create the PLATDIR source directory, if one wasn't distributed..
$(srcdir)/Lib/$(PLATDIR):
-@@ -1044,7 +1046,8 @@ libainstall: all python-config
+@@ -1044,7 +1045,8 @@ libainstall: all python-config
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: sharedmods
@@ -124,7 +123,7 @@ diff -Nur Python-2.7.1.orig/Makefile.pre.in Python-2.7.1/Makefile.pre.in
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
-@@ -1082,7 +1085,7 @@ frameworkinstallstructure: $(LDLIBRARY)
+@@ -1082,7 +1084,7 @@ frameworkinstallstructure: $(LDLIBRARY)
fi; \
done
$(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
@@ -133,7 +132,7 @@ diff -Nur Python-2.7.1.orig/Makefile.pre.in Python-2.7.1/Makefile.pre.in
$(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
$(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
$(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
-@@ -1117,7 +1120,7 @@ frameworkinstallextras:
+@@ -1117,7 +1119,7 @@ frameworkinstallextras:
# This installs a few of the useful scripts in Tools/scripts
scriptsinstall:
SRCDIR=$(srcdir) $(RUNSHARED) \
@@ -142,7 +141,7 @@ diff -Nur Python-2.7.1.orig/Makefile.pre.in Python-2.7.1/Makefile.pre.in
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--root=/$(DESTDIR)
-@@ -1139,7 +1142,7 @@ config.status: $(srcdir)/configure
+@@ -1139,7 +1141,7 @@ config.status: $(srcdir)/configure
# Run reindent on the library
reindent:
@@ -151,7 +150,7 @@ diff -Nur Python-2.7.1.orig/Makefile.pre.in Python-2.7.1/Makefile.pre.in
# Rerun configure with the same options as it was run last time,
# provided the config.status script exists
-@@ -1242,7 +1245,7 @@ funny:
+@@ -1242,7 +1244,7 @@ funny:
# Perform some verification checks on any modified files.
patchcheck:
diff --git a/package/python2/patches/patch-configure b/package/python2/patches/patch-configure
index 5f31d2fdb..e47d860fd 100644
--- a/package/python2/patches/patch-configure
+++ b/package/python2/patches/patch-configure
@@ -1,5 +1,5 @@
--- Python-2.7.1.orig/configure 2010-11-01 02:47:19.000000000 +0100
-+++ Python-2.7.1/configure 2011-10-06 18:21:02.848792210 +0200
++++ Python-2.7.1/configure 2011-10-14 17:36:48.000000000 +0200
@@ -2972,12 +2972,12 @@ fi
$as_echo_n "checking MACHDEP... " >&6; }
if test -z "$MACHDEP"
@@ -20,7 +20,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking machine type as reported by uname -m" >&5
$as_echo_n "checking machine type as reported by uname -m... " >&6; }
-ac_sys_machine=`uname -m`
-+ac_sys_machine=@@CPU_ARCH@@
++ac_sys_machine=x86_64
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_sys_machine" >&5
$as_echo "$ac_sys_machine" >&6; }
diff --git a/package/python2/patches/patch-setup_py b/package/python2/patches/patch-setup_py
index 7da78c43c..fb91da1d3 100644
--- a/package/python2/patches/patch-setup_py
+++ b/package/python2/patches/patch-setup_py
@@ -89,8 +89,8 @@ diff -Nur Python-2.7.orig/setup.py Python-2.7/setup.py
- '/lib', '/usr/lib',
- ]
- inc_dirs = self.compiler.include_dirs + ['/usr/include']
-+ lib_dirs = self.compiler.library_dirs
-+ inc_dirs = self.compiler.include_dirs
++ lib_dirs = self.compiler.library_dirs + ['@@STAGING_DIR@@/usr/lib']
++ inc_dirs = self.compiler.include_dirs + ['@@STAGING_DIR@@/usr/include']
exts = []
missing = []