[Distutils] First steps with distutils...
Greg Ward
gward@python.net
Sat Sep 2 10:52:02 2000
On 02 September 2000, M.-A. Lemburg said:
> I've also posted this to Greg directly, but on second
> thought I think it might be worthwhile getting some feedback from
> distutilers as well:
Then I'll reply publicly too; seems more useful that way.
> * distutils doesn't seem to like diretory names in MANIFEST
Correct. MANIFEST is a simple list of files, one per line. If you want
to include whole directories, you should write a MANIFEST.in file.
Eg. here is the Distutils' MANIFEST.in; I have (right now) 536 files in
my Distutils working tree, and this MANIFEST.in whittles it down to the
89 files you see in the 0.9.2 source tarball:
include *.txt TODO
include MANIFEST.in
recursive-include examples *.txt *.py
prune examples/sample*/build
include doc/dist/*.tex doc/inst/*.tex
graft misc
exclude misc/*.zip
global-exclude *~
The docs for MANIFEST.in are sketchy right now; see
http://www.python.org/sigs/distutils-sig/doc/dist/sdist-cmd.html
for a start.
> * the setup.py file itself is not included in the source
> distribution per default (why not ?)
It should be if you have a MANIFEST.in file.
One current weakness is that the "sdist" command isn't very smart in the
absence of a MANIFEST.in file. I always seem to notice this in the
final hours up to a release, which is not the time or place for major
surgery to fix this. Sigh.
> * bdist_wininst wants zlib but the installer has a note that
> it is not using it anymore
Thomas, is this true?
> * bdist_wininst fails with a setup.py file which does not
> define long_description
I thought that was fixed in 0.9.2 -- !@&%@!#&!@#&%!
> * bdist_rpm fails with an error in the rpm command (the source
> rpm is built, but it fails to build to the binary rpm for
> some reason -- it says, that it can't find the file ??);
> do I need some new rpm release for this to work ?
bdist_rpm requires RPM 3.0, which all current RPM-based Linux
distributions use (AFAIK). It does *not* work on Red Hat 5.x, which is
what finally prompted me to upgrade to 6.2. ;-)
Can you show the exact output when you run "setup.py bdist_rpm"?
> * the bdist commands don't compile the .py files into .pyo
> but this is needed in order to use them with python -O
Yeah, known problem. How big do you want your RPM to be again? ;-(
> * bdist (the dumb version) defaults to creating a tar.gz
> archive which is relative to / -- it shouldn't use the
> usr/local/ prefix to make the installation relocateable
> (e.g. to install under /usr, /opt, /opt/local, etc.)
There's no one right way to do this; I've tried them both, and they're
both wrong. Originally, bdist_dumb created an archive relative to
<prefix> -- relocatable, but it didn't work if prefix != exec-prefix.
(I can't remember if it bombed or created a bogus archive, but the
bottom line is it didn't work.) Now it creates an archive relative to
/, which handles prefix != exec-prefix, but is not relocatable. ;-(
I think the answer is to let the packager decide, ie. add an option to
make the archive relative to / or prefix. (And it should blow up if
prefix != exec-prefix and you try to make a prefix-relative archive.)
> * how can I define the compiler settings for extension
> compilation (it defaults to -m486 for RPMs -- -mcpu=pentium
> would be more appropriate; default for standard bdist
> seems to be -O2 and no architecture) ?
For a straight Distutil build (ie. no RPM involved), setting CFLAGS
should work, but it only applies to extensions (not C libraries). When
RPM is involved, I'm not sure what the Right Way to do it is. Maybe
CFLAGS will work? Maybe editing /etc/rpmrc or /usr/lib/rpm/rpmrc? I
dunno.
> And a general question: how can I define which files are
> documentation, examples and auxiliary files ?
Doc files can be defined with the doc_files option to bdist_rpm. The
easiest way to set this is with a setup.cfg in your distribution root,
eg. the Distutils setup.cfg has:
[bdist_rpm]
release = 1
packager = Greg Ward <gward@python.net>
doc_files = CHANGES.txt
README.txt
USAGE.txt
doc/
examples/
...
Although I have been thinking that putting making every RPM option a
Distutils option was a bad idea. Hmmmm.
> More to come :-)
Oh no! You might want to take a look in the Distutils-0.9.2/TODO file
to see what's on "the list".
Greg
--
Greg Ward - nerd gward@python.net
http://starship.python.net/~gward/
Does your DRESSING ROOM have enough ASPARAGUS?