Difference between revisions of "Python"
(2.7.8 has no multilib patch. William Feely has one for his LFS multilib build: https://www.williamfeely.info/wiki/Lfs-multilib/blfs#Python_2) |
|||
(43 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
{| style="text-align: left; background-color: AliceBlue;" | {| style="text-align: left; background-color: AliceBlue;" | ||
− | |- | + | |-valign="top" |
!Download Source: | !Download Source: | ||
− | | http://www.python.org/ftp/python/ | + | | http://www.python.org/ftp/python/{{Python-Version}}/Python-{{Python-Version}}.tar.xz |
− | |- | + | |-valign="top" |
− | ! | + | !Alternate Requierd Patch (For Multilib): |
− | | | + | | Refer to https://www.williamfeely.info/download/lfs-multilib/Python-2.7.6-multilib-1.patch |
− | |- | + | |-valign="top" |
!Required Patch (For Multilib): | !Required Patch (For Multilib): | ||
− | | http://svn.cross-lfs.org/svn/repos/patches/Python/Python- | + | | Bad link: http://svn.cross-lfs.org/svn/repos/patches/Python/Python-{{Python-Version}}-multilib-1.patch |
+ | |-valign="top" | ||
|} | |} | ||
---- | ---- | ||
+ | |||
+ | {{Package-Introduction|Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code.|http://www.python.org/}} | ||
== Dependencies == | == Dependencies == | ||
Line 20: | Line 23: | ||
* [[GDBM]] | * [[GDBM]] | ||
* [[X Window System]] | * [[X Window System]] | ||
+ | * [[SQLite3]] | ||
+ | * [[Libffi]] | ||
+ | * [[Bluez]] | ||
== Non-Multilib == | == Non-Multilib == | ||
+ | |||
+ | {{Note|If the test suite ('''make test''') fails because it cannot find python's math library, then you will need to install python before you can run the tests.}} | ||
+ | |||
+ | {{Note|If the installation of python fails, rebuild python. It appears to be somewhat inconsistant with regards to whether it works or not. The ''-fwrapv'' flag used with make attempts to fixes this. If it still doesn't complete '''make install''' without failing, then use '''make -i install''' instead ('''-i''' tells '''make''' to ignore errors). It's less desirable, but it should work. The other option is to run '''make install''' twice. The second time around it locates the installed python libraries it needs for the installation and is able to complete it.}} | ||
Compile the package: | Compile the package: | ||
− | + | sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" setup.py && | |
./configure --prefix=/usr --enable-shared && | ./configure --prefix=/usr --enable-shared && | ||
make | make | ||
Line 32: | Line 42: | ||
make install | make install | ||
+ | |||
+ | === Command Explanations === | ||
+ | |||
+ | ''--enable-shared'': Enables the building of shared libraries. | ||
== Multilib == | == Multilib == | ||
Line 39: | Line 53: | ||
Compile the package: | Compile the package: | ||
− | + | sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" setup.py && | |
+ | sed -i 's@/lib64@/lib@g' Modules/_ctypes/libffi/m4/libtool.m4 \ | ||
+ | Modules/_ctypes/libffi/configure setup.py && | ||
+ | sed -i "s/'lib64'/'lib'/g" setup.py && | ||
CC="gcc ${BUILD32}" CXX="g++ ${BUILD32}" ./configure --prefix=/usr \ | CC="gcc ${BUILD32}" CXX="g++ ${BUILD32}" ./configure --prefix=/usr \ | ||
--enable-shared && | --enable-shared && | ||
Line 48: | Line 65: | ||
make install && | make install && | ||
mv -v /usr/bin/python{,-32} && | mv -v /usr/bin/python{,-32} && | ||
− | mv -v /usr/bin/python2 | + | mv -v /usr/bin/python2{,-32} && |
− | mv -v /usr/include/ | + | mv -v /usr/bin/python{{Python-Version2}}{,-32} && |
+ | mv -v /usr/include/python{{Python-Version2}}/pyconfig{,-32}.h && | ||
+ | ln -sfv python2.7-32 /usr/bin/python2-32 && | ||
+ | ln -sfv python2-32 /usr/bin/python-32 | ||
=== N32 === | === N32 === | ||
Line 55: | Line 75: | ||
Change the libdir that Python is going to use to lib32: | Change the libdir that Python is going to use to lib32: | ||
− | patch -Np1 -i ../Python- | + | patch -Np1 -i ../Python-{{Python-Version}}-multilib-1.patch && |
− | sed -i -e "s | + | |
− | + | sed -i -e "s|@@MULTILIB_DIR@@|/lib32|g" Lib/distutils/command/install.py \ | |
− | + | Lib/distutils/sysconfig.py \ | |
− | + | Lib/pydoc.py \ | |
− | + | Lib/site.py \ | |
− | + | Lib/sysconfig.py \ | |
− | + | Lib/test/test_dl.py \ | |
− | + | Lib/test/test_site.py \ | |
+ | Lib/trace.py \ | ||
+ | Makefile.pre.in \ | ||
+ | Modules/getpath.c \ | ||
+ | setup.py | ||
Compile the package: | Compile the package: | ||
− | + | sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" setup.py && | |
+ | sed -i 's@/lib64@/lib32@g' Modules/_ctypes/libffi/m4/libtool.m4 \ | ||
+ | Modules/_ctypes/libffi/configure setup.py && | ||
+ | sed -i "s/'lib64'/'lib32'/g" setup.py && | ||
CC="gcc ${BUILDN32}" CXX="g++ ${BUILDN32}" ./configure --prefix=/usr \ | CC="gcc ${BUILDN32}" CXX="g++ ${BUILDN32}" ./configure --prefix=/usr \ | ||
--libdir=/usr/lib32 --enable-shared && | --libdir=/usr/lib32 --enable-shared && | ||
Line 76: | Line 103: | ||
make install && | make install && | ||
mv -v /usr/bin/python{,-n32} && | mv -v /usr/bin/python{,-n32} && | ||
− | mv -v /usr/bin/python2 | + | mv -v /usr/bin/python2{,-n32} && |
− | mv -v /usr/include/ | + | mv -v /usr/bin/python{{Python-Version2}}{,-n32} && |
+ | mv -v /usr/include/python{{Python-Version2}}/pyconfig{,-n32}.h && | ||
+ | ln -sfv python2.7-n32 /usr/bin/python2-n32 && | ||
+ | ln -sfv python2-n32 /usr/bin/python-n32 | ||
=== 64Bit === | === 64Bit === | ||
Line 83: | Line 113: | ||
Change the libdir that Python is going to use to lib64: | Change the libdir that Python is going to use to lib64: | ||
− | patch -Np1 -i ../Python- | + | patch -Np1 -i ../Python-{{Python-Version}}-multilib-1.patch && |
− | sed -i -e "s | + | |
− | + | sed -i -e "s|@@MULTILIB_DIR@@|/lib64|g" Lib/distutils/command/install.py \ | |
− | + | Lib/distutils/sysconfig.py \ | |
− | + | Lib/pydoc.py \ | |
− | + | Lib/site.py \ | |
− | + | Lib/sysconfig.py \ | |
− | + | Lib/test/test_dl.py \ | |
− | + | Lib/test/test_site.py \ | |
+ | Lib/trace.py \ | ||
+ | Makefile.pre.in \ | ||
+ | Modules/getpath.c \ | ||
+ | setup.py | ||
Compile the package: | Compile the package: | ||
− | + | sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" setup.py && | |
CC="gcc ${BUILD64}" CXX="g++ ${BUILD64}" ./configure --prefix=/usr \ | CC="gcc ${BUILD64}" CXX="g++ ${BUILD64}" ./configure --prefix=/usr \ | ||
--libdir=/usr/lib64 --enable-shared && | --libdir=/usr/lib64 --enable-shared && | ||
make | make | ||
+ | |||
+ | '''Remark''' | ||
+ | * sed on Modules/getpath.c did not work for me, had to add | ||
+ | sed -i 's@lib/python@lib64/python@g' Modules/getpath.c | ||
+ | * Needed additional explicit export before configure: | ||
+ | export USE_ARCH=64 | ||
+ | * Needed LDFLAGS making the call to configure look like this: | ||
+ | CC="gcc ${BUILD64}" CXX="g++ ${BUILD64}" LDFLAGS="-L/usr/lib64" \ | ||
+ | ./configure --prefix=/usr --libdir=/usr/lib64 --enable-shared | ||
+ | * Needed EXTRA_CFLAGS for make: | ||
+ | make EXTRA_CFLAGS="-fwrapv" | ||
+ | '''Remark ends''' | ||
+ | |||
Install the package | Install the package | ||
Line 104: | Line 151: | ||
make install && | make install && | ||
mv -v /usr/bin/python{,-64} && | mv -v /usr/bin/python{,-64} && | ||
− | mv -v /usr/bin/python2 | + | mv -v /usr/bin/python2{,-64} && |
+ | mv -v /usr/bin/python{{Python-Version2}}{,-64} && | ||
+ | ln -sfv python2.7-64 /usr/bin/python2-64 && | ||
+ | ln -sfv python2-64 /usr/bin/python-64 && | ||
ln -sfv multiarch_wrapper /usr/bin/python && | ln -sfv multiarch_wrapper /usr/bin/python && | ||
− | ln -sfv multiarch_wrapper /usr/bin/python2 | + | ln -sfv multiarch_wrapper /usr/bin/python2 && |
− | mv -v /usr/include/ | + | ln -sfv multiarch_wrapper /usr/bin/python{{Python-Version2}} && |
+ | mv -v /usr/include/python{{Python-Version2}}/pyconfig{,-64}.h | ||
+ | |||
+ | {{Stub-Header|pyconfig|/usr/include/python{{Python-Version2}}}} | ||
− | = | + | = Contents = |
− | + | {| style="text-align: left;" | |
− | + | |-valign="top" | |
− | + | ! Installed Programs: | |
− | + | | pydoc, python, python{{Python-Version2}}, python-config, python{{Python-Version2}}-config, smtpd.py, and (if Tk is installed) idle | |
− | + | |-valign="top" | |
− | + | ! Installed Libraries: | |
− | + | | libpython{{Python-Version2}}.so and various modules in /usr/lib/lib-dynload | |
− | + | |-valign="top" | |
− | + | ! Installed Directories: | |
− | + | | /usr/include/python{{Python-Version2}}, /usr/lib/python{{Python-Version2}} | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | === | + | === Short Descriptions === |
− | + | {| style="text-align: left;" | |
− | + | |-valign="top" | |
− | + | ! pydoc | |
− | + | | is a tool for reading python documentation. | |
− | + | |-valign="top" | |
− | + | ! python | |
− | + | | is an interpreted, interactive, object-oriented programming language. | |
− | + | |-valign="top" | |
− | + | ! python{{Python-Version2}} | |
− | + | | is a version-specific version of '''python'''. | |
− | + | |-valign="top" | |
− | + | ! python-config | |
− | + | | is a symlink to '''python{{Python-Version2}}-config'''. | |
− | + | |-valign="top" | |
− | + | ! python{{Python-Version}}-config | |
− | + | | ??? | |
− | + | |-valign="top" | |
+ | ! smtpd.py | ||
+ | | is a Python implemention of the minimal SMTP protocol as defined in RFC 821. | ||
+ | |-valign="top" | ||
+ | ! idle | ||
+ | | is an Integrated DeveLopment Environment (IDLE) for Python. It's based on Tkinter, Python's bindings to the Tk widget set. | ||
+ | |-valign="top" | ||
+ | ! libpython{{Python-Version2}}.so | ||
+ | | ??? | ||
+ | |} | ||
+ | |||
+ | [[Category:Programming]] |
Latest revision as of 05:22, 18 July 2017
Download Source: | http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz |
---|---|
Alternate Requierd Patch (For Multilib): | Refer to https://www.williamfeely.info/download/lfs-multilib/Python-2.7.6-multilib-1.patch |
Required Patch (For Multilib): | Bad link: http://svn.cross-lfs.org/svn/repos/patches/Python/Python-2.7.8-multilib-1.patch |
Contents
Introduction to Python
Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code.
Project Homepage: http://www.python.org/
Dependencies
Optional
Non-Multilib
Compile the package:
sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" setup.py && ./configure --prefix=/usr --enable-shared && make
Install the package
make install
Command Explanations
--enable-shared: Enables the building of shared libraries.
Multilib
32Bit
Compile the package:
sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" setup.py && sed -i 's@/lib64@/lib@g' Modules/_ctypes/libffi/m4/libtool.m4 \ Modules/_ctypes/libffi/configure setup.py && sed -i "s/'lib64'/'lib'/g" setup.py && CC="gcc ${BUILD32}" CXX="g++ ${BUILD32}" ./configure --prefix=/usr \ --enable-shared && make
Install the package
make install && mv -v /usr/bin/python{,-32} && mv -v /usr/bin/python2{,-32} && mv -v /usr/bin/python2.7{,-32} && mv -v /usr/include/python2.7/pyconfig{,-32}.h && ln -sfv python2.7-32 /usr/bin/python2-32 && ln -sfv python2-32 /usr/bin/python-32
N32
Change the libdir that Python is going to use to lib32:
patch -Np1 -i ../Python-2.7.8-multilib-1.patch && sed -i -e "s|@@MULTILIB_DIR@@|/lib32|g" Lib/distutils/command/install.py \ Lib/distutils/sysconfig.py \ Lib/pydoc.py \ Lib/site.py \ Lib/sysconfig.py \ Lib/test/test_dl.py \ Lib/test/test_site.py \ Lib/trace.py \ Makefile.pre.in \ Modules/getpath.c \ setup.py
Compile the package:
sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" setup.py && sed -i 's@/lib64@/lib32@g' Modules/_ctypes/libffi/m4/libtool.m4 \ Modules/_ctypes/libffi/configure setup.py && sed -i "s/'lib64'/'lib32'/g" setup.py && CC="gcc ${BUILDN32}" CXX="g++ ${BUILDN32}" ./configure --prefix=/usr \ --libdir=/usr/lib32 --enable-shared && make
Install the package
make install && mv -v /usr/bin/python{,-n32} && mv -v /usr/bin/python2{,-n32} && mv -v /usr/bin/python2.7{,-n32} && mv -v /usr/include/python2.7/pyconfig{,-n32}.h && ln -sfv python2.7-n32 /usr/bin/python2-n32 && ln -sfv python2-n32 /usr/bin/python-n32
64Bit
Change the libdir that Python is going to use to lib64:
patch -Np1 -i ../Python-2.7.8-multilib-1.patch && sed -i -e "s|@@MULTILIB_DIR@@|/lib64|g" Lib/distutils/command/install.py \ Lib/distutils/sysconfig.py \ Lib/pydoc.py \ Lib/site.py \ Lib/sysconfig.py \ Lib/test/test_dl.py \ Lib/test/test_site.py \ Lib/trace.py \ Makefile.pre.in \ Modules/getpath.c \ setup.py
Compile the package:
sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" setup.py && CC="gcc ${BUILD64}" CXX="g++ ${BUILD64}" ./configure --prefix=/usr \ --libdir=/usr/lib64 --enable-shared && make
Remark
- sed on Modules/getpath.c did not work for me, had to add
sed -i 's@lib/python@lib64/python@g' Modules/getpath.c
- Needed additional explicit export before configure:
export USE_ARCH=64
- Needed LDFLAGS making the call to configure look like this:
CC="gcc ${BUILD64}" CXX="g++ ${BUILD64}" LDFLAGS="-L/usr/lib64" \ ./configure --prefix=/usr --libdir=/usr/lib64 --enable-shared
- Needed EXTRA_CFLAGS for make:
make EXTRA_CFLAGS="-fwrapv"
Remark ends
Install the package
make install && mv -v /usr/bin/python{,-64} && mv -v /usr/bin/python2{,-64} && mv -v /usr/bin/python2.7{,-64} && ln -sfv python2.7-64 /usr/bin/python2-64 && ln -sfv python2-64 /usr/bin/python-64 && ln -sfv multiarch_wrapper /usr/bin/python && ln -sfv multiarch_wrapper /usr/bin/python2 && ln -sfv multiarch_wrapper /usr/bin/python2.7 && mv -v /usr/include/python2.7/pyconfig{,-64}.h
Creating a Stub Header (Multilib Only)
Creating a Generic Stub Header
cat > /usr/include/python2.7/pyconfig.h << "EOF" /* pyconfig.h - Stub Header */ #ifndef __STUB__PYCONFIG_H__ #define __STUB__PYCONFIG_H__ #if defined(__x86_64__) || \ defined(__sparc64__) || \ defined(__arch64__) || \ defined(__powerpc64__) || \ defined (__s390x__) # include "pyconfig-64.h" #else # include "pyconfig-32.h" #endif #endif /* __STUB__PYCONFIG_H__ */ EOF
Creating a Stub Header For Mips
cat > /usr/include/python2.7/pyconfig.h << "EOF" /* pyconfig.h - Stub Header */ #ifndef __STUB__PYCONFIG_H__ #define __STUB__PYCONFIG_H__ #include <sgidefs.h> #if (_MIPS_SIM == _ABIO32) # include "pyconfig-32.h" #elif (_MIPS_SIM == _ABIN32) # include "pyconfig-n32.h" #elif (_MIPS_SIM == _ABI64) # include "pyconfig-64.h" #endif #endif /* __STUB__PYCONFIG_H__ */ EOF
Contents
Installed Programs: | pydoc, python, python2.7, python-config, python2.7-config, smtpd.py, and (if Tk is installed) idle |
---|---|
Installed Libraries: | libpython2.7.so and various modules in /usr/lib/lib-dynload |
Installed Directories: | /usr/include/python2.7, /usr/lib/python2.7 |
Short Descriptions
pydoc | is a tool for reading python documentation. |
---|---|
python | is an interpreted, interactive, object-oriented programming language. |
python2.7 | is a version-specific version of python. |
python-config | is a symlink to python2.7-config. |
python2.7.8-config | ??? |
smtpd.py | is a Python implemention of the minimal SMTP protocol as defined in RFC 821. |
idle | is an Integrated DeveLopment Environment (IDLE) for Python. It's based on Tkinter, Python's bindings to the Tk widget set. |
libpython2.7.so | ??? |