packages and modules together

Here's a topic that's come up before. Distutils does not currently support having both packages and modules in the same call to distutils.core.setup(). While this is probably fine for many projects, others have been bitten by it; Anthony Baxter asked about this just last month: http://mail.python.org/pipermail/distutils-sig/2003-January/003151.html We're increasingly using distutils with Zope, and would like to make our use of it as "clean" as possible. The current setup script I'm working with has to call distutils.core.setup() three times, which is just too many for me. Some of this can probably be improved by adjusting more of the provided knobs more carefully, but the simple use of both modules and packages seems like aviodable pain. Is there any reason not to support both in the distutils core directly? While the limitation can be worked around, it seems gratuitous, and shouldn't need the extra machinations. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation

Fred L. Drake, Jr. wrote:
This seems to be related to some design decision in build_py.py which is not clear at all: # Two options control which modules will be installed: 'packages' # and 'py_modules'. The former lets us work with whole packages, not # specifying individual modules at all; the latter is for # specifying modules one-at-a-time. Currently they are mutually # exclusive: you can define one or the other (or neither), but not # both. It remains to be seen how limiting this is. # Dispose of the two "unusual" cases first: no pure Python modules # at all (no problem, just return silently), and over-specified # 'packages' and 'py_modules' options. if not self.py_modules and not self.packages: return if self.py_modules and self.packages: raise DistutilsOptionError, \ "build_py: supplying both 'packages' and 'py_modules' " + \ "options is not allowed" # Now we're down to two cases: 'py_modules' only and 'packages' only. if self.py_modules: self.build_modules() else: self.build_packages() I believe that a simple change to the .find_all_modules() method would solve the problem: the method would need to merge the two generated lists (from py_modules and the modules from the packages). -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Feb 27 2003)
Python/Zope Products & Consulting ... http://www.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
Python UK 2003, Oxford: 33 days left EuroPython 2003, Charleroi, Belgium: 117 days left

M.-A. Lemburg writes:
This seems to be related to some design decision in build_py.py which is not clear at all:
No kidding! No clarity there.
I'm sure it won't be too difficult to remove the limitation, but I wanted to determine if there were any objections before I dug into it. I'll try and work up a patch in the next few days and post it on SourceForge. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation

"M.-A. Lemburg" <mal@lemburg.com> writes:
I ran across this general distutils problem as well when writing the setup.py for Thuban [1] and I derived a new build command just so that I could have both modules and packages. Overriding find_all_modules and run was necessary. find_all_modules as MAL described and run so that it will allow specifying both modules and packages. This has been working very well in Thuban. Bernhard [1] (http://thuban.intevation.org/) -- Intevation GmbH http://intevation.de/ Sketch http://sketch.sourceforge.net/ MapIt! http://www.mapit.de/

Bernhard Herzog wrote:
Could you submit this as patch for the standard build_py command ?
Bernhard
-- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Feb 28 2003)
Python/Zope Products & Consulting ... http://www.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
Python UK 2003, Oxford: 32 days left EuroPython 2003, Charleroi, Belgium: 116 days left

"M.-A. Lemburg" <mal@lemburg.com> writes:
http://www.python.org/sf/695090 Bernhard -- Intevation GmbH http://intevation.de/ Sketch http://sketch.sourceforge.net/ MapIt! http://www.mapit.de/

Fred L. Drake, Jr. wrote:
This seems to be related to some design decision in build_py.py which is not clear at all: # Two options control which modules will be installed: 'packages' # and 'py_modules'. The former lets us work with whole packages, not # specifying individual modules at all; the latter is for # specifying modules one-at-a-time. Currently they are mutually # exclusive: you can define one or the other (or neither), but not # both. It remains to be seen how limiting this is. # Dispose of the two "unusual" cases first: no pure Python modules # at all (no problem, just return silently), and over-specified # 'packages' and 'py_modules' options. if not self.py_modules and not self.packages: return if self.py_modules and self.packages: raise DistutilsOptionError, \ "build_py: supplying both 'packages' and 'py_modules' " + \ "options is not allowed" # Now we're down to two cases: 'py_modules' only and 'packages' only. if self.py_modules: self.build_modules() else: self.build_packages() I believe that a simple change to the .find_all_modules() method would solve the problem: the method would need to merge the two generated lists (from py_modules and the modules from the packages). -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Feb 27 2003)
Python/Zope Products & Consulting ... http://www.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
Python UK 2003, Oxford: 33 days left EuroPython 2003, Charleroi, Belgium: 117 days left

M.-A. Lemburg writes:
This seems to be related to some design decision in build_py.py which is not clear at all:
No kidding! No clarity there.
I'm sure it won't be too difficult to remove the limitation, but I wanted to determine if there were any objections before I dug into it. I'll try and work up a patch in the next few days and post it on SourceForge. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation

"M.-A. Lemburg" <mal@lemburg.com> writes:
I ran across this general distutils problem as well when writing the setup.py for Thuban [1] and I derived a new build command just so that I could have both modules and packages. Overriding find_all_modules and run was necessary. find_all_modules as MAL described and run so that it will allow specifying both modules and packages. This has been working very well in Thuban. Bernhard [1] (http://thuban.intevation.org/) -- Intevation GmbH http://intevation.de/ Sketch http://sketch.sourceforge.net/ MapIt! http://www.mapit.de/

Bernhard Herzog wrote:
Could you submit this as patch for the standard build_py command ?
Bernhard
-- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Feb 28 2003)
Python/Zope Products & Consulting ... http://www.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
Python UK 2003, Oxford: 32 days left EuroPython 2003, Charleroi, Belgium: 116 days left

"M.-A. Lemburg" <mal@lemburg.com> writes:
http://www.python.org/sf/695090 Bernhard -- Intevation GmbH http://intevation.de/ Sketch http://sketch.sourceforge.net/ MapIt! http://www.mapit.de/
participants (3)
-
Bernhard Herzog
-
Fred L. Drake, Jr.
-
M.-A. Lemburg