[Distutils] Python module for use in ‘setup.py’ but not to install

Ben Finney ben+python at benfinney.id.au
Mon Jan 19 05:11:34 CET 2015


Ben Finney <ben+python at benfinney.id.au> writes:

> Donald Stufft <donald at stufft.io> writes:
>
> > I’m pretty sure that find_packages is going to discover version.py
> > and add it as part of the return value which is then passing that to
> > the packages kwarg.
>
> That doesn't match the documentation for ‘find_packages’:
> […]
>
> The ‘version.py’ module is not within any package, so I infer that
> ‘find_packages’ should ignore it. Is that wrong?

Testing with Python 2.7 and Python 3.4 demonstrates that, indeed,
‘find_packages’ ignores the file because it's not in a package.

When I put in ‘setup.py’ a diagnostic line::

    print(find_packages(exclude=["test"]))

the output shows ‘version.py’ is not collected::

    $ python2.7 ./setup.py check
    ['daemon']
    running check
    
    $ python3.4 ./setup.py check
    ['daemon']
    running check

Which is as it should be.

So should I expect that, if a module is not specified in the ‘packages’
parameter nor the ‘py_modules’ parameter, it will not be installed?

-- 
 \       “See, in my line of work you gotta keep repeating things over |
  `\       and over and over again, for the truth to sink in; to kinda |
_o__)               catapult the propaganda.” —George W. Bush, 2005-05 |
Ben Finney



More information about the Distutils-SIG mailing list