Do not fail if json Python module is not available
Fallback to old simplejson module if present, and options that require the json module (create extension and performance) if absent. https://bugzilla.gnome.org/show_bug.cgi?id=619580
This commit is contained in:
parent
2ace472100
commit
f1e3104128
@ -3,7 +3,13 @@
|
|||||||
|
|
||||||
import atexit
|
import atexit
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
try:
|
||||||
|
import json
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
import simplejson as json
|
||||||
|
except ImportError:
|
||||||
|
json = None
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
@ -548,9 +554,15 @@ if args:
|
|||||||
parser.print_usage()
|
parser.print_usage()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if options.create_extension:
|
if options.create_extension and json is None:
|
||||||
import json
|
print 'The Python simplejson module is required to create a new GNOME Shell extension'
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if options.perf and json is None:
|
||||||
|
print 'The Python simplejson module is required for performance tests'
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if options.create_extension:
|
||||||
print
|
print
|
||||||
print '''Name should be a very short (ideally descriptive) string.
|
print '''Name should be a very short (ideally descriptive) string.
|
||||||
Examples are: "Click To Focus", "Adblock", "Shell Window Shrinker".
|
Examples are: "Click To Focus", "Adblock", "Shell Window Shrinker".
|
||||||
|
Loading…
Reference in New Issue
Block a user