Mercurial > hg
comparison setup.py @ 48303:2ce31dbde4b1
backout: backed out changeset f78d8b8c46d7
This and the following backout exist because the original patches break the
Windows CI for some yet unknown reason.
Differential Revision: https://phab.mercurial-scm.org/D11726
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Wed, 27 Oct 2021 12:07:58 +0200 |
parents | 01c3dd208c75 |
children | fff5942d445f a1538c05d855 |
comparison
equal
deleted
inserted
replaced
48302:1eaf37369eba | 48303:2ce31dbde4b1 |
---|---|
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 | |
783 if getattr(sys, 'dllhandle', None): | 786 if getattr(sys, 'dllhandle', None): |
784 # Different Python installs can have different Python library | 787 # Different Python installs can have different Python library |
785 # names. e.g. the official CPython distribution uses pythonXY.dll | 788 # names. e.g. the official CPython distribution uses pythonXY.dll |
786 # and MinGW uses libpythonX.Y.dll. | 789 # and MinGW uses libpythonX.Y.dll. |
787 _kernel32 = ctypes.windll.kernel32 | 790 _kernel32 = ctypes.windll.kernel32 |
803 raise SystemExit( | 806 raise SystemExit( |
804 'Python DLL does not end with .dll: %s' % dllbasename | 807 'Python DLL does not end with .dll: %s' % dllbasename |
805 ) | 808 ) |
806 pythonlib = dllbasename[:-4] | 809 pythonlib = dllbasename[:-4] |
807 | 810 |
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 | |
808 if not pythonlib: | 840 if not pythonlib: |
809 log.warn( | 841 log.warn( |
810 'could not determine Python DLL filename; assuming pythonXY' | 842 'could not determine Python DLL filename; assuming pythonXY' |
811 ) | 843 ) |
812 | 844 |
825 objects = self.compiler.compile( | 857 objects = self.compiler.compile( |
826 ['mercurial/exewrapper.c'], | 858 ['mercurial/exewrapper.c'], |
827 output_dir=self.build_temp, | 859 output_dir=self.build_temp, |
828 macros=macros, | 860 macros=macros, |
829 ) | 861 ) |
830 dir = os.path.dirname(self.get_ext_fullpath('dummy')) | |
831 self.hgtarget = os.path.join(dir, 'hg') | |
832 self.compiler.link_executable( | 862 self.compiler.link_executable( |
833 objects, self.hgtarget, libraries=[], output_dir=self.build_temp | 863 objects, self.hgtarget, libraries=[], output_dir=self.build_temp |
834 ) | 864 ) |
835 if self.long_paths_support: | 865 if self.long_paths_support: |
836 self.addlongpathsmanifest() | 866 self.addlongpathsmanifest() |