summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-11-07 07:16:52 -0800
committerChanho Park <chanho61.park@samsung.com>2014-08-19 19:35:27 +0900
commit5f53ee60d85cd5e278e2e4e4a788ed430249552a (patch)
tree2dd458ddc2a96007da4d6df0a9eb9d07a6bc47df
parent4252549b57962f6b8f1e66cea37abe4b7492b575 (diff)
downloadpython-5f53ee60d85cd5e278e2e4e4a788ed430249552a.tar.gz
python-5f53ee60d85cd5e278e2e4e4a788ed430249552a.tar.bz2
python-5f53ee60d85cd5e278e2e4e4a788ed430249552a.zip
add missing files
-rw-r--r--packaging/_local.pth1
-rw-r--r--packaging/distutils.cfg6
-rw-r--r--packaging/macros.python18
-rw-r--r--packaging/pre_checkin.sh11
-rw-r--r--packaging/python-base.spec328
-rw-r--r--packaging/python.csh2
-rw-r--r--packaging/python.manifest5
-rw-r--r--packaging/python.sh2
-rw-r--r--packaging/python.spec275
-rw-r--r--packaging/pythonstart30
10 files changed, 678 insertions, 0 deletions
diff --git a/packaging/_local.pth b/packaging/_local.pth
new file mode 100644
index 0000000..75ea69d
--- /dev/null
+++ b/packaging/_local.pth
@@ -0,0 +1 @@
+import site; import sys; site.addsitedir("/usr/local/" + sys.lib + "/python"+sys.version[:3]+"/site-packages", set()); sys.lib != "lib" and site.addsitedir("/usr/local/lib/python"+sys.version[:3]+"/site-packages", set())
diff --git a/packaging/distutils.cfg b/packaging/distutils.cfg
new file mode 100644
index 0000000..c745bcd
--- /dev/null
+++ b/packaging/distutils.cfg
@@ -0,0 +1,6 @@
+[build_py]
+optimize=0
+
+[install]
+prefix=/usr/local
+optimize=0
diff --git a/packaging/macros.python b/packaging/macros.python
new file mode 100644
index 0000000..6d49e9c
--- /dev/null
+++ b/packaging/macros.python
@@ -0,0 +1,18 @@
+%py_ver %(python -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND)
+%py_prefix %(python -c "import sys; print sys.prefix" 2>/dev/null || echo PYTHON-NOT-FOUND)
+%py_libdir %{py_prefix}/%{_lib}/python%{py_ver}
+%py_incdir %{py_prefix}/include/python%{py_ver}
+%py_sitedir %{py_libdir}/site-packages
+%py_compile(O) \
+find %1 -name '*.pyc' -exec rm -f {} \\; \
+python -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
+%{-O: \
+find %1 -name '*.pyo' -exec rm -f {} \\; \
+python -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
+}
+%py_requires(d) \
+BuildRequires: /usr/bin/python %{-d:python-devel} \
+PreReq: python = %{py_ver}
+
+%python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib();")
+%python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True);")
diff --git a/packaging/pre_checkin.sh b/packaging/pre_checkin.sh
new file mode 100644
index 0000000..08fd96c
--- /dev/null
+++ b/packaging/pre_checkin.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# This script is called automatically during autobuild checkin.
+
+for spec in python.spec; do
+{ sed -n -e '1,/COMMON-PATCH-BEGIN/p' $spec
+ sed -n -e '/COMMON-PATCH-BEGIN/,/COMMON-PATCH-END/p' python-base.spec
+ sed -n -e '/COMMON-PATCH-END/,/COMMON-PREP-BEGIN/p' $spec
+ sed -n -e '/COMMON-PREP-BEGIN/,/COMMON-PREP-END/p' python-base.spec
+ sed -n -e '/COMMON-PREP-END/,$p' $spec;
+ } | uniq > $spec.tmp && mv $spec.tmp $spec
+done
diff --git a/packaging/python-base.spec b/packaging/python-base.spec
new file mode 100644
index 0000000..9537743
--- /dev/null
+++ b/packaging/python-base.spec
@@ -0,0 +1,328 @@
+Name: python-base
+Version: 2.7.3
+Release: 0
+License: Python-2.0
+Summary: Python Interpreter base package
+Url: http://www.python.org/
+Group: Development/Languages/Python
+%define tarversion %{version}
+%define tarname Python-%{tarversion}
+Source0: %{tarname}.tar.bz2
+Source1: macros.python
+Source4: distutils.cfg
+Source5: _local.pth
+Source1001: python.manifest
+# COMMON-PATCH-BEGIN
+Patch1: python-2.7-dirs.patch
+Patch2: python-distutils-rpm-8.patch
+Patch3: python-2.7.3rc2-multilib.patch
+Patch4: python-2.5.1-sqlite.patch
+Patch5: python-2.7.3rc2-canonicalize2.patch
+Patch6: python-2.7rc2-configure.patch
+Patch7: python-2.6-gettext-plurals.patch
+Patch8: python-2.6b3-curses-panel.patch
+Patch9: python-2.7.1-distutils_test_path.patch
+Patch12: http://psf.upfronthosting.co.za/roundup/tracker/file19029/python-test_structmembers.patch
+Patch13: python-2.7.2-fix_date_time_compiler.patch
+Patch16: pypirc-secure.diff
+Patch17: remove-static-libpython.diff
+Patch18: python-2.7.3-ssl_ca_path.patch
+# COMMON-PATCH-END
+%define python_version %(echo %{tarversion} | head -c 3)
+BuildRequires: automake
+BuildRequires: fdupes
+BuildRequires: pkg-config
+BuildRequires: zlib-devel
+BuildRequires: bzip2-devel
+
+Provides: %{name} = %{python_version}
+# Hack
+Provides: /bin/python
+
+%description
+Python is an interpreted, object-oriented programming language, and is
+often compared to Tcl, Perl, Scheme, or Java. You can find an overview
+of Python in the documentation and tutorials included in the python-doc
+(HTML) or python-doc-pdf (PDF) packages.
+
+This package contains all of stand-alone Python files, minus binary
+modules that would pull in extra dependencies.
+
+%package -n python-devel
+Summary: Include Files and Libraries Mandatory for Building Python Modules
+Group: Development/Languages/Python
+Requires: glibc-devel
+Requires: python-base = %{version}
+
+%description -n python-devel
+The Python programming language's interpreter can be extended with
+dynamically loaded extensions and can be embedded in other programs.
+
+This package contains header files, a static library, and development
+tools for building Python modules, extending the Python interpreter or
+embedding Python in applications.
+
+%package -n python-xml
+Summary: A Python XML Interface
+Group: Development/Libraries/Python
+Requires: python-base = %{version}
+# pyxml used to live out of tree
+Provides: pyxml = 0.8.5
+Obsoletes: pyxml < 0.8.5
+
+%description -n python-xml
+The expat module is a Python interface to the expat XML parser. Since
+Python2.x, it is part of the core Python distribution.
+
+%package -n libpython
+Summary: Python Interpreter shared library
+Group: Development/Languages/Python
+
+%description -n libpython
+Python is an interpreted, object-oriented programming language, and is
+often compared to Tcl, Perl, Scheme, or Java. You can find an overview
+of Python in the documentation and tutorials included in the python-doc
+(HTML) or python-doc-pdf (PDF) packages.
+
+This package contains libpython2.6 shared library for embedding in
+other applications.
+
+%prep
+%setup -q -n %{tarname}
+# patching
+# COMMON-PREP-BEGIN
+%patch1 -p1
+%patch2 -p1
+%patch3
+%patch4
+%patch5
+%patch6
+%patch7
+%patch8
+%patch9 -p1
+%patch12
+%patch13
+#skip test_io test for ppc,ppc64 as it broken.
+%patch16 -p1
+%patch17
+%patch18
+# COMMON-PREP-END
+
+# drop Autoconf version requirement
+sed -i 's/^version_required/dnl version_required/' configure.in
+
+%build
+cp %{S:1001} .
+export OPT="%{optflags}"
+
+autoreconf -f -i . # Modules/_ctypes/libffi
+
+# provide a stable timestamp
+touch -r %{SOURCE0} Makefile.pre.in
+
+# prevent make from trying to rebuild asdl stuff, which requires existing
+# python installation
+touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h
+
+%configure \
+ --docdir=%{_docdir}/python \
+ --with-fpectl \
+ --enable-ipv6 \
+ --enable-shared \
+ --enable-unicode=ucs4
+
+LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH \
+ make %{?_smp_mflags} profile-opt
+
+
+%install
+# replace rest of /usr/local/bin/python or /usr/bin/python2.5 with /usr/bin/python
+find . -wholename "./Parser" -prune -o -name '*.py' -type f -print0 | xargs -0 grep -lE '^#! *(/usr/.*bin/(env +)?)?python' | xargs sed -r -i -e '1s@^#![[:space:]]*(/usr/(local/)?bin/(env +)?)?python([0-9]+\.[0-9]+)?@#!/usr/bin/python@'
+# the grep inbetween makes it much faster
+########################################
+# install it
+########################################
+export OPT="%{optflags} -fPIC"
+%make_install
+# install site-specific tweaks
+#ln -s python%{python_version} %{buildroot}%{_bindir}/python2
+install -m 644 %{SOURCE4} %{buildroot}%{_libdir}/python%{python_version}/distutils
+install -m 644 %{SOURCE5} %{buildroot}%{_libdir}/python%{python_version}/site-packages
+install -d -m 755 %{buildroot}%{_sysconfdir}/rpm
+install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm
+# make sure /usr/lib/python/site-packages exists even on lib64 machines
+mkdir -p %{buildroot}%{_prefix}/lib/python%{python_version}/site-packages
+########################################
+# some cleanups
+########################################
+# remove hard links and replace them with symlinks
+for dir in bin include %{_lib} ; do
+ rm -f %{buildroot}/%{_prefix}/$dir/python
+ ln -s python%{python_version} %{buildroot}/%{_prefix}/$dir/python
+done
+CLEANUP_DIR="%{buildroot}%{_libdir}/python%{python_version}"
+# don't distribute precompiled windows installers (duh)
+rm -f $CLEANUP_DIR/distutils/command/*.exe
+# kill imageop.so and audioop.so, they are rarely used and insecure
+rm -f $CLEANUP_DIR/lib-dynload/imageop.so
+rm -f $CLEANUP_DIR/lib-dynload/audioop.so
+# link shared library instead of static library that tools expect
+ln -s ../../libpython%{python_version}.so %{buildroot}%{_libdir}/python%{python_version}/config/libpython%{python_version}.so
+# remove various things that don't need to be in python-base
+rm %{buildroot}%{_bindir}/idle
+rm -rf $CLEANUP_DIR/{curses,bsddb,idlelib,lib-tk,sqlite3}
+rm $CLEANUP_DIR/ssl.py*
+# does not work without _ssl.so anyway
+# replace duplicate .pyo/.pyc with hardlinks
+%fdupes %{buildroot}/%{_libdir}/python%{python_version}
+########################################
+# documentation
+########################################
+export PDOCS=%{buildroot}%{_docdir}/%{name}
+install -d -m 755 $PDOCS
+install -c -m 644 LICENSE $PDOCS/
+install -c -m 644 README $PDOCS/
+ln -s python%{python_version}.1.gz %{buildroot}%{_mandir}/man1/python.1.gz
+########################################
+# devel
+########################################
+# install Makefile.pre.in and Makefile.pre
+cp Makefile Makefile.pre.in Makefile.pre %{buildroot}%{_libdir}/python%{python_version}/config/
+
+%post -n libpython -p /sbin/ldconfig
+
+%postun -n libpython -p /sbin/ldconfig
+
+%files -n python-devel
+%manifest python.manifest
+%defattr(-, root, root)
+%{_libdir}/python%{python_version}/config/*
+%exclude %{_libdir}/python%{python_version}/config/Setup
+%exclude %{_libdir}/python%{python_version}/config/Makefile
+%defattr(644, root, root, 755)
+%{_libdir}/libpython*.so
+%{_libdir}/pkgconfig/python-%{python_version}.pc
+%{_libdir}/pkgconfig/python.pc
+%{_libdir}/pkgconfig/python2.pc
+%{_includedir}/python*
+%exclude %{_includedir}/python%{python_version}/pyconfig.h
+%{_libdir}/python%{python_version}/test
+%defattr(755, root, root)
+%{_bindir}/python-config
+%{_bindir}/python2-config
+%{_bindir}/python%{python_version}-config
+
+%files -n python-xml
+%manifest python.manifest
+%defattr(644, root, root, 755)
+%{_libdir}/python%{python_version}/xml
+%{_libdir}/python%{python_version}/lib-dynload/pyexpat.so
+
+%files -n libpython
+%manifest python.manifest
+%defattr(644, root, root)
+%{_libdir}/libpython*.so.*
+
+%files
+%manifest python.manifest
+%defattr(644, root, root, 755)
+%config %{_sysconfdir}/rpm/macros.python
+%dir %{_docdir}/%{name}
+%doc %{_docdir}/%{name}/README
+%doc %{_docdir}/%{name}/LICENSE
+%doc %{_mandir}/man1/python.1*
+%doc %{_mandir}/man1/python%{python_version}.1*
+%dir %{_includedir}/python%{python_version}
+%{_includedir}/python%{python_version}/pyconfig.h
+%{_libdir}/python
+%dir %{_prefix}/lib/python%{python_version}
+%dir %{_prefix}/lib/python%{python_version}/site-packages
+%dir %{_libdir}/python%{python_version}
+%dir %{_libdir}/python%{python_version}/config
+%{_libdir}/python%{python_version}/config/Setup
+%{_libdir}/python%{python_version}/config/Makefile
+%{_libdir}/python%{python_version}/*.*
+%{_libdir}/python%{python_version}/compiler
+%{_libdir}/python%{python_version}/ctypes
+%{_libdir}/python%{python_version}/distutils
+%{_libdir}/python%{python_version}/email
+%{_libdir}/python%{python_version}/encodings
+%{_libdir}/python%{python_version}/hotshot
+%{_libdir}/python%{python_version}/importlib
+%{_libdir}/python%{python_version}/json
+%{_libdir}/python%{python_version}/lib2to3
+%{_libdir}/python%{python_version}/logging
+%{_libdir}/python%{python_version}/multiprocessing
+%{_libdir}/python%{python_version}/plat-*
+%{_libdir}/python%{python_version}/pydoc_data
+%{_libdir}/python%{python_version}/unittest
+%{_libdir}/python%{python_version}/wsgiref
+%dir %{_libdir}/python%{python_version}/site-packages
+%{_libdir}/python%{python_version}/site-packages/README
+%{_libdir}/python%{python_version}/site-packages/_local.pth
+%dir %{_libdir}/python%{python_version}/lib-dynload
+%{_libdir}/python%{python_version}/lib-dynload/_bisect.so
+%{_libdir}/python%{python_version}/lib-dynload/_csv.so
+%{_libdir}/python%{python_version}/lib-dynload/_collections.so
+%{_libdir}/python%{python_version}/lib-dynload/_ctypes.so
+%{_libdir}/python%{python_version}/lib-dynload/_ctypes_test.so
+%{_libdir}/python%{python_version}/lib-dynload/_elementtree.so
+%{_libdir}/python%{python_version}/lib-dynload/_functools.so
+%{_libdir}/python%{python_version}/lib-dynload/_heapq.so
+%{_libdir}/python%{python_version}/lib-dynload/_hotshot.so
+%{_libdir}/python%{python_version}/lib-dynload/_io.so
+%{_libdir}/python%{python_version}/lib-dynload/_json.so
+%{_libdir}/python%{python_version}/lib-dynload/_locale.so
+%{_libdir}/python%{python_version}/lib-dynload/_lsprof.so
+%{_libdir}/python%{python_version}/lib-dynload/_md5.so
+%{_libdir}/python%{python_version}/lib-dynload/_multiprocessing.so
+%{_libdir}/python%{python_version}/lib-dynload/_random.so
+%{_libdir}/python%{python_version}/lib-dynload/_sha.so
+%{_libdir}/python%{python_version}/lib-dynload/_sha256.so
+%{_libdir}/python%{python_version}/lib-dynload/_sha512.so
+%{_libdir}/python%{python_version}/lib-dynload/_socket.so
+%{_libdir}/python%{python_version}/lib-dynload/_struct.so
+%{_libdir}/python%{python_version}/lib-dynload/_testcapi.so
+%{_libdir}/python%{python_version}/lib-dynload/array.so
+%{_libdir}/python%{python_version}/lib-dynload/binascii.so
+%{_libdir}/python%{python_version}/lib-dynload/bz2.so
+%{_libdir}/python%{python_version}/lib-dynload/cPickle.so
+%{_libdir}/python%{python_version}/lib-dynload/cStringIO.so
+%{_libdir}/python%{python_version}/lib-dynload/cmath.so
+%{_libdir}/python%{python_version}/lib-dynload/crypt.so
+%{_libdir}/python%{python_version}/lib-dynload/datetime.so
+%{_libdir}/python%{python_version}/lib-dynload/fcntl.so
+%{_libdir}/python%{python_version}/lib-dynload/future_builtins.so
+%{_libdir}/python%{python_version}/lib-dynload/grp.so
+%{_libdir}/python%{python_version}/lib-dynload/itertools.so
+%{_libdir}/python%{python_version}/lib-dynload/linuxaudiodev.so
+%{_libdir}/python%{python_version}/lib-dynload/math.so
+%{_libdir}/python%{python_version}/lib-dynload/mmap.so
+%{_libdir}/python%{python_version}/lib-dynload/nis.so
+%{_libdir}/python%{python_version}/lib-dynload/operator.so
+%{_libdir}/python%{python_version}/lib-dynload/ossaudiodev.so
+%{_libdir}/python%{python_version}/lib-dynload/parser.so
+%{_libdir}/python%{python_version}/lib-dynload/resource.so
+%{_libdir}/python%{python_version}/lib-dynload/select.so
+%{_libdir}/python%{python_version}/lib-dynload/spwd.so
+%{_libdir}/python%{python_version}/lib-dynload/strop.so
+%{_libdir}/python%{python_version}/lib-dynload/syslog.so
+%{_libdir}/python%{python_version}/lib-dynload/termios.so
+%{_libdir}/python%{python_version}/lib-dynload/time.so
+%{_libdir}/python%{python_version}/lib-dynload/unicodedata.so
+%{_libdir}/python%{python_version}/lib-dynload/zlib.so
+%{_libdir}/python%{python_version}/lib-dynload/_codecs*.so
+%{_libdir}/python%{python_version}/lib-dynload/_multibytecodec.so
+%{_libdir}/python%{python_version}/lib-dynload/Python-%{tarversion}-py%{python_version}.egg-info
+# these modules don't support 64-bit arches (disabled by setup.py)
+%ifnarch x86_64
+# requires sizeof(int) == sizeof(long) == sizeof(char*)
+%{_libdir}/python%{python_version}/lib-dynload/dl.so
+%endif
+%attr(755, root, root) %{_bindir}/pydoc
+%attr(755, root, root) %{_bindir}/python
+%attr(755, root, root) %{_bindir}/python%{python_version}
+%attr(755, root, root) %{_bindir}/smtpd.py
+%{_bindir}/python2
+%exclude %{_bindir}/2to3
+
diff --git a/packaging/python.csh b/packaging/python.csh
new file mode 100644
index 0000000..b94d822
--- /dev/null
+++ b/packaging/python.csh
@@ -0,0 +1,2 @@
+# add python startup script for interactive sessions
+setenv PYTHONSTARTUP /etc/pythonstart
diff --git a/packaging/python.manifest b/packaging/python.manifest
new file mode 100644
index 0000000..017d22d
--- /dev/null
+++ b/packaging/python.manifest
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
diff --git a/packaging/python.sh b/packaging/python.sh
new file mode 100644
index 0000000..887a886
--- /dev/null
+++ b/packaging/python.sh
@@ -0,0 +1,2 @@
+# add python startup script for interactive sessions
+export PYTHONSTARTUP=/etc/pythonstart
diff --git a/packaging/python.spec b/packaging/python.spec
new file mode 100644
index 0000000..c78f670
--- /dev/null
+++ b/packaging/python.spec
@@ -0,0 +1,275 @@
+Name: python
+Version: 2.7.3
+Release: 1
+License: Python-2.0
+Summary: Python Interpreter
+Url: http://www.python.org/
+Group: Development/Languages/Python
+%define tarversion %{version}
+%define tarname Python-%{tarversion}
+Source0: %{tarname}.tar.bz2
+Source2: pythonstart
+Source3: python.sh
+Source4: python.csh
+Source1001: %name.manifest
+# !!!!!!!!!!!!!!
+# do not add or edit patches here. please edit python-base.spec
+# instead and run pre_checkin.sh
+# !!!!!!!!!!!!!!
+# COMMON-PATCH-BEGIN
+Patch1: python-2.7-dirs.patch
+Patch2: python-distutils-rpm-8.patch
+Patch3: python-2.7.3rc2-multilib.patch
+Patch4: python-2.5.1-sqlite.patch
+Patch5: python-2.7.3rc2-canonicalize2.patch
+Patch6: python-2.7rc2-configure.patch
+Patch7: python-2.6-gettext-plurals.patch
+Patch8: python-2.6b3-curses-panel.patch
+Patch9: python-2.7.1-distutils_test_path.patch
+Patch12: http://psf.upfronthosting.co.za/roundup/tracker/file19029/python-test_structmembers.patch
+Patch13: python-2.7.2-fix_date_time_compiler.patch
+Patch16: pypirc-secure.diff
+Patch17: remove-static-libpython.diff
+Patch18: python-2.7.3-ssl_ca_path.patch
+# COMMON-PATCH-END
+BuildRequires: automake
+BuildRequires: db4-devel
+BuildRequires: fdupes
+BuildRequires: gmp-devel
+BuildRequires: bzip2-devel
+BuildRequires: openssl-devel
+BuildRequires: ncurses-devel
+BuildRequires: readline-devel
+BuildRequires: sqlite-devel
+%define python_version %(echo %{tarversion} | head -c 3)
+%define idle_name idle
+Requires: python-base = %{version}
+Provides: %{name} = %{python_version}
+Obsoletes: python-elementtree
+Obsoletes: python-nothreads
+Obsoletes: python-sqlite
+
+%description
+Python is an interpreted, object-oriented programming language, and is
+often compared to Tcl, Perl, Scheme, or Java. You can find an overview
+of Python in the documentation and tutorials included in the python-doc
+(HTML) or python-doc-pdf (PDF) packages.
+
+If you want to install third party modules using distutils, you need to
+install python-devel package.
+
+%package curses
+Summary: Python Interface to the (N)Curses Library
+Group: Development/Libraries/Python
+Requires: python-base = %{version}
+Obsoletes: pyth_cur
+Provides: pyth_cur
+
+%description curses
+An easy to use interface to the (n)curses CUI library. CUI stands for
+Console User Interface.
+
+%prep
+%setup -q -n %{tarname}
+# COMMON-PREP-BEGIN
+%patch1 -p1
+%patch2 -p1
+%patch3
+%patch4
+%patch5
+%patch6
+%patch7
+%patch8
+%patch9 -p1
+%patch12
+%patch13
+#skip test_io test for ppc,ppc64 as it broken.
+%patch16 -p1
+%patch17
+%patch18
+# COMMON-PREP-END
+
+# drop Autoconf version requirement
+sed -i 's/^version_required/dnl version_required/' configure.in
+
+# remove newslist.py because of bad license
+rm Demo/scripts/newslist.*
+
+%build
+cp %{S:1001} .
+export OPT=$(echo $RPM_OPT_FLAGS | sed -s "s/--param=ssp-buffer-size=32//g")
+
+autoreconf -f -i . # Modules/_ctypes/libffi
+# prevent make from trying to rebuild asdl stuff, which requires existing
+# python installation
+touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h
+
+%configure \
+ --docdir=%{_docdir}/python \
+ --enable-ipv6 \
+ --with-fpectl \
+ --enable-shared \
+ --enable-unicode=ucs4
+
+make %{?_smp_mflags}
+
+%install
+# replace rest of /usr/local/bin/python or /usr/bin/python2.x with /usr/bin/python
+find . -wholename "./Parser" -prune -o -name '*.py' -type f -print0 | xargs -0 grep -lE '^#! *(/usr/.*bin/(env +)?)?python' | xargs sed -r -i -e '1s@^#![[:space:]]*(/usr/(local/)?bin/(env +)?)?python([0-9]+\.[0-9]+)?@#!/usr/bin/python@'
+# the grep inbetween makes it much faster
+########################################
+# install it
+########################################
+export OPT=$(echo $RPM_OPT_FLAGS | sed -s "s/--param=ssp-buffer-size=32//g")
+%make_install
+########################################
+# some cleanups
+########################################
+# remove hard links and replace them with symlinks
+for dir in bin include %{_lib} ; do
+ rm -f %{buildroot}/%{_prefix}/$dir/python
+ ln -s python%{python_version} %{buildroot}/%{_prefix}/$dir/python
+done
+# kill imageop.so, it's insecure
+rm -f %{buildroot}/%{_libdir}/python%{python_version}/lib-dynload/imageop.so
+#cleanup for -base
+rm %{buildroot}%{_bindir}/python%{python_version}
+rm %{buildroot}%{_bindir}/python2
+rm %{buildroot}%{_bindir}/python
+rm %{buildroot}%{_bindir}/smtpd.py
+rm %{buildroot}%{_bindir}/pydoc
+rm %{buildroot}%{_bindir}/2to3
+rm %{buildroot}%{_mandir}/man1/python*
+rm %{buildroot}%{_libdir}/libpython*.so.*
+rm %{buildroot}%{_libdir}/python
+find %{buildroot}%{_libdir}/python%{python_version} -maxdepth 1 ! \( -name "ssl.py" \) -exec rm {} ";"
+rm %{buildroot}%{_bindir}/python%{python_version}-config
+rm %{buildroot}%{_bindir}/python2-config
+rm %{buildroot}%{_bindir}/python-config
+rm %{buildroot}%{_libdir}/pkgconfig/*
+rm -rf %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/dbm.so
+rm -r %{buildroot}%{_includedir}/python
+rm -r %{buildroot}%{_includedir}/python%{python_version}
+rm -r %{buildroot}%{_libdir}/python%{python_version}/compiler
+rm -r %{buildroot}%{_libdir}/python%{python_version}/config
+rm -r %{buildroot}%{_libdir}/python%{python_version}/ctypes
+rm -r %{buildroot}%{_libdir}/python%{python_version}/distutils
+rm -r %{buildroot}%{_libdir}/python%{python_version}/email
+rm -r %{buildroot}%{_libdir}/python%{python_version}/encodings
+rm -r %{buildroot}%{_libdir}/python%{python_version}/hotshot
+rm -r %{buildroot}%{_libdir}/python%{python_version}/importlib
+rm -r %{buildroot}%{_libdir}/python%{python_version}/json
+rm -r %{buildroot}%{_libdir}/python%{python_version}/lib2to3
+rm -r %{buildroot}%{_libdir}/python%{python_version}/logging
+rm -r %{buildroot}%{_libdir}/python%{python_version}/multiprocessing
+rm -r %{buildroot}%{_libdir}/python%{python_version}/plat-*
+rm -r %{buildroot}%{_libdir}/python%{python_version}/pydoc_data
+rm -r %{buildroot}%{_libdir}/python%{python_version}/test
+rm -r %{buildroot}%{_libdir}/python%{python_version}/unittest
+rm -r %{buildroot}%{_libdir}/python%{python_version}/wsgiref
+rm -r %{buildroot}%{_libdir}/python%{python_version}/xml
+rm %{buildroot}%{_libdir}/libpython%{python_version}.so
+rm %{buildroot}%{_libdir}/python%{python_version}/site-packages/README
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_bisect.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_csv.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_collections.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_ctypes.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_ctypes_test.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_elementtree.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_functools.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_heapq.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_hotshot.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_io.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_json.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_locale.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_lsprof.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_multiprocessing.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_random.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_socket.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_struct.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_testcapi.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/array.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/binascii.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/bz2.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/cPickle.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/cStringIO.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/cmath.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/crypt.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/datetime.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/fcntl.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/future_builtins.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/grp.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/itertools.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/linuxaudiodev.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/math.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/mmap.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/nis.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/operator.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/ossaudiodev.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/parser.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/pyexpat.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/resource.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/select.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/spwd.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/strop.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/syslog.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/termios.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/time.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/unicodedata.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/zlib.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_codecs*.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_multibytecodec.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/audioop.so
+rm -f %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/dl.so
+rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/Python-%{tarversion}-py%{python_version}.egg-info
+# replace duplicate .pyo/.pyc with hardlinks
+%fdupes %{buildroot}/%{_libdir}/python%{python_version}
+########################################
+# documentation
+########################################
+export PDOCS=%{buildroot}%{_docdir}/%{name}
+install -d -m 755 $PDOCS
+install -c -m 644 LICENSE $PDOCS/
+install -c -m 644 README $PDOCS/
+########################################
+# startup script
+########################################
+install -d -m 755 %{buildroot}%{_sysconfdir}/profile.d
+install -m 644 %{SOURCE2} %{buildroot}/etc
+install -m 644 %{SOURCE3} %{SOURCE4} %{buildroot}%{_sysconfdir}/profile.d
+
+rm -rf %{buildroot}%{_bindir}/idle
+rm -rf %{buildroot}%{_libdir}/python%{python_version}/idlelib
+rm -rf %{buildroot}%{_libdir}/python%{python_version}/lib-tk
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files curses
+%manifest %name.manifest
+%defattr(644, root, root, 755)
+%{_libdir}/python%{python_version}/curses
+%{_libdir}/python%{python_version}/lib-dynload/_curses.so
+%{_libdir}/python%{python_version}/lib-dynload/_curses_panel.so
+
+%files
+%manifest %name.manifest
+%defattr(644, root, root, 755)
+%dir %{_docdir}/%{name}
+%doc %{_docdir}/%{name}/README
+%doc %{_docdir}/%{name}/LICENSE
+%config %{_sysconfdir}/pythonstart
+%config %{_sysconfdir}/profile.d/python.*
+%dir %{_libdir}/python%{python_version}
+%{_libdir}/python%{python_version}/ssl.py*
+%{_libdir}/python%{python_version}/bsddb
+%{_libdir}/python%{python_version}/sqlite3
+%dir %{_libdir}/python%{python_version}/lib-dynload
+%{_libdir}/python%{python_version}/lib-dynload/_bsddb.so
+%{_libdir}/python%{python_version}/lib-dynload/_hashlib.so
+%{_libdir}/python%{python_version}/lib-dynload/_sqlite3.so
+%{_libdir}/python%{python_version}/lib-dynload/_ssl.so
+%{_libdir}/python%{python_version}/lib-dynload/readline.so
+
+%changelog
diff --git a/packaging/pythonstart b/packaging/pythonstart
new file mode 100644
index 0000000..1708f3a
--- /dev/null
+++ b/packaging/pythonstart
@@ -0,0 +1,30 @@
+# startup script for python to enable saving of interpreter history and
+# enabling name completion
+
+# import needed modules
+import atexit
+import os
+import readline
+import rlcompleter
+
+# where is history saved
+historyPath = os.path.expanduser("~/.pyhistory")
+
+# handler for saving history
+def save_history(historyPath=historyPath):
+ import readline
+ readline.write_history_file(historyPath)
+
+# read history, if it exists
+if os.path.exists(historyPath):
+ readline.set_history_length(10000)
+ readline.read_history_file(historyPath)
+
+# register saving handler
+atexit.register(save_history)
+
+# enable completion
+readline.parse_and_bind('tab: complete')
+
+# cleanup
+del os, atexit, readline, rlcompleter, save_history, historyPath