RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Per Øyvind Karlsen
  Root:   /v/rpm/cvs                       Email:  pkarl...@rpm5.org
  Module: rpm                              Date:   19-Oct-2010 04:46:53
  Branch: HEAD                             Handle: 2010101902465201

  Added files:
    rpm/scripts             pythoneggs.py
  Modified files:
    rpm                     CHANGES
    rpm/macros              python.in
    rpm/scripts             Makefile.am

  Log:
     proyvind: add automatic pythoneggs() dependencies. (finish up last
    details tomorrow..)

  Summary:
    Revision    Changes     Path
    1.3481      +1  -0      rpm/CHANGES
    1.4         +2  -0      rpm/macros/python.in
    1.72        +2  -2      rpm/scripts/Makefile.am
    1.1         +83 -0      rpm/scripts/pythoneggs.py
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.3480 -r1.3481 CHANGES
  --- rpm/CHANGES       19 Oct 2010 02:34:03 -0000      1.3480
  +++ rpm/CHANGES       19 Oct 2010 02:46:52 -0000      1.3481
  @@ -1,4 +1,5 @@
   5.3.4 -> 5.4a1:
  +    - proyvind: add automatic pythoneggs() dependencies.
       - proyvind: ditch %gem_unpack macro and make %setup automatically handle
        ruby gem extraction in stead.
       - jbj: sqlite: fix: permit building without sqlite, <db51/dbsql.h> 
instead.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/macros/python.in
  ============================================================================
  $ cvs diff -u -r1.3 -r1.4 python.in
  --- rpm/macros/python.in      21 Aug 2009 16:48:52 -0000      1.3
  +++ rpm/macros/python.in      19 Oct 2010 02:46:53 -0000      1.4
  @@ -10,6 +10,8 @@
   # helpers are also used by %{_rpmhome}/rpmdeps {--provides|--requires}.
   %__python_provides   %{_rpmhome}/pythondeps.sh --provides
   %__python_requires   %{_rpmhome}/pythondeps.sh --requires
  +%__python_suggests   %{_rpmhome}/pythoneggs.py --suggests
  +%__python_conflicts  %{_rpmhome}/pythoneggs.py --conflicts
   #
   # python main version
   %py_ver              %(echo `python -c "import sys; print sys.version[:3]"`)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/scripts/Makefile.am
  ============================================================================
  $ cvs diff -u -r1.71 -r1.72 Makefile.am
  --- rpm/scripts/Makefile.am   16 Oct 2010 10:04:43 -0000      1.71
  +++ rpm/scripts/Makefile.am   19 Oct 2010 02:46:52 -0000      1.72
  @@ -23,7 +23,7 @@
        mono-find-provides mono-find-requires \
        nix_meta \
        osgideps.pl pkgconfigdeps.sh \
  -     perldeps.pl perl.prov perl.req pythondeps.sh \
  +     perldeps.pl perl.prov perl.req pythoneggs.py \
        php.prov php.req rpm2cpio \
        rpmdb_loadcvt rpmdiff rpmdiff.cgi \
        rpm.daily rpm.log rpm.xinetd \
  @@ -54,7 +54,7 @@
        javadeps.sh libtooldeps.sh \
        mono-find-provides mono-find-requires \
        osgideps.pl pkgconfigdeps.sh \
  -     perldeps.pl perl.prov perl.req pythondeps.sh \
  +     perldeps.pl perl.prov perl.req pythoneggs.py \
        php.prov php.req \
        rpm2cpio rpmdb_loadcvt \
        rpm.daily rpm.log rpm.xinetd \
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/scripts/pythoneggs.py
  ============================================================================
  $ cvs diff -u -r0 -r1.1 pythoneggs.py
  --- /dev/null 2010-10-19 04:46:21.000000000 +0200
  +++ pythoneggs.py     2010-10-19 04:46:52.874584459 +0200
  @@ -0,0 +1,83 @@
  +#!/usr/bin/env python
  +from getopt import getopt
  +from os.path import basename, dirname, splitext
  +from sys import argv, stdin, version
  +from pkg_resources import PathMetadata, Distribution
  +from distutils.sysconfig import get_python_lib
  +
  +
  +opts, args = getopt(argv[1:], 'hPRSECO',
  +        ['help', 'provides', 'requires', 'suggests', 'enhances', 
'conflicts', 'obsoletes'])
  +
  +Provides = False
  +Requires = False
  +Suggests = False
  +Enhances = False
  +Conflicts = False
  +Obsoletes = False
  +
  +for o, a in opts:
  +    if o in ('-h', '--help'):
  +        print '-h, --help\tPrint help'
  +        print '-P, --provides\tPrint Provides'
  +        print '-R, --requires\tPrint Requires'
  +        print '-S, --suggests\tPrint Suggests'
  +        print '-E, --enhances\tPrint Enhances (unused)'
  +        print '-C, --conflicts\tPrint Conflicts'
  +        print '-O, --obsoletes\tPrint Obsoletes (unused)'
  +        exit(1)
  +    elif o in ('-P', '--provides'):
  +        Provides = True
  +    elif o in ('-R', '--requires'):
  +        Requires = True
  +    elif o in ('-S', '--suggests'):
  +        Suggests = True
  +    elif o in ('-E', '--enhances'):
  +        Enhances = True
  +    elif o in ('-C', '--conflicts'):
  +        Conflicts = True
  +    elif o in ('-O', '--obsoletes'):
  +        Obsoletes = True
  +
  +Version = version[:3]
  +for f in stdin.readlines():
  +    f = f.strip()
  +    # FIXME: get other versions as well...
  +    if Provides:
  +        if "/usr/lib/libpython%s.so" % Version in f or \
  +                "/usr/lib64/libpython%s.so" % Version in f:
  +                    print "python(abi) == %s" % Version
  +    if Requires:
  +        if get_python_lib(plat_specific=1) in f or get_python_lib() in f:
  +            print "python(abi) >= %s" % Version
  +    if f.endswith('.egg') or f.endswith('.egg-info') or 
f.endswith('.egg-link'):
  +        base_dir = dirname(f)
  +        metadata = PathMetadata(base_dir, f)
  +        dist_name = splitext(basename(f))[0]
  +        dist = 
Distribution(base_dir,project_name=dist_name,metadata=metadata)
  +        if Provides:
  +            print 'pythonegg(%s) = %s' % (dist.project_name, dist.version)
  +        if Requires or (Suggests and dist.extras):
  +            deps = dist.requires()
  +            if Suggests:
  +                depsextras = dist.requires(extras=dist.extras)
  +                if not Requires:
  +                    for dep in reversed(depsextras):
  +                        if dep in deps:
  +                            depsextras.remove(dep)
  +                deps = depsextras
  +            for dep in deps:
  +                if not dep.specs:
  +                    print 'pythonegg(%s)' % dep.project_name
  +                else:
  +                    for spec in dep.specs:
  +                        if spec[0] != '!=':
  +                            print 'pythonegg(%s) %s' % (dep.project_name, ' 
'.join(spec))
  +        if Conflicts:
  +            # Should we really add conflicts for extras?
  +            # Creating a meta package per extra with suggests on, which has
  +            # the requires/conflicts in stead might be a better solution...
  +            for dep in dist.requires(extras=dist.extras):
  +                for spec in dep.specs:
  +                    if spec[0] == '!=':
  +                        print 'pythonegg(%s) == %s' % (dep.project_name, 
spec[1])
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to