D7417: procutil: extract executable-relative resources test
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Fri Nov 15 03:58:57 UTC 2019
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
We'll want to test for this in the new resource reading API.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D7417
AFFECTED FILES
mercurial/utils/procutil.py
CHANGE DETAILS
diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -537,9 +537,13 @@
# continue the hg process here.
os._exit(returncode)
+def executablerelativeresources():
+ """Whether data/resource files are relative to the current executable."""
+ return mainfrozen() and getattr(sys, 'frozen', None) != 'macosx_app'
+
def datapath():
"""Return location of data/resource files that are part of the source."""
- if mainfrozen() and getattr(sys, 'frozen', None) != 'macosx_app':
+ if executablerelativeresources():
# executable version (py2exe) doesn't support __file__
return os.path.dirname(pycompat.sysexecutable)
else:
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list