[Distutils] setuptools 0.6c5 released :(
Phillip J. Eby
pje at telecommunity.com
Wed Jan 17 18:08:22 CET 2007
[Please stop taking this off-list; I don't do off-list support.]
At 08:17 AM 1/17/2007 -0600, Jon Nelson wrote:
>Phillip J. Eby wrote:
> > At 05:05 PM 1/9/2007 -0600, Jon Nelson wrote:
> >> Say, I've got a local patch to setuptools that adds rpm 'Requires'
> >> lines for all dependencies, which is a huge boon to us that use rpm for
> >> everything (and rely on /it/ for dependency management). Interested?
> >>
> >> It's a pretty small patch, and I'm probably doing it wrong anyway, but
> >> it works with everything I've thrown at it so far.
> >
> > The main problem I see is that there is no guaranteed mapping between
> > RPM package names and PyPI package names. I'm also not clear on what
> > scope you're trying to deal with the issue in.
>
>Well, in theory, the change would only affect those using setuptools
>*and* bdist_rpm. If using bdist_rpm, then it only /adds/ dependency
>information.
As far as I can tell, unless these requirements are prefixed with somethign
to indicate their CheeseShop/setuptools nature, *and* a corresponding
Provides: is done in the RPM for what *that* package provides, I don't
really see how that would work.
The difficulty I see in doing that, especially as a default setting, is
that it means dependency RPMs might need to be rebuilt as setuptools RPMs.
Essentially, I don't see how this can work as a default behavior, and I'd
like some input from other people using RPMs before considering adding this
as a normal behavior.
Note too, by the way, that there is absolutely no need for you to patch
setuptools in order to get this behavior. just create a project directory
like this:
setup.py
my_bdist_rpm.py
And define a subclass of setuptools' bdist_rpm in my_bdist_rpm.py, list it
in your 'distutils.commands' entry points (see setuptools' own setup.py for
examples), and then run "setup.py install". You will then have a new
command installed on your machine, that you can run with *any*
setuptools-based package, or by using this trick to run a non-setuptools'
package's setup.py with your command:
python -c "import setuptools;execfile('setup.py')" my_bdist_rpm ...
So, there's nothing stopping you from having this behavior without needing
to maintain a patch; just maintain a subclass instead. You can even
distribute your extended command on the Cheeseshop, so that other people
can install it with easy_install and be able to use the same behavior, if
they prefer it. Some popularity might then be convincing with respect to
including it in 0.7 as a default behavior.
>I'll send you the patch anyway. What would really be ideal, IMO, would
>be for it to default to on (again, it only changes bdist_rpm behavior)
>and for it to be switchable somehow. For environments that use RPM
>heavily (like all of the environments I've worked in for almost 10 years
>now) it's a huge bonus.
>
>
>diff -ur setuptools-0.6c5.orig/setuptools/command/bdist_rpm.py
>setuptools-0.6c5/setuptools/command/bdist_rpm.py
>--- setuptools-0.6c5.orig/setuptools/command/bdist_rpm.py
>2007-01-09 13:20:24.000000000 -0600
>+++ setuptools-0.6c5/setuptools/command/bdist_rpm.py 2007-01-09
>16:59:01.000000000 -0600
>@@ -4,7 +4,9 @@
> # finally, a kludge to track .rpm files for uploading when run on
>Python <2.5.
>
> from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm
>-import sys, os
>+from distutils.sysconfig import get_python_version
>+import sys, os, re
>+from pkg_resources import *
>
> class bdist_rpm(_bdist_rpm):
>
>@@ -12,6 +14,21 @@
> _bdist_rpm.initialize_options(self)
> self.no_egg = None
>
>+ def finalize_options(self):
>+ _bdist_rpm.finalize_options(self)
>+ requires = list( yield_lines(self.distribution.install_requires
>or ()) )
>+ if not requires: return
>+ if not self.requires:
>+ self.requires = []
>+ # dang. RPM requires versions in a different format (w/spaces!)
>+ VERS_RE = re.compile(r"\s*(<=?|>=?|==|!=)\s*((\w|[-.])+)")
>+ for req in requires:
>+ parts = VERS_RE.split(req)[:3]
>+ parts[0] = safe_name(parts[0])
>+ if len(parts) > 1:
>+ parts[2] = safe_version(parts[2])
>+ self.requires.append(' '.join(parts))
>+
> if sys.version<"2.5":
> # Track for uploading any .rpm file(s) moved to self.dist_dir
> def move_file(self, src, dst, level=1):
More information about the Distutils-SIG
mailing list