Show More
@@ -780,6 +780,9 b' class buildhgexe(build_ext):' | |||||
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 | |
@@ -805,6 +808,35 b' class buildhgexe(build_ext):' | |||||
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' | |
@@ -827,8 +859,6 b' class buildhgexe(build_ext):' | |||||
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 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now