summaryrefslogtreecommitdiffstats
path: root/makeapi
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2012-04-12 08:39:39 -0400
committerMartin Kosek <mkosek@redhat.com>2012-12-12 14:10:47 +0100
commitfa6be6d8db985d6c85c819fe62c0a1edac63fd40 (patch)
tree7937498d44b290c3f4239fd951ae74bce74a5f17 /makeapi
parent7f27a18b519133d918db83e722ee2339388a02a9 (diff)
downloadfreeipa-fa6be6d8db985d6c85c819fe62c0a1edac63fd40.tar.gz
freeipa-fa6be6d8db985d6c85c819fe62c0a1edac63fd40.tar.xz
freeipa-fa6be6d8db985d6c85c819fe62c0a1edac63fd40.zip
Sort Options and Outputs in API.txt
Python does not guarantee dict order. Our reliance on it in `makeapi` is technically incorrect, even if it doesn't matter yet in any of our developers' environments. This patch sorts the options by name instead of relying on dict order. As an added benefit, future API.txt diffs should be be neater.
Diffstat (limited to 'makeapi')
-rwxr-xr-xmakeapi5
1 files changed, 3 insertions, 2 deletions
diff --git a/makeapi b/makeapi
index bb455860c..8981a97c2 100755
--- a/makeapi
+++ b/makeapi
@@ -27,6 +27,7 @@ import sys
import os
import re
import inspect
+import operator
from ipalib import api
from ipalib.parameters import Param
from ipalib.output import Output
@@ -206,9 +207,9 @@ def make_api():
fd.write('args: %d,%d,%d\n' % (len(cmd.args), len(cmd.options), len(cmd.output)))
for a in cmd.args():
fd.write('arg: %s\n' % param_repr(a))
- for o in cmd.options():
+ for o in sorted(cmd.options(), key=operator.attrgetter('name')):
fd.write('option: %s\n' % param_repr(o))
- for o in cmd.output():
+ for o in sorted(cmd.output(), key=operator.attrgetter('name')):
fd.write('output: %s\n' % param_repr(o))
fd.close()