Bug#484305: PoC not working for bicyclerepair

Nico Golde nion at debian.org
Mon Jul 7 19:16:21 UTC 2008


Hi James,
* James Vega <jamessan at debian.org> [2008-07-07 20:11]:
> On Mon, Jul 07, 2008 at 07:11:10PM +0200, Nico Golde wrote:
> > * Thomas Arendsen Hein <thomas at intevation.de> [2008-07-06 22:53]:
> > > * Steffen Joeris <steffen.joeris at skolelinux.de> [20080706 11:15]:
[...] 
> In Lenny/Sid, all Vim packages except vim-tiny and vim contain the
> python support, so it is more likely that a user will have a vim binary
> that can be scripted via Python.
> 
> On the other hand, in Lenny/Sid the path that plugins used to be
> installed to (/usr/share/vim/addons) is no longer automatically included
> in Vim's runtimepath.  This means that manual work is required to enable
> the plugin.

Ok, thanks for this information!

[...] 
> > That's why I Cc'ed the vim maintainers. Do you think this 
> > should also work in the same way in unstable/testing?
> 
> See above explanation.
> 
> Also, taking a look at the current bicyclerepair package, the addon is
> now installed to /usr/share/addons/vim/ftplugin/python_bike.vim.  This
> means that the functionality will only be used when editing python files
> (once the user has enabled the plugin) instead of when editing any file,
> as was the case when it was installed to plugins/bike.vim.

Ok

> > I am also not really sure what is causing the automatic 
> > import.
> 
> Python, by default, has '' as the initial item in its sys.path list
> 
>   $ python
>   Python 2.5.2 (r252:60911, Jun 25 2008, 17:58:32)
>   [GCC 4.3.1] on linux2
>   Type "help", "copyright", "credits" or "license" for more information.
>   >>> import sys
>   >>> sys.path
>   ['', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/Numeric', '/usr/lib/python2.5/site-packages/gst-0.10', '/var/lib/python-support/python2.5', '/var/lib/python-support/python2.5/gtk-2.0']
> 
> This means that anything in the current directory is first priority when
> trying to use/import a module.

This should only happen in an interactive session, not!?
nion at coredump:/tmp$] mkdir somedir
[nion at coredump:/tmp$] cd somedir
[nion at coredump:somedir$] cat > /tmp/test.py << EOF
heredoc> import sys
heredoc> print sys.path
heredoc> EOF
[nion at coredump:somedir$] python /tmp/test.py
['/tmp', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/Numeric', '/usr/lib/python2.5/site-packages/PIL', '/var/lib/python-support/python2.5', '/var/lib/python-support/python2.5/gtk-2.0', '/usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode']

The python docs also state "As initialized upon program startup, the first item
of this list, path[0], is the directory containing the script that was used to
invoke the Python interpreter."
So this should be no problem unless I missed your point.

> /usr/lib/pythonX.Y/compiler/transformer.py has the following lines that
> are run when the module is imported
> 
>   import token
>   ...
>   _cmp_types = {
>       token.LESS : '<',
>       token.GREATER : '>',
>       token.EQEQUAL : '==',
>       token.EQUAL : '==',
>       token.LESSEQUAL : '<=',
>       token.GREATEREQUAL : '>=',
>       token.NOTEQUAL : '!=',
>       }
> 
> When the bike Vim plugin is loaded, it imports the bike python module,
> which imports compiler (and therefore compiler.transformer).  Since
> Vim's current working directory is roundup-X.Y/roundup, the above lines
> from transformer.py combined with '' being the first item in sys.path
> cause python to load the token module in the current working directory
> (from roundup's source) instead of using /usr/lib/pythonX.Y/token.py.

I'd agree if that would be the case in a python script, I had this thought
as well first but this doesn't seem to work. That's why I said that I don't
see something like sys.path = [os.curdir] + sys.path in the code.

Did I misunderstand what you wrote?

Thanks for your help James!
Cheers
Nico
-- 
Nico Golde - http://www.ngolde.de - nion at jabber.ccc.de - GPG: 0x73647CFF
For security reasons, all text in this mail is double-rot13 encrypted.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20080707/fc4e2d77/attachment.pgp 


More information about the pkg-vim-maintainers mailing list