py2docfx 0.1.13rc2012291__py3-none-any.whl → 0.1.13rc2022156__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/_modified.py +26 -4
  2. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/_msvccompiler.py +2 -603
  3. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/archive_util.py +48 -18
  4. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/ccompiler.py +17 -1257
  5. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/cmd.py +133 -41
  6. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/bdist.py +19 -8
  7. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/bdist_dumb.py +2 -1
  8. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/bdist_rpm.py +6 -5
  9. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/build.py +8 -4
  10. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/build_clib.py +8 -7
  11. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/build_ext.py +32 -13
  12. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/build_py.py +10 -9
  13. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/build_scripts.py +3 -14
  14. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/check.py +1 -1
  15. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/clean.py +2 -1
  16. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/config.py +1 -8
  17. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/install.py +22 -19
  18. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/install_data.py +4 -3
  19. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/install_headers.py +1 -1
  20. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/install_lib.py +11 -7
  21. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/install_scripts.py +4 -3
  22. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/sdist.py +22 -16
  23. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compat/__init__.py +6 -1
  24. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/base.py +1391 -0
  25. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/cygwin.py +340 -0
  26. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/errors.py +24 -0
  27. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/msvc.py +614 -0
  28. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/{tests/test_ccompiler.py → compilers/C/tests/test_base.py} +9 -19
  29. py2docfx/venv/{venv1/Lib/site-packages/setuptools/_distutils/tests/test_cygwinccompiler.py → basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_cygwin.py} +7 -12
  30. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/{tests/test_mingwccompiler.py → compilers/C/tests/test_mingw.py} +12 -20
  31. py2docfx/venv/{venv1/Lib/site-packages/setuptools/_distutils/tests/test_msvccompiler.py → basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_msvc.py} +11 -12
  32. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/{tests/test_unixccompiler.py → compilers/C/tests/test_unix.py} +5 -5
  33. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/unix.py +409 -0
  34. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/zos.py +230 -0
  35. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/cygwinccompiler.py +20 -328
  36. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/dist.py +148 -80
  37. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/errors.py +11 -27
  38. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/extension.py +19 -16
  39. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/filelist.py +80 -15
  40. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/spawn.py +22 -5
  41. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/sysconfig.py +32 -7
  42. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/tests/test_build_ext.py +13 -0
  43. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/tests/test_sdist.py +1 -1
  44. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/unixccompiler.py +2 -401
  45. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/util.py +38 -23
  46. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/zosccompiler.py +2 -228
  47. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_static.py +1 -1
  48. py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/editable_wheel.py +3 -3
  49. py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/install.py +1 -1
  50. py2docfx/venv/basevenv/Lib/site-packages/setuptools/tests/config/test_setupcfg.py +2 -0
  51. py2docfx/venv/basevenv/Lib/site-packages/setuptools/tests/test_build_py.py +1 -1
  52. py2docfx/venv/basevenv/Lib/site-packages/setuptools/unicode_utils.py +1 -1
  53. py2docfx/venv/venv1/Lib/site-packages/adodbapi/__init__.py +2 -1
  54. py2docfx/venv/venv1/Lib/site-packages/adodbapi/ado_consts.py +3 -1
  55. py2docfx/venv/venv1/Lib/site-packages/adodbapi/adodbapi.py +22 -26
  56. py2docfx/venv/venv1/Lib/site-packages/adodbapi/apibase.py +3 -4
  57. py2docfx/venv/venv1/Lib/site-packages/adodbapi/examples/db_print.py +1 -1
  58. py2docfx/venv/venv1/Lib/site-packages/adodbapi/examples/db_table_names.py +1 -1
  59. py2docfx/venv/venv1/Lib/site-packages/adodbapi/process_connect_string.py +7 -7
  60. py2docfx/venv/venv1/Lib/site-packages/adodbapi/setup.py +2 -2
  61. py2docfx/venv/venv1/Lib/site-packages/adodbapi/test/adodbapitest.py +21 -73
  62. py2docfx/venv/venv1/Lib/site-packages/adodbapi/test/adodbapitestconfig.py +1 -1
  63. py2docfx/venv/venv1/Lib/site-packages/adodbapi/test/dbapi20.py +11 -17
  64. py2docfx/venv/venv1/Lib/site-packages/adodbapi/test/setuptestframework.py +2 -1
  65. py2docfx/venv/venv1/Lib/site-packages/isapi/install.py +8 -11
  66. py2docfx/venv/venv1/Lib/site-packages/isapi/samples/redirector.py +1 -1
  67. py2docfx/venv/venv1/Lib/site-packages/isapi/samples/redirector_asynch.py +1 -1
  68. py2docfx/venv/venv1/Lib/site-packages/isapi/samples/redirector_with_filter.py +2 -1
  69. py2docfx/venv/venv1/Lib/site-packages/isapi/simple.py +1 -0
  70. py2docfx/venv/venv1/Lib/site-packages/isapi/threaded_extension.py +1 -0
  71. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/app/basictimerapp.py +1 -1
  72. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/app/customprint.py +1 -3
  73. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/app/demoutils.py +1 -3
  74. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/cmdserver.py +2 -5
  75. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/guidemo.py +14 -41
  76. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/objdoc.py +1 -1
  77. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/ocx/demoutils.py +1 -3
  78. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/ocx/flash.py +1 -1
  79. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/ocx/ocxserialtest.py +1 -2
  80. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/ocx/ocxtest.py +1 -2
  81. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/ocx/webbrowser.py +3 -3
  82. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/openGLDemo.py +57 -12
  83. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/toolbar.py +0 -1
  84. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/debugger/configui.py +1 -1
  85. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/debugger/dbgcon.py +0 -1
  86. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/debugger/debugger.py +7 -8
  87. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/debugger/fail.py +1 -1
  88. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/dialogs/ideoptions.py +7 -10
  89. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/dialogs/list.py +11 -8
  90. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/dialogs/login.py +0 -1
  91. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/docking/DockingBar.py +0 -1
  92. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/app.py +19 -22
  93. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/dbgcommands.py +2 -3
  94. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/editor/ModuleBrowser.py +1 -1
  95. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/editor/__init__.py +3 -1
  96. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/editor/document.py +0 -1
  97. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/editor/editor.py +6 -6
  98. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/editor/vss.py +2 -2
  99. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/help.py +2 -1
  100. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/interact.py +1 -1
  101. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/intpyapp.py +5 -7
  102. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/intpydde.py +7 -2
  103. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/scriptutils.py +4 -6
  104. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/sgrepmdi.py +13 -22
  105. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/startup.py +1 -1
  106. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/stdin.py +1 -0
  107. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/toolmenu.py +0 -2
  108. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/idle/AutoIndent.py +3 -3
  109. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/idle/CallTips.py +1 -3
  110. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/mfc/activex.py +1 -2
  111. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/mfc/dialog.py +7 -10
  112. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/IDLEenvironment.py +1 -5
  113. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/bindings.py +4 -2
  114. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/config.py +3 -5
  115. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/configui.py +2 -3
  116. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/document.py +1 -1
  117. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/formatter.py +3 -3
  118. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/keycodes.py +2 -2
  119. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/scintillacon.py +1178 -78
  120. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/view.py +17 -21
  121. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/tools/browser.py +6 -18
  122. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/tools/hierlist.py +2 -2
  123. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/_modified.py +26 -4
  124. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/_msvccompiler.py +2 -603
  125. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/archive_util.py +48 -18
  126. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/ccompiler.py +17 -1257
  127. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/cmd.py +133 -41
  128. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/bdist.py +19 -8
  129. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/bdist_dumb.py +2 -1
  130. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/bdist_rpm.py +6 -5
  131. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/build.py +8 -4
  132. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/build_clib.py +8 -7
  133. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/build_ext.py +32 -13
  134. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/build_py.py +10 -9
  135. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/build_scripts.py +3 -14
  136. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/check.py +1 -1
  137. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/clean.py +2 -1
  138. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/config.py +1 -8
  139. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/install.py +22 -19
  140. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/install_data.py +4 -3
  141. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/install_headers.py +1 -1
  142. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/install_lib.py +11 -7
  143. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/install_scripts.py +4 -3
  144. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/sdist.py +22 -16
  145. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compat/__init__.py +6 -1
  146. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compilers/C/base.py +1391 -0
  147. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compilers/C/cygwin.py +340 -0
  148. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compilers/C/errors.py +24 -0
  149. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compilers/C/msvc.py +614 -0
  150. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/{tests/test_ccompiler.py → compilers/C/tests/test_base.py} +9 -19
  151. py2docfx/venv/{basevenv/Lib/site-packages/setuptools/_distutils/tests/test_cygwinccompiler.py → venv1/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_cygwin.py} +7 -12
  152. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/{tests/test_mingwccompiler.py → compilers/C/tests/test_mingw.py} +12 -20
  153. py2docfx/venv/{basevenv/Lib/site-packages/setuptools/_distutils/tests/test_msvccompiler.py → venv1/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_msvc.py} +11 -12
  154. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/{tests/test_unixccompiler.py → compilers/C/tests/test_unix.py} +5 -5
  155. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compilers/C/unix.py +409 -0
  156. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compilers/C/zos.py +230 -0
  157. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/cygwinccompiler.py +20 -328
  158. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/dist.py +148 -80
  159. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/errors.py +11 -27
  160. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/extension.py +19 -16
  161. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/filelist.py +80 -15
  162. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/spawn.py +22 -5
  163. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/sysconfig.py +32 -7
  164. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/tests/test_build_ext.py +13 -0
  165. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/tests/test_sdist.py +1 -1
  166. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/unixccompiler.py +2 -401
  167. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/util.py +38 -23
  168. py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/zosccompiler.py +2 -228
  169. py2docfx/venv/venv1/Lib/site-packages/setuptools/_static.py +1 -1
  170. py2docfx/venv/venv1/Lib/site-packages/setuptools/command/editable_wheel.py +3 -3
  171. py2docfx/venv/venv1/Lib/site-packages/setuptools/command/install.py +1 -1
  172. py2docfx/venv/venv1/Lib/site-packages/setuptools/tests/config/test_setupcfg.py +2 -0
  173. py2docfx/venv/venv1/Lib/site-packages/setuptools/tests/test_build_py.py +1 -1
  174. py2docfx/venv/venv1/Lib/site-packages/setuptools/unicode_utils.py +1 -1
  175. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/EvtFormatMessage.py +1 -1
  176. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/EvtSubscribe_push.py +8 -1
  177. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/GetSaveFileName.py +8 -8
  178. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/c_extension/setup.py +1 -1
  179. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/dde/ddeclient.py +1 -1
  180. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/dde/ddeserver.py +1 -1
  181. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/getfilever.py +1 -1
  182. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/pipes/runproc.py +2 -2
  183. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/rastest.py +4 -6
  184. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/GetTokenInformation.py +4 -4
  185. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/account_rights.py +0 -2
  186. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/explicit_entries.py +0 -1
  187. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/get_policy_info.py +0 -3
  188. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/list_rights.py +0 -2
  189. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/localized_names.py +7 -2
  190. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/query_information.py +1 -1
  191. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/set_file_audit.py +1 -2
  192. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/set_file_owner.py +0 -1
  193. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/set_policy_info.py +0 -3
  194. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/setkernelobjectsecurity.py +0 -1
  195. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/setsecurityinfo.py +0 -1
  196. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/setuserobjectsecurity.py +0 -1
  197. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/sspi/fetch_url.py +3 -3
  198. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/sspi/simple_auth.py +3 -3
  199. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/sspi/socket_server.py +1 -2
  200. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/service/pipeTestService.py +10 -9
  201. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/service/pipeTestServiceClient.py +6 -3
  202. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32clipboardDemo.py +17 -5
  203. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32comport_demo.py +32 -2
  204. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32console_demo.py +1 -4
  205. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32gui_devicenotify.py +0 -1
  206. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32gui_menu.py +60 -5
  207. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32gui_taskbar.py +1 -1
  208. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32netdemo.py +2 -5
  209. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32ts_logoff_disconnected.py +1 -1
  210. py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32wnet/testwnet.py +1 -1
  211. py2docfx/venv/venv1/Lib/site-packages/win32/lib/commctrl.py +1 -1
  212. py2docfx/venv/venv1/Lib/site-packages/win32/lib/netbios.py +8 -10
  213. py2docfx/venv/venv1/Lib/site-packages/win32/lib/pywin32_bootstrap.py +2 -10
  214. py2docfx/venv/venv1/Lib/site-packages/win32/lib/pywin32_testutil.py +2 -2
  215. py2docfx/venv/venv1/Lib/site-packages/win32/lib/pywintypes.py +1 -1
  216. py2docfx/venv/venv1/Lib/site-packages/win32/lib/regutil.py +1 -1
  217. py2docfx/venv/venv1/Lib/site-packages/win32/lib/sspi.py +3 -3
  218. py2docfx/venv/venv1/Lib/site-packages/win32/lib/win2kras.py +14 -7
  219. py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32con.py +16 -35
  220. py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32cryptcon.py +1 -4
  221. py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32evtlogutil.py +1 -2
  222. py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32gui_struct.py +6 -6
  223. py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32pdhquery.py +10 -11
  224. py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32pdhutil.py +5 -5
  225. py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32rcparser.py +1 -0
  226. py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32serviceutil.py +4 -6
  227. py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32timezone.py +304 -121
  228. py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32verstamp.py +1 -1
  229. py2docfx/venv/venv1/Lib/site-packages/win32/lib/winerror.py +4926 -604
  230. py2docfx/venv/venv1/Lib/site-packages/win32/lib/winxptheme.py +1 -1
  231. py2docfx/venv/venv1/Lib/site-packages/win32/scripts/h2py.py +194 -0
  232. py2docfx/venv/venv1/Lib/site-packages/win32/scripts/pywin32_postinstall.py +733 -0
  233. py2docfx/venv/venv1/Lib/site-packages/win32/scripts/pywin32_testall.py +120 -0
  234. py2docfx/venv/venv1/Lib/site-packages/win32/scripts/regsetup.py +4 -7
  235. py2docfx/venv/venv1/Lib/site-packages/win32/scripts/setup_d.py +1 -1
  236. py2docfx/venv/venv1/Lib/site-packages/win32/test/handles.py +13 -5
  237. py2docfx/venv/venv1/Lib/site-packages/win32/test/test_clipboard.py +12 -1
  238. py2docfx/venv/venv1/Lib/site-packages/win32/test/test_sspi.py +1 -1
  239. py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32api.py +8 -4
  240. py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32clipboard.py +2 -3
  241. py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32cred.py +0 -1
  242. py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32crypt.py +16 -3
  243. py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32file.py +24 -8
  244. py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32gui.py +0 -1
  245. py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32guistruct.py +2 -5
  246. py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32inet.py +23 -6
  247. py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32net.py +0 -1
  248. py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32ts.py +19 -0
  249. py2docfx/venv/venv1/Lib/site-packages/win32/winxpgui.py +3 -11
  250. py2docfx/venv/venv1/Lib/site-packages/win32com/client/CLSIDToClass.py +3 -1
  251. py2docfx/venv/venv1/Lib/site-packages/win32com/client/__init__.py +97 -65
  252. py2docfx/venv/venv1/Lib/site-packages/win32com/client/build.py +24 -24
  253. py2docfx/venv/venv1/Lib/site-packages/win32com/client/combrowse.py +17 -33
  254. py2docfx/venv/venv1/Lib/site-packages/win32com/client/dynamic.py +14 -14
  255. py2docfx/venv/venv1/Lib/site-packages/win32com/client/gencache.py +30 -12
  256. py2docfx/venv/venv1/Lib/site-packages/win32com/client/genpy.py +50 -98
  257. py2docfx/venv/venv1/Lib/site-packages/win32com/client/makepy.py +12 -8
  258. py2docfx/venv/venv1/Lib/site-packages/win32com/client/selecttlb.py +3 -4
  259. py2docfx/venv/venv1/Lib/site-packages/win32com/client/util.py +1 -1
  260. py2docfx/venv/venv1/Lib/site-packages/win32com/demos/dump_clipboard.py +1 -1
  261. py2docfx/venv/venv1/Lib/site-packages/win32com/demos/excelAddin.py +1 -1
  262. py2docfx/venv/venv1/Lib/site-packages/win32com/demos/excelRTDServer.py +1 -1
  263. py2docfx/venv/venv1/Lib/site-packages/win32com/demos/iebutton.py +0 -3
  264. py2docfx/venv/venv1/Lib/site-packages/win32com/demos/ietoolbar.py +1 -1
  265. py2docfx/venv/venv1/Lib/site-packages/win32com/demos/outlookAddin.py +1 -3
  266. py2docfx/venv/venv1/Lib/site-packages/win32com/makegw/makegw.py +48 -56
  267. py2docfx/venv/venv1/Lib/site-packages/win32com/makegw/makegwenum.py +2 -6
  268. py2docfx/venv/venv1/Lib/site-packages/win32com/makegw/makegwparse.py +9 -11
  269. py2docfx/venv/venv1/Lib/site-packages/win32com/olectl.py +1 -1
  270. py2docfx/venv/venv1/Lib/site-packages/win32com/server/connect.py +2 -2
  271. py2docfx/venv/venv1/Lib/site-packages/win32com/server/dispatcher.py +20 -24
  272. py2docfx/venv/venv1/Lib/site-packages/win32com/server/exception.py +8 -8
  273. py2docfx/venv/venv1/Lib/site-packages/win32com/server/policy.py +4 -18
  274. py2docfx/venv/venv1/Lib/site-packages/win32com/server/register.py +5 -6
  275. py2docfx/venv/venv1/Lib/site-packages/win32com/servers/dictionary.py +2 -5
  276. py2docfx/venv/venv1/Lib/site-packages/win32com/servers/interp.py +7 -7
  277. py2docfx/venv/venv1/Lib/site-packages/win32com/servers/test_pycomtest.py +0 -1
  278. py2docfx/venv/venv1/Lib/site-packages/win32com/test/GenTestScripts.py +2 -4
  279. py2docfx/venv/venv1/Lib/site-packages/win32com/test/errorSemantics.py +3 -3
  280. py2docfx/venv/venv1/Lib/site-packages/win32com/test/pippo_server.py +1 -4
  281. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testADOEvents.py +1 -1
  282. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testAXScript.py +1 -2
  283. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testDictionary.py +4 -3
  284. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testDynamic.py +3 -5
  285. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testExchange.py +2 -7
  286. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testGatewayAddresses.py +1 -1
  287. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testIterators.py +1 -1
  288. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testMSOffice.py +40 -57
  289. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testMSOfficeEvents.py +3 -3
  290. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testPersist.py +7 -7
  291. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testPippo.py +2 -3
  292. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testPyComTest.py +143 -7
  293. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testServers.py +1 -2
  294. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testall.py +1 -2
  295. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testmakepy.py +1 -2
  296. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testvb.py +12 -8
  297. py2docfx/venv/venv1/Lib/site-packages/win32com/test/util.py +1 -3
  298. py2docfx/venv/venv1/Lib/site-packages/win32com/universal.py +1 -3
  299. py2docfx/venv/venv1/Lib/site-packages/win32com/util.py +1 -1
  300. py2docfx/venv/venv1/Lib/site-packages/win32comext/adsi/demos/scp.py +1 -1
  301. py2docfx/venv/venv1/Lib/site-packages/win32comext/adsi/demos/search.py +0 -1
  302. py2docfx/venv/venv1/Lib/site-packages/win32comext/authorization/demos/EditSecurity.py +1 -24
  303. py2docfx/venv/venv1/Lib/site-packages/win32comext/authorization/demos/EditServiceSecurity.py +0 -20
  304. py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/adb.py +2 -8
  305. py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/codecontainer.py +16 -12
  306. py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/contexts.py +1 -3
  307. py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/debugger.py +2 -2
  308. py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/documents.py +2 -3
  309. py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/dump.py +2 -4
  310. py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/expressions.py +2 -2
  311. py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/util.py +7 -14
  312. py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/client/debug.py +2 -14
  313. py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/client/error.py +4 -5
  314. py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/client/framework.py +5 -5
  315. py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/client/pydumper.py +0 -1
  316. py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/client/pyscript.py +5 -10
  317. py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/client/scriptdispatch.py +3 -4
  318. py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/server/axsite.py +1 -2
  319. py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/test/leakTest.py +2 -3
  320. py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/test/testHost4Dbg.py +0 -3
  321. py2docfx/venv/venv1/Lib/site-packages/win32comext/bits/test/test_bits.py +3 -3
  322. py2docfx/venv/venv1/Lib/site-packages/win32comext/ifilter/demo/filterDemo.py +1 -1
  323. py2docfx/venv/venv1/Lib/site-packages/win32comext/mapi/demos/mapisend.py +1 -1
  324. py2docfx/venv/venv1/Lib/site-packages/win32comext/mapi/emsabtags.py +1 -0
  325. py2docfx/venv/venv1/Lib/site-packages/win32comext/mapi/mapitags.py +1 -3
  326. py2docfx/venv/venv1/Lib/site-packages/win32comext/mapi/mapiutil.py +2 -2
  327. py2docfx/venv/venv1/Lib/site-packages/win32comext/propsys/test/testpropsys.py +1 -1
  328. py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/IFileOperationProgressSink.py +1 -1
  329. py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/ITransferAdviseSink.py +5 -3
  330. py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/servers/column_provider.py +0 -1
  331. py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/servers/copy_hook.py +1 -1
  332. py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/servers/empty_volume_cache.py +1 -1
  333. py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/servers/folder_view.py +2 -2
  334. py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/servers/icon_handler.py +1 -2
  335. py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/servers/shell_view.py +4 -5
  336. py2docfx/venv/venv1/Lib/site-packages/win32comext/taskscheduler/test/test_addtask_2.py +0 -1
  337. py2docfx/venv/venv1/Scripts/pywin32_postinstall.py +77 -122
  338. py2docfx/venv/venv1/Scripts/pywin32_testall.py +4 -9
  339. {py2docfx-0.1.13rc2012291.dist-info → py2docfx-0.1.13rc2022156.dist-info}/METADATA +1 -1
  340. {py2docfx-0.1.13rc2012291.dist-info → py2docfx-0.1.13rc2022156.dist-info}/RECORD +342 -329
  341. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/ocx/__init__.py +0 -0
  342. py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/mdi_pychecker.py +0 -850
  343. py2docfx/venv/venv1/Lib/site-packages/win32com/test/testNetscape.py +0 -24
  344. {py2docfx-0.1.13rc2012291.dist-info → py2docfx-0.1.13rc2022156.dist-info}/WHEEL +0 -0
  345. {py2docfx-0.1.13rc2012291.dist-info → py2docfx-0.1.13rc2022156.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,1391 @@
1
+ """distutils.ccompiler
2
+
3
+ Contains Compiler, an abstract base class that defines the interface
4
+ for the Distutils compiler abstraction model."""
5
+
6
+ from __future__ import annotations
7
+
8
+ import os
9
+ import pathlib
10
+ import re
11
+ import sys
12
+ import warnings
13
+ from collections.abc import Callable, Iterable, MutableSequence, Sequence
14
+ from typing import (
15
+ TYPE_CHECKING,
16
+ ClassVar,
17
+ Literal,
18
+ TypeVar,
19
+ Union,
20
+ overload,
21
+ )
22
+
23
+ from more_itertools import always_iterable
24
+
25
+ from ..._log import log
26
+ from ..._modified import newer_group
27
+ from ...dir_util import mkpath
28
+ from ...errors import (
29
+ DistutilsModuleError,
30
+ DistutilsPlatformError,
31
+ )
32
+ from ...file_util import move_file
33
+ from ...spawn import spawn
34
+ from ...util import execute, is_mingw, split_quoted
35
+ from .errors import (
36
+ CompileError,
37
+ LinkError,
38
+ UnknownFileType,
39
+ )
40
+
41
+ if TYPE_CHECKING:
42
+ from typing_extensions import TypeAlias, TypeVarTuple, Unpack
43
+
44
+ _Ts = TypeVarTuple("_Ts")
45
+
46
+ _Macro: TypeAlias = Union[tuple[str], tuple[str, Union[str, None]]]
47
+ _StrPathT = TypeVar("_StrPathT", bound="str | os.PathLike[str]")
48
+ _BytesPathT = TypeVar("_BytesPathT", bound="bytes | os.PathLike[bytes]")
49
+
50
+
51
+ class Compiler:
52
+ """Abstract base class to define the interface that must be implemented
53
+ by real compiler classes. Also has some utility methods used by
54
+ several compiler classes.
55
+
56
+ The basic idea behind a compiler abstraction class is that each
57
+ instance can be used for all the compile/link steps in building a
58
+ single project. Thus, attributes common to all of those compile and
59
+ link steps -- include directories, macros to define, libraries to link
60
+ against, etc. -- are attributes of the compiler instance. To allow for
61
+ variability in how individual files are treated, most of those
62
+ attributes may be varied on a per-compilation or per-link basis.
63
+ """
64
+
65
+ # 'compiler_type' is a class attribute that identifies this class. It
66
+ # keeps code that wants to know what kind of compiler it's dealing with
67
+ # from having to import all possible compiler classes just to do an
68
+ # 'isinstance'. In concrete CCompiler subclasses, 'compiler_type'
69
+ # should really, really be one of the keys of the 'compiler_class'
70
+ # dictionary (see below -- used by the 'new_compiler()' factory
71
+ # function) -- authors of new compiler interface classes are
72
+ # responsible for updating 'compiler_class'!
73
+ compiler_type: ClassVar[str] = None # type: ignore[assignment]
74
+
75
+ # XXX things not handled by this compiler abstraction model:
76
+ # * client can't provide additional options for a compiler,
77
+ # e.g. warning, optimization, debugging flags. Perhaps this
78
+ # should be the domain of concrete compiler abstraction classes
79
+ # (UnixCCompiler, MSVCCompiler, etc.) -- or perhaps the base
80
+ # class should have methods for the common ones.
81
+ # * can't completely override the include or library searchg
82
+ # path, ie. no "cc -I -Idir1 -Idir2" or "cc -L -Ldir1 -Ldir2".
83
+ # I'm not sure how widely supported this is even by Unix
84
+ # compilers, much less on other platforms. And I'm even less
85
+ # sure how useful it is; maybe for cross-compiling, but
86
+ # support for that is a ways off. (And anyways, cross
87
+ # compilers probably have a dedicated binary with the
88
+ # right paths compiled in. I hope.)
89
+ # * can't do really freaky things with the library list/library
90
+ # dirs, e.g. "-Ldir1 -lfoo -Ldir2 -lfoo" to link against
91
+ # different versions of libfoo.a in different locations. I
92
+ # think this is useless without the ability to null out the
93
+ # library search path anyways.
94
+
95
+ executables: ClassVar[dict]
96
+
97
+ # Subclasses that rely on the standard filename generation methods
98
+ # implemented below should override these; see the comment near
99
+ # those methods ('object_filenames()' et. al.) for details:
100
+ src_extensions: ClassVar[list[str] | None] = None
101
+ obj_extension: ClassVar[str | None] = None
102
+ static_lib_extension: ClassVar[str | None] = None
103
+ shared_lib_extension: ClassVar[str | None] = None
104
+ static_lib_format: ClassVar[str | None] = None # format string
105
+ shared_lib_format: ClassVar[str | None] = None # prob. same as static_lib_format
106
+ exe_extension: ClassVar[str | None] = None
107
+
108
+ # Default language settings. language_map is used to detect a source
109
+ # file or Extension target language, checking source filenames.
110
+ # language_order is used to detect the language precedence, when deciding
111
+ # what language to use when mixing source types. For example, if some
112
+ # extension has two files with ".c" extension, and one with ".cpp", it
113
+ # is still linked as c++.
114
+ language_map: ClassVar[dict[str, str]] = {
115
+ ".c": "c",
116
+ ".cc": "c++",
117
+ ".cpp": "c++",
118
+ ".cxx": "c++",
119
+ ".m": "objc",
120
+ }
121
+ language_order: ClassVar[list[str]] = ["c++", "objc", "c"]
122
+
123
+ include_dirs = []
124
+ """
125
+ include dirs specific to this compiler class
126
+ """
127
+
128
+ library_dirs = []
129
+ """
130
+ library dirs specific to this compiler class
131
+ """
132
+
133
+ def __init__(
134
+ self, verbose: bool = False, dry_run: bool = False, force: bool = False
135
+ ) -> None:
136
+ self.dry_run = dry_run
137
+ self.force = force
138
+ self.verbose = verbose
139
+
140
+ # 'output_dir': a common output directory for object, library,
141
+ # shared object, and shared library files
142
+ self.output_dir: str | None = None
143
+
144
+ # 'macros': a list of macro definitions (or undefinitions). A
145
+ # macro definition is a 2-tuple (name, value), where the value is
146
+ # either a string or None (no explicit value). A macro
147
+ # undefinition is a 1-tuple (name,).
148
+ self.macros: list[_Macro] = []
149
+
150
+ # 'include_dirs': a list of directories to search for include files
151
+ self.include_dirs: list[str] = []
152
+
153
+ # 'libraries': a list of libraries to include in any link
154
+ # (library names, not filenames: eg. "foo" not "libfoo.a")
155
+ self.libraries: list[str] = []
156
+
157
+ # 'library_dirs': a list of directories to search for libraries
158
+ self.library_dirs: list[str] = []
159
+
160
+ # 'runtime_library_dirs': a list of directories to search for
161
+ # shared libraries/objects at runtime
162
+ self.runtime_library_dirs: list[str] = []
163
+
164
+ # 'objects': a list of object files (or similar, such as explicitly
165
+ # named library files) to include on any link
166
+ self.objects: list[str] = []
167
+
168
+ for key in self.executables.keys():
169
+ self.set_executable(key, self.executables[key])
170
+
171
+ def set_executables(self, **kwargs: str) -> None:
172
+ """Define the executables (and options for them) that will be run
173
+ to perform the various stages of compilation. The exact set of
174
+ executables that may be specified here depends on the compiler
175
+ class (via the 'executables' class attribute), but most will have:
176
+ compiler the C/C++ compiler
177
+ linker_so linker used to create shared objects and libraries
178
+ linker_exe linker used to create binary executables
179
+ archiver static library creator
180
+
181
+ On platforms with a command-line (Unix, DOS/Windows), each of these
182
+ is a string that will be split into executable name and (optional)
183
+ list of arguments. (Splitting the string is done similarly to how
184
+ Unix shells operate: words are delimited by spaces, but quotes and
185
+ backslashes can override this. See
186
+ 'distutils.util.split_quoted()'.)
187
+ """
188
+
189
+ # Note that some CCompiler implementation classes will define class
190
+ # attributes 'cpp', 'cc', etc. with hard-coded executable names;
191
+ # this is appropriate when a compiler class is for exactly one
192
+ # compiler/OS combination (eg. MSVCCompiler). Other compiler
193
+ # classes (UnixCCompiler, in particular) are driven by information
194
+ # discovered at run-time, since there are many different ways to do
195
+ # basically the same things with Unix C compilers.
196
+
197
+ for key in kwargs:
198
+ if key not in self.executables:
199
+ raise ValueError(
200
+ f"unknown executable '{key}' for class {self.__class__.__name__}"
201
+ )
202
+ self.set_executable(key, kwargs[key])
203
+
204
+ def set_executable(self, key, value):
205
+ if isinstance(value, str):
206
+ setattr(self, key, split_quoted(value))
207
+ else:
208
+ setattr(self, key, value)
209
+
210
+ def _find_macro(self, name):
211
+ i = 0
212
+ for defn in self.macros:
213
+ if defn[0] == name:
214
+ return i
215
+ i += 1
216
+ return None
217
+
218
+ def _check_macro_definitions(self, definitions):
219
+ """Ensure that every element of 'definitions' is valid."""
220
+ for defn in definitions:
221
+ self._check_macro_definition(*defn)
222
+
223
+ def _check_macro_definition(self, defn):
224
+ """
225
+ Raise a TypeError if defn is not valid.
226
+
227
+ A valid definition is either a (name, value) 2-tuple or a (name,) tuple.
228
+ """
229
+ if not isinstance(defn, tuple) or not self._is_valid_macro(*defn):
230
+ raise TypeError(
231
+ f"invalid macro definition '{defn}': "
232
+ "must be tuple (string,), (string, string), or (string, None)"
233
+ )
234
+
235
+ @staticmethod
236
+ def _is_valid_macro(name, value=None):
237
+ """
238
+ A valid macro is a ``name : str`` and a ``value : str | None``.
239
+ """
240
+ return isinstance(name, str) and isinstance(value, (str, None))
241
+
242
+ # -- Bookkeeping methods -------------------------------------------
243
+
244
+ def define_macro(self, name: str, value: str | None = None) -> None:
245
+ """Define a preprocessor macro for all compilations driven by this
246
+ compiler object. The optional parameter 'value' should be a
247
+ string; if it is not supplied, then the macro will be defined
248
+ without an explicit value and the exact outcome depends on the
249
+ compiler used (XXX true? does ANSI say anything about this?)
250
+ """
251
+ # Delete from the list of macro definitions/undefinitions if
252
+ # already there (so that this one will take precedence).
253
+ i = self._find_macro(name)
254
+ if i is not None:
255
+ del self.macros[i]
256
+
257
+ self.macros.append((name, value))
258
+
259
+ def undefine_macro(self, name: str) -> None:
260
+ """Undefine a preprocessor macro for all compilations driven by
261
+ this compiler object. If the same macro is defined by
262
+ 'define_macro()' and undefined by 'undefine_macro()' the last call
263
+ takes precedence (including multiple redefinitions or
264
+ undefinitions). If the macro is redefined/undefined on a
265
+ per-compilation basis (ie. in the call to 'compile()'), then that
266
+ takes precedence.
267
+ """
268
+ # Delete from the list of macro definitions/undefinitions if
269
+ # already there (so that this one will take precedence).
270
+ i = self._find_macro(name)
271
+ if i is not None:
272
+ del self.macros[i]
273
+
274
+ undefn = (name,)
275
+ self.macros.append(undefn)
276
+
277
+ def add_include_dir(self, dir: str) -> None:
278
+ """Add 'dir' to the list of directories that will be searched for
279
+ header files. The compiler is instructed to search directories in
280
+ the order in which they are supplied by successive calls to
281
+ 'add_include_dir()'.
282
+ """
283
+ self.include_dirs.append(dir)
284
+
285
+ def set_include_dirs(self, dirs: list[str]) -> None:
286
+ """Set the list of directories that will be searched to 'dirs' (a
287
+ list of strings). Overrides any preceding calls to
288
+ 'add_include_dir()'; subsequence calls to 'add_include_dir()' add
289
+ to the list passed to 'set_include_dirs()'. This does not affect
290
+ any list of standard include directories that the compiler may
291
+ search by default.
292
+ """
293
+ self.include_dirs = dirs[:]
294
+
295
+ def add_library(self, libname: str) -> None:
296
+ """Add 'libname' to the list of libraries that will be included in
297
+ all links driven by this compiler object. Note that 'libname'
298
+ should *not* be the name of a file containing a library, but the
299
+ name of the library itself: the actual filename will be inferred by
300
+ the linker, the compiler, or the compiler class (depending on the
301
+ platform).
302
+
303
+ The linker will be instructed to link against libraries in the
304
+ order they were supplied to 'add_library()' and/or
305
+ 'set_libraries()'. It is perfectly valid to duplicate library
306
+ names; the linker will be instructed to link against libraries as
307
+ many times as they are mentioned.
308
+ """
309
+ self.libraries.append(libname)
310
+
311
+ def set_libraries(self, libnames: list[str]) -> None:
312
+ """Set the list of libraries to be included in all links driven by
313
+ this compiler object to 'libnames' (a list of strings). This does
314
+ not affect any standard system libraries that the linker may
315
+ include by default.
316
+ """
317
+ self.libraries = libnames[:]
318
+
319
+ def add_library_dir(self, dir: str) -> None:
320
+ """Add 'dir' to the list of directories that will be searched for
321
+ libraries specified to 'add_library()' and 'set_libraries()'. The
322
+ linker will be instructed to search for libraries in the order they
323
+ are supplied to 'add_library_dir()' and/or 'set_library_dirs()'.
324
+ """
325
+ self.library_dirs.append(dir)
326
+
327
+ def set_library_dirs(self, dirs: list[str]) -> None:
328
+ """Set the list of library search directories to 'dirs' (a list of
329
+ strings). This does not affect any standard library search path
330
+ that the linker may search by default.
331
+ """
332
+ self.library_dirs = dirs[:]
333
+
334
+ def add_runtime_library_dir(self, dir: str) -> None:
335
+ """Add 'dir' to the list of directories that will be searched for
336
+ shared libraries at runtime.
337
+ """
338
+ self.runtime_library_dirs.append(dir)
339
+
340
+ def set_runtime_library_dirs(self, dirs: list[str]) -> None:
341
+ """Set the list of directories to search for shared libraries at
342
+ runtime to 'dirs' (a list of strings). This does not affect any
343
+ standard search path that the runtime linker may search by
344
+ default.
345
+ """
346
+ self.runtime_library_dirs = dirs[:]
347
+
348
+ def add_link_object(self, object: str) -> None:
349
+ """Add 'object' to the list of object files (or analogues, such as
350
+ explicitly named library files or the output of "resource
351
+ compilers") to be included in every link driven by this compiler
352
+ object.
353
+ """
354
+ self.objects.append(object)
355
+
356
+ def set_link_objects(self, objects: list[str]) -> None:
357
+ """Set the list of object files (or analogues) to be included in
358
+ every link to 'objects'. This does not affect any standard object
359
+ files that the linker may include by default (such as system
360
+ libraries).
361
+ """
362
+ self.objects = objects[:]
363
+
364
+ # -- Private utility methods --------------------------------------
365
+ # (here for the convenience of subclasses)
366
+
367
+ # Helper method to prep compiler in subclass compile() methods
368
+
369
+ def _setup_compile(
370
+ self,
371
+ outdir: str | None,
372
+ macros: list[_Macro] | None,
373
+ incdirs: list[str] | tuple[str, ...] | None,
374
+ sources,
375
+ depends,
376
+ extra,
377
+ ):
378
+ """Process arguments and decide which source files to compile."""
379
+ outdir, macros, incdirs = self._fix_compile_args(outdir, macros, incdirs)
380
+
381
+ if extra is None:
382
+ extra = []
383
+
384
+ # Get the list of expected output (object) files
385
+ objects = self.object_filenames(sources, strip_dir=False, output_dir=outdir)
386
+ assert len(objects) == len(sources)
387
+
388
+ pp_opts = gen_preprocess_options(macros, incdirs)
389
+
390
+ build = {}
391
+ for i in range(len(sources)):
392
+ src = sources[i]
393
+ obj = objects[i]
394
+ ext = os.path.splitext(src)[1]
395
+ self.mkpath(os.path.dirname(obj))
396
+ build[obj] = (src, ext)
397
+
398
+ return macros, objects, extra, pp_opts, build
399
+
400
+ def _get_cc_args(self, pp_opts, debug, before):
401
+ # works for unixccompiler, cygwinccompiler
402
+ cc_args = pp_opts + ['-c']
403
+ if debug:
404
+ cc_args[:0] = ['-g']
405
+ if before:
406
+ cc_args[:0] = before
407
+ return cc_args
408
+
409
+ def _fix_compile_args(
410
+ self,
411
+ output_dir: str | None,
412
+ macros: list[_Macro] | None,
413
+ include_dirs: list[str] | tuple[str, ...] | None,
414
+ ) -> tuple[str, list[_Macro], list[str]]:
415
+ """Typecheck and fix-up some of the arguments to the 'compile()'
416
+ method, and return fixed-up values. Specifically: if 'output_dir'
417
+ is None, replaces it with 'self.output_dir'; ensures that 'macros'
418
+ is a list, and augments it with 'self.macros'; ensures that
419
+ 'include_dirs' is a list, and augments it with 'self.include_dirs'.
420
+ Guarantees that the returned values are of the correct type,
421
+ i.e. for 'output_dir' either string or None, and for 'macros' and
422
+ 'include_dirs' either list or None.
423
+ """
424
+ if output_dir is None:
425
+ output_dir = self.output_dir
426
+ elif not isinstance(output_dir, str):
427
+ raise TypeError("'output_dir' must be a string or None")
428
+
429
+ if macros is None:
430
+ macros = list(self.macros)
431
+ elif isinstance(macros, list):
432
+ macros = macros + (self.macros or [])
433
+ else:
434
+ raise TypeError("'macros' (if supplied) must be a list of tuples")
435
+
436
+ if include_dirs is None:
437
+ include_dirs = list(self.include_dirs)
438
+ elif isinstance(include_dirs, (list, tuple)):
439
+ include_dirs = list(include_dirs) + (self.include_dirs or [])
440
+ else:
441
+ raise TypeError("'include_dirs' (if supplied) must be a list of strings")
442
+
443
+ # add include dirs for class
444
+ include_dirs += self.__class__.include_dirs
445
+
446
+ return output_dir, macros, include_dirs
447
+
448
+ def _prep_compile(self, sources, output_dir, depends=None):
449
+ """Decide which source files must be recompiled.
450
+
451
+ Determine the list of object files corresponding to 'sources',
452
+ and figure out which ones really need to be recompiled.
453
+ Return a list of all object files and a dictionary telling
454
+ which source files can be skipped.
455
+ """
456
+ # Get the list of expected output (object) files
457
+ objects = self.object_filenames(sources, output_dir=output_dir)
458
+ assert len(objects) == len(sources)
459
+
460
+ # Return an empty dict for the "which source files can be skipped"
461
+ # return value to preserve API compatibility.
462
+ return objects, {}
463
+
464
+ def _fix_object_args(
465
+ self, objects: list[str] | tuple[str, ...], output_dir: str | None
466
+ ) -> tuple[list[str], str]:
467
+ """Typecheck and fix up some arguments supplied to various methods.
468
+ Specifically: ensure that 'objects' is a list; if output_dir is
469
+ None, replace with self.output_dir. Return fixed versions of
470
+ 'objects' and 'output_dir'.
471
+ """
472
+ if not isinstance(objects, (list, tuple)):
473
+ raise TypeError("'objects' must be a list or tuple of strings")
474
+ objects = list(objects)
475
+
476
+ if output_dir is None:
477
+ output_dir = self.output_dir
478
+ elif not isinstance(output_dir, str):
479
+ raise TypeError("'output_dir' must be a string or None")
480
+
481
+ return (objects, output_dir)
482
+
483
+ def _fix_lib_args(
484
+ self,
485
+ libraries: list[str] | tuple[str, ...] | None,
486
+ library_dirs: list[str] | tuple[str, ...] | None,
487
+ runtime_library_dirs: list[str] | tuple[str, ...] | None,
488
+ ) -> tuple[list[str], list[str], list[str]]:
489
+ """Typecheck and fix up some of the arguments supplied to the
490
+ 'link_*' methods. Specifically: ensure that all arguments are
491
+ lists, and augment them with their permanent versions
492
+ (eg. 'self.libraries' augments 'libraries'). Return a tuple with
493
+ fixed versions of all arguments.
494
+ """
495
+ if libraries is None:
496
+ libraries = list(self.libraries)
497
+ elif isinstance(libraries, (list, tuple)):
498
+ libraries = list(libraries) + (self.libraries or [])
499
+ else:
500
+ raise TypeError("'libraries' (if supplied) must be a list of strings")
501
+
502
+ if library_dirs is None:
503
+ library_dirs = list(self.library_dirs)
504
+ elif isinstance(library_dirs, (list, tuple)):
505
+ library_dirs = list(library_dirs) + (self.library_dirs or [])
506
+ else:
507
+ raise TypeError("'library_dirs' (if supplied) must be a list of strings")
508
+
509
+ # add library dirs for class
510
+ library_dirs += self.__class__.library_dirs
511
+
512
+ if runtime_library_dirs is None:
513
+ runtime_library_dirs = list(self.runtime_library_dirs)
514
+ elif isinstance(runtime_library_dirs, (list, tuple)):
515
+ runtime_library_dirs = list(runtime_library_dirs) + (
516
+ self.runtime_library_dirs or []
517
+ )
518
+ else:
519
+ raise TypeError(
520
+ "'runtime_library_dirs' (if supplied) must be a list of strings"
521
+ )
522
+
523
+ return (libraries, library_dirs, runtime_library_dirs)
524
+
525
+ def _need_link(self, objects, output_file):
526
+ """Return true if we need to relink the files listed in 'objects'
527
+ to recreate 'output_file'.
528
+ """
529
+ if self.force:
530
+ return True
531
+ else:
532
+ if self.dry_run:
533
+ newer = newer_group(objects, output_file, missing='newer')
534
+ else:
535
+ newer = newer_group(objects, output_file)
536
+ return newer
537
+
538
+ def detect_language(self, sources: str | list[str]) -> str | None:
539
+ """Detect the language of a given file, or list of files. Uses
540
+ language_map, and language_order to do the job.
541
+ """
542
+ if not isinstance(sources, list):
543
+ sources = [sources]
544
+ lang = None
545
+ index = len(self.language_order)
546
+ for source in sources:
547
+ base, ext = os.path.splitext(source)
548
+ extlang = self.language_map.get(ext)
549
+ try:
550
+ extindex = self.language_order.index(extlang)
551
+ if extindex < index:
552
+ lang = extlang
553
+ index = extindex
554
+ except ValueError:
555
+ pass
556
+ return lang
557
+
558
+ # -- Worker methods ------------------------------------------------
559
+ # (must be implemented by subclasses)
560
+
561
+ def preprocess(
562
+ self,
563
+ source: str | os.PathLike[str],
564
+ output_file: str | os.PathLike[str] | None = None,
565
+ macros: list[_Macro] | None = None,
566
+ include_dirs: list[str] | tuple[str, ...] | None = None,
567
+ extra_preargs: list[str] | None = None,
568
+ extra_postargs: Iterable[str] | None = None,
569
+ ):
570
+ """Preprocess a single C/C++ source file, named in 'source'.
571
+ Output will be written to file named 'output_file', or stdout if
572
+ 'output_file' not supplied. 'macros' is a list of macro
573
+ definitions as for 'compile()', which will augment the macros set
574
+ with 'define_macro()' and 'undefine_macro()'. 'include_dirs' is a
575
+ list of directory names that will be added to the default list.
576
+
577
+ Raises PreprocessError on failure.
578
+ """
579
+ pass
580
+
581
+ def compile(
582
+ self,
583
+ sources: Sequence[str | os.PathLike[str]],
584
+ output_dir: str | None = None,
585
+ macros: list[_Macro] | None = None,
586
+ include_dirs: list[str] | tuple[str, ...] | None = None,
587
+ debug: bool = False,
588
+ extra_preargs: list[str] | None = None,
589
+ extra_postargs: list[str] | None = None,
590
+ depends: list[str] | tuple[str, ...] | None = None,
591
+ ) -> list[str]:
592
+ """Compile one or more source files.
593
+
594
+ 'sources' must be a list of filenames, most likely C/C++
595
+ files, but in reality anything that can be handled by a
596
+ particular compiler and compiler class (eg. MSVCCompiler can
597
+ handle resource files in 'sources'). Return a list of object
598
+ filenames, one per source filename in 'sources'. Depending on
599
+ the implementation, not all source files will necessarily be
600
+ compiled, but all corresponding object filenames will be
601
+ returned.
602
+
603
+ If 'output_dir' is given, object files will be put under it, while
604
+ retaining their original path component. That is, "foo/bar.c"
605
+ normally compiles to "foo/bar.o" (for a Unix implementation); if
606
+ 'output_dir' is "build", then it would compile to
607
+ "build/foo/bar.o".
608
+
609
+ 'macros', if given, must be a list of macro definitions. A macro
610
+ definition is either a (name, value) 2-tuple or a (name,) 1-tuple.
611
+ The former defines a macro; if the value is None, the macro is
612
+ defined without an explicit value. The 1-tuple case undefines a
613
+ macro. Later definitions/redefinitions/ undefinitions take
614
+ precedence.
615
+
616
+ 'include_dirs', if given, must be a list of strings, the
617
+ directories to add to the default include file search path for this
618
+ compilation only.
619
+
620
+ 'debug' is a boolean; if true, the compiler will be instructed to
621
+ output debug symbols in (or alongside) the object file(s).
622
+
623
+ 'extra_preargs' and 'extra_postargs' are implementation- dependent.
624
+ On platforms that have the notion of a command-line (e.g. Unix,
625
+ DOS/Windows), they are most likely lists of strings: extra
626
+ command-line arguments to prepend/append to the compiler command
627
+ line. On other platforms, consult the implementation class
628
+ documentation. In any event, they are intended as an escape hatch
629
+ for those occasions when the abstract compiler framework doesn't
630
+ cut the mustard.
631
+
632
+ 'depends', if given, is a list of filenames that all targets
633
+ depend on. If a source file is older than any file in
634
+ depends, then the source file will be recompiled. This
635
+ supports dependency tracking, but only at a coarse
636
+ granularity.
637
+
638
+ Raises CompileError on failure.
639
+ """
640
+ # A concrete compiler class can either override this method
641
+ # entirely or implement _compile().
642
+ macros, objects, extra_postargs, pp_opts, build = self._setup_compile(
643
+ output_dir, macros, include_dirs, sources, depends, extra_postargs
644
+ )
645
+ cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
646
+
647
+ for obj in objects:
648
+ try:
649
+ src, ext = build[obj]
650
+ except KeyError:
651
+ continue
652
+ self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
653
+
654
+ # Return *all* object filenames, not just the ones we just built.
655
+ return objects
656
+
657
+ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
658
+ """Compile 'src' to product 'obj'."""
659
+ # A concrete compiler class that does not override compile()
660
+ # should implement _compile().
661
+ pass
662
+
663
+ def create_static_lib(
664
+ self,
665
+ objects: list[str] | tuple[str, ...],
666
+ output_libname: str,
667
+ output_dir: str | None = None,
668
+ debug: bool = False,
669
+ target_lang: str | None = None,
670
+ ) -> None:
671
+ """Link a bunch of stuff together to create a static library file.
672
+ The "bunch of stuff" consists of the list of object files supplied
673
+ as 'objects', the extra object files supplied to
674
+ 'add_link_object()' and/or 'set_link_objects()', the libraries
675
+ supplied to 'add_library()' and/or 'set_libraries()', and the
676
+ libraries supplied as 'libraries' (if any).
677
+
678
+ 'output_libname' should be a library name, not a filename; the
679
+ filename will be inferred from the library name. 'output_dir' is
680
+ the directory where the library file will be put.
681
+
682
+ 'debug' is a boolean; if true, debugging information will be
683
+ included in the library (note that on most platforms, it is the
684
+ compile step where this matters: the 'debug' flag is included here
685
+ just for consistency).
686
+
687
+ 'target_lang' is the target language for which the given objects
688
+ are being compiled. This allows specific linkage time treatment of
689
+ certain languages.
690
+
691
+ Raises LibError on failure.
692
+ """
693
+ pass
694
+
695
+ # values for target_desc parameter in link()
696
+ SHARED_OBJECT = "shared_object"
697
+ SHARED_LIBRARY = "shared_library"
698
+ EXECUTABLE = "executable"
699
+
700
+ def link(
701
+ self,
702
+ target_desc: str,
703
+ objects: list[str] | tuple[str, ...],
704
+ output_filename: str,
705
+ output_dir: str | None = None,
706
+ libraries: list[str] | tuple[str, ...] | None = None,
707
+ library_dirs: list[str] | tuple[str, ...] | None = None,
708
+ runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
709
+ export_symbols: Iterable[str] | None = None,
710
+ debug: bool = False,
711
+ extra_preargs: list[str] | None = None,
712
+ extra_postargs: list[str] | None = None,
713
+ build_temp: str | os.PathLike[str] | None = None,
714
+ target_lang: str | None = None,
715
+ ):
716
+ """Link a bunch of stuff together to create an executable or
717
+ shared library file.
718
+
719
+ The "bunch of stuff" consists of the list of object files supplied
720
+ as 'objects'. 'output_filename' should be a filename. If
721
+ 'output_dir' is supplied, 'output_filename' is relative to it
722
+ (i.e. 'output_filename' can provide directory components if
723
+ needed).
724
+
725
+ 'libraries' is a list of libraries to link against. These are
726
+ library names, not filenames, since they're translated into
727
+ filenames in a platform-specific way (eg. "foo" becomes "libfoo.a"
728
+ on Unix and "foo.lib" on DOS/Windows). However, they can include a
729
+ directory component, which means the linker will look in that
730
+ specific directory rather than searching all the normal locations.
731
+
732
+ 'library_dirs', if supplied, should be a list of directories to
733
+ search for libraries that were specified as bare library names
734
+ (ie. no directory component). These are on top of the system
735
+ default and those supplied to 'add_library_dir()' and/or
736
+ 'set_library_dirs()'. 'runtime_library_dirs' is a list of
737
+ directories that will be embedded into the shared library and used
738
+ to search for other shared libraries that *it* depends on at
739
+ run-time. (This may only be relevant on Unix.)
740
+
741
+ 'export_symbols' is a list of symbols that the shared library will
742
+ export. (This appears to be relevant only on Windows.)
743
+
744
+ 'debug' is as for 'compile()' and 'create_static_lib()', with the
745
+ slight distinction that it actually matters on most platforms (as
746
+ opposed to 'create_static_lib()', which includes a 'debug' flag
747
+ mostly for form's sake).
748
+
749
+ 'extra_preargs' and 'extra_postargs' are as for 'compile()' (except
750
+ of course that they supply command-line arguments for the
751
+ particular linker being used).
752
+
753
+ 'target_lang' is the target language for which the given objects
754
+ are being compiled. This allows specific linkage time treatment of
755
+ certain languages.
756
+
757
+ Raises LinkError on failure.
758
+ """
759
+ raise NotImplementedError
760
+
761
+ # Old 'link_*()' methods, rewritten to use the new 'link()' method.
762
+
763
+ def link_shared_lib(
764
+ self,
765
+ objects: list[str] | tuple[str, ...],
766
+ output_libname: str,
767
+ output_dir: str | None = None,
768
+ libraries: list[str] | tuple[str, ...] | None = None,
769
+ library_dirs: list[str] | tuple[str, ...] | None = None,
770
+ runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
771
+ export_symbols: Iterable[str] | None = None,
772
+ debug: bool = False,
773
+ extra_preargs: list[str] | None = None,
774
+ extra_postargs: list[str] | None = None,
775
+ build_temp: str | os.PathLike[str] | None = None,
776
+ target_lang: str | None = None,
777
+ ):
778
+ self.link(
779
+ Compiler.SHARED_LIBRARY,
780
+ objects,
781
+ self.library_filename(output_libname, lib_type='shared'),
782
+ output_dir,
783
+ libraries,
784
+ library_dirs,
785
+ runtime_library_dirs,
786
+ export_symbols,
787
+ debug,
788
+ extra_preargs,
789
+ extra_postargs,
790
+ build_temp,
791
+ target_lang,
792
+ )
793
+
794
+ def link_shared_object(
795
+ self,
796
+ objects: list[str] | tuple[str, ...],
797
+ output_filename: str,
798
+ output_dir: str | None = None,
799
+ libraries: list[str] | tuple[str, ...] | None = None,
800
+ library_dirs: list[str] | tuple[str, ...] | None = None,
801
+ runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
802
+ export_symbols: Iterable[str] | None = None,
803
+ debug: bool = False,
804
+ extra_preargs: list[str] | None = None,
805
+ extra_postargs: list[str] | None = None,
806
+ build_temp: str | os.PathLike[str] | None = None,
807
+ target_lang: str | None = None,
808
+ ):
809
+ self.link(
810
+ Compiler.SHARED_OBJECT,
811
+ objects,
812
+ output_filename,
813
+ output_dir,
814
+ libraries,
815
+ library_dirs,
816
+ runtime_library_dirs,
817
+ export_symbols,
818
+ debug,
819
+ extra_preargs,
820
+ extra_postargs,
821
+ build_temp,
822
+ target_lang,
823
+ )
824
+
825
+ def link_executable(
826
+ self,
827
+ objects: list[str] | tuple[str, ...],
828
+ output_progname: str,
829
+ output_dir: str | None = None,
830
+ libraries: list[str] | tuple[str, ...] | None = None,
831
+ library_dirs: list[str] | tuple[str, ...] | None = None,
832
+ runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
833
+ debug: bool = False,
834
+ extra_preargs: list[str] | None = None,
835
+ extra_postargs: list[str] | None = None,
836
+ target_lang: str | None = None,
837
+ ):
838
+ self.link(
839
+ Compiler.EXECUTABLE,
840
+ objects,
841
+ self.executable_filename(output_progname),
842
+ output_dir,
843
+ libraries,
844
+ library_dirs,
845
+ runtime_library_dirs,
846
+ None,
847
+ debug,
848
+ extra_preargs,
849
+ extra_postargs,
850
+ None,
851
+ target_lang,
852
+ )
853
+
854
+ # -- Miscellaneous methods -----------------------------------------
855
+ # These are all used by the 'gen_lib_options() function; there is
856
+ # no appropriate default implementation so subclasses should
857
+ # implement all of these.
858
+
859
+ def library_dir_option(self, dir: str) -> str:
860
+ """Return the compiler option to add 'dir' to the list of
861
+ directories searched for libraries.
862
+ """
863
+ raise NotImplementedError
864
+
865
+ def runtime_library_dir_option(self, dir: str) -> str:
866
+ """Return the compiler option to add 'dir' to the list of
867
+ directories searched for runtime libraries.
868
+ """
869
+ raise NotImplementedError
870
+
871
+ def library_option(self, lib: str) -> str:
872
+ """Return the compiler option to add 'lib' to the list of libraries
873
+ linked into the shared library or executable.
874
+ """
875
+ raise NotImplementedError
876
+
877
+ def has_function( # noqa: C901
878
+ self,
879
+ funcname: str,
880
+ includes: Iterable[str] | None = None,
881
+ include_dirs: list[str] | tuple[str, ...] | None = None,
882
+ libraries: list[str] | None = None,
883
+ library_dirs: list[str] | tuple[str, ...] | None = None,
884
+ ) -> bool:
885
+ """Return a boolean indicating whether funcname is provided as
886
+ a symbol on the current platform. The optional arguments can
887
+ be used to augment the compilation environment.
888
+
889
+ The libraries argument is a list of flags to be passed to the
890
+ linker to make additional symbol definitions available for
891
+ linking.
892
+
893
+ The includes and include_dirs arguments are deprecated.
894
+ Usually, supplying include files with function declarations
895
+ will cause function detection to fail even in cases where the
896
+ symbol is available for linking.
897
+
898
+ """
899
+ # this can't be included at module scope because it tries to
900
+ # import math which might not be available at that point - maybe
901
+ # the necessary logic should just be inlined?
902
+ import tempfile
903
+
904
+ if includes is None:
905
+ includes = []
906
+ else:
907
+ warnings.warn("includes is deprecated", DeprecationWarning)
908
+ if include_dirs is None:
909
+ include_dirs = []
910
+ else:
911
+ warnings.warn("include_dirs is deprecated", DeprecationWarning)
912
+ if libraries is None:
913
+ libraries = []
914
+ if library_dirs is None:
915
+ library_dirs = []
916
+ fd, fname = tempfile.mkstemp(".c", funcname, text=True)
917
+ with os.fdopen(fd, "w", encoding='utf-8') as f:
918
+ for incl in includes:
919
+ f.write(f"""#include "{incl}"\n""")
920
+ if not includes:
921
+ # Use "char func(void);" as the prototype to follow
922
+ # what autoconf does. This prototype does not match
923
+ # any well-known function the compiler might recognize
924
+ # as a builtin, so this ends up as a true link test.
925
+ # Without a fake prototype, the test would need to
926
+ # know the exact argument types, and the has_function
927
+ # interface does not provide that level of information.
928
+ f.write(
929
+ f"""\
930
+ #ifdef __cplusplus
931
+ extern "C"
932
+ #endif
933
+ char {funcname}(void);
934
+ """
935
+ )
936
+ f.write(
937
+ f"""\
938
+ int main (int argc, char **argv) {{
939
+ {funcname}();
940
+ return 0;
941
+ }}
942
+ """
943
+ )
944
+
945
+ try:
946
+ objects = self.compile([fname], include_dirs=include_dirs)
947
+ except CompileError:
948
+ return False
949
+ finally:
950
+ os.remove(fname)
951
+
952
+ try:
953
+ self.link_executable(
954
+ objects, "a.out", libraries=libraries, library_dirs=library_dirs
955
+ )
956
+ except (LinkError, TypeError):
957
+ return False
958
+ else:
959
+ os.remove(
960
+ self.executable_filename("a.out", output_dir=self.output_dir or '')
961
+ )
962
+ finally:
963
+ for fn in objects:
964
+ os.remove(fn)
965
+ return True
966
+
967
+ def find_library_file(
968
+ self, dirs: Iterable[str], lib: str, debug: bool = False
969
+ ) -> str | None:
970
+ """Search the specified list of directories for a static or shared
971
+ library file 'lib' and return the full path to that file. If
972
+ 'debug' true, look for a debugging version (if that makes sense on
973
+ the current platform). Return None if 'lib' wasn't found in any of
974
+ the specified directories.
975
+ """
976
+ raise NotImplementedError
977
+
978
+ # -- Filename generation methods -----------------------------------
979
+
980
+ # The default implementation of the filename generating methods are
981
+ # prejudiced towards the Unix/DOS/Windows view of the world:
982
+ # * object files are named by replacing the source file extension
983
+ # (eg. .c/.cpp -> .o/.obj)
984
+ # * library files (shared or static) are named by plugging the
985
+ # library name and extension into a format string, eg.
986
+ # "lib%s.%s" % (lib_name, ".a") for Unix static libraries
987
+ # * executables are named by appending an extension (possibly
988
+ # empty) to the program name: eg. progname + ".exe" for
989
+ # Windows
990
+ #
991
+ # To reduce redundant code, these methods expect to find
992
+ # several attributes in the current object (presumably defined
993
+ # as class attributes):
994
+ # * src_extensions -
995
+ # list of C/C++ source file extensions, eg. ['.c', '.cpp']
996
+ # * obj_extension -
997
+ # object file extension, eg. '.o' or '.obj'
998
+ # * static_lib_extension -
999
+ # extension for static library files, eg. '.a' or '.lib'
1000
+ # * shared_lib_extension -
1001
+ # extension for shared library/object files, eg. '.so', '.dll'
1002
+ # * static_lib_format -
1003
+ # format string for generating static library filenames,
1004
+ # eg. 'lib%s.%s' or '%s.%s'
1005
+ # * shared_lib_format
1006
+ # format string for generating shared library filenames
1007
+ # (probably same as static_lib_format, since the extension
1008
+ # is one of the intended parameters to the format string)
1009
+ # * exe_extension -
1010
+ # extension for executable files, eg. '' or '.exe'
1011
+
1012
+ def object_filenames(
1013
+ self,
1014
+ source_filenames: Iterable[str | os.PathLike[str]],
1015
+ strip_dir: bool = False,
1016
+ output_dir: str | os.PathLike[str] | None = '',
1017
+ ) -> list[str]:
1018
+ if output_dir is None:
1019
+ output_dir = ''
1020
+ return list(
1021
+ self._make_out_path(output_dir, strip_dir, src_name)
1022
+ for src_name in source_filenames
1023
+ )
1024
+
1025
+ @property
1026
+ def out_extensions(self):
1027
+ return dict.fromkeys(self.src_extensions, self.obj_extension)
1028
+
1029
+ def _make_out_path(self, output_dir, strip_dir, src_name):
1030
+ return self._make_out_path_exts(
1031
+ output_dir, strip_dir, src_name, self.out_extensions
1032
+ )
1033
+
1034
+ @classmethod
1035
+ def _make_out_path_exts(cls, output_dir, strip_dir, src_name, extensions):
1036
+ r"""
1037
+ >>> exts = {'.c': '.o'}
1038
+ >>> Compiler._make_out_path_exts('.', False, '/foo/bar.c', exts).replace('\\', '/')
1039
+ './foo/bar.o'
1040
+ >>> Compiler._make_out_path_exts('.', True, '/foo/bar.c', exts).replace('\\', '/')
1041
+ './bar.o'
1042
+ """
1043
+ src = pathlib.PurePath(src_name)
1044
+ # Ensure base is relative to honor output_dir (python/cpython#37775).
1045
+ base = cls._make_relative(src)
1046
+ try:
1047
+ new_ext = extensions[src.suffix]
1048
+ except LookupError:
1049
+ raise UnknownFileType(f"unknown file type '{src.suffix}' (from '{src}')")
1050
+ if strip_dir:
1051
+ base = pathlib.PurePath(base.name)
1052
+ return os.path.join(output_dir, base.with_suffix(new_ext))
1053
+
1054
+ @staticmethod
1055
+ def _make_relative(base: pathlib.Path):
1056
+ return base.relative_to(base.anchor)
1057
+
1058
+ @overload
1059
+ def shared_object_filename(
1060
+ self,
1061
+ basename: str,
1062
+ strip_dir: Literal[False] = False,
1063
+ output_dir: str | os.PathLike[str] = "",
1064
+ ) -> str: ...
1065
+ @overload
1066
+ def shared_object_filename(
1067
+ self,
1068
+ basename: str | os.PathLike[str],
1069
+ strip_dir: Literal[True],
1070
+ output_dir: str | os.PathLike[str] = "",
1071
+ ) -> str: ...
1072
+ def shared_object_filename(
1073
+ self,
1074
+ basename: str | os.PathLike[str],
1075
+ strip_dir: bool = False,
1076
+ output_dir: str | os.PathLike[str] = '',
1077
+ ) -> str:
1078
+ assert output_dir is not None
1079
+ if strip_dir:
1080
+ basename = os.path.basename(basename)
1081
+ return os.path.join(output_dir, basename + self.shared_lib_extension)
1082
+
1083
+ @overload
1084
+ def executable_filename(
1085
+ self,
1086
+ basename: str,
1087
+ strip_dir: Literal[False] = False,
1088
+ output_dir: str | os.PathLike[str] = "",
1089
+ ) -> str: ...
1090
+ @overload
1091
+ def executable_filename(
1092
+ self,
1093
+ basename: str | os.PathLike[str],
1094
+ strip_dir: Literal[True],
1095
+ output_dir: str | os.PathLike[str] = "",
1096
+ ) -> str: ...
1097
+ def executable_filename(
1098
+ self,
1099
+ basename: str | os.PathLike[str],
1100
+ strip_dir: bool = False,
1101
+ output_dir: str | os.PathLike[str] = '',
1102
+ ) -> str:
1103
+ assert output_dir is not None
1104
+ if strip_dir:
1105
+ basename = os.path.basename(basename)
1106
+ return os.path.join(output_dir, basename + (self.exe_extension or ''))
1107
+
1108
+ def library_filename(
1109
+ self,
1110
+ libname: str,
1111
+ lib_type: str = "static",
1112
+ strip_dir: bool = False,
1113
+ output_dir: str | os.PathLike[str] = "", # or 'shared'
1114
+ ):
1115
+ assert output_dir is not None
1116
+ expected = '"static", "shared", "dylib", "xcode_stub"'
1117
+ if lib_type not in eval(expected):
1118
+ raise ValueError(f"'lib_type' must be {expected}")
1119
+ fmt = getattr(self, lib_type + "_lib_format")
1120
+ ext = getattr(self, lib_type + "_lib_extension")
1121
+
1122
+ dir, base = os.path.split(libname)
1123
+ filename = fmt % (base, ext)
1124
+ if strip_dir:
1125
+ dir = ''
1126
+
1127
+ return os.path.join(output_dir, dir, filename)
1128
+
1129
+ # -- Utility methods -----------------------------------------------
1130
+
1131
+ def announce(self, msg: object, level: int = 1) -> None:
1132
+ log.debug(msg)
1133
+
1134
+ def debug_print(self, msg: object) -> None:
1135
+ from distutils.debug import DEBUG
1136
+
1137
+ if DEBUG:
1138
+ print(msg)
1139
+
1140
+ def warn(self, msg: object) -> None:
1141
+ sys.stderr.write(f"warning: {msg}\n")
1142
+
1143
+ def execute(
1144
+ self,
1145
+ func: Callable[[Unpack[_Ts]], object],
1146
+ args: tuple[Unpack[_Ts]],
1147
+ msg: object = None,
1148
+ level: int = 1,
1149
+ ) -> None:
1150
+ execute(func, args, msg, self.dry_run)
1151
+
1152
+ def spawn(
1153
+ self, cmd: MutableSequence[bytes | str | os.PathLike[str]], **kwargs
1154
+ ) -> None:
1155
+ spawn(cmd, dry_run=self.dry_run, **kwargs)
1156
+
1157
+ @overload
1158
+ def move_file(
1159
+ self, src: str | os.PathLike[str], dst: _StrPathT
1160
+ ) -> _StrPathT | str: ...
1161
+ @overload
1162
+ def move_file(
1163
+ self, src: bytes | os.PathLike[bytes], dst: _BytesPathT
1164
+ ) -> _BytesPathT | bytes: ...
1165
+ def move_file(
1166
+ self,
1167
+ src: str | os.PathLike[str] | bytes | os.PathLike[bytes],
1168
+ dst: str | os.PathLike[str] | bytes | os.PathLike[bytes],
1169
+ ) -> str | os.PathLike[str] | bytes | os.PathLike[bytes]:
1170
+ return move_file(src, dst, dry_run=self.dry_run)
1171
+
1172
+ def mkpath(self, name, mode=0o777):
1173
+ mkpath(name, mode, dry_run=self.dry_run)
1174
+
1175
+
1176
+ # Map a sys.platform/os.name ('posix', 'nt') to the default compiler
1177
+ # type for that platform. Keys are interpreted as re match
1178
+ # patterns. Order is important; platform mappings are preferred over
1179
+ # OS names.
1180
+ _default_compilers = (
1181
+ # Platform string mappings
1182
+ # on a cygwin built python we can use gcc like an ordinary UNIXish
1183
+ # compiler
1184
+ ('cygwin.*', 'unix'),
1185
+ ('zos', 'zos'),
1186
+ # OS name mappings
1187
+ ('posix', 'unix'),
1188
+ ('nt', 'msvc'),
1189
+ )
1190
+
1191
+
1192
+ def get_default_compiler(osname: str | None = None, platform: str | None = None) -> str:
1193
+ """Determine the default compiler to use for the given platform.
1194
+
1195
+ osname should be one of the standard Python OS names (i.e. the
1196
+ ones returned by os.name) and platform the common value
1197
+ returned by sys.platform for the platform in question.
1198
+
1199
+ The default values are os.name and sys.platform in case the
1200
+ parameters are not given.
1201
+ """
1202
+ if osname is None:
1203
+ osname = os.name
1204
+ if platform is None:
1205
+ platform = sys.platform
1206
+ # Mingw is a special case where sys.platform is 'win32' but we
1207
+ # want to use the 'mingw32' compiler, so check it first
1208
+ if is_mingw():
1209
+ return 'mingw32'
1210
+ for pattern, compiler in _default_compilers:
1211
+ if (
1212
+ re.match(pattern, platform) is not None
1213
+ or re.match(pattern, osname) is not None
1214
+ ):
1215
+ return compiler
1216
+ # Default to Unix compiler
1217
+ return 'unix'
1218
+
1219
+
1220
+ # Map compiler types to (module_name, class_name) pairs -- ie. where to
1221
+ # find the code that implements an interface to this compiler. (The module
1222
+ # is assumed to be in the 'distutils' package.)
1223
+ compiler_class = {
1224
+ 'unix': ('unixccompiler', 'UnixCCompiler', "standard UNIX-style compiler"),
1225
+ 'msvc': ('_msvccompiler', 'MSVCCompiler', "Microsoft Visual C++"),
1226
+ 'cygwin': (
1227
+ 'cygwinccompiler',
1228
+ 'CygwinCCompiler',
1229
+ "Cygwin port of GNU C Compiler for Win32",
1230
+ ),
1231
+ 'mingw32': (
1232
+ 'cygwinccompiler',
1233
+ 'Mingw32CCompiler',
1234
+ "Mingw32 port of GNU C Compiler for Win32",
1235
+ ),
1236
+ 'bcpp': ('bcppcompiler', 'BCPPCompiler', "Borland C++ Compiler"),
1237
+ 'zos': ('zosccompiler', 'zOSCCompiler', 'IBM XL C/C++ Compilers'),
1238
+ }
1239
+
1240
+
1241
+ def show_compilers() -> None:
1242
+ """Print list of available compilers (used by the "--help-compiler"
1243
+ options to "build", "build_ext", "build_clib").
1244
+ """
1245
+ # XXX this "knows" that the compiler option it's describing is
1246
+ # "--compiler", which just happens to be the case for the three
1247
+ # commands that use it.
1248
+ from distutils.fancy_getopt import FancyGetopt
1249
+
1250
+ compilers = sorted(
1251
+ ("compiler=" + compiler, None, compiler_class[compiler][2])
1252
+ for compiler in compiler_class.keys()
1253
+ )
1254
+ pretty_printer = FancyGetopt(compilers)
1255
+ pretty_printer.print_help("List of available compilers:")
1256
+
1257
+
1258
+ def new_compiler(
1259
+ plat: str | None = None,
1260
+ compiler: str | None = None,
1261
+ verbose: bool = False,
1262
+ dry_run: bool = False,
1263
+ force: bool = False,
1264
+ ) -> Compiler:
1265
+ """Generate an instance of some CCompiler subclass for the supplied
1266
+ platform/compiler combination. 'plat' defaults to 'os.name'
1267
+ (eg. 'posix', 'nt'), and 'compiler' defaults to the default compiler
1268
+ for that platform. Currently only 'posix' and 'nt' are supported, and
1269
+ the default compilers are "traditional Unix interface" (UnixCCompiler
1270
+ class) and Visual C++ (MSVCCompiler class). Note that it's perfectly
1271
+ possible to ask for a Unix compiler object under Windows, and a
1272
+ Microsoft compiler object under Unix -- if you supply a value for
1273
+ 'compiler', 'plat' is ignored.
1274
+ """
1275
+ if plat is None:
1276
+ plat = os.name
1277
+
1278
+ try:
1279
+ if compiler is None:
1280
+ compiler = get_default_compiler(plat)
1281
+
1282
+ (module_name, class_name, long_description) = compiler_class[compiler]
1283
+ except KeyError:
1284
+ msg = f"don't know how to compile C/C++ code on platform '{plat}'"
1285
+ if compiler is not None:
1286
+ msg = msg + f" with '{compiler}' compiler"
1287
+ raise DistutilsPlatformError(msg)
1288
+
1289
+ try:
1290
+ module_name = "distutils." + module_name
1291
+ __import__(module_name)
1292
+ module = sys.modules[module_name]
1293
+ klass = vars(module)[class_name]
1294
+ except ImportError:
1295
+ raise DistutilsModuleError(
1296
+ f"can't compile C/C++ code: unable to load module '{module_name}'"
1297
+ )
1298
+ except KeyError:
1299
+ raise DistutilsModuleError(
1300
+ f"can't compile C/C++ code: unable to find class '{class_name}' "
1301
+ f"in module '{module_name}'"
1302
+ )
1303
+
1304
+ # XXX The None is necessary to preserve backwards compatibility
1305
+ # with classes that expect verbose to be the first positional
1306
+ # argument.
1307
+ return klass(None, dry_run, force)
1308
+
1309
+
1310
+ def gen_preprocess_options(
1311
+ macros: Iterable[_Macro], include_dirs: Iterable[str]
1312
+ ) -> list[str]:
1313
+ """Generate C pre-processor options (-D, -U, -I) as used by at least
1314
+ two types of compilers: the typical Unix compiler and Visual C++.
1315
+ 'macros' is the usual thing, a list of 1- or 2-tuples, where (name,)
1316
+ means undefine (-U) macro 'name', and (name,value) means define (-D)
1317
+ macro 'name' to 'value'. 'include_dirs' is just a list of directory
1318
+ names to be added to the header file search path (-I). Returns a list
1319
+ of command-line options suitable for either Unix compilers or Visual
1320
+ C++.
1321
+ """
1322
+ # XXX it would be nice (mainly aesthetic, and so we don't generate
1323
+ # stupid-looking command lines) to go over 'macros' and eliminate
1324
+ # redundant definitions/undefinitions (ie. ensure that only the
1325
+ # latest mention of a particular macro winds up on the command
1326
+ # line). I don't think it's essential, though, since most (all?)
1327
+ # Unix C compilers only pay attention to the latest -D or -U
1328
+ # mention of a macro on their command line. Similar situation for
1329
+ # 'include_dirs'. I'm punting on both for now. Anyways, weeding out
1330
+ # redundancies like this should probably be the province of
1331
+ # CCompiler, since the data structures used are inherited from it
1332
+ # and therefore common to all CCompiler classes.
1333
+ pp_opts = []
1334
+ for macro in macros:
1335
+ if not (isinstance(macro, tuple) and 1 <= len(macro) <= 2):
1336
+ raise TypeError(
1337
+ f"bad macro definition '{macro}': "
1338
+ "each element of 'macros' list must be a 1- or 2-tuple"
1339
+ )
1340
+
1341
+ if len(macro) == 1: # undefine this macro
1342
+ pp_opts.append(f"-U{macro[0]}")
1343
+ elif len(macro) == 2:
1344
+ if macro[1] is None: # define with no explicit value
1345
+ pp_opts.append(f"-D{macro[0]}")
1346
+ else:
1347
+ # XXX *don't* need to be clever about quoting the
1348
+ # macro value here, because we're going to avoid the
1349
+ # shell at all costs when we spawn the command!
1350
+ pp_opts.append("-D{}={}".format(*macro))
1351
+
1352
+ pp_opts.extend(f"-I{dir}" for dir in include_dirs)
1353
+ return pp_opts
1354
+
1355
+
1356
+ def gen_lib_options(
1357
+ compiler: Compiler,
1358
+ library_dirs: Iterable[str],
1359
+ runtime_library_dirs: Iterable[str],
1360
+ libraries: Iterable[str],
1361
+ ) -> list[str]:
1362
+ """Generate linker options for searching library directories and
1363
+ linking with specific libraries. 'libraries' and 'library_dirs' are,
1364
+ respectively, lists of library names (not filenames!) and search
1365
+ directories. Returns a list of command-line options suitable for use
1366
+ with some compiler (depending on the two format strings passed in).
1367
+ """
1368
+ lib_opts = [compiler.library_dir_option(dir) for dir in library_dirs]
1369
+
1370
+ for dir in runtime_library_dirs:
1371
+ lib_opts.extend(always_iterable(compiler.runtime_library_dir_option(dir)))
1372
+
1373
+ # XXX it's important that we *not* remove redundant library mentions!
1374
+ # sometimes you really do have to say "-lfoo -lbar -lfoo" in order to
1375
+ # resolve all symbols. I just hope we never have to say "-lfoo obj.o
1376
+ # -lbar" to get things to work -- that's certainly a possibility, but a
1377
+ # pretty nasty way to arrange your C code.
1378
+
1379
+ for lib in libraries:
1380
+ (lib_dir, lib_name) = os.path.split(lib)
1381
+ if lib_dir:
1382
+ lib_file = compiler.find_library_file([lib_dir], lib_name)
1383
+ if lib_file:
1384
+ lib_opts.append(lib_file)
1385
+ else:
1386
+ compiler.warn(
1387
+ f"no library file corresponding to '{lib}' found (skipping)"
1388
+ )
1389
+ else:
1390
+ lib_opts.append(compiler.library_option(lib))
1391
+ return lib_opts