[Distutils] setuputils cvs based source detection?
Jeremy Kloth
jeremy.kloth at 4suite.org
Sun Oct 15 19:31:14 CEST 2006
On Saturday 14 October 2006 8:55 pm, S Joshua Swamidass wrote:
> Here is the situation:
>
> I have a large project in one big cvs tree. i want to be able to
> release in differen't packages from this tree using different
> setup.py's. My project is organized like:
>
> ./ (root dir)
> setup_A.py #package = ['A']
> setup_B.py #package = ['B']
> A/
> __init__.py
> moduleA.py
> B/
> __init__.py
> moduleB.py
Check out 4Suite's distutils extensions. They support this kind of layout as
that is how 4Suite itself is layed out. It is run with a "master" setup.py
file that defers to "package files" for the contents of sub-packages.
<setup.py>
from Ft.Lib.DistExt import setup
setup(name="LargeProject",
package_files=['A.pkg', 'B.pkg'],
# Other values that are consistent between sub-packages
# like any of the metadata fields (including the fields
# from PEP 345 like `requires`, `provides`, `obsoletes`
# and `requires_python`.
)
<EOF>
<A.pkg>
# This file contains the setup() keywords specific to 'A'.
# Either `package` or `name` is required. `package` means the sub-package
# name will be, in this case, "LargeProject-A".
package = 'A'
# or
# name = "SomeProjectA"
<EOF>
<B.pkg>
# This file contains the setup() keywords specific to 'B'.
package = 'B'
<EOF>
Other keywords that are usable as setup() keyword arguments are allowed. This
file is treated as a "regular" Python script, so imports and such are
allowed. The various classes used for representing data structures are
automatically provided in the namespace for the script when it is evaluated
for keyword arguments.
To work on a single package, call setup.py with a
`--package=<sub-package-name>` (-p) argument. Otherwise it will iterate over
all sub-packages sorted by the provides/requires order of inter-package
dependencies.
The DistExt feature list includes:
* .egg distributions
* InnoSetup installers for Windows
* scripts are real executables on Windows
* automatic API documentation generation
* a `config` command for saving configuration between multiple runs
* gettext (l10n) message catalogs
* a "smart" sdist that packages files referenced the all the commands
(include the C headers for extension modules)
DistExt has been around a long time, since distutils first release in fact,
and is in constant use, but fairly under-documented (as it has been
4Suite-only, but I'm looking to change that).
I'd suggest looking at 4Suite's setup.py and related package files for a
start.
--
Jeremy Kloth
http://4suite.org/
More information about the Distutils-SIG
mailing list