On 19.05.05, Jose' Matos wrote:
> On Friday 13 May 2005 13:39, G. Milde wrote:
> > On 11.05.05, Jose' Matos wrote:
> 
> > Actually, I already converted my pyclient script into a LyX package (with
> > LyX/pyserver.py, LyX/pyclient.py, LyX/lfuns.py, ...). (As I need to
> > finish testing, it is still unpublished.)
> 
>   To be a real package you need the __init__.py file also, I didn't saw it 
> there in your list. :-)

I can assure you that __init__.py is there.
 
> > I currently have it in my PYTHONPATH
 
>   But we can, and should add it to the sitelib of python. Just like we do 
> with some of the tex related stuff.

That's it. What I meant by PYTHONPATH was not the environment variable,
but sys.path -- pythons search path for modules (whether it is sitelib or
local-sitelib or whatever has to be decided by the Makefile or the
distribution package maintainer)
 
>   For Fedora 3 that I am using now this is:
> /usr/lib/python2.3/site-packages/

The same here on Debian/testing

>   But again due to python multi-platform nature that is not a problem since 
> we can use distutils to install it in the correct place.

Yes. Still it could be nice to have the LyX python files in the "sysdir"

  LyX files dir: /usr/share/lyx

under e.g. /usr/share/lyx/pyLyX/LyX/ for all platforms (and user provided
ones under ~/.lyx/pyLyX/LyX/). 

>   With my proposal LyX is again the natural name and there is no need to 
> play with PYTHONPATH, as the package will then be installed in the 
> system. :-)

Yes. If the developers agree to put the LyX python support files in
pythons standard search path, no additional fiddeling is needed.

The install could either symlink the package dir LyX to the sitelib or
place a pth (path extension) file there containing simply

   # LyX.pth
   /usr/share/lyx/pyLyX

I tested this variant yesterday. As this file adds the directory to the
search path, all python modules in /usr/share/lyx/pyLyX will be directly
accessible to import and /usr/share/lyx/pyLyX/LyX/ will result in the
"natural" package name (i.e. LyX), while pyLyX still shows the
non-pythonic lyxers what is in this directory.

The __init__.py file in LyX/ should add ~/.lyx/pyLyX/LyX/ to the
_packages_ __path__, so that user added python scripts become part of the
LyX package as well.


> > If you then move LYXDIR/lyx2lyx/ to LYXDIR/pyLyX/lyx2lyx, it becomes
> > a part of the pyLyX package. Now moving LYXDIR/lyx2lyx/lyx2lyx to
> > LYXDIR/scripts/lyx2lyx would make the lyx2lyx wrapper easily available
> > again. Of course this moves would need changes in the import
> > statements...
> 
>   Again no need to change its place, lyx2lyx should remain where it is and 
> as it does now it is a simple client of LyX.
> 
>   Also with this scheme there is no need to change either yours or the 
> existing code.

You are right. Just now it is easiest to keep the things as-is and try
whether the LyX package integrates well.

In the long run, however, I would like to merge lyx2lyx into the LyX
package (as ...LyX/lyx2lyx sub-module). This way it would be importable
from other python scripts wanting to work with LyX files. Also the import
statements in lyx2lyx become more clean and natural. (The same holds for
the auxiliary scripts now under "sysdir"/doc/.)


G�nter 


-- 
G.Milde web.de

Reply via email to