Repository: libcloud
Updated Branches:
  refs/heads/trunk c07dbe8c3 -> ae85479e8


[google compute] fix pricing script and test; fix build

Revert conditional import of simplejson to unconditional: the code as
implemented only works with simplejson and not the standard json library because
it relies on the `item_sort_key` functionality which only simplejson provides
and json does not.

Also fixes indentation which breaks the build since the linter is part of the
tests.

Fixes the issues seen here:
* https://travis-ci.org/apache/libcloud/builds/90117628
* https://travis-ci.org/apache/libcloud/jobs/90117643

Closes #630

Signed-off-by: Eric Johnson <erjoh...@google.com>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ae85479e
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ae85479e
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ae85479e

Branch: refs/heads/trunk
Commit: ae85479e835494e196e2f6e79aae9a475603d8ac
Parents: c07dbe8
Author: Misha Brukman <mbruk...@google.com>
Authored: Mon Nov 9 14:28:21 2015 -0800
Committer: Eric Johnson <erjoh...@google.com>
Committed: Mon Nov 9 23:31:53 2015 +0000

----------------------------------------------------------------------
 contrib/update_google_prices.py | 8 +++-----
 contrib/utils_test.py           | 7 ++-----
 2 files changed, 5 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/ae85479e/contrib/update_google_prices.py
----------------------------------------------------------------------
diff --git a/contrib/update_google_prices.py b/contrib/update_google_prices.py
index e69ffe1..d3028d7 100755
--- a/contrib/update_google_prices.py
+++ b/contrib/update_google_prices.py
@@ -19,10 +19,8 @@ Loads Google Cloud Platform prices and updates the 
`pricing.json` data file.
 """
 
 import os
-try:
-    import simplejson as json
-except ImportError:
-    import json
+import json
+import simplejson
 import sys
 import time
 import urllib2
@@ -80,7 +78,7 @@ def main(argv):
 
     # Write updated price list.
     with open(PRICING_FILE_PATH, 'w') as libcloud_out:
-        json_str = json.dumps(libcloud_data, indent=4 * ' ',
+        json_str = simplejson.dumps(libcloud_data, indent=4 * ' ',
                                     item_sort_key=utils.sortKeysNumerically)
         libcloud_out.write(json_str)
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ae85479e/contrib/utils_test.py
----------------------------------------------------------------------
diff --git a/contrib/utils_test.py b/contrib/utils_test.py
index 98016a4..cec766c 100644
--- a/contrib/utils_test.py
+++ b/contrib/utils_test.py
@@ -16,10 +16,7 @@
 #
 
################################################################################
 
-try:
-    import simplejson as json
-except ImportError:
-    import json
+import simplejson
 import unittest
 import utils
 
@@ -59,7 +56,7 @@ class SortKeysNumericallyTest(unittest.TestCase):
 }\
 """
         self.assertEqual(
-            json.dumps(input, indent=4 * ' ',
+            simplejson.dumps(input, indent=4 * ' ',
                              item_sort_key=utils.sortKeysNumerically),
             output)
 

Reply via email to