aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2010-11-01 22:59:36 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2010-11-01 22:59:36 +0000
commit7f85f01152b56cf76d68ca3a8c5fe7b1e5e71112 (patch)
tree6e90220fd9da216b02dc23eda353324e305db6d4
parent5f1c99a31c75ec21b70bba3284663aedd868e739 (diff)
downloadrpm-setup-7f85f01152b56cf76d68ca3a8c5fe7b1e5e71112.tar
rpm-setup-7f85f01152b56cf76d68ca3a8c5fe7b1e5e71112.tar.gz
rpm-setup-7f85f01152b56cf76d68ca3a8c5fe7b1e5e71112.tar.bz2
rpm-setup-7f85f01152b56cf76d68ca3a8c5fe7b1e5e71112.tar.xz
rpm-setup-7f85f01152b56cf76d68ca3a8c5fe7b1e5e71112.zip
add documentation
-rwxr-xr-xpythoneggs.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/pythoneggs.py b/pythoneggs.py
index 33093ec..c4119e1 100755
--- a/pythoneggs.py
+++ b/pythoneggs.py
@@ -1,4 +1,13 @@
#!/usr/bin/env python
+#
+# Copyright 2010 Per Øyvind Karlsen <peroyvind@mandriva.org>
+#
+# This program is free software. It may be redistributed and/or modified under
+# the terms of the LGPL version 2.1 (or later).
+#
+# RPM5 python (egg) dependency generator.
+#
+
from getopt import getopt
from os.path import basename, dirname, isdir, sep, splitext
from sys import argv, stdin, version
@@ -52,6 +61,7 @@ for f in files:
f = f.strip()
lower = f.lower()
name = 'python(abi)'
+ # add dependency based on path, versioned if within versioned python directory
if py_abi and (lower.endswith('.py') or lower.endswith('.pyc') or lower.endswith('.pyo')):
if not name in py_deps:
py_deps[name] = []
@@ -62,6 +72,7 @@ for f in files:
spec = ('==',f.split(lib)[1].split(sep)[0])
if not spec in py_deps[name]:
py_deps[name].append(spec)
+ # Determine provide, requires, conflicts & suggests based on egg metadata
if lower.endswith('.egg') or \
lower.endswith('.egg-info') or \
lower.endswith('.egg-link'):
@@ -72,8 +83,9 @@ for f in files:
else:
path_item = f
metadata = FileMetadata(f)
- dist = Distribution.from_location(path_item,dist_name,metadata)
+ dist = Distribution.from_location(path_item, dist_name, metadata)
if Provides:
+ # If egg metadata says package name is python, we provide python(abi)
if dist.key == 'python':
name = 'python(abi)'
if not name in py_deps:
@@ -88,6 +100,7 @@ for f in files:
py_deps[name].append(spec)
if Requires or (Suggests and dist.extras):
name = 'python(abi)'
+ # If egg metadata says package name is python, we don't add dependency on python(abi)
if dist.key == 'python':
py_abi = False
if name in py_deps:
@@ -106,6 +119,7 @@ for f in files:
if dep in deps:
depsextras.remove(dep)
deps = depsextras
+ # add requires/suggests based on egg metadata
for dep in deps:
name = 'pythonegg(%s)' % dep.project_name
for spec in dep.specs:
@@ -116,6 +130,8 @@ for f in files:
py_deps[name].append(spec)
if not dep.specs:
py_deps[name] = []
+ # Unused, for automatic sub-package generation based on 'extras' from egg metadata
+ # TODO: implement in rpm later, or...?
if Extras:
deps = dist.requires()
extras = dist.extras
@@ -155,7 +171,9 @@ names = py_deps.keys()
names.sort()
for name in names:
if py_deps[name]:
+ # Print out versioned provides, requires, suggests, conflicts
for spec in py_deps[name]:
print '%s %s %s' % (name, spec[0], spec[1])
else:
+ # Print out unversioned provides, requires, suggests, conflicts
print name