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