Changes

no edit summary
Line 1: Line 1: −
Welcome to Simone Giustetti's wiki pages.
+
{{header_en|title=How-to enable Python bindings for TDE| keyword={{Template:keyword_en_tde}}| description=Building, installing and configuring working packages for TDE Python bindings on Slackware Linux | link_page=TDE_14.0.0_supporto_python}}
 
  −
 
  −
Languages: '''English''' - [http://www.giustetti.net/wiki/index.php?title=TDE_14.0.0_supporto_python Italiano]
  −
 
  −
----
      
== '''Python Language Support''' ==
 
== '''Python Language Support''' ==
[[En/trinity_desktop_environment_14.0.0]]
+
[[En/trinity_desktop_environment_14.0.0 | Trinity Desktop Environment 14.0.0]]
    
A '''Trinity Desktop Environment''' standard install comes with many useful programs ready for use. These cover many but not all of the user base needs therefore a '''S'''oftware '''D'''evelopment '''K'''it is distributed meant to develop new applications easily integrated in the desktop environment. TDE is written in the '''C++''' programming language, making it the preferred language for writing new software and upgrading existing one. Moreover bindings to many other languages are provided as well to meet developers needs. Among those other languages '''Python''', an interpreted language rich with features and expansion libraries, covers a prominent role. To enable Python support in TDE some packages are needed and should be installed before building '''tdebindings'''. The package list includes: '''pytdeextensions''', '''python-tqt''', '''python-trinity''' and '''tqscintilla'''. The procedure needed to build working packages for '''Slackware  Linux 14.1''' will be discussed in the present paper.
 
A '''Trinity Desktop Environment''' standard install comes with many useful programs ready for use. These cover many but not all of the user base needs therefore a '''S'''oftware '''D'''evelopment '''K'''it is distributed meant to develop new applications easily integrated in the desktop environment. TDE is written in the '''C++''' programming language, making it the preferred language for writing new software and upgrading existing one. Moreover bindings to many other languages are provided as well to meet developers needs. Among those other languages '''Python''', an interpreted language rich with features and expansion libraries, covers a prominent role. To enable Python support in TDE some packages are needed and should be installed before building '''tdebindings'''. The package list includes: '''pytdeextensions''', '''python-tqt''', '''python-trinity''' and '''tqscintilla'''. The procedure needed to build working packages for '''Slackware  Linux 14.1''' will be discussed in the present paper.
Line 28: Line 23:  
|}
 
|}
   −
