[Checkins] SVN: van.pydeb/trunk/ Implement a --override-dep option which can be used to override python to
Brian Sutherland
jinty at web.de
Fri Sep 4 03:47:00 EDT 2009
Log message for revision 103524:
Implement a --override-dep option which can be used to override python to
binary package dependencies.
Changed:
U van.pydeb/trunk/CHANGES.txt
U van.pydeb/trunk/van/pydeb/__init__.py
U van.pydeb/trunk/van/pydeb/tests/__init__.py
U van.pydeb/trunk/van/pydeb/tests/extras.txt
U van.pydeb/trunk/van/pydeb/tests/translations.txt
-=-
Modified: van.pydeb/trunk/CHANGES.txt
===================================================================
--- van.pydeb/trunk/CHANGES.txt 2009-09-04 05:13:32 UTC (rev 103523)
+++ van.pydeb/trunk/CHANGES.txt 2009-09-04 07:47:00 UTC (rev 103524)
@@ -14,6 +14,8 @@
* Add the concept of options to the list of dependencies.
* Create a "reduced" option that causes warnings to be printed when a reduced
dependncy is used.
+* Implement a --override-dep option which can be used to override python to
+ binary package dependencies.
1.2.1 (2009-06-15)
------------------
Modified: van.pydeb/trunk/van/pydeb/__init__.py
===================================================================
--- van.pydeb/trunk/van/pydeb/__init__.py 2009-09-04 05:13:32 UTC (rev 103523)
+++ van.pydeb/trunk/van/pydeb/__init__.py 2009-09-04 07:47:00 UTC (rev 103524)
@@ -78,6 +78,18 @@
_PY_TO_BIN, _BIN_TO_PY = _read_map(os.path.join(_HERE, 'py_to_bin.txt'))
_PY_TO_SRC, _SRC_TO_PY = _read_map(os.path.join(_HERE, 'py_to_src.txt'))
+def _parse_override_bdep(parser):
+ parser.add_option("--override-bdep", dest="override_bdep", action="append",
+ help="Override a binary-python dependency relation. Format: 'python_package_name binary_package_name'. Can be used multiple times.")
+
+def _handle_override_bdep(options):
+ if options.override_bdep is None:
+ return
+ for override in options.override_bdep:
+ py, bin = override.split()
+ _PY_TO_BIN[py] = (bin, {})
+ _BIN_TO_PY[bin] = (py, {})
+
_DEFVAL = (None, None)
def py_to_bin(setuptools_project):
@@ -128,13 +140,15 @@
def _string_command(argv):
command = argv[1]
parser = optparse.OptionParser(usage="usage: %%prog %s argument" % command)
+ _parse_override_bdep(parser)
options, args = parser.parse_args(argv)
- assert len(argv) == 3, "Too many or few arguments"
+ _handle_override_bdep(options)
+ assert len(args) == 3, "Too many or few arguments %s" % args
print {'py_to_src': py_to_src,
'py_to_bin': py_to_bin,
'bin_to_py': bin_to_py,
'src_to_py': src_to_py,
- 'py_version_to_deb': py_version_to_deb}[command](argv[2])
+ 'py_version_to_deb': py_version_to_deb}[command](args[2])
return 0
_COMMANDS['py_to_src'] = _COMMANDS['py_to_bin'] = _string_command
_COMMANDS['src_to_py'] = _COMMANDS['bin_to_py'] = _string_command
@@ -206,7 +220,9 @@
help="Exclude extras from dependencies")
parser.add_option("--extra", dest="extras", action="append",
help="Generate dependency for extra[s]")
+ _parse_override_bdep(parser)
options, args = parser.parse_args(argv)
+ _handle_override_bdep(options)
assert len(args) == 2, "One and only one command can be specified"
command = args[1]
assert os.path.exists(options.egg_info), "Does not exist: %s" % options.egg_info
Modified: van.pydeb/trunk/van/pydeb/tests/__init__.py
===================================================================
--- van.pydeb/trunk/van/pydeb/tests/__init__.py 2009-09-04 05:13:32 UTC (rev 103523)
+++ van.pydeb/trunk/van/pydeb/tests/__init__.py 2009-09-04 07:47:00 UTC (rev 103524)
@@ -4,6 +4,16 @@
def runit(string):
"Test run a command"
- exitcode = main(string.split())
+ # find quoted argments:
+ targs = string.split('"')
+ count = 0
+ args = []
+ for arg in targs:
+ if divmod(count, 2)[1] == 0:
+ args.extend(arg.split())
+ else:
+ args.append(arg)
+ count += 1
+ exitcode = main(args)
if exitcode != 0:
return exitcode
Modified: van.pydeb/trunk/van/pydeb/tests/extras.txt
===================================================================
--- van.pydeb/trunk/van/pydeb/tests/extras.txt 2009-09-04 05:13:32 UTC (rev 103523)
+++ van.pydeb/trunk/van/pydeb/tests/extras.txt 2009-09-04 07:47:00 UTC (rev 103524)
@@ -72,3 +72,11 @@
>>> runit('van-pydeb depends --egg-info %s' % zope_security) # doctest: +ELLIPSIS
python-..., python-zope.component, ...
+
+Overriding binary dependencies
+------------------------------
+
+The --override-bdep command line option can be used to override mappings of binary dependencies.
+
+ >>> runit('van-pydeb depends --egg-info %s --exclude-extra docs --override-bdep "setuptools python-setuptools" --override-bdep "ZODB3 python-zodb3"' % zope_component)
+ python-setuptools, python-zodb3, python-zope, python-zope.configuration, python-zope.event, python-zope.hookable, python-zope.i18nmessageid, python-zope.interface, python-zope.location, python-zope.proxy, python-zope.security, python-zope.testing
Modified: van.pydeb/trunk/van/pydeb/tests/translations.txt
===================================================================
--- van.pydeb/trunk/van/pydeb/tests/translations.txt 2009-09-04 05:13:32 UTC (rev 103523)
+++ van.pydeb/trunk/van/pydeb/tests/translations.txt 2009-09-04 07:47:00 UTC (rev 103524)
@@ -47,6 +47,22 @@
>>> print pydeb.bin_to_py("foo")
foo
+Overriding binary package translations
+--------------------------------------
+
+The --override-bdep command line option can be used to override mappings of binary dependencies.
+
+ >>> runit('van-pydeb py_to_bin foo')
+ python-foo
+ >>> runit('van-pydeb py_to_bin --override-bdep "foo python-bar" foo')
+ python-bar
+ >>> runit('van-pydeb py_to_bin --override-bdep "Test python-tst" --override-bdep "foo python-bar" foo')
+ python-bar
+ >>> runit('van-pydeb py_to_bin --override-bdep "foo python-bar" --override-bdep "foo python-bar" foo')
+ python-bar
+
+
+
Setuptools
----------
More information about the checkins
mailing list