File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 1212# Use "-h" to get help options.
1313
1414from __future__ import print_function
15- import sys
16- import shutil
17- # for utf-8
18- reload (sys )
19- sys .setdefaultencoding ("utf-8" )
2015
16+ import json
2117import optparse
2218import os
23- import json
2419import re
20+ import shutil
21+ import sys
22+
23+ try :
24+ # for utf-8 on Python 2
25+ reload (sys )
26+ sys .setdefaultencoding ("utf-8" )
27+ except NameError :
28+ pass # Python 3 already defaults to utf-8
29+
30+ try :
31+ basestring # Python 2
32+ except NameError :
33+ basestring = str # Python 3
2534
2635endian = sys .byteorder
2736
@@ -214,7 +223,7 @@ def queueForRemoval(tree):
214223 if (options .verbose > 0 ):
215224 print ("* %s: %d items" % (tree , len (mytree ["locs" ])))
216225 # do varible substitution for this tree here
217- if type (config ["trees" ][tree ]) == str or type ( config [ "trees" ][ tree ]) == unicode :
226+ if isinstance (config ["trees" ][tree ], basestring ) :
218227 treeStr = config ["trees" ][tree ]
219228 if (options .verbose > 5 ):
220229 print (" Substituting $%s for tree %s" % (treeStr , tree ))
You can’t perform that action at this time.
0 commit comments