comparison mercurial/util.py @ 30039:ff7697b436ab

py3: use unicode in is_frozen() imp.is_frozen() doesnot accepts bytes on Python 3. It does accept both bytes and strings on Python 2.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 02 Oct 2016 05:29:17 +0530
parents 42ead5b3aa7b
children dbcef8918bbd
comparison
equal deleted inserted replaced
30038:42ead5b3aa7b 30039:ff7697b436ab
925 The code supports py2exe (most common, Windows only) and tools/freeze 925 The code supports py2exe (most common, Windows only) and tools/freeze
926 (portable, not much used). 926 (portable, not much used).
927 """ 927 """
928 return (safehasattr(sys, "frozen") or # new py2exe 928 return (safehasattr(sys, "frozen") or # new py2exe
929 safehasattr(sys, "importers") or # old py2exe 929 safehasattr(sys, "importers") or # old py2exe
930 imp.is_frozen("__main__")) # tools/freeze 930 imp.is_frozen(u"__main__")) # tools/freeze
931 931
932 # the location of data files matching the source code 932 # the location of data files matching the source code
933 if mainfrozen() and getattr(sys, 'frozen', None) != 'macosx_app': 933 if mainfrozen() and getattr(sys, 'frozen', None) != 'macosx_app':
934 # executable version (py2exe) doesn't support __file__ 934 # executable version (py2exe) doesn't support __file__
935 datapath = os.path.dirname(sys.executable) 935 datapath = os.path.dirname(sys.executable)