From 67cdfc1cec0b696624463dfabec191097aa70ed6 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Thu, 27 Dec 2018 13:47:48 +0900 Subject: [PATCH] Bump to python 2.7.15 [Model] All [BinType] AP [Customer] OPEN [Issue#] N/A [Request] N/A [Occurrence Version] N/A [Problem] python version upgrade [Cause & Measure] [Checking Method] [Team] Open Source Management and Setting Part [Developer] dh0128.kwak [Solution company] Samsung [Change Type] N/A Change-Id: I28e8832b87b20556efd740ce95c0be11c94bc206 Signed-off-by: DongHun Kwak --- Makefile.pre.in | 2 +- Modules/_curses_panel.c | 2 +- packaging/distutils.cfg | 6 + packaging/macros.python | 18 ++ packaging/python-2.7.15_lib64.patch | 142 +++++++++++++++ packaging/python.changes | 17 ++ packaging/python.csh | 2 + packaging/python.manifest | 5 + packaging/python.sh | 2 + packaging/python.spec | 345 ++++++++++++++++++++++++++++++++++++ packaging/pythonstart | 30 ++++ 11 files changed, 569 insertions(+), 2 deletions(-) create mode 100644 packaging/distutils.cfg create mode 100644 packaging/macros.python create mode 100644 packaging/python-2.7.15_lib64.patch create mode 100644 packaging/python.changes create mode 100644 packaging/python.csh create mode 100644 packaging/python.manifest create mode 100644 packaging/python.sh create mode 100644 packaging/python.spec create mode 100644 packaging/pythonstart diff --git a/Makefile.pre.in b/Makefile.pre.in index 9297e7f..3231b34 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -211,7 +211,7 @@ TCLTK_LIBS= @TCLTK_LIBS@ # The task to run while instrument when building the profile-opt target # We exclude unittests with -x that take a rediculious amount of time to # run in the instrumented training build or do not provide much value. -PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing test_subprocess +#PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing test_subprocess # report files for gcov / lcov coverage report COVERAGE_INFO= $(abs_builddir)/coverage.info diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c index bc89447..b9b524f 100644 --- a/Modules/_curses_panel.c +++ b/Modules/_curses_panel.c @@ -14,7 +14,7 @@ static char *PyCursesVersion = "2.1"; #include "py_curses.h" -#include +#include static PyObject *PyCursesError; 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..bce9c44 --- /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} \ +Requires(pre): 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/python-2.7.15_lib64.patch b/packaging/python-2.7.15_lib64.patch new file mode 100644 index 0000000..22159fc --- /dev/null +++ b/packaging/python-2.7.15_lib64.patch @@ -0,0 +1,142 @@ +diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py +index b9f1c6c..7b23714 100644 +--- a/Lib/distutils/command/install.py ++++ b/Lib/distutils/command/install.py +@@ -42,14 +42,14 @@ else: + INSTALL_SCHEMES = { + 'unix_prefix': { + 'purelib': '$base/lib/python$py_version_short/site-packages', +- 'platlib': '$platbase/lib/python$py_version_short/site-packages', ++ 'platlib': '$platbase/lib64/python$py_version_short/site-packages', + 'headers': '$base/include/python$py_version_short/$dist_name', + 'scripts': '$base/bin', + 'data' : '$base', + }, + 'unix_home': { + 'purelib': '$base/lib/python', +- 'platlib': '$base/lib/python', ++ 'platlib': '$base/lib64/python', + 'headers': '$base/include/python/$dist_name', + 'scripts': '$base/bin', + 'data' : '$base', +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index de7da1d..5333b06 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -119,8 +119,11 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): + prefix = plat_specific and EXEC_PREFIX or PREFIX + + if os.name == "posix": +- libpython = os.path.join(prefix, +- "lib", "python" + get_python_version()) ++ if plat_specific or standard_lib: ++ lib = "lib64" ++ else: ++ lib = "lib" ++ libpython = os.path.join(prefix, lib, "python" + get_python_version()) + if standard_lib: + return libpython + else: +diff --git a/Lib/site.py b/Lib/site.py +index 3b51e81..9fd76c8 100644 +--- a/Lib/site.py ++++ b/Lib/site.py +@@ -288,12 +288,16 @@ def getsitepackages(): + if sys.platform in ('os2emx', 'riscos'): + sitepackages.append(os.path.join(prefix, "Lib", "site-packages")) + elif os.sep == '/': ++ sitepackages.append(os.path.join(prefix, "lib64", ++ "python" + sys.version[:3], ++ "site-packages")) + sitepackages.append(os.path.join(prefix, "lib", + "python" + sys.version[:3], + "site-packages")) + sitepackages.append(os.path.join(prefix, "lib", "site-python")) + else: + sitepackages.append(prefix) ++ sitepackages.append(os.path.join(prefix, "lib64", "site-packages")) + sitepackages.append(os.path.join(prefix, "lib", "site-packages")) + return sitepackages + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 9297e7f..773f15d 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -110,7 +110,7 @@ LIBDIR= @libdir@ + MANDIR= @mandir@ + INCLUDEDIR= @includedir@ + CONFINCLUDEDIR= $(exec_prefix)/include +-SCRIPTDIR= $(prefix)/lib ++SCRIPTDIR= $(prefix)/lib64 + + # Detailed destination directories + BINLIBDEST= $(LIBDIR)/python$(VERSION) +diff --git a/Modules/getpath.c b/Modules/getpath.c +index c42ce31..2d68cb4 100644 +--- a/Modules/getpath.c ++++ b/Modules/getpath.c +@@ -108,7 +108,7 @@ static char prefix[MAXPATHLEN+1]; + static char exec_prefix[MAXPATHLEN+1]; + static char progpath[MAXPATHLEN+1]; + static char *module_search_path = NULL; +-static char lib_python[] = "lib/python" VERSION; ++static char lib_python[] = "lib64/python" VERSION; + + static void + reduce(char *dir) +@@ -520,7 +520,7 @@ calculate_path(void) + } + else + strncpy(zip_path, PREFIX, MAXPATHLEN); +- joinpath(zip_path, "lib/python00.zip"); ++ joinpath(zip_path, "lib64/python00.zip"); + bufsz = strlen(zip_path); /* Replace "00" with version */ + zip_path[bufsz - 6] = VERSION[0]; + zip_path[bufsz - 5] = VERSION[2]; +@@ -530,7 +530,7 @@ calculate_path(void) + fprintf(stderr, + "Could not find platform dependent libraries \n"); + strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN); +- joinpath(exec_prefix, "lib/lib-dynload"); ++ joinpath(exec_prefix, "lib64/lib-dynload"); + } + /* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */ + +diff --git a/setup.py b/setup.py +index 33cecc6..b787487 100644 +--- a/setup.py ++++ b/setup.py +@@ -456,7 +456,7 @@ class PyBuildExt(build_ext): + def detect_modules(self): + # Ensure that /usr/local is always used + if not cross_compiling: +- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') ++ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64') + add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') + if cross_compiling: + self.add_gcc_paths() +@@ -782,11 +782,11 @@ class PyBuildExt(build_ext): + elif curses_library: + readline_libs.append(curses_library) + elif self.compiler.find_library_file(lib_dirs + +- ['/usr/lib/termcap'], ++ ['/usr/lib64/termcap'], + 'termcap'): + readline_libs.append('termcap') + exts.append( Extension('readline', ['readline.c'], +- library_dirs=['/usr/lib/termcap'], ++ library_dirs=['/usr/lib64/termcap'], + extra_link_args=readline_extra_link_args, + libraries=readline_libs) ) + else: +@@ -821,8 +821,8 @@ class PyBuildExt(build_ext): + if krb5_h: + ssl_incs += krb5_h + ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, +- ['/usr/local/ssl/lib', +- '/usr/contrib/ssl/lib/' ++ ['/usr/local/ssl/lib64', ++ '/usr/contrib/ssl/lib64/' + ] ) + + if (ssl_incs is not None and diff --git a/packaging/python.changes b/packaging/python.changes new file mode 100644 index 0000000..03af7ba --- /dev/null +++ b/packaging/python.changes @@ -0,0 +1,17 @@ +* Tue Aug 19 2014 Chanho Park upstream/2.7.8-36-g11532b0 +- Imported Upstream version 2.7.8 + +* Fri Sep 06 2013 Anas Nashif accepted/tizen/20130710.215023@f56f704 +- clean up groups/license +- fix gcc 4.8 incompatibility +- resetting manifest requested domain to floor + +* Sat Mar 30 2013 Anas Nashif submit/trunk/20130219.185052@98825e9 +- Fixed file list + +* Tue Feb 19 2013 Anas Nashif submit/trunk/20130112.140659@1b048b7 +- Packaging: Provide python(abi) = 2.7 + +* Sat Jan 12 2013 Anas Nashif upstream/2.7.3@ad84453 +- Remove nis.so for glibc 2.17 + 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 @@ + + + + + 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..8b7bb5e --- /dev/null +++ b/packaging/python.spec @@ -0,0 +1,345 @@ +Name: python +Version: 2.7.15 +Release: 1 +License: Python-2.0 +Summary: Python Interpreter +Url: http://www.python.org/ +Group: Development/Languages +%define tarversion %{version} +%define tarname Python-%{tarversion} +Source0: %{tarname}.tar.bz2 +Source1: macros.python +Source2: pythonstart +Source3: python.sh +Source4: python.csh +Source6: python-2.7.15_lib64.patch +Source1001: %name.manifest + + +BuildRequires: automake +BuildRequires: db4-devel +BuildRequires: fdupes +BuildRequires: bzip2-devel +BuildRequires: openssl-devel +BuildRequires: ncurses-devel +BuildRequires: readline-devel +BuildRequires: sqlite-devel +BuildRequires: zlib-devel +%define python_version %(echo %{tarversion} | head -c 3) +%define idle_name idle +Provides: %{name} = %{python_version} +# FIXME +Provides: /bin/python +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 +Requires: python = %{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. + +%package -n python-devel +Summary: Include Files and Libraries Mandatory for Building Python Modules +Requires: glibc-devel +Requires: python = %{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 +Requires: python = %{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 + +%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} + +%ifarch x86_64 aarch64 +%{__patch} -p1 < %{SOURCE6} +%endif + +# drop Autoconf version requirement +sed -i 's/^version_required/dnl version_required/' configure.ac + +%build +cp %{S:1001} . +export OPT=$(echo $RPM_OPT_FLAGS | sed -s "s/--param=ssp-buffer-size=32//g") +export CFLAGS+=" -fPIC -DNCURSES_INTERNALS" +export LDFLAGS+=" -Wl,-z,relro" + +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 + +LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH \ + make %{?_smp_mflags} BASE_LIB=%{_lib} profile-opt + +%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 +# install site-specific tweaks +install -m 644 %{SOURCE4} %{buildroot}%{_libdir}/python%{python_version}/distutils +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 +# kill imageop.so, it's insecure +rm -f %{buildroot}/%{_libdir}/python%{python_version}/lib-dynload/imageop.so +# 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 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/ + +######################################## +# 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 + +%license LICENSE + +%config %{_sysconfdir}/pythonstart +%config %{_sysconfdir}/profile.d/python.* + +%dir %{_usr}/lib/python%{python_version}/site-packages +%dir %{_libdir}/python%{python_version} +%dir %{_prefix}/lib/python%{python_version} +%dir %{_libdir}/python%{python_version}/lib-dynload +%dir %{_libdir}/python%{python_version}/config +%dir %{_includedir}/python%{python_version} + +%{_libdir}/python +%{_libdir}/python%{python_version}/config/Setup +%{_libdir}/python%{python_version}/config/Makefile + +%{_libdir}/python%{python_version}/*.* + +%{_libdir}/python%{python_version}/bsddb +%{_libdir}/python%{python_version}/sqlite3 +%{_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}/ensurepip +%{_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 +%{_libdir}/python%{python_version}/site-packages/README + +%{_includedir}/python%{python_version}/pyconfig.h + +%{_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 +%{_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/nis.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/audioop.so +%{_libdir}/python%{python_version}/lib-dynload/dbm.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/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 aarch64 +# requires sizeof(int) == sizeof(long) == sizeof(char*) +%{_libdir}/python%{python_version}/lib-dynload/dl.so +%endif + +%defattr(644, root, root, 755) +%config %{_sysconfdir}/rpm/macros.python + +%doc %{_mandir}/man1/python.1* +%doc %{_mandir}/man1/python2.* +%doc %{_mandir}/man1/python%{python_version}.1* +%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 + +%post -n libpython -p /sbin/ldconfig + +%postun -n libpython -p /sbin/ldconfig + +%files -n python-devel +%manifest %{name}.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 %{name}.manifest +%defattr(644, root, root, 755) +%{_libdir}/python%{python_version}/xml +%{_libdir}/python%{python_version}/lib-dynload/pyexpat.so + +%files -n libpython +%manifest %{name}.manifest +%defattr(644, root, root) +%{_libdir}/libpython*.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 -- 2.7.4