[Updated] D9362: setup: copy pythonXY.dll next to the hg.exe wrapper when building
mharbison72 (Matt Harbison)
phabricator at mercurial-scm.org
Thu Nov 26 13:16:09 UTC 2020
Closed by commit rHG2960b7fac966: setup: copy pythonXY.dll next to the hg.exe wrapper when building (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D9362?vs=23617&id=23701
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9362/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9362
AFFECTED FILES
setup.py
CHANGE DETAILS
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -782,6 +782,9 @@
pythonlib = None
+ dir = os.path.dirname(self.get_ext_fullpath('dummy'))
+ self.hgtarget = os.path.join(dir, 'hg')
+
if getattr(sys, 'dllhandle', None):
# Different Python installs can have different Python library
# names. e.g. the official CPython distribution uses pythonXY.dll
@@ -807,6 +810,19 @@
)
pythonlib = dllbasename[:-4]
+ # Copy the pythonXY.dll next to the binary so that it runs
+ # without tampering with PATH.
+ fsdecode = lambda x: x
+ if sys.version_info[0] >= 3:
+ fsdecode = os.fsdecode
+ dest = os.path.join(
+ os.path.dirname(self.hgtarget),
+ fsdecode(dllbasename),
+ )
+
+ if not os.path.exists(dest):
+ shutil.copy(buf.value, dest)
+
if not pythonlib:
log.warn(
'could not determine Python DLL filename; assuming pythonXY'
@@ -829,8 +845,6 @@
output_dir=self.build_temp,
macros=macros,
)
- dir = os.path.dirname(self.get_ext_fullpath('dummy'))
- self.hgtarget = os.path.join(dir, 'hg')
self.compiler.link_executable(
objects, self.hgtarget, libraries=[], output_dir=self.build_temp
)
To: mharbison72, #hg-reviewers, Alphare, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201126/e4d8db52/attachment-0002.html>
More information about the Mercurial-patches
mailing list