On Sun, May 18, 2008 at 11:02 PM, Edward K. Ream <[EMAIL PROTECTED]> wrote:
> 2. We will change all imports from > > import leoX > > to > > import leo.core.leoX. Or, perhaps less intrusively (sourcecodewise), "from leo.core import leoX", as you mention later on. > Requirement 2. We have got to be able to override the Leo package > defined in site-packages. That is, even if Leo is truly installed as > a package, we must be able to run Leo from a bzr branch. Python This works if you have a small "leo launch" script in bzr root. In ipython we have ipython.py at root of the source distribution, and it just does the import and launch. Also, you can benefit from setuptools here. See e.g. "eggsetup.py" in ipython. If you do 'python eggsetup.py develop", a small wrapper will be installed in site-packages and all places that import the leo package will see the bzr checkout. > In short: > > A: We must rename leo.py. Very true. > B: We can simulate Leo being a package by having sitecustomize.py > place leo.repo\leo-as-a-package in sys.path. Or just having the script that does the import in source root folder. > C: All imports in Leo, wherever they may be, will use fully-qualified > imports such as import leo.core.leoGlobals as g. This should ensure > sanity and consistency. I think you meant "from leo.core import leoGlobals as g". > These imports are all different because they put three different > entries in sys.modules. The keys in sys.modules are respectively > "leoGlobals", "core.leoGlobals" and "leo.core.leoGlobals". I have no > idea whether this could be called a bug (I kinda doubt it), but it > means that all imports in Leo must use exactly the same scheme. This is a misfeature in python, but the plan is to require fully qualified import for package modules anyway (but of course that will break lots of stuff). See http://www.python.org/dev/peps/pep-0328/ esp. the part about "from __future__ import absolute_import" -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to leo-editor@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en -~----------~----~----~----~------~----~------~--~---