comparison mercurial/util.py @ 43713:9fb85668ee15

util: move definition of datapath to resourceutil Since this means moving the function into a subdirectory, we have to compensate by adding another layer of os.path.dirname(). Differential Revision: https://phab.mercurial-scm.org/D7434
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 14 Nov 2019 12:33:10 -0800
parents 664e24207728
children f0bee3b1b847
comparison
equal deleted inserted replaced
43712:664e24207728 43713:9fb85668ee15
1821 b.pop() 1821 b.pop()
1822 b.reverse() 1822 b.reverse()
1823 return pycompat.ossep.join(([b'..'] * len(a)) + b) or b'.' 1823 return pycompat.ossep.join(([b'..'] * len(a)) + b) or b'.'
1824 1824
1825 1825
1826 # the location of data files matching the source code 1826 datapath = resourceutil.datapath
1827 if resourceutil.mainfrozen() and getattr(sys, 'frozen', None) != 'macosx_app':
1828 # executable version (py2exe) doesn't support __file__
1829 datapath = os.path.dirname(pycompat.sysexecutable)
1830 else:
1831 datapath = os.path.dirname(pycompat.fsencode(__file__))
1832
1833 i18n.setdatapath(datapath) 1827 i18n.setdatapath(datapath)
1834 1828
1835 1829
1836 def checksignature(func): 1830 def checksignature(func):
1837 '''wrap a function with code to check for calling errors''' 1831 '''wrap a function with code to check for calling errors'''