Patchwork D11455: setup: stop packaging python3.dll and python3X.dll in the wheel distribution

login
register
mail settings
Submitter phabricator
Date Sept. 19, 2021, 6:28 p.m.
Message ID <differential-rev-PHID-DREV-ubryrhet35bvbr3eunfm-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49771/
State Superseded
Headers show

Comments

phabricator - Sept. 19, 2021, 6:28 p.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Now that exewrapper is smart enough to find the DLLs it needs without help from
  the build script, backout ed286d150aa8 <https://phab.mercurial-scm.org/rHGed286d150aa89d742a24015be22f0b1c36855697> and 2960b7fac966 <https://phab.mercurial-scm.org/rHG2960b7fac966193436266a02230f3bc996e768bd>.  Note that this will
  require deleting the build/lib.win-amd64-3.X directory to actually remove it
  from the final wheel.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11455

AFFECTED FILES
  setup.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -780,9 +780,6 @@ 
 
         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
@@ -808,35 +805,6 @@ 
                     )
                 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)
-
-                # Also overwrite python3.dll so that hgext.git is usable.
-                # TODO: also handle the MSYS flavor
-                if sys.version_info[0] >= 3:
-                    python_x = os.path.join(
-                        os.path.dirname(fsdecode(buf.value)),
-                        "python3.dll",
-                    )
-
-                    if os.path.exists(python_x):
-                        dest = os.path.join(
-                            os.path.dirname(self.hgtarget),
-                            os.path.basename(python_x),
-                        )
-
-                        shutil.copy(python_x, dest)
-
         if not pythonlib:
             log.warn(
                 'could not determine Python DLL filename; assuming pythonXY'
@@ -859,6 +827,8 @@ 
             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
         )