[Distutils] How to eliminate on part of a package?

Skip Montanaro skip.montanaro at gmail.com
Wed Apr 25 16:28:41 EDT 2018


>
> If by "top/server tree" you mean that there are more subpackages under top.server (not just a server.py file as your diagram shows), then you need to filter out all of those subpackages as well, e.g.:
>
>     packages = setuptools.find_packages()
>     if sys.version_info.major < 3:
>         packages = [
>             pkg for pkg in packages
>                 if pkg != "top.server" and not pkg.startswith("top.server.")
>         ]

Thanks, yes, there is another subpackage within top/server, but I
eliminated it as well. I was simplifying for the email. The raw
find_packages() output looks like this:

['tests', 'top', 'tests.python', 'top.client', 'top.server', 'top.server.db']

I was excising the last two elements from the returned list, so the
argument of the packages keyword looked like this:

['tests', 'top', 'tests.python', 'top.client']

Does the presence of 'top' in the list imply everything under it will
be copied (I do want 'top', as that's the top level package, not just
a directory in my repo.)

I'll keep messing with it.

Skip


More information about the Distutils-SIG mailing list