Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 2.82 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. mdawkins@hi wdj54]$ diff -uNr ./scripts/pythoneggs.py ../pythoneggs.py
  2. --- ./scripts/pythoneggs.py     2011-01-25 21:54:40.000000000 +0000
  3. +++ ../pythoneggs.py    2012-04-30 20:17:33.000000000 +0000
  4. @@ -14,10 +14,12 @@
  5.  from sys import argv, stdin, version
  6.  from pkg_resources import Distribution, FileMetadata, PathMetadata
  7.  from distutils.sysconfig import get_python_lib
  8. +from subprocess import Popen, PIPE, STDOUT
  9. +import os
  10.  
  11.  
  12. -opts, args = getopt(argv[1:], 'hPRSCOE',
  13. -        ['help', 'provides', 'requires', 'suggests', 'conflicts', 'obsoletes', 'extras'])
  14. +opts, args = getopt(argv[1:], 'hPRSCOEb:',
  15. +        ['help', 'provides', 'requires', 'suggests', 'conflicts', 'obsoletes', 'extras','buildroot='])
  16.  
  17.  Provides = False
  18.  Requires = False
  19. @@ -25,6 +27,7 @@
  20.  Conflicts = False
  21.  Obsoletes = False
  22.  Extras = False
  23. +buildroot = None
  24.  
  25.  for o, a in opts:
  26.      if o in ('-h', '--help'):
  27. @@ -35,6 +38,7 @@
  28.          print '-C, --conflicts\tPrint Conflicts'
  29.          print '-O, --obsoletes\tPrint Obsoletes (unused)'
  30.          print '-E, --extras\tPrint Extras '
  31. +        print '-b, --buildroot\tBuildroot for package '
  32.          exit(1)
  33.      elif o in ('-P', '--provides'):
  34.          Provides = True
  35. @@ -48,6 +52,19 @@
  36.          Obsoletes = True
  37.      elif o in ('-E', '--extras'):
  38.          Extras = True
  39. +    elif o in ('-b', '--buildroot'):
  40. +        buildroot = a
  41. +
  42. +def is_exe(fpath):
  43. +    return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
  44. +
  45. +typelib_check = False
  46. +
  47. +if is_exe("/usr/lib/rpm/gi-find-deps.sh") and is_exe("/usr/bin/g-ir-dep-tool"):
  48. +    if not buildroot:
  49. +        pass
  50. +    else:
  51. +        typelib_check = True
  52.  
  53.  if Requires:
  54.      py_abi = True
  55. @@ -58,6 +75,7 @@
  56.      files = args
  57.  else:
  58.      files = stdin.readlines()
  59. +
  60.  for f in files:
  61.      f = f.strip()
  62.      lower = f.lower()
  63. @@ -73,6 +91,21 @@
  64.                  spec = ('==',f.split(lib)[1].split(sep)[0])
  65.                  if not spec in py_deps[name]:
  66.                      py_deps[name].append(spec)
  67. +        # Pipe files to find typelib requires
  68. +        if typelib_check:
  69. +            p = Popen(['/usr/lib/rpm/gi-find-deps.sh', '-R',str(buildroot)], stdout=PIPE, stdin=PIPE, stderr=STDOUT)
  70. +            (stdoutdata, stderrdata) = p.communicate(input=str(f)+"\n")
  71. +            
  72. +            if stdoutdata and stdoutdata:
  73. +                py_deps[stdoutdata.strip()]= ""
  74. +
  75. +    # XXX: hack to workaround RPM internal dependency generator not passing directories
  76. +    dlower = dirname(lower)
  77. +    if dlower.endswith('.egg') or \
  78. +            dlower.endswith('.egg-info') or \
  79. +            dlower.endswith('.egg-link'):
  80. +        lower = dlower
  81. +        f = dirname(f)
  82.      # Determine provide, requires, conflicts & suggests based on egg metadata
  83.      if lower.endswith('.egg') or \
  84.              lower.endswith('.egg-info') or \