Building GARNOME: PYTHON issues
- From: "Joseph E. Sacco, PhD" <joseph_sacco comcast net>
- To: garnome-list gnome org
- Subject: Building GARNOME: PYTHON issues
- Date: Fri, 29 Jul 2005 10:37:36 -0400
Issues
------
(1) All GNOME applications that use python should test for the existence
of the environment variable, PYTHON, during configuration. Most do. Some
do not.
(2) PYTHONPATH needs to be set when building some GNOME applications.
==============================================================================
Issue 1
-------
On my system, python-2.4.1 is installed in a non-standard location,
/opt/python-2.4.1
An older version of python,2.3.5, is installed in the usual location:
/usr
To use python-2.4.1 when building GARNOME, gar.conf.mk is edited to set
an evironment variable:
...
# If you want to use a different version of python everywhere
# change this
#PYTHON = $(shell which python)
PYTHON = /opt/python-2.4.1/bin/python
<<===============
...
Setting the PYTHON environment variable in gar.conf.mk works provided
all applications that require python actually test for the PYTHON
environment variable when being configured. Most do.
A few do not:
* libxml2
* libxslt
* gamin
These three applications, maintained by the same author, offer a
configuration option to specify the location of the python
installation,e.g.,
--with-python=/opt/python-2.4.1
However, the logic within the configuration files
...
if test "$with_python" != ""
then
pythondir='$(PYTHON_SITE_PACKAGES)'
else
pythondir='$(libdir)/python${PYTHON_VERSION}/site-packages'
fi
...
dictates that if the user specifies a location for python, all python
packages will be installed in the site-packages directory located under
that location.
For example,
if:
$with_python = /opt/python-2.4.1
then:
pythondir = $(PYTHON_SITE_PACKAGES)
= /opt/python-2.4.1/lib/python2.4/site-packages
I have pondered over this choice for a while and have concluded that:
(1) the choice is not unreasonable.
(2) the choice is not consistent with what other GNOME applications do.
This is a GNOME coding standards issue.
ISSUE 2
--------
While building the snapshot version of 2.11.90 I encountered a python
related build problem with gnome-panel:
...
Making all in clock
make[7]: Entering directory `/mnt/ydl-4.0.1/usr/local/src/GNOME/2.11/garnome-hackers-2.11/src/desktop/gnome-panel/work/main.d/gnome-panel-2.11.90/help/clock'
if ! test -d de/; then mkdir de/; fi if test -f "C/clock.xml"; then d="../"; else d=".././"; fi; \
(cd de/ && \ `which xml2po` -e -p \
${d}de/de.po \ ${d}C/clock.xml > clock.xml.tmp && \
cp clock.xml.tmp clock.xml && rm -f clock.xml.tmp) Traceback (most recent call last):
File "/mnt/ydl-4.0.1/usr/local/src/GNOME/2.11/garnome-hackers-2.11/bin/xml2po", line 34, in ? import libxml2
ImportError: No module named libxml2
...
Observations:
* xml2po is a python script
that is built and installed as part of gnome-doc-utils.
* xml2po imports a python module libxml2
that is built and installed as part of libxml2
* Both gnome-doc-utils and libxml2 had already been built and installed
before the build of gnome-panel commenced.
Questions:
* Why the failure???
* Why wasn't this seen before?
Answers:
* the python package, libxml2, was not found in the search path
for /opt/python-2.4.1/bin/python.
The solution is to add and export PYTHONPATH in gar.conf.mk:
...
# If you want to use a different version of python everywhere
# change this
#PYTHON = $(shell which python)
PYTHON = /opt/python-2.4.1/bin/python
PYTHONPATH=$(main_libdir)/python2.4/site-packages
# Let's see if we can get gtk-doc going 100%
XML_CATALOG_FILES += $(DESTDIR)$(sysconfdir)/xml/catalog
# GNOME CVS root if we need it
GNOMECVSROOT = ":pserver:anonymous anoncvs gnome org:/cvs/gnome"
# Put these variables in the environment during the
# configure build and install stages
STAGE_EXPORTS = DESTDIR prefix exec_prefix bindir sbindir libexecdir datadir
STAGE_EXPORTS += sysconfdir sharedstatedir localstatedir libdir infodir lispdir
STAGE_EXPORTS += includedir mandir docdir sourcedir
STAGE_EXPORTS += CPPFLAGS CFLAGS CXXFLAGS LDFLAGS ACLOCAL_FLAGS
STAGE_EXPORTS += CC CXX PYTHON PYTHONPATH
...
* Earlier versions of gnome-panel did not use xml2po.
I perused the build logs for garnome-2.11.5. xml2po is built but not
used when building any of the applications in desktop, fifth-toe,
geektoys, hacker-tools, matchbox, mono, or office.
So... "we" were lucky.
-Joseph
--
joseph_sacco [at] comcast [dot] net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]