For a description of the generic structure of a SlackBuild script please refer to the [[TDE_14.0.0_prerequisites#Common_Build_Script_Structure]] page while for some information about generic build options please consult the [[TDE_14.0.0_prerequisites#Generic_Options]] one where similar information was provided for packages in the '''Prerequisites''' group. Information about options specific to single packages and links to the full SalckBuild scripts will be provided below.
+
For a description of the generic structure of a SlackBuild script please refer to the [[TDE_14.0.0_prerequisites#Common_Build_Script_Structure |Common Build Script Structure]] page while for some information about generic build options please consult the [[TDE_14.0.0_prerequisites#Generic_Options |Generic Options]] one where similar information was provided for packages in the '''Prerequisites''' group. Information about options specific to single packages and links to the full SalckBuild scripts will be provided below.
    
=== Custom Options ===
 
=== Custom Options ===
   −
Please build and install packages following the order provided in page [[en/trinity_desktop_environment_14.0.0#Build_order]] otherwise the procedure will probably fail reporting some missing dependency. The packages will be discussed in alphabetical order below.
+
Please build and install packages following the order provided in page [[en/trinity_desktop_environment_14.0.0#Build_order |Build Order]] otherwise the procedure will probably fail reporting some missing dependency. The packages will be discussed in alphabetical order below.
    
==== PYTDEEXTENSIONS ====
 
==== PYTDEEXTENSIONS ====
    
The '''Pytdeextensions''' library contains a multitude of Python written classes and related methods, ready for use by developers writing TDE integrated software. To build a working package declare some environment variables:
 
The '''Pytdeextensions''' library contains a multitude of Python written classes and related methods, ready for use by developers writing TDE integrated software. To build a working package declare some environment variables:
 +
<syntaxhighlight lang="bash">
 
   PREFIX=${PREFIX:-"/usr"}
 
   PREFIX=${PREFIX:-"/usr"}
 
   MANDIR=${MANDIR:-"${PREFIX}/man"}
 
   MANDIR=${MANDIR:-"${PREFIX}/man"}
 +
</syntaxhighlight>
 
Then run script setup.py passing it the '''install''' option:
 
Then run script setup.py passing it the '''install''' option:
 +
<syntaxhighlight lang="bash">
 
   # Configure, build and install the package
 
   # Configure, build and install the package
   '''python''' ./setup.py install ''--verbose --root=''${PKG}
+
   python ./setup.py install --verbose --root=${PKG}
 +
</syntaxhighlight>
 
The script will automatically execute each step needed to build and install the package. A compressed archive containing the SlackBuild script and the related configuration files can be downloaded from the following [http://www.giustetti.net/resource/slackbuild/tde/1400/pytdeextensions.tar.gz link].
 
The script will automatically execute each step needed to build and install the package. A compressed archive containing the SlackBuild script and the related configuration files can be downloaded from the following [http://www.giustetti.net/resource/slackbuild/tde/1400/pytdeextensions.tar.gz link].
   Line 47: Line 46:     
'''Python-tqt''' are the Python language bindings. TDE based software cannot be developed without. To work the package needs '''Sip''' installed. Sip is a binding generator for Python and C or C++ written libraries. To build a working package declare some environment variables:
 
'''Python-tqt''' are the Python language bindings. TDE based software cannot be developed without. To work the package needs '''Sip''' installed. Sip is a binding generator for Python and C or C++ written libraries. To build a working package declare some environment variables:
 +
<syntaxhighlight lang="bash">
 
   PREFIX=${PREFIX:-"/usr/local"}
 
   PREFIX=${PREFIX:-"/usr/local"}
 
   MANDIR=${MANDIR:-"/usr/man"}
 
   MANDIR=${MANDIR:-"/usr/man"}
 +
</syntaxhighlight>
 
Add some paths to include files located in the TDE install path:
 
Add some paths to include files located in the TDE install path:
 +
<syntaxhighlight lang="bash">
 
   SLKCFLAGS="${SLKCFLAGS} -I/usr/include/tqt -I${PREFIX_TDE}/include"
 
   SLKCFLAGS="${SLKCFLAGS} -I/usr/include/tqt -I${PREFIX_TDE}/include"
 +
</syntaxhighlight>
 
Otherwise the build script will fail returning an error. Configure source code invoking script '''configure.py''':
 
Otherwise the build script will fail returning an error. Configure source code invoking script '''configure.py''':
 +
<syntaxhighlight lang="bash">
 
   echo "yes" | \
 
   echo "yes" | \
   '''python''' configure.py \
+
   python configure.py \
 
       CFLAGS="${SLKCFLAGS}" \
 
       CFLAGS="${SLKCFLAGS}" \
 
       CXXFLAGS="${SLKCFLAGS}"
 
       CXXFLAGS="${SLKCFLAGS}"
 +
</syntaxhighlight>
 
Last run '''make''' to build source code.
 
Last run '''make''' to build source code.
    
Some code examples will be copied to the documentation directory to help developers:
 
Some code examples will be copied to the documentation directory to help developers:
 +
<syntaxhighlight lang="bash">
 
   # Add some examples to the documentation directory
 
   # Add some examples to the documentation directory
   '''mkdir''' ''-p'' ${PKG}/usr/doc/${PRGNAM}"-"$VERSION"/examples2"
+
   mkdir -p ${PKG}/usr/doc/${PRGNAM}"-"$VERSION"/examples2"
   '''cp''' ''-aR'' ${TMP}/tmp-${PRGNAM}/${DIR_SRC}/examples2/* ${PKG}/usr/doc/${PRGNAM}"-"${VERSION}"/examples2"
+
   cp -aR ${TMP}/tmp-${PRGNAM}/${DIR_SRC}/examples2/* ${PKG}/usr/doc/${PRGNAM}"-"${VERSION}"/examples2"
   '''mkdir''' ''-p'' ${PKG}/usr/doc/${PRGNAM}"-"$VERSION"/examples3"
+
   mkdir -p ${PKG}/usr/doc/${PRGNAM}"-"$VERSION"/examples3"
   '''cp''' ''-aR'' ${TMP}/tmp-${PRGNAM}/${DIR_SRC}/examples3/* ${PKG}/usr/doc/${PRGNAM}"-"${VERSION}"/examples3"
+
   cp -aR ${TMP}/tmp-${PRGNAM}/${DIR_SRC}/examples3/* ${PKG}/usr/doc/${PRGNAM}"-"${VERSION}"/examples3"
 +
</syntaxhighlight>
    
A compressed archive containing the SlackBuild script and the related configuration files can be downloaded from the following [http://www.giustetti.net/resource/slackbuild/tde/1400/python-tqt.tar.gz link].
 
A compressed archive containing the SlackBuild script and the related configuration files can be downloaded from the following [http://www.giustetti.net/resource/slackbuild/tde/1400/python-tqt.tar.gz link].
Line 70: Line 77:     
'''Python-trinity''' includes some more bindings between Python and the '''TQt''' libraries. Again to build a package initialize some environment and some Python related variables:
 
'''Python-trinity''' includes some more bindings between Python and the '''TQt''' libraries. Again to build a package initialize some environment and some Python related variables:
   '''export''' TDE_PREFIX=${PREFIX}
+
<syntaxhighlight lang="bash">
   '''export''' TDE_INCLUDEDIR="${TDE_PREFIX}/include"
+
   export TDE_PREFIX=${PREFIX}
   '''export''' TDE_LIBDIR="${TDE_PREFIX}/lib${LIBDIRSUFFIX}"
+
   export TDE_INCLUDEDIR="${TDE_PREFIX}/include"
   '''export''' PYTHON_VER=$('''python''' ''-V'' 2>&1 | '''cut''' ''-f'' 2 ''-d''<nowiki>' '</nowiki> | '''cut''' ''-f'' 1-2 ''-d''.)
+
   export TDE_LIBDIR="${TDE_PREFIX}/lib${LIBDIRSUFFIX}"
   '''export''' PYTHON_LIB=$( '''python''' ''-c'' 'from distutils.sysconfig import get_python_lib; print get_python_lib()' )
+
   export PYTHON_VER=$( python -V 2>&1 | cut -f 2 -d' ' | cut -f 1-2 -d.)
   '''export''' PYTHON_INCLUDE="/usr/include/python${PYTHON_VER}"
+
   export PYTHON_LIB=$( python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()' )
 +
   export PYTHON_INCLUDE="/usr/include/python${PYTHON_VER}"
 +
</syntaxhighlight>
 
Then configure source code through script '''configure.py''':
 
Then configure source code through script '''configure.py''':
 +
<syntaxhighlight lang="bash">
 
   CFLAGS="${SLKCFLAGS}" \
 
   CFLAGS="${SLKCFLAGS}" \
 
   CXXFLAGS="${SLKCFLAGS}" \
 
   CXXFLAGS="${SLKCFLAGS}" \
   '''python''' ./configure.py \
+
   python ./configure.py \
       ''-d'' "${PYTHON_LIB}" \
+
       -d "${PYTHON_LIB}" \
       ''-k'' "${TDE_PREFIX}" \
+
       -k "${TDE_PREFIX}" \
       ''-L'' "${PYTHON_INCLUDE}" \
+
       -L "${PYTHON_INCLUDE}" \
       ''-n'' "${TDE_LIBDIR}" \
+
       -n "${TDE_LIBDIR}" \
       ''-o'' "${TDE_INCLUDEDIR}"
+
       -o "${TDE_INCLUDEDIR}"
 +
</syntaxhighlight>
 
And run '''make''' to execute package build.
 
And run '''make''' to execute package build.
   Line 92: Line 103:     
'''TQScintilla''' is a port of '''Scintilla''' to the '''TQt''' library. '''TQScintilla''' provides some text editing functionality especially useful to write or debug source code. Only one among the packages discussed so far to use '''tqmake''', to build a working package for Slackware 14.1 define some environment variables:
 
'''TQScintilla''' is a port of '''Scintilla''' to the '''TQt''' library. '''TQScintilla''' provides some text editing functionality especially useful to write or debug source code. Only one among the packages discussed so far to use '''tqmake''', to build a working package for Slackware 14.1 define some environment variables:
 +
<syntaxhighlight lang="bash">
 
   PREFIX=${PREFIX:-"/usr/local"}
 
   PREFIX=${PREFIX:-"/usr/local"}
 
   MANDIR=${MANDIR:-"/usr/man"}
 
   MANDIR=${MANDIR:-"/usr/man"}
 +
</syntaxhighlight>
 
Add some paths to include located in the TDE root directory:
 
Add some paths to include located in the TDE root directory:
 +
<syntaxhighlight lang="bash">
 
   SLKCFLAGS="${SLKCFLAGS} -I/usr/include/tqt -I${PREFIX_TDE}/include"
 
   SLKCFLAGS="${SLKCFLAGS} -I/usr/include/tqt -I${PREFIX_TDE}/include"
 +
</syntaxhighlight>
 
In order to avoid the build procedure failure. Apply a patch solving an issue with the '''DESTDIR''' variable which will be replaced by '''INSTALL_ROOT''':
 
In order to avoid the build procedure failure. Apply a patch solving an issue with the '''DESTDIR''' variable which will be replaced by '''INSTALL_ROOT''':
   '''patch''' ''-p0 -i'' ${SRCDIR}/qscintilla.patch
+
<syntaxhighlight lang="bash">
 +
   patch -p0 -i ${SRCDIR}/qscintilla.patch
 +
</syntaxhighlight>
 
Configure source code with '''tqmake''' and the '''qscintilla.pro''' script:
 
Configure source code with '''tqmake''' and the '''qscintilla.pro''' script:
 +
<syntaxhighlight lang="bash">
 
   CFLAGS="${SLKCFLAGS}" \
 
   CFLAGS="${SLKCFLAGS}" \
   CXXFLAGS="${SLKCFLAGS} ''-fno-exceptions''" \
+
   CXXFLAGS="${SLKCFLAGS} -fno-exceptions" \
   '''tqmake''' qscintilla.pro
+
   tqmake qscintilla.pro
 +
</syntaxhighlight>
 
Then run '''make''' to start the build procedure:
 
Then run '''make''' to start the build procedure:
   '''make''' VERBOSE=1 2>&1
+
<syntaxhighlight lang="bash">
   '''make''' install INSTALL_ROOT=${PKG}
+
   make VERBOSE=1 2>&1
 +
   make install INSTALL_ROOT=${PKG}
 +
</syntaxhighlight>
 
Last, as done for the python-tqt package, copy some documentation for developers ad some code examples:
 
Last, as done for the python-tqt package, copy some documentation for developers ad some code examples:
 +
<syntaxhighlight lang="bash">
 
   # Add HTML and SGML files to the documentation directory
 
   # Add HTML and SGML files to the documentation directory
   '''mkdir''' ''-p'' ${PKG}/usr/doc/${PRGNAM}"-"$VERSION"/html"
+
   mkdir -p ${PKG}/usr/doc/${PRGNAM}"-"$VERSION"/html"
   '''cp''' ''-a'' ${TMP}/tmp-${PRGNAM}/${DIR_SRC}/doc/html/* ${PKG}/usr/doc/${PRGNAM}"-"${VERSION}"/html"
+
   cp -a ${TMP}/tmp-${PRGNAM}/${DIR_SRC}/doc/html/* ${PKG}/usr/doc/${PRGNAM}"-"${VERSION}"/html"
   '''mkdir''' ''-p'' ${PKG}/usr/doc/${PRGNAM}"-"$VERSION"/Scintilla"
+
   mkdir -p ${PKG}/usr/doc/${PRGNAM}"-"$VERSION"/Scintilla"
   '''cp''' ''-a'' ${TMP}/tmp-${PRGNAM}/${DIR_SRC}/doc/Scintilla/* ${PKG}/usr/doc/${PRGNAM}"-"${VERSION}"/Scintilla"
+
   cp -a ${TMP}/tmp-${PRGNAM}/${DIR_SRC}/doc/Scintilla/* ${PKG}/usr/doc/${PRGNAM}"-"${VERSION}"/Scintilla"
 
   # Add some examples to the documentation directory
 
   # Add some examples to the documentation directory
   '''mkdir''' ''-p'' ${PKG}/usr/doc/${PRGNAM}"-"$VERSION"/example"
+
   mkdir -p ${PKG}/usr/doc/${PRGNAM}"-"$VERSION"/example"
   '''cp''' ''-aR'' ${TMP}/tmp-${PRGNAM}/${DIR_SRC}/example/* ${PKG}/usr/doc/${PRGNAM}"-"${VERSION}"/example"
+
   cp -aR ${TMP}/tmp-${PRGNAM}/${DIR_SRC}/example/* ${PKG}/usr/doc/${PRGNAM}"-"${VERSION}"/example"
 +
</syntaxhighlight>
    
A compressed archive containing the SlackBuild script and the related configuration files can be downloaded from the following [http://www.giustetti.net/resource/slackbuild/tde/1400/tqscintilla.tar.gz link].
 
A compressed archive containing the SlackBuild script and the related configuration files can be downloaded from the following [http://www.giustetti.net/resource/slackbuild/tde/1400/tqscintilla.tar.gz link].
Line 133: Line 156:  
* [http://www.trinitydesktop.org/ TDE home page]
 
* [http://www.trinitydesktop.org/ TDE home page]
 
* [http://www.slackware.com Slackware home page]
 
* [http://www.slackware.com Slackware home page]
* [https://www.python.org Python home page]
+
* [ Python home page]
       
----
 
----
   −
Languages: '''English''' - [http://www.giustetti.net/wiki/index.php?title=TDE_14.0.0_supporto_python Italiano]
+
{{footer_en | link_page=TDE_14.0.0_supporto_python}}