Q: distutils - name clash protection?

Martin Bless mb at muenster.de
Mon Jul 26 22:53:05 CEST 2004

Q: How do I make my setup procedure safe?
Q: How can I let users specify a different destination dir?

By now I think I have some useful modules I'd like to share. In "my
world" everything is centered around my name, therefor my stuff
typically lives in or beneath a package "mb". To use a module - for
example - I do:

  >>> from mb import mbsql

Following this approach a minimalistic setup.py looks like this:

# minimal setup.py
from distutils.core import setup
setup(name = "mbsql",
      packages = ["mb","mb.mbsql"],)

While this is fine in my little world I hate the idea that somebody
else gets unexpectedly and with no warning overwritten what maybe was
in his own "mb" package.

(1) There should be a check built into the sdist that issues as
warning ('mb' already exists - continue?).

(2) Or even better: If the user already has an existing "mb" package:
let him specify a name he likes, maybe "mbmbmb". For example some
tools I found on the web live in a package "SamRushing" on my
installation. And I like the according import statement for its

  >>> from SamRushing import calldll

"distutils" is wonderful but a beast of its own if it comes to
customizing. I'd like to know:

Q: What's the best way to accomplish (1) and/or (2)?

Thank you very much,

mb - Martin Bless

More information about the Python-list mailing list