TDE 14.0.0 python support

Revision as of 14:11, 21 December 2016 by Wikiuser (talk | contribs) (Page updated to new template)

Welcome to Simone Giustetti's wiki pages.


Languages: English - Italiano


Python Language Support

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 Software Development Kit 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.

Build System

Packages related to the Python language are distributed between two of the TDE package groups: Libraries and Prerequisites. All packages are optional ones and You can omit their installation, but in doing so You'll prevent the ability to write TDE integrated applications in Python language. Given their origin all of the packages require for a build system other than the usual Cmake or Autotools. A list of packages and corresponding build system follows:

BUILD SYSTEM
Package Package Group System
pytdeextensions Libraries configure.py script
Python interpreter required
python-tqt Prerequisites configure.py script
Python interpreter required
python-trinity Libraries configure.py script
Python interpreter required
tqscintilla Prerequisites Uses script qscintilla.pro for qmake
TQt3 library required

For a description of the generic structure of a SlackBuild script please refer to the Common Build Script Structure page while for some information about generic build options please consult the 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

Please build and install packages following the order provided in page Build Order otherwise the procedure will probably fail reporting some missing dependency. The packages will be discussed in alphabetical order below.

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:

   PREFIX=${PREFIX:-"/usr"}
   MANDIR=${MANDIR:-"${PREFIX}/man"}

Then run script setup.py passing it the install option:

   # Configure, build and install the package
   python ./setup.py install --verbose --root=${PKG}

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 link.

PYTHON-TQT

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:

   PREFIX=${PREFIX:-"/usr/local"}
   MANDIR=${MANDIR:-"/usr/man"}

Add some paths to include files located in the TDE install path:

   SLKCFLAGS="${SLKCFLAGS} -I/usr/include/tqt -I${PREFIX_TDE}/include"

Otherwise the build script will fail returning an error. Configure source code invoking script configure.py:

   echo "yes" | \
   python configure.py \
      CFLAGS="${SLKCFLAGS}" \
      CXXFLAGS="${SLKCFLAGS}"

Last run make to build source code.

Some code examples will be copied to the documentation directory to help developers:

   # Add some examples to the documentation directory
   mkdir -p ${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"
   cp -aR ${TMP}/tmp-${PRGNAM}/${DIR_SRC}/examples3/* ${PKG}/usr/doc/${PRGNAM}"-"${VERSION}"/examples3"

A compressed archive containing the SlackBuild script and the related configuration files can be downloaded from the following link.

PYTHON-TRINITY

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}
   export TDE_INCLUDEDIR="${TDE_PREFIX}/include"
   export TDE_LIBDIR="${TDE_PREFIX}/lib${LIBDIRSUFFIX}"
   export PYTHON_VER=$( python -V 2>&1 | cut -f 2 -d' ' | cut -f 1-2 -d.)
   export PYTHON_LIB=$( python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()' )
   export PYTHON_INCLUDE="/usr/include/python${PYTHON_VER}"

Then configure source code through script configure.py:

   CFLAGS="${SLKCFLAGS}" \
   CXXFLAGS="${SLKCFLAGS}" \
   python ./configure.py \
      -d "${PYTHON_LIB}" \
      -k "${TDE_PREFIX}" \
      -L "${PYTHON_INCLUDE}" \
      -n "${TDE_LIBDIR}" \
      -o "${TDE_INCLUDEDIR}"

And run make to execute package build.

A compressed archive containing the SlackBuild script and the related configuration files can be downloaded from the following link.

TQSCINTILLA

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:

   PREFIX=${PREFIX:-"/usr/local"}
   MANDIR=${MANDIR:-"/usr/man"}

Add some paths to include located in the TDE root directory:

   SLKCFLAGS="${SLKCFLAGS} -I/usr/include/tqt -I${PREFIX_TDE}/include"

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

Configure source code with tqmake and the qscintilla.pro script:

   CFLAGS="${SLKCFLAGS}" \
   CXXFLAGS="${SLKCFLAGS} -fno-exceptions" \
   tqmake qscintilla.pro

Then run make to start the build procedure:

   make VERBOSE=1 2>&1
   make install INSTALL_ROOT=${PKG}

Last, as done for the python-tqt package, copy some documentation for developers ad some code examples:

   # Add HTML and SGML files to the documentation directory
   mkdir -p ${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"
   cp -a ${TMP}/tmp-${PRGNAM}/${DIR_SRC}/doc/Scintilla/* ${PKG}/usr/doc/${PRGNAM}"-"${VERSION}"/Scintilla"
   # Add some examples to the documentation directory
   mkdir -p ${PKG}/usr/doc/${PRGNAM}"-"$VERSION"/example"
   cp -aR ${TMP}/tmp-${PRGNAM}/${DIR_SRC}/example/* ${PKG}/usr/doc/${PRGNAM}"-"${VERSION}"/example"

A compressed archive containing the SlackBuild script and the related configuration files can be downloaded from the following link.

All packages discussed so far can be installed with the command installpkg standard in every Slackware distribution.

Conclusions

The present paper discussed the procedure to build packages adding Python support for the Trinity Desktop Environment. Custom options were documented for each package and links for all of the used SlackBuild scripts were provided in the hope for them to be useful to Slackware Linux users wishing to give a try at building the desktop environment from scratch.


For any feedback, questions, errors and such, please e-mail me at studiosg [at] giustetti [dot] net


External links






Languages: English - Italiano