You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
7.1 KiB

bpo-32030: Split Py_Main() into subfunctions (#4399) * Don't use "Python runtime" anymore to parse command line options or to get environment variables: pymain_init() is now a strict separation. * Use an error message rather than "crashing" directly with Py_FatalError(). Limit the number of calls to Py_FatalError(). It prepares the code to handle errors more nicely later. * Warnings options (-W, PYTHONWARNINGS) and "XOptions" (-X) are now only added to the sys module once Python core is properly initialized. * _PyMain is now the well identified owner of some important strings like: warnings options, XOptions, and the "program name". The program name string is now properly freed at exit. pymain_free() is now responsible to free the "command" string. * Rename most methods in Modules/main.c to use a "pymain_" prefix to avoid conflits and ease debug. * Replace _Py_CommandLineDetails_INIT with memset(0) * Reorder a lot of code to fix the initialization ordering. For example, initializing standard streams now comes before parsing PYTHONWARNINGS. * Py_Main() now handles errors when adding warnings options and XOptions. * Add _PyMem_GetDefaultRawAllocator() private function. * Cleanup _PyMem_Initialize(): remove useless global constants: move them into _PyMem_Initialize(). * Call _PyRuntime_Initialize() as soon as possible: _PyRuntime_Initialize() now returns an error message on failure. * Add _PyInitError structure and following macros: * _Py_INIT_OK() * _Py_INIT_ERR(msg) * _Py_INIT_USER_ERR(msg): "user" error, don't abort() in that case * _Py_INIT_FAILED(err)
8 years ago
bpo-32030: Split Py_Main() into subfunctions (#4399) * Don't use "Python runtime" anymore to parse command line options or to get environment variables: pymain_init() is now a strict separation. * Use an error message rather than "crashing" directly with Py_FatalError(). Limit the number of calls to Py_FatalError(). It prepares the code to handle errors more nicely later. * Warnings options (-W, PYTHONWARNINGS) and "XOptions" (-X) are now only added to the sys module once Python core is properly initialized. * _PyMain is now the well identified owner of some important strings like: warnings options, XOptions, and the "program name". The program name string is now properly freed at exit. pymain_free() is now responsible to free the "command" string. * Rename most methods in Modules/main.c to use a "pymain_" prefix to avoid conflits and ease debug. * Replace _Py_CommandLineDetails_INIT with memset(0) * Reorder a lot of code to fix the initialization ordering. For example, initializing standard streams now comes before parsing PYTHONWARNINGS. * Py_Main() now handles errors when adding warnings options and XOptions. * Add _PyMem_GetDefaultRawAllocator() private function. * Cleanup _PyMem_Initialize(): remove useless global constants: move them into _PyMem_Initialize(). * Call _PyRuntime_Initialize() as soon as possible: _PyRuntime_Initialize() now returns an error message on failure. * Add _PyInitError structure and following macros: * _Py_INIT_OK() * _Py_INIT_ERR(msg) * _Py_INIT_USER_ERR(msg): "user" error, don't abort() in that case * _Py_INIT_FAILED(err)
8 years ago
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3. <ItemGroup Label="ProjectConfigurations">
  4. <ProjectConfiguration Include="Debug|ARM">
  5. <Configuration>Debug</Configuration>
  6. <Platform>ARM</Platform>
  7. </ProjectConfiguration>
  8. <ProjectConfiguration Include="Debug|ARM64">
  9. <Configuration>Debug</Configuration>
  10. <Platform>ARM64</Platform>
  11. </ProjectConfiguration>
  12. <ProjectConfiguration Include="Debug|Win32">
  13. <Configuration>Debug</Configuration>
  14. <Platform>Win32</Platform>
  15. </ProjectConfiguration>
  16. <ProjectConfiguration Include="Debug|x64">
  17. <Configuration>Debug</Configuration>
  18. <Platform>x64</Platform>
  19. </ProjectConfiguration>
  20. <ProjectConfiguration Include="PGInstrument|ARM">
  21. <Configuration>PGInstrument</Configuration>
  22. <Platform>ARM</Platform>
  23. </ProjectConfiguration>
  24. <ProjectConfiguration Include="PGInstrument|ARM64">
  25. <Configuration>PGInstrument</Configuration>
  26. <Platform>ARM64</Platform>
  27. </ProjectConfiguration>
  28. <ProjectConfiguration Include="PGInstrument|Win32">
  29. <Configuration>PGInstrument</Configuration>
  30. <Platform>Win32</Platform>
  31. </ProjectConfiguration>
  32. <ProjectConfiguration Include="PGInstrument|x64">
  33. <Configuration>PGInstrument</Configuration>
  34. <Platform>x64</Platform>
  35. </ProjectConfiguration>
  36. <ProjectConfiguration Include="PGUpdate|ARM">
  37. <Configuration>PGUpdate</Configuration>
  38. <Platform>ARM</Platform>
  39. </ProjectConfiguration>
  40. <ProjectConfiguration Include="PGUpdate|ARM64">
  41. <Configuration>PGUpdate</Configuration>
  42. <Platform>ARM64</Platform>
  43. </ProjectConfiguration>
  44. <ProjectConfiguration Include="PGUpdate|Win32">
  45. <Configuration>PGUpdate</Configuration>
  46. <Platform>Win32</Platform>
  47. </ProjectConfiguration>
  48. <ProjectConfiguration Include="PGUpdate|x64">
  49. <Configuration>PGUpdate</Configuration>
  50. <Platform>x64</Platform>
  51. </ProjectConfiguration>
  52. <ProjectConfiguration Include="Release|ARM">
  53. <Configuration>Release</Configuration>
  54. <Platform>ARM</Platform>
  55. </ProjectConfiguration>
  56. <ProjectConfiguration Include="Release|ARM64">
  57. <Configuration>Release</Configuration>
  58. <Platform>ARM64</Platform>
  59. </ProjectConfiguration>
  60. <ProjectConfiguration Include="Release|Win32">
  61. <Configuration>Release</Configuration>
  62. <Platform>Win32</Platform>
  63. </ProjectConfiguration>
  64. <ProjectConfiguration Include="Release|x64">
  65. <Configuration>Release</Configuration>
  66. <Platform>x64</Platform>
  67. </ProjectConfiguration>
  68. </ItemGroup>
  69. <PropertyGroup Label="Globals">
  70. <ProjectGuid>{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}</ProjectGuid>
  71. </PropertyGroup>
  72. <Import Project="python.props" />
  73. <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  74. <PropertyGroup Label="Configuration">
  75. <ConfigurationType>Application</ConfigurationType>
  76. <UseOfMfc>false</UseOfMfc>
  77. <CharacterSet>MultiByte</CharacterSet>
  78. </PropertyGroup>
  79. <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  80. <ImportGroup Label="ExtensionSettings">
  81. </ImportGroup>
  82. <ImportGroup Label="PropertySheets">
  83. <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  84. <Import Project="pyproject.props" />
  85. <Import Project="tcltk.props" />
  86. </ImportGroup>
  87. <PropertyGroup Label="UserMacros" />
  88. <PropertyGroup>
  89. <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
  90. </PropertyGroup>
  91. <ItemDefinitionGroup>
  92. <ClCompile>
  93. <PreprocessorDefinitions>Py_BUILD_CORE;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  94. </ClCompile>
  95. <Link>
  96. <SubSystem>Console</SubSystem>
  97. <StackReserveSize>2000000</StackReserveSize>
  98. </Link>
  99. </ItemDefinitionGroup>
  100. <ItemGroup>
  101. <None Include="..\PC\pycon.ico" />
  102. </ItemGroup>
  103. <ItemGroup>
  104. <ResourceCompile Include="..\PC\python_exe.rc" />
  105. </ItemGroup>
  106. <ItemGroup>
  107. <ClCompile Include="..\Programs\python.c" />
  108. </ItemGroup>
  109. <ItemGroup>
  110. <ProjectReference Include="pythoncore.vcxproj">
  111. <Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
  112. <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
  113. </ProjectReference>
  114. </ItemGroup>
  115. <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  116. <ImportGroup Label="ExtensionTargets">
  117. </ImportGroup>
  118. <Target Name="ValidateUcrtbase" AfterTargets="AfterBuild" Condition="$(Configuration) != 'PGInstrument' and $(Platform) != 'ARM' and $(Platform) != 'ARM64'">
  119. <PropertyGroup>
  120. <UcrtName>ucrtbase</UcrtName>
  121. <UcrtName Condition="'$(Configuration)' == 'Debug'">ucrtbased</UcrtName>
  122. </PropertyGroup>
  123. <Exec Command='setlocal
  124. set PYTHONPATH=$(PySourcePath)Lib
  125. "$(OutDir)python$(PyDebugExt).exe" "$(PySourcePath)PC\validate_ucrtbase.py" $(UcrtName)' ContinueOnError="true" />
  126. </Target>
  127. <Target Name="GeneratePythonBat" AfterTargets="AfterBuild">
  128. <PropertyGroup>
  129. <_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(Platform) == 'Win32'">@set PATH=%PATH%%3B$(VCInstallDir)bin</_PGOPath>
  130. <_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(Platform) == 'x64'">@set PATH=%PATH%%3B$(VCInstallDir)bin\amd64</_PGOPath>
  131. <_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(VC_PGO_RunTime_Dir) != ''">@set PATH=%PATH%%3B$(VC_PGO_RunTime_Dir)</_PGOPath>
  132. <_Content>@rem This script invokes the most recently built Python with all arguments
  133. @rem passed through to the interpreter. This file is generated by the
  134. @rem build process and any changes *will* be thrown away by the next
  135. @rem rebuild.
  136. @rem This is only meant as a convenience for developing CPython
  137. @rem and using it outside of that context is ill-advised.
  138. @echo Running $(Configuration)^|$(Platform) interpreter...
  139. @setlocal
  140. @set PYTHONHOME=$(PySourcePath)
  141. $(_PGOPath)
  142. @"$(OutDir)python$(PyDebugExt).exe" %*
  143. </_Content>
  144. <_ExistingContent Condition="Exists('$(PySourcePath)python.bat')">$([System.IO.File]::ReadAllText('$(PySourcePath)python.bat'))</_ExistingContent>
  145. </PropertyGroup>
  146. <WriteLinesToFile File="$(PySourcePath)python.bat" Lines="$(_Content)" Overwrite="true" Condition="'$(_Content)' != '$(_ExistingContent)'" />
  147. </Target>
  148. <Target Name="GenerateLicense" AfterTargets="AfterBuild">
  149. <ItemGroup>
  150. <LicenseFiles Include="$(PySourcePath)LICENSE;
  151. $(PySourcePath)PC\crtlicense.txt;
  152. $(bz2Dir)LICENSE;
  153. $(opensslOutDir)LICENSE;" />
  154. <LicenseFiles Include="$(tcltkDir)tcllicense.terms;
  155. $(tcltkDir)tklicense.terms;
  156. $(tcltkDir)tixlicense.terms" Condition="$(IncludeTkinter)" />
  157. <_LicenseFiles Include="@(LicenseFiles)">
  158. <Content>$([System.IO.File]::ReadAllText(%(FullPath)))</Content>
  159. </_LicenseFiles>
  160. </ItemGroup>
  161. <WriteLinesToFile File="$(OutDir)LICENSE.txt"
  162. Overwrite="true"
  163. Lines="@(_LicenseFiles->'%(Content)')" />
  164. </Target>
  165. </Project>