|
Description
Francois Andriot
2013-12-28 08:08:24 CST
A word about SIP: since we have renamed QT3 to TQT3, we cannot use anymore the official SIP utilities to generate our python utilities. The official SIP only recognizes the "Q" variables and functions, not the "TQ". We now MUST use our own SIP utility from our GIT. It is based on version 4.10.5 and works well for TDE. BUT our SIP utility should co-exist with the distribution-provided one (used by KDE4, among other). So I chose to install the utilities under "/opt/trinity" and the Python modules under "/usr/lib64/pythonXX/site-packages/sip4-tqt" . The original SIP goes directly under "/usr/lib64/pythonXX/site-packages" so we need to be in a subdirectory. Here are the build commands (change path according to your distribution): mkdir build cd build python ../configure.py -b /opt/trinity/bin -d /usr/lib64/python2.6/site-packages/sip4-tqt -e /opt/trinity/include Then I get the files: /usr/lib64/python2.6/site-packages/sip4-tqt/sip.so /usr/lib64/python2.6/site-packages/sip4-tqt/sipconfig.py /usr/lib64/python2.6/site-packages/sip4-tqt/sipdistutils.py And in development package: /opt/trinity/bin/sip /opt/trinity/include/sip.h BTW, having our own "SIP" utility avoids the problem I currently have in openSUSE 13.1: python-trinity package FTBFS with upstream SIP 4.15 ... (En réponse au commentaire 1) Further advance in SIP compilation: In order to properly use SIP as a python module (e.g. our scripts located in a subfolder of the python module directory), it needs to have an "__init__.py" script, which can be empty text file. Also, a python module cannot contain dash caracter, so I now use underscore. Resulting files: /usr/lib64/python2.7/site-packages/sip4_tqt/__init__.py /usr/lib64/python2.7/site-packages/sip4_tqt/sip.so /usr/lib64/python2.7/site-packages/sip4_tqt/sipconfig.py /usr/lib64/python2.7/site-packages/sip4_tqt/sipdistutils.py Development files: /opt/trinity/bin/sip /opt/trinity/include/sip.h Please note that the "/usr/lib64/python2.7/site-packages" is the "Python Library directory", where the Python architecture-dependant modules are installed in a RPM distribution. It is given by the command: python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" Created attachment 1787 [details]
python-tqt : fix detection of sip4-tqt
The "python-tqt" package should now be installed to "<python_modules_dir>/python_tqt", because in the default location it may conflict with python-qt3 from a KDE3 installation.
The attached patch allows building python-tqt while sip4-tqt is located in a subfolder. In this way, we ensure that we do NOT use the distribution-provided SIP utility, if it exists?
As well as sip4-tqt, Python-tqt now being in a subfolder, it needs an (empty) file "__init__.py" too.
I use the following "configure" lines (you need to adapt to your environment):
mkdir build
cd build
python ../configure.py -c -n /usr/include/tqscintilla -q /usr/share/tqt3 -y tqt-mt -o /usr/lib64 -u -j 10 -d /usr/lib64/python2.7/site-packages/python_tqt -v /usr/share/sip/tqt -b /opt/trinity/bin
Once installed, it gives the following files:
/usr/lib64/python2.7/site-packages/python_tqt/__init__.py
/usr/lib64/python2.7/site-packages/python_tqt/qt.so
/usr/lib64/python2.7/site-packages/python_tqt/qtcanvas.so
/usr/lib64/python2.7/site-packages/python_tqt/qtnetwork.so
/usr/lib64/python2.7/site-packages/python_tqt/qtsql.so
/usr/lib64/python2.7/site-packages/python_tqt/qttable.so
/usr/lib64/python2.7/site-packages/python_tqt/qtui.so
/usr/lib64/python2.7/site-packages/python_tqt/qtxml.so
And development files:
/usr/lib64/python2.7/site-packages/python_tqt/pyqtconfig.py
/usr/share/sip/tqt/pyqt-gpl.sip
/usr/share/sip/tqt/qt
/usr/share/sip/tqt/qt/copying.sip
/usr/share/sip/tqt/qt/qaccel.sip
[... and all other .sip files ...]
Created attachment 1788 [details]
python-trinity : fix detection of sip4-tqt and python-tqt
Now, let's build python-trinity.
Since it has been converted QT=>TQT and KDE=TDE, there is no risk of file conflict with anyone else. We can simply install this one in the default python module location (no subfolder needed).
Still, it needs to be able to detect the sip4-tqt and python-tqt. The attached patch fixes the detection of both.
Build command:
python configure.py -k /opt/trinity -L lib64 -v /usr/share/sip/trinity
Resulting files:
/usr/lib64/python2.7/site-packages/dcop.so
/usr/lib64/python2.7/site-packages/dcopexport.py
/usr/lib64/python2.7/site-packages/dcopext.py
/usr/lib64/python2.7/site-packages/pytdeconfig.py
/usr/lib64/python2.7/site-packages/tdeabc.so
/usr/lib64/python2.7/site-packages/tdecore.so
/usr/lib64/python2.7/site-packages/tdefile.so
/usr/lib64/python2.7/site-packages/tdefx.so
/usr/lib64/python2.7/site-packages/tdehtml.so
/usr/lib64/python2.7/site-packages/tdeio.so
/usr/lib64/python2.7/site-packages/tdemdi.so
/usr/lib64/python2.7/site-packages/tdeparts.so
/usr/lib64/python2.7/site-packages/tdeprint.so
/usr/lib64/python2.7/site-packages/tderesources.so
/usr/lib64/python2.7/site-packages/tdespell.so
/usr/lib64/python2.7/site-packages/tdeui.so
/usr/lib64/python2.7/site-packages/tdeutils.so
Development files:
/opt/trinity/bin/kdepyuic
/usr/share/sip/trinity/dcop/dcopclient.sip
/usr/share/sip/trinity/dcop/dcopmod.sip
/usr/share/sip/trinity/dcop/dcopobject.sip
/usr/share/sip/trinity/dcop/dcopref.sip
/usr/share/sip/trinity/dcop/dcopstub.sip
/usr/share/sip/trinity/dcop/typedefs.sip
[... and many other .sip files ...]
Created attachment 1789 [details]
pytdeextensions: convert QT to TQT in 'kdedistutils.py'
Building pytdeextensions is the most complicated of all our python stuff.
The most important file is "src/kdedistutils.py". It is used both at build time of pytdeextensions, and later at build time of next package (tde-guidance). It can also be used at runtime of non-compiled python scripts.
First, we need to finish the QT->TQT conversion (see attached patch).
Created attachment 1790 [details]
pytdeextensions: add sip4-tqt and python-tqt to the Python search path
Now, we must make the sip4-tqt and python-tqt available to the Python search path, so that calling applications (tde-guidance) do not need to worry about this.
In 'kdedistutils.py' we write the code at two location:
1) In the header of the script itself, so that python scripts that use kdedistutils will have the correct environment
2) In the "return_instance" function, which is later used to produce KCM modules (C++) from python scripts.
Created attachment 1791 [details] pytdeextensions: adds the EXTRA_MODULES_DIR variable Now it's the return of the EXTRA_MODULES_DIR variable (see bug #1188). Since the tde-guidance will be installed in a non-standard location, but we don't know which yet, we need to add an environment variable-defined directory to the Python search path. The variable will be set later, when tde-guidance will be built. Created attachment 1792 [details]
pytdeextensions: remove hardoded "lib" directory
Comment on attachment 1792 [details]
pytdeextensions: remove hardoded "lib" directory
Another patch to remove undesirable hardcoding in path.
Created attachment 1793 [details]
pytdeextensions: fix include directory location
Another patch to remove old, unwanted KDE include location, and instead use a more likely TDE include location.
Created attachment 1794 [details]
pytdeextensions: sample resulting 'kdedistutils.py' file
Now the funny stuff :-)
How to build this monster called "pytdeextensions".
At build time, to maximize the chances to have correct TDE-related path, I hardcode a lot of things in the "kdedistutils" script. Notice that there are already hardcoded things in the original script.
Here is the sed command:
In my case, the macros have value:
%{python_sitearch} = /usr/lib64/python2.7/site-packages
%{tde_libdir} = /opt/trinity/lib64
%{tde_tdeincludedir} = /opt/trinity/include/tde
The command is run in a loop:
for f in src/*.py; do
sed -i "${f}" \
-e "s|'sip-dir=','/usr/lib/pyshared/python\*'|'sip-dir=','%{python_sitearch}/sip4_tqt'|g" \
-e "s|self.sip_dir = .*|self.sip_dir = \"%{python_sitearch}/sip4_tqt\"|g" \
-e "s|'pyqt-dir=','/usr/lib/pyshared/python\*'|'pyqt-dir=','%{python_sitearch}/python_tqt'|g" \
-e "s|self.pyqt_dir = .*|self.pyqt_dir = \"%{python_sitearch}/python_tqt\"|g" \
-e "s|'pytde-dir=',None,|'pytde-dir=','%{python_sitearch}',|g" \
-e "s|self.pytde_dir = None|self.pytde_dir = \"%{python_sitearch}\"|g" \
-e "s|'kde-lib-dir=',None,|'kde-lib-dir=','%{tde_libdir}',|g" \
-e "s|self.kde_lib_dir = None|self.kde_lib_dir = \"%{tde_libdir}\"|g" \
-e "s|'kde-kcm-lib-dir=',None,|'kde-kcm-lib-dir=','%{tde_libdir}/trinity',|g" \
-e "s|self.kde_kcm_lib_dir = None|self.kde_kcm_lib_dir = \"%{tde_libdir}/trinity\"|g" \
-e "s|%{tde_includedir}/tde|%{tde_tdeincludedir}|g" \
-e 's|"/kde"|"/tde"|' \
-e 's|"-I" + self.kde_inc_dir + "/tde"|"-I/opt/trinity/include"|' \
-e "s|/usr/lib/pyshared/python\*|%{python_sitearch}|g"
done
You can find a sample of the resulting file attached. All important variables are between lines 500-530.
After making sure that kdedistutils.py is correct, we can now build with mkdir build ./setup.py build_libpythonize ./setup.py install \ --root=/dev/shm/xxxxx \ --prefix=/opt/trinity \ --install-clib=/opt/trinity/lib64 \ --install-cheaders=/opt/trinity/include/tde \ -v There are also some cleanup to do after this install step (moving files, deleting files ...). See ubuntu package "rules" file or RPM "spec" file for more details. If you did not build correctly, you'll notice it at runtime afterward ! Created attachment 1795 [details]
tde-guidance: fix 'userconfig' for TDE R14
Now the interesting part: building tde-guidance !
The attached patch is a conversion for 'userconfig' utility so that it runs with TDE.
The Guidance package is also a hard piece to build. See ubuntu rules file or RPM spec files for details.
Finally, with all the previous steps, I have a working "tdecmshell userconfig" in TDE R14 !
Created attachment 1861 [details]
python-trinity : rename kdepyuic => tdepyuic
When testing the patch is necessary to think that 'tdepyuic' must be executable in the source folder.
Created attachment 1862 [details]
pytdeextensions: add sip4-tqt and python-tqt to the Python search path (1)
During my testing on Ubuntu Lucid I ran into a problem because the modules were installed in the /usr/lib/pymodules/python-2.6 => other path than that returned from get_python_lib.
I modified setting the paths in the way that they are searched in all modules folders. This also allow to remove the hard-coded paths sip_dir and pyqt_dir.
Created attachment 1863 [details] pytdeextensions: remove hardoded "lib" directory (1) The patch from attachment 1792 [details] on Debian / Ubuntu causes FTBFS because install.prefix is /usr, while TDE is in /opt/trinity. Instead of install.prefix I used self.install_prefix. To setup path to self.install_prefix I used ask_kde_config. This allow to remove additional hard-coded paths. Created attachment 1864 [details]
pytdeextensions: fix include directory location (1)
By using self.install_prefix is possible to replace additional hard-coded paths.
Created attachment 1865 [details]
pytdeextensions: rename kdedistutils => tdedistutils
This patch assumes that previous pytdeextensions patches already applied.
Created attachment 1866 [details]
pytdeextensions: rename kdedesigner => tdedesigner
Now the latest patch for pytdeextensions.
Created attachment 1869 [details] pytdeextensions: rename kdedistutils => tdedistutils (1) Previous patch from attachment 1865 [details] contained several typos ( " × ' ). Created attachment 1870 [details] tde-guidance: fix 'userconfig' for TDE R14 (1) Finding paths adjusted to the same method as in the patch from attachment 1862 [details]. Created attachment 1871 [details]
tde-guidance: rename kdedistutils => tdedistutils
Update tde-guidance to conform rename kdedistutils => tdedistutils.
François, please, can you test the updated patches? Or should I push patches to GIT and possible fixes we will deal after that? Comment on attachment 1861 [details]
python-trinity : rename kdepyuic => tdepyuic
Patch is OK for me.
All other patches build and works for me. You can push everything ! Comment on attachment 1787 [details]
python-tqt : fix detection of sip4-tqt
Pushed to GIT in hash bef77650.
Comment on attachment 1788 [details]
python-trinity : fix detection of sip4-tqt and python-tqt
Pushed to GIT in hash 9d39e811.
Comment on attachment 1861 [details]
python-trinity : rename kdepyuic => tdepyuic
Pushed to GIT in hash a2e9913e.
Comment on attachment 1789 [details]
pytdeextensions: convert QT to TQT in 'kdedistutils.py'
Pushed to GIT in hash 4997bbf9.
Comment on attachment 1862 [details]
pytdeextensions: add sip4-tqt and python-tqt to the Python search path (1)
Pushed to GIT in hash 7f3ecf70.
Comment on attachment 1791 [details]
pytdeextensions: adds the EXTRA_MODULES_DIR variable
Pushed to GIT in hash f664d2c4.
Comment on attachment 1863 [details]
pytdeextensions: remove hardoded "lib" directory (1)
Pushed to GIT in hash 6d061b32.
Comment on attachment 1864 [details]
pytdeextensions: fix include directory location (1)
Pushed to GIT in hash edae246d.
Comment on attachment 1869 [details]
pytdeextensions: rename kdedistutils => tdedistutils (1)
Pushed to GIT in hash 5559f44e.
Comment on attachment 1866 [details]
pytdeextensions: rename kdedesigner => tdedesigner
Pushed to GIT in hash d424535c.
Comment on attachment 1870 [details]
tde-guidance: fix 'userconfig' for TDE R14 (1)
Pushed to GIT in hash 605e1937.
Comment on attachment 1871 [details]
tde-guidance: rename kdedistutils => tdedistutils
Pushed to GIT in hash 0d63bc84.
It seems that all patches and also related changes in Debian / Ubuntu packaging are pushed into the GIT. This bug report we can probably close. (In reply to comment #38) > It seems that all patches and also related changes in Debian / Ubuntu packaging > are pushed into the GIT. > > This bug report we can probably close. Wait, hold off until we know this will work for everyone. I had R14 building OK on the 15th, let's see if it will build/operate before we close the bug. Created attachment 1912 [details]
sip4-tqt : install as module by default
Although I announced that I'm not friend with Python, I tried to prepare patches for sip4-tqt and python-tqt that by default installed as Python modules.
This could simplify the building with default parameters.
Please try it.
Created attachment 1913 [details]
python-tqt : install as module by default
François, please, can you check this patches? Patches are prepared so that to the existing build scripts not need to be any changes. Comment on attachment 1912 [details]
sip4-tqt : install as module by default
Pushed to GIT in hash 8cb66711
Comment on attachment 1913 [details]
python-tqt : install as module by default
Pushed to GIT in hash 4049988a
It seems that everything necessary has been done and that this bug report can be closed. (In reply to comment #45) > It seems that everything necessary has been done and that this bug report can > be closed. No, Where did the patches Go? The patches were pushed to git. Typically when patches are pushed we try in the bug report to remember to tag the patches as obsolete. That way people do not get confused and try to use a patch that is already pushed, which then will cause build failures and confusing messages about asking to reverse the patch. |