[RFC] move tools to bzrlib.tools

Jonathan Lange jml at mumak.net
Wed Apr 18 06:07:43 BST 2007


On 4/18/07, Alexander Belchenko <bialix at ukr.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Robert Collins пишет:
> > In the bzr source tree, tools/ has at some point become a python module.
> > This means that it appears in the python search path as 'tools', but its
> > part of bzr, so I think its better for it to be bzrlib.tools - this
> > makes it easier to test them, and to reuse the code. If we dont want to
> > install them, thats fine.
> >
> > I'd actually like to cleanup our root so that no files which can be
> > imported by python (except 'bzrlib') are present in the root of our
> > source tree. This would stop any funniness if you run 'python' in the
> > root of the source tree.
>
> 'tools' is package because 'generate_docs.py' holds its modules in it.
> Also it contains several scripts and helpers for creating docs and installers.
> I think it should not be installed as part of bzrlib.
>
> Also, Python 2.5 no more require presence of __init__.py to treat directory
> as python package, so you need to consider 'contrib' as well.
>

I'm not sure what you mean here. Python 2.5 still requires __init__.py
to treat a directory as a package. For example,

$ mkdir nonpackage
$ touch nonpackage/foo.py
$ python
Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from nonpackage import foo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named nonpackage
>>>

$ touch nonpackage/__init__.py
$ python
Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from nonpackage import foo
>>>
jml at rhino:~/Code/Scratch$


cheers,
jml


More information about the bazaar mailing list