diff options
author | kurrik@chromium.org <kurrik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-02 23:18:19 +0000 |
---|---|---|
committer | kurrik@chromium.org <kurrik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-02 23:18:19 +0000 |
commit | 44e6e916d72360059c8ea044a3a11f76211196d5 (patch) | |
tree | 6f8ad9cd8082544c57bb20d3668ff152f548609b | |
parent | 4dd9a1ed7d31f0cbe5b45f84f77458ecc7959a8e (diff) | |
download | chromium_src-44e6e916d72360059c8ea044a3a11f76211196d5.zip chromium_src-44e6e916d72360059c8ea044a3a11f76211196d5.tar.gz chromium_src-44e6e916d72360059c8ea044a3a11f76211196d5.tar.bz2 |
Add a second level of ordering to samples directory.
This should keep the news samples from randomly changing order.
BUG=None
TEST=Samples with the same name should not change when rebuilding samples.json
Review URL: http://codereview.chromium.org/3304006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58425 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/common/extensions/docs/build/directory.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/chrome/common/extensions/docs/build/directory.py b/chrome/common/extensions/docs/build/directory.py index c64dcd4..405fbd4 100644 --- a/chrome/common/extensions/docs/build/directory.py +++ b/chrome/common/extensions/docs/build/directory.py @@ -188,7 +188,15 @@ class SamplesManifest(object): # Don't render apps if sample.is_app() == False: samples.append(sample) - samples.sort(lambda x,y: cmp(x['name'].upper(), y['name'].upper())) + + def compareSamples(sample1, sample2): + """ Compares two samples as a sort comparator, by name then path. """ + value = cmp(sample1['name'].upper(), sample2['name'].upper()) + if value == 0: + value = cmp(sample1['path'], sample2['path']) + return value + + samples.sort(compareSamples) manifest_data = {'samples': samples, 'api': api_method_dict} return manifest_data |