Mercurial > public > mercurial-scm > hg
comparison setup.py @ 48180:f78d8b8c46d7
setup: stop packaging python3.dll and python3X.dll in the wheel distribution
Now that exewrapper is smart enough to find the DLLs it needs without help from
the build script, backout ed286d150aa8 and 2960b7fac966. Note that this will
require deleting the build/lib.win-amd64-3.X directory to actually remove it
from the final wheel.
Differential Revision: https://phab.mercurial-scm.org/D11455
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 19 Sep 2021 01:36:37 -0400 |
parents | ff97e793ed36 |
children | 01c3dd208c75 |
comparison
equal
deleted
inserted
replaced
48179:67d14d4e036c | 48180:f78d8b8c46d7 |
---|---|
778 self.compiler.compiler_so = self.compiler.compiler # no -mdll | 778 self.compiler.compiler_so = self.compiler.compiler # no -mdll |
779 self.compiler.dll_libraries = [] # no -lmsrvc90 | 779 self.compiler.dll_libraries = [] # no -lmsrvc90 |
780 | 780 |
781 pythonlib = None | 781 pythonlib = None |
782 | 782 |
783 dir = os.path.dirname(self.get_ext_fullpath('dummy')) | |
784 self.hgtarget = os.path.join(dir, 'hg') | |
785 | |
786 if getattr(sys, 'dllhandle', None): | 783 if getattr(sys, 'dllhandle', None): |
787 # Different Python installs can have different Python library | 784 # Different Python installs can have different Python library |
788 # names. e.g. the official CPython distribution uses pythonXY.dll | 785 # names. e.g. the official CPython distribution uses pythonXY.dll |
789 # and MinGW uses libpythonX.Y.dll. | 786 # and MinGW uses libpythonX.Y.dll. |
790 _kernel32 = ctypes.windll.kernel32 | 787 _kernel32 = ctypes.windll.kernel32 |
806 raise SystemExit( | 803 raise SystemExit( |
807 'Python DLL does not end with .dll: %s' % dllbasename | 804 'Python DLL does not end with .dll: %s' % dllbasename |
808 ) | 805 ) |
809 pythonlib = dllbasename[:-4] | 806 pythonlib = dllbasename[:-4] |
810 | 807 |
811 # Copy the pythonXY.dll next to the binary so that it runs | |
812 # without tampering with PATH. | |
813 fsdecode = lambda x: x | |
814 if sys.version_info[0] >= 3: | |
815 fsdecode = os.fsdecode | |
816 dest = os.path.join( | |
817 os.path.dirname(self.hgtarget), | |
818 fsdecode(dllbasename), | |
819 ) | |
820 | |
821 if not os.path.exists(dest): | |
822 shutil.copy(buf.value, dest) | |
823 | |
824 # Also overwrite python3.dll so that hgext.git is usable. | |
825 # TODO: also handle the MSYS flavor | |
826 if sys.version_info[0] >= 3: | |
827 python_x = os.path.join( | |
828 os.path.dirname(fsdecode(buf.value)), | |
829 "python3.dll", | |
830 ) | |
831 | |
832 if os.path.exists(python_x): | |
833 dest = os.path.join( | |
834 os.path.dirname(self.hgtarget), | |
835 os.path.basename(python_x), | |
836 ) | |
837 | |
838 shutil.copy(python_x, dest) | |
839 | |
840 if not pythonlib: | 808 if not pythonlib: |
841 log.warn( | 809 log.warn( |
842 'could not determine Python DLL filename; assuming pythonXY' | 810 'could not determine Python DLL filename; assuming pythonXY' |
843 ) | 811 ) |
844 | 812 |
857 objects = self.compiler.compile( | 825 objects = self.compiler.compile( |
858 ['mercurial/exewrapper.c'], | 826 ['mercurial/exewrapper.c'], |
859 output_dir=self.build_temp, | 827 output_dir=self.build_temp, |
860 macros=macros, | 828 macros=macros, |
861 ) | 829 ) |
830 dir = os.path.dirname(self.get_ext_fullpath('dummy')) | |
831 self.hgtarget = os.path.join(dir, 'hg') | |
862 self.compiler.link_executable( | 832 self.compiler.link_executable( |
863 objects, self.hgtarget, libraries=[], output_dir=self.build_temp | 833 objects, self.hgtarget, libraries=[], output_dir=self.build_temp |
864 ) | 834 ) |
865 if self.long_paths_support: | 835 if self.long_paths_support: |
866 self.addlongpathsmanifest() | 836 self.addlongpathsmanifest() |