#30 Do not depend on .py exts for plugins

closed
Doug Hellmann
None
2
2002-02-07
2002-02-07
Doug Hellmann
No

> There is a policy which says that PLD packages
contain no *.py
> files - only *.pyc and *.pyo. HappyDoc plugin loader
tries to load

What an odd policy. I would be interested to know why
they do it that way.

> only *.py files so I got into trouble when creating
the package.
> I have an idea so HappyDoc could use *.pyo files when
available
> and when not then load *.py plugins. I am attaching a
patch which
> illustrates the change but _is_not_the_solution_ (it
loads *.pyo
> files but no *.py). If you like the idea, then I can
provide
> full solution.

There may be a case for changing the scheme by why
plugins are identified.
It seems like a better approach would be to find
distinct basenames for files
that begin with the plugin name. Something along the
lines of:

all_files = glob.glob('formatter_*')
all_basenames = map(os.path.basename, all_files)
unique_modules = []
for module in all_basenames:
if module not in unique_modules:
unique_modules.append(module)

That would let a developer create .pyd, .pyo, .so, .dll
or whatever other
format extension they might want. I'll add that to the
feature request
tracker.

Doug

Discussion

  • Doug Hellmann
    Doug Hellmann
    2002-02-07

    • status: open --> closed
     
  • Doug Hellmann
    Doug Hellmann
    2002-02-07

    • assigned_to: nobody --> doughellmann