android-notify 1.60.0__py3-none-any.whl → 1.60.2__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.

Potentially problematic release.


This version of android-notify might be problematic. Click here for more details.

Files changed (375) hide show
  1. android_notify/config.py +1 -1
  2. {android_notify-1.60.0.dist-info → android_notify-1.60.2.dist-info}/METADATA +4 -4
  3. {android_notify-1.60.0.dist-info → android_notify-1.60.2.dist-info}/RECORD +375 -6
  4. venv/Lib/site-packages/_distutils_hack/__init__.py +239 -0
  5. venv/Lib/site-packages/_distutils_hack/override.py +1 -0
  6. venv/Lib/site-packages/pkg_resources/__init__.py +3713 -0
  7. venv/Lib/site-packages/pkg_resources/py.typed +0 -0
  8. venv/Lib/site-packages/pkg_resources/tests/__init__.py +0 -0
  9. venv/Lib/site-packages/pkg_resources/tests/data/my-test-package-source/setup.py +7 -0
  10. venv/Lib/site-packages/pkg_resources/tests/test_find_distributions.py +56 -0
  11. venv/Lib/site-packages/pkg_resources/tests/test_integration_zope_interface.py +54 -0
  12. venv/Lib/site-packages/pkg_resources/tests/test_markers.py +8 -0
  13. venv/Lib/site-packages/pkg_resources/tests/test_pkg_resources.py +485 -0
  14. venv/Lib/site-packages/pkg_resources/tests/test_resources.py +869 -0
  15. venv/Lib/site-packages/pkg_resources/tests/test_working_set.py +505 -0
  16. venv/Lib/site-packages/setuptools/__init__.py +248 -0
  17. venv/Lib/site-packages/setuptools/_core_metadata.py +337 -0
  18. venv/Lib/site-packages/setuptools/_discovery.py +33 -0
  19. venv/Lib/site-packages/setuptools/_distutils/__init__.py +14 -0
  20. venv/Lib/site-packages/setuptools/_distutils/_log.py +3 -0
  21. venv/Lib/site-packages/setuptools/_distutils/_macos_compat.py +12 -0
  22. venv/Lib/site-packages/setuptools/_distutils/_modified.py +95 -0
  23. venv/Lib/site-packages/setuptools/_distutils/_msvccompiler.py +16 -0
  24. venv/Lib/site-packages/setuptools/_distutils/archive_util.py +294 -0
  25. venv/Lib/site-packages/setuptools/_distutils/ccompiler.py +26 -0
  26. venv/Lib/site-packages/setuptools/_distutils/cmd.py +554 -0
  27. venv/Lib/site-packages/setuptools/_distutils/command/__init__.py +23 -0
  28. venv/Lib/site-packages/setuptools/_distutils/command/_framework_compat.py +54 -0
  29. venv/Lib/site-packages/setuptools/_distutils/command/bdist.py +167 -0
  30. venv/Lib/site-packages/setuptools/_distutils/command/bdist_dumb.py +141 -0
  31. venv/Lib/site-packages/setuptools/_distutils/command/bdist_rpm.py +598 -0
  32. venv/Lib/site-packages/setuptools/_distutils/command/build.py +156 -0
  33. venv/Lib/site-packages/setuptools/_distutils/command/build_clib.py +201 -0
  34. venv/Lib/site-packages/setuptools/_distutils/command/build_ext.py +812 -0
  35. venv/Lib/site-packages/setuptools/_distutils/command/build_py.py +407 -0
  36. venv/Lib/site-packages/setuptools/_distutils/command/build_scripts.py +160 -0
  37. venv/Lib/site-packages/setuptools/_distutils/command/check.py +152 -0
  38. venv/Lib/site-packages/setuptools/_distutils/command/clean.py +77 -0
  39. venv/Lib/site-packages/setuptools/_distutils/command/config.py +358 -0
  40. venv/Lib/site-packages/setuptools/_distutils/command/install.py +805 -0
  41. venv/Lib/site-packages/setuptools/_distutils/command/install_data.py +94 -0
  42. venv/Lib/site-packages/setuptools/_distutils/command/install_egg_info.py +91 -0
  43. venv/Lib/site-packages/setuptools/_distutils/command/install_headers.py +46 -0
  44. venv/Lib/site-packages/setuptools/_distutils/command/install_lib.py +238 -0
  45. venv/Lib/site-packages/setuptools/_distutils/command/install_scripts.py +62 -0
  46. venv/Lib/site-packages/setuptools/_distutils/command/sdist.py +521 -0
  47. venv/Lib/site-packages/setuptools/_distutils/compat/__init__.py +18 -0
  48. venv/Lib/site-packages/setuptools/_distutils/compat/numpy.py +2 -0
  49. venv/Lib/site-packages/setuptools/_distutils/compat/py39.py +66 -0
  50. venv/Lib/site-packages/setuptools/_distutils/compilers/C/base.py +1394 -0
  51. venv/Lib/site-packages/setuptools/_distutils/compilers/C/cygwin.py +340 -0
  52. venv/Lib/site-packages/setuptools/_distutils/compilers/C/errors.py +24 -0
  53. venv/Lib/site-packages/setuptools/_distutils/compilers/C/msvc.py +614 -0
  54. venv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_base.py +83 -0
  55. venv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_cygwin.py +76 -0
  56. venv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_mingw.py +48 -0
  57. venv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_msvc.py +136 -0
  58. venv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_unix.py +413 -0
  59. venv/Lib/site-packages/setuptools/_distutils/compilers/C/unix.py +422 -0
  60. venv/Lib/site-packages/setuptools/_distutils/compilers/C/zos.py +230 -0
  61. venv/Lib/site-packages/setuptools/_distutils/core.py +289 -0
  62. venv/Lib/site-packages/setuptools/_distutils/cygwinccompiler.py +31 -0
  63. venv/Lib/site-packages/setuptools/_distutils/debug.py +5 -0
  64. venv/Lib/site-packages/setuptools/_distutils/dep_util.py +14 -0
  65. venv/Lib/site-packages/setuptools/_distutils/dir_util.py +244 -0
  66. venv/Lib/site-packages/setuptools/_distutils/dist.py +1386 -0
  67. venv/Lib/site-packages/setuptools/_distutils/errors.py +108 -0
  68. venv/Lib/site-packages/setuptools/_distutils/extension.py +258 -0
  69. venv/Lib/site-packages/setuptools/_distutils/fancy_getopt.py +471 -0
  70. venv/Lib/site-packages/setuptools/_distutils/file_util.py +236 -0
  71. venv/Lib/site-packages/setuptools/_distutils/filelist.py +431 -0
  72. venv/Lib/site-packages/setuptools/_distutils/log.py +56 -0
  73. venv/Lib/site-packages/setuptools/_distutils/spawn.py +134 -0
  74. venv/Lib/site-packages/setuptools/_distutils/sysconfig.py +598 -0
  75. venv/Lib/site-packages/setuptools/_distutils/tests/__init__.py +42 -0
  76. venv/Lib/site-packages/setuptools/_distutils/tests/compat/__init__.py +0 -0
  77. venv/Lib/site-packages/setuptools/_distutils/tests/compat/py39.py +40 -0
  78. venv/Lib/site-packages/setuptools/_distutils/tests/support.py +134 -0
  79. venv/Lib/site-packages/setuptools/_distutils/tests/test_archive_util.py +353 -0
  80. venv/Lib/site-packages/setuptools/_distutils/tests/test_bdist.py +47 -0
  81. venv/Lib/site-packages/setuptools/_distutils/tests/test_bdist_dumb.py +78 -0
  82. venv/Lib/site-packages/setuptools/_distutils/tests/test_bdist_rpm.py +127 -0
  83. venv/Lib/site-packages/setuptools/_distutils/tests/test_build.py +49 -0
  84. venv/Lib/site-packages/setuptools/_distutils/tests/test_build_clib.py +134 -0
  85. venv/Lib/site-packages/setuptools/_distutils/tests/test_build_ext.py +628 -0
  86. venv/Lib/site-packages/setuptools/_distutils/tests/test_build_py.py +196 -0
  87. venv/Lib/site-packages/setuptools/_distutils/tests/test_build_scripts.py +96 -0
  88. venv/Lib/site-packages/setuptools/_distutils/tests/test_check.py +194 -0
  89. venv/Lib/site-packages/setuptools/_distutils/tests/test_clean.py +45 -0
  90. venv/Lib/site-packages/setuptools/_distutils/tests/test_cmd.py +107 -0
  91. venv/Lib/site-packages/setuptools/_distutils/tests/test_config_cmd.py +87 -0
  92. venv/Lib/site-packages/setuptools/_distutils/tests/test_core.py +130 -0
  93. venv/Lib/site-packages/setuptools/_distutils/tests/test_dir_util.py +139 -0
  94. venv/Lib/site-packages/setuptools/_distutils/tests/test_dist.py +552 -0
  95. venv/Lib/site-packages/setuptools/_distutils/tests/test_extension.py +117 -0
  96. venv/Lib/site-packages/setuptools/_distutils/tests/test_file_util.py +95 -0
  97. venv/Lib/site-packages/setuptools/_distutils/tests/test_filelist.py +336 -0
  98. venv/Lib/site-packages/setuptools/_distutils/tests/test_install.py +245 -0
  99. venv/Lib/site-packages/setuptools/_distutils/tests/test_install_data.py +74 -0
  100. venv/Lib/site-packages/setuptools/_distutils/tests/test_install_headers.py +33 -0
  101. venv/Lib/site-packages/setuptools/_distutils/tests/test_install_lib.py +110 -0
  102. venv/Lib/site-packages/setuptools/_distutils/tests/test_install_scripts.py +52 -0
  103. venv/Lib/site-packages/setuptools/_distutils/tests/test_log.py +12 -0
  104. venv/Lib/site-packages/setuptools/_distutils/tests/test_modified.py +126 -0
  105. venv/Lib/site-packages/setuptools/_distutils/tests/test_sdist.py +470 -0
  106. venv/Lib/site-packages/setuptools/_distutils/tests/test_spawn.py +141 -0
  107. venv/Lib/site-packages/setuptools/_distutils/tests/test_sysconfig.py +319 -0
  108. venv/Lib/site-packages/setuptools/_distutils/tests/test_text_file.py +127 -0
  109. venv/Lib/site-packages/setuptools/_distutils/tests/test_util.py +243 -0
  110. venv/Lib/site-packages/setuptools/_distutils/tests/test_version.py +80 -0
  111. venv/Lib/site-packages/setuptools/_distutils/tests/test_versionpredicate.py +0 -0
  112. venv/Lib/site-packages/setuptools/_distutils/tests/unix_compat.py +17 -0
  113. venv/Lib/site-packages/setuptools/_distutils/text_file.py +286 -0
  114. venv/Lib/site-packages/setuptools/_distutils/unixccompiler.py +9 -0
  115. venv/Lib/site-packages/setuptools/_distutils/util.py +518 -0
  116. venv/Lib/site-packages/setuptools/_distutils/version.py +348 -0
  117. venv/Lib/site-packages/setuptools/_distutils/versionpredicate.py +175 -0
  118. venv/Lib/site-packages/setuptools/_distutils/zosccompiler.py +3 -0
  119. venv/Lib/site-packages/setuptools/_entry_points.py +94 -0
  120. venv/Lib/site-packages/setuptools/_imp.py +87 -0
  121. venv/Lib/site-packages/setuptools/_importlib.py +9 -0
  122. venv/Lib/site-packages/setuptools/_itertools.py +23 -0
  123. venv/Lib/site-packages/setuptools/_normalization.py +177 -0
  124. venv/Lib/site-packages/setuptools/_path.py +93 -0
  125. venv/Lib/site-packages/setuptools/_reqs.py +42 -0
  126. venv/Lib/site-packages/setuptools/_scripts.py +361 -0
  127. venv/Lib/site-packages/setuptools/_shutil.py +59 -0
  128. venv/Lib/site-packages/setuptools/_static.py +188 -0
  129. venv/Lib/site-packages/setuptools/_vendor/autocommand/__init__.py +27 -0
  130. venv/Lib/site-packages/setuptools/_vendor/autocommand/autoasync.py +142 -0
  131. venv/Lib/site-packages/setuptools/_vendor/autocommand/autocommand.py +70 -0
  132. venv/Lib/site-packages/setuptools/_vendor/autocommand/automain.py +59 -0
  133. venv/Lib/site-packages/setuptools/_vendor/autocommand/autoparse.py +333 -0
  134. venv/Lib/site-packages/setuptools/_vendor/autocommand/errors.py +23 -0
  135. venv/Lib/site-packages/setuptools/_vendor/backports/__init__.py +1 -0
  136. venv/Lib/site-packages/setuptools/_vendor/backports/tarfile/__init__.py +2937 -0
  137. venv/Lib/site-packages/setuptools/_vendor/backports/tarfile/__main__.py +5 -0
  138. venv/Lib/site-packages/setuptools/_vendor/backports/tarfile/compat/__init__.py +0 -0
  139. venv/Lib/site-packages/setuptools/_vendor/backports/tarfile/compat/py38.py +24 -0
  140. venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/__init__.py +1083 -0
  141. venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_adapters.py +83 -0
  142. venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_collections.py +30 -0
  143. venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_compat.py +57 -0
  144. venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_functools.py +104 -0
  145. venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py +73 -0
  146. venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_meta.py +67 -0
  147. venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_text.py +99 -0
  148. venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/compat/__init__.py +0 -0
  149. venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/compat/py311.py +22 -0
  150. venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/compat/py39.py +36 -0
  151. venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/diagnose.py +21 -0
  152. venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/py.typed +0 -0
  153. venv/Lib/site-packages/setuptools/_vendor/inflect/__init__.py +3986 -0
  154. venv/Lib/site-packages/setuptools/_vendor/inflect/compat/__init__.py +0 -0
  155. venv/Lib/site-packages/setuptools/_vendor/inflect/compat/py38.py +7 -0
  156. venv/Lib/site-packages/setuptools/_vendor/inflect/py.typed +0 -0
  157. venv/Lib/site-packages/setuptools/_vendor/jaraco/collections/__init__.py +1091 -0
  158. venv/Lib/site-packages/setuptools/_vendor/jaraco/collections/py.typed +0 -0
  159. venv/Lib/site-packages/setuptools/_vendor/jaraco/context.py +361 -0
  160. venv/Lib/site-packages/setuptools/_vendor/jaraco/functools/__init__.py +633 -0
  161. venv/Lib/site-packages/setuptools/_vendor/jaraco/functools/__init__.pyi +125 -0
  162. venv/Lib/site-packages/setuptools/_vendor/jaraco/functools/py.typed +0 -0
  163. venv/Lib/site-packages/setuptools/_vendor/jaraco/text/__init__.py +624 -0
  164. venv/Lib/site-packages/setuptools/_vendor/jaraco/text/layouts.py +25 -0
  165. venv/Lib/site-packages/setuptools/_vendor/jaraco/text/show-newlines.py +33 -0
  166. venv/Lib/site-packages/setuptools/_vendor/jaraco/text/strip-prefix.py +21 -0
  167. venv/Lib/site-packages/setuptools/_vendor/jaraco/text/to-dvorak.py +6 -0
  168. venv/Lib/site-packages/setuptools/_vendor/jaraco/text/to-qwerty.py +6 -0
  169. venv/Lib/site-packages/setuptools/_vendor/more_itertools/__init__.py +6 -0
  170. venv/Lib/site-packages/setuptools/_vendor/more_itertools/__init__.pyi +2 -0
  171. venv/Lib/site-packages/setuptools/_vendor/more_itertools/more.py +4806 -0
  172. venv/Lib/site-packages/setuptools/_vendor/more_itertools/more.pyi +709 -0
  173. venv/Lib/site-packages/setuptools/_vendor/more_itertools/py.typed +0 -0
  174. venv/Lib/site-packages/setuptools/_vendor/more_itertools/recipes.py +1046 -0
  175. venv/Lib/site-packages/setuptools/_vendor/more_itertools/recipes.pyi +136 -0
  176. venv/Lib/site-packages/setuptools/_vendor/packaging/__init__.py +15 -0
  177. venv/Lib/site-packages/setuptools/_vendor/packaging/_elffile.py +110 -0
  178. venv/Lib/site-packages/setuptools/_vendor/packaging/_manylinux.py +263 -0
  179. venv/Lib/site-packages/setuptools/_vendor/packaging/_musllinux.py +85 -0
  180. venv/Lib/site-packages/setuptools/_vendor/packaging/_parser.py +354 -0
  181. venv/Lib/site-packages/setuptools/_vendor/packaging/_structures.py +61 -0
  182. venv/Lib/site-packages/setuptools/_vendor/packaging/_tokenizer.py +194 -0
  183. venv/Lib/site-packages/setuptools/_vendor/packaging/licenses/__init__.py +145 -0
  184. venv/Lib/site-packages/setuptools/_vendor/packaging/licenses/_spdx.py +759 -0
  185. venv/Lib/site-packages/setuptools/_vendor/packaging/markers.py +331 -0
  186. venv/Lib/site-packages/setuptools/_vendor/packaging/metadata.py +863 -0
  187. venv/Lib/site-packages/setuptools/_vendor/packaging/py.typed +0 -0
  188. venv/Lib/site-packages/setuptools/_vendor/packaging/requirements.py +91 -0
  189. venv/Lib/site-packages/setuptools/_vendor/packaging/specifiers.py +1020 -0
  190. venv/Lib/site-packages/setuptools/_vendor/packaging/tags.py +617 -0
  191. venv/Lib/site-packages/setuptools/_vendor/packaging/utils.py +163 -0
  192. venv/Lib/site-packages/setuptools/_vendor/packaging/version.py +582 -0
  193. venv/Lib/site-packages/setuptools/_vendor/platformdirs/__init__.py +627 -0
  194. venv/Lib/site-packages/setuptools/_vendor/platformdirs/__main__.py +55 -0
  195. venv/Lib/site-packages/setuptools/_vendor/platformdirs/android.py +249 -0
  196. venv/Lib/site-packages/setuptools/_vendor/platformdirs/api.py +292 -0
  197. venv/Lib/site-packages/setuptools/_vendor/platformdirs/macos.py +130 -0
  198. venv/Lib/site-packages/setuptools/_vendor/platformdirs/py.typed +0 -0
  199. venv/Lib/site-packages/setuptools/_vendor/platformdirs/unix.py +275 -0
  200. venv/Lib/site-packages/setuptools/_vendor/platformdirs/version.py +16 -0
  201. venv/Lib/site-packages/setuptools/_vendor/platformdirs/windows.py +272 -0
  202. venv/Lib/site-packages/setuptools/_vendor/tomli/__init__.py +11 -0
  203. venv/Lib/site-packages/setuptools/_vendor/tomli/_parser.py +691 -0
  204. venv/Lib/site-packages/setuptools/_vendor/tomli/_re.py +107 -0
  205. venv/Lib/site-packages/setuptools/_vendor/tomli/_types.py +10 -0
  206. venv/Lib/site-packages/setuptools/_vendor/tomli/py.typed +1 -0
  207. venv/Lib/site-packages/setuptools/_vendor/typeguard/__init__.py +48 -0
  208. venv/Lib/site-packages/setuptools/_vendor/typeguard/_checkers.py +993 -0
  209. venv/Lib/site-packages/setuptools/_vendor/typeguard/_config.py +108 -0
  210. venv/Lib/site-packages/setuptools/_vendor/typeguard/_decorators.py +235 -0
  211. venv/Lib/site-packages/setuptools/_vendor/typeguard/_exceptions.py +42 -0
  212. venv/Lib/site-packages/setuptools/_vendor/typeguard/_functions.py +308 -0
  213. venv/Lib/site-packages/setuptools/_vendor/typeguard/_importhook.py +213 -0
  214. venv/Lib/site-packages/setuptools/_vendor/typeguard/_memo.py +48 -0
  215. venv/Lib/site-packages/setuptools/_vendor/typeguard/_pytest_plugin.py +127 -0
  216. venv/Lib/site-packages/setuptools/_vendor/typeguard/_suppression.py +86 -0
  217. venv/Lib/site-packages/setuptools/_vendor/typeguard/_transformer.py +1229 -0
  218. venv/Lib/site-packages/setuptools/_vendor/typeguard/_union_transformer.py +55 -0
  219. venv/Lib/site-packages/setuptools/_vendor/typeguard/_utils.py +173 -0
  220. venv/Lib/site-packages/setuptools/_vendor/typeguard/py.typed +0 -0
  221. venv/Lib/site-packages/setuptools/_vendor/typing_extensions.py +3641 -0
  222. venv/Lib/site-packages/setuptools/_vendor/wheel/__init__.py +3 -0
  223. venv/Lib/site-packages/setuptools/_vendor/wheel/__main__.py +23 -0
  224. venv/Lib/site-packages/setuptools/_vendor/wheel/_bdist_wheel.py +613 -0
  225. venv/Lib/site-packages/setuptools/_vendor/wheel/_setuptools_logging.py +26 -0
  226. venv/Lib/site-packages/setuptools/_vendor/wheel/bdist_wheel.py +26 -0
  227. venv/Lib/site-packages/setuptools/_vendor/wheel/cli/__init__.py +155 -0
  228. venv/Lib/site-packages/setuptools/_vendor/wheel/cli/convert.py +332 -0
  229. venv/Lib/site-packages/setuptools/_vendor/wheel/cli/pack.py +85 -0
  230. venv/Lib/site-packages/setuptools/_vendor/wheel/cli/tags.py +139 -0
  231. venv/Lib/site-packages/setuptools/_vendor/wheel/cli/unpack.py +30 -0
  232. venv/Lib/site-packages/setuptools/_vendor/wheel/macosx_libfile.py +482 -0
  233. venv/Lib/site-packages/setuptools/_vendor/wheel/metadata.py +183 -0
  234. venv/Lib/site-packages/setuptools/_vendor/wheel/util.py +17 -0
  235. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/__init__.py +0 -0
  236. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/__init__.py +0 -0
  237. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/_elffile.py +108 -0
  238. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/_manylinux.py +260 -0
  239. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/_musllinux.py +83 -0
  240. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/_parser.py +356 -0
  241. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/_structures.py +61 -0
  242. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/_tokenizer.py +192 -0
  243. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/markers.py +253 -0
  244. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/requirements.py +90 -0
  245. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/specifiers.py +1011 -0
  246. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/tags.py +571 -0
  247. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/utils.py +172 -0
  248. venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/version.py +561 -0
  249. venv/Lib/site-packages/setuptools/_vendor/wheel/wheelfile.py +227 -0
  250. venv/Lib/site-packages/setuptools/_vendor/zipp/__init__.py +501 -0
  251. venv/Lib/site-packages/setuptools/_vendor/zipp/compat/__init__.py +0 -0
  252. venv/Lib/site-packages/setuptools/_vendor/zipp/compat/py310.py +11 -0
  253. venv/Lib/site-packages/setuptools/_vendor/zipp/glob.py +106 -0
  254. venv/Lib/site-packages/setuptools/archive_util.py +219 -0
  255. venv/Lib/site-packages/setuptools/build_meta.py +548 -0
  256. venv/Lib/site-packages/setuptools/command/__init__.py +21 -0
  257. venv/Lib/site-packages/setuptools/command/_requirestxt.py +131 -0
  258. venv/Lib/site-packages/setuptools/command/alias.py +77 -0
  259. venv/Lib/site-packages/setuptools/command/bdist_egg.py +477 -0
  260. venv/Lib/site-packages/setuptools/command/bdist_rpm.py +42 -0
  261. venv/Lib/site-packages/setuptools/command/bdist_wheel.py +604 -0
  262. venv/Lib/site-packages/setuptools/command/build.py +135 -0
  263. venv/Lib/site-packages/setuptools/command/build_clib.py +103 -0
  264. venv/Lib/site-packages/setuptools/command/build_ext.py +470 -0
  265. venv/Lib/site-packages/setuptools/command/build_py.py +400 -0
  266. venv/Lib/site-packages/setuptools/command/develop.py +55 -0
  267. venv/Lib/site-packages/setuptools/command/dist_info.py +103 -0
  268. venv/Lib/site-packages/setuptools/command/easy_install.py +30 -0
  269. venv/Lib/site-packages/setuptools/command/editable_wheel.py +908 -0
  270. venv/Lib/site-packages/setuptools/command/egg_info.py +718 -0
  271. venv/Lib/site-packages/setuptools/command/install.py +131 -0
  272. venv/Lib/site-packages/setuptools/command/install_egg_info.py +58 -0
  273. venv/Lib/site-packages/setuptools/command/install_lib.py +137 -0
  274. venv/Lib/site-packages/setuptools/command/install_scripts.py +67 -0
  275. venv/Lib/site-packages/setuptools/command/rotate.py +65 -0
  276. venv/Lib/site-packages/setuptools/command/saveopts.py +21 -0
  277. venv/Lib/site-packages/setuptools/command/sdist.py +217 -0
  278. venv/Lib/site-packages/setuptools/command/setopt.py +141 -0
  279. venv/Lib/site-packages/setuptools/command/test.py +45 -0
  280. venv/Lib/site-packages/setuptools/compat/__init__.py +0 -0
  281. venv/Lib/site-packages/setuptools/compat/py310.py +20 -0
  282. venv/Lib/site-packages/setuptools/compat/py311.py +27 -0
  283. venv/Lib/site-packages/setuptools/compat/py312.py +13 -0
  284. venv/Lib/site-packages/setuptools/compat/py39.py +9 -0
  285. venv/Lib/site-packages/setuptools/config/__init__.py +43 -0
  286. venv/Lib/site-packages/setuptools/config/_apply_pyprojecttoml.py +526 -0
  287. venv/Lib/site-packages/setuptools/config/_validate_pyproject/__init__.py +34 -0
  288. venv/Lib/site-packages/setuptools/config/_validate_pyproject/error_reporting.py +336 -0
  289. venv/Lib/site-packages/setuptools/config/_validate_pyproject/extra_validations.py +82 -0
  290. venv/Lib/site-packages/setuptools/config/_validate_pyproject/fastjsonschema_exceptions.py +51 -0
  291. venv/Lib/site-packages/setuptools/config/_validate_pyproject/fastjsonschema_validations.py +1412 -0
  292. venv/Lib/site-packages/setuptools/config/_validate_pyproject/formats.py +402 -0
  293. venv/Lib/site-packages/setuptools/config/expand.py +452 -0
  294. venv/Lib/site-packages/setuptools/config/pyprojecttoml.py +468 -0
  295. venv/Lib/site-packages/setuptools/config/setupcfg.py +780 -0
  296. venv/Lib/site-packages/setuptools/depends.py +185 -0
  297. venv/Lib/site-packages/setuptools/discovery.py +614 -0
  298. venv/Lib/site-packages/setuptools/dist.py +1119 -0
  299. venv/Lib/site-packages/setuptools/errors.py +67 -0
  300. venv/Lib/site-packages/setuptools/extension.py +177 -0
  301. venv/Lib/site-packages/setuptools/glob.py +185 -0
  302. venv/Lib/site-packages/setuptools/installer.py +155 -0
  303. venv/Lib/site-packages/setuptools/launch.py +36 -0
  304. venv/Lib/site-packages/setuptools/logging.py +40 -0
  305. venv/Lib/site-packages/setuptools/modified.py +18 -0
  306. venv/Lib/site-packages/setuptools/monkey.py +126 -0
  307. venv/Lib/site-packages/setuptools/msvc.py +1536 -0
  308. venv/Lib/site-packages/setuptools/namespaces.py +106 -0
  309. venv/Lib/site-packages/setuptools/tests/__init__.py +13 -0
  310. venv/Lib/site-packages/setuptools/tests/compat/__init__.py +0 -0
  311. venv/Lib/site-packages/setuptools/tests/compat/py39.py +3 -0
  312. venv/Lib/site-packages/setuptools/tests/config/__init__.py +0 -0
  313. venv/Lib/site-packages/setuptools/tests/config/downloads/__init__.py +59 -0
  314. venv/Lib/site-packages/setuptools/tests/config/downloads/preload.py +18 -0
  315. venv/Lib/site-packages/setuptools/tests/config/test_apply_pyprojecttoml.py +772 -0
  316. venv/Lib/site-packages/setuptools/tests/config/test_expand.py +247 -0
  317. venv/Lib/site-packages/setuptools/tests/config/test_pyprojecttoml.py +396 -0
  318. venv/Lib/site-packages/setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py +109 -0
  319. venv/Lib/site-packages/setuptools/tests/config/test_setupcfg.py +980 -0
  320. venv/Lib/site-packages/setuptools/tests/contexts.py +131 -0
  321. venv/Lib/site-packages/setuptools/tests/environment.py +95 -0
  322. venv/Lib/site-packages/setuptools/tests/fixtures.py +392 -0
  323. venv/Lib/site-packages/setuptools/tests/integration/__init__.py +0 -0
  324. venv/Lib/site-packages/setuptools/tests/integration/helpers.py +77 -0
  325. venv/Lib/site-packages/setuptools/tests/integration/test_pbr.py +20 -0
  326. venv/Lib/site-packages/setuptools/tests/integration/test_pip_install_sdist.py +223 -0
  327. venv/Lib/site-packages/setuptools/tests/mod_with_constant.py +1 -0
  328. venv/Lib/site-packages/setuptools/tests/namespaces.py +90 -0
  329. venv/Lib/site-packages/setuptools/tests/script-with-bom.py +1 -0
  330. venv/Lib/site-packages/setuptools/tests/test_archive_util.py +36 -0
  331. venv/Lib/site-packages/setuptools/tests/test_bdist_deprecations.py +28 -0
  332. venv/Lib/site-packages/setuptools/tests/test_bdist_egg.py +73 -0
  333. venv/Lib/site-packages/setuptools/tests/test_bdist_wheel.py +708 -0
  334. venv/Lib/site-packages/setuptools/tests/test_build.py +33 -0
  335. venv/Lib/site-packages/setuptools/tests/test_build_clib.py +84 -0
  336. venv/Lib/site-packages/setuptools/tests/test_build_ext.py +293 -0
  337. venv/Lib/site-packages/setuptools/tests/test_build_meta.py +959 -0
  338. venv/Lib/site-packages/setuptools/tests/test_build_py.py +480 -0
  339. venv/Lib/site-packages/setuptools/tests/test_config_discovery.py +647 -0
  340. venv/Lib/site-packages/setuptools/tests/test_core_metadata.py +622 -0
  341. venv/Lib/site-packages/setuptools/tests/test_depends.py +15 -0
  342. venv/Lib/site-packages/setuptools/tests/test_develop.py +112 -0
  343. venv/Lib/site-packages/setuptools/tests/test_dist.py +278 -0
  344. venv/Lib/site-packages/setuptools/tests/test_dist_info.py +147 -0
  345. venv/Lib/site-packages/setuptools/tests/test_distutils_adoption.py +198 -0
  346. venv/Lib/site-packages/setuptools/tests/test_editable_install.py +1263 -0
  347. venv/Lib/site-packages/setuptools/tests/test_egg_info.py +1306 -0
  348. venv/Lib/site-packages/setuptools/tests/test_extern.py +15 -0
  349. venv/Lib/site-packages/setuptools/tests/test_find_packages.py +218 -0
  350. venv/Lib/site-packages/setuptools/tests/test_find_py_modules.py +73 -0
  351. venv/Lib/site-packages/setuptools/tests/test_glob.py +45 -0
  352. venv/Lib/site-packages/setuptools/tests/test_install_scripts.py +89 -0
  353. venv/Lib/site-packages/setuptools/tests/test_logging.py +76 -0
  354. venv/Lib/site-packages/setuptools/tests/test_manifest.py +622 -0
  355. venv/Lib/site-packages/setuptools/tests/test_namespaces.py +138 -0
  356. venv/Lib/site-packages/setuptools/tests/test_scripts.py +12 -0
  357. venv/Lib/site-packages/setuptools/tests/test_sdist.py +984 -0
  358. venv/Lib/site-packages/setuptools/tests/test_setopt.py +40 -0
  359. venv/Lib/site-packages/setuptools/tests/test_setuptools.py +290 -0
  360. venv/Lib/site-packages/setuptools/tests/test_shutil_wrapper.py +23 -0
  361. venv/Lib/site-packages/setuptools/tests/test_unicode_utils.py +10 -0
  362. venv/Lib/site-packages/setuptools/tests/test_virtualenv.py +113 -0
  363. venv/Lib/site-packages/setuptools/tests/test_warnings.py +106 -0
  364. venv/Lib/site-packages/setuptools/tests/test_wheel.py +690 -0
  365. venv/Lib/site-packages/setuptools/tests/test_windows_wrappers.py +258 -0
  366. venv/Lib/site-packages/setuptools/tests/text.py +4 -0
  367. venv/Lib/site-packages/setuptools/tests/textwrap.py +6 -0
  368. venv/Lib/site-packages/setuptools/unicode_utils.py +102 -0
  369. venv/Lib/site-packages/setuptools/version.py +6 -0
  370. venv/Lib/site-packages/setuptools/warnings.py +110 -0
  371. venv/Lib/site-packages/setuptools/wheel.py +261 -0
  372. venv/Lib/site-packages/setuptools/windows_support.py +30 -0
  373. {android_notify-1.60.0.dist-info → android_notify-1.60.2.dist-info}/WHEEL +0 -0
  374. {android_notify-1.60.0.dist-info → android_notify-1.60.2.dist-info}/entry_points.txt +0 -0
  375. {android_notify-1.60.0.dist-info → android_notify-1.60.2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,1386 @@
1
+ """distutils.dist
2
+
3
+ Provides the Distribution class, which represents the module distribution
4
+ being built/installed/distributed.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import contextlib
10
+ import logging
11
+ import os
12
+ import pathlib
13
+ import re
14
+ import sys
15
+ import warnings
16
+ from collections.abc import Iterable, MutableMapping
17
+ from email import message_from_file
18
+ from typing import (
19
+ IO,
20
+ TYPE_CHECKING,
21
+ Any,
22
+ ClassVar,
23
+ Literal,
24
+ TypeVar,
25
+ Union,
26
+ overload,
27
+ )
28
+
29
+ from packaging.utils import canonicalize_name, canonicalize_version
30
+
31
+ from ._log import log
32
+ from .debug import DEBUG
33
+ from .errors import (
34
+ DistutilsArgError,
35
+ DistutilsClassError,
36
+ DistutilsModuleError,
37
+ DistutilsOptionError,
38
+ )
39
+ from .fancy_getopt import FancyGetopt, translate_longopt
40
+ from .util import check_environ, rfc822_escape, strtobool
41
+
42
+ if TYPE_CHECKING:
43
+ from _typeshed import SupportsWrite
44
+ from typing_extensions import TypeAlias
45
+
46
+ # type-only import because of mutual dependence between these modules
47
+ from .cmd import Command
48
+
49
+ _CommandT = TypeVar("_CommandT", bound="Command")
50
+ _OptionsList: TypeAlias = list[
51
+ Union[tuple[str, Union[str, None], str, int], tuple[str, Union[str, None], str]]
52
+ ]
53
+
54
+
55
+ # Regex to define acceptable Distutils command names. This is not *quite*
56
+ # the same as a Python NAME -- I don't allow leading underscores. The fact
57
+ # that they're very similar is no coincidence; the default naming scheme is
58
+ # to look for a Python module named after the command.
59
+ command_re = re.compile(r'^[a-zA-Z]([a-zA-Z0-9_]*)$')
60
+
61
+
62
+ def _ensure_list(value: str | Iterable[str], fieldname) -> str | list[str]:
63
+ if isinstance(value, str):
64
+ # a string containing comma separated values is okay. It will
65
+ # be converted to a list by Distribution.finalize_options().
66
+ pass
67
+ elif not isinstance(value, list):
68
+ # passing a tuple or an iterator perhaps, warn and convert
69
+ typename = type(value).__name__
70
+ msg = "Warning: '{fieldname}' should be a list, got type '{typename}'"
71
+ msg = msg.format(**locals())
72
+ log.warning(msg)
73
+ value = list(value)
74
+ return value
75
+
76
+
77
+ class Distribution:
78
+ """The core of the Distutils. Most of the work hiding behind 'setup'
79
+ is really done within a Distribution instance, which farms the work out
80
+ to the Distutils commands specified on the command line.
81
+
82
+ Setup scripts will almost never instantiate Distribution directly,
83
+ unless the 'setup()' function is totally inadequate to their needs.
84
+ However, it is conceivable that a setup script might wish to subclass
85
+ Distribution for some specialized purpose, and then pass the subclass
86
+ to 'setup()' as the 'distclass' keyword argument. If so, it is
87
+ necessary to respect the expectations that 'setup' has of Distribution.
88
+ See the code for 'setup()', in core.py, for details.
89
+ """
90
+
91
+ # 'global_options' describes the command-line options that may be
92
+ # supplied to the setup script prior to any actual commands.
93
+ # Eg. "./setup.py -n" or "./setup.py --quiet" both take advantage of
94
+ # these global options. This list should be kept to a bare minimum,
95
+ # since every global option is also valid as a command option -- and we
96
+ # don't want to pollute the commands with too many options that they
97
+ # have minimal control over.
98
+ # The fourth entry for verbose means that it can be repeated.
99
+ global_options: ClassVar[_OptionsList] = [
100
+ ('verbose', 'v', "run verbosely (default)", 1),
101
+ ('quiet', 'q', "run quietly (turns verbosity off)"),
102
+ ('dry-run', 'n', "don't actually do anything"),
103
+ ('help', 'h', "show detailed help message"),
104
+ ('no-user-cfg', None, 'ignore pydistutils.cfg in your home directory'),
105
+ ]
106
+
107
+ # 'common_usage' is a short (2-3 line) string describing the common
108
+ # usage of the setup script.
109
+ common_usage: ClassVar[str] = """\
110
+ Common commands: (see '--help-commands' for more)
111
+
112
+ setup.py build will build the package underneath 'build/'
113
+ setup.py install will install the package
114
+ """
115
+
116
+ # options that are not propagated to the commands
117
+ display_options: ClassVar[_OptionsList] = [
118
+ ('help-commands', None, "list all available commands"),
119
+ ('name', None, "print package name"),
120
+ ('version', 'V', "print package version"),
121
+ ('fullname', None, "print <package name>-<version>"),
122
+ ('author', None, "print the author's name"),
123
+ ('author-email', None, "print the author's email address"),
124
+ ('maintainer', None, "print the maintainer's name"),
125
+ ('maintainer-email', None, "print the maintainer's email address"),
126
+ ('contact', None, "print the maintainer's name if known, else the author's"),
127
+ (
128
+ 'contact-email',
129
+ None,
130
+ "print the maintainer's email address if known, else the author's",
131
+ ),
132
+ ('url', None, "print the URL for this package"),
133
+ ('license', None, "print the license of the package"),
134
+ ('licence', None, "alias for --license"),
135
+ ('description', None, "print the package description"),
136
+ ('long-description', None, "print the long package description"),
137
+ ('platforms', None, "print the list of platforms"),
138
+ ('classifiers', None, "print the list of classifiers"),
139
+ ('keywords', None, "print the list of keywords"),
140
+ ('provides', None, "print the list of packages/modules provided"),
141
+ ('requires', None, "print the list of packages/modules required"),
142
+ ('obsoletes', None, "print the list of packages/modules made obsolete"),
143
+ ]
144
+ display_option_names: ClassVar[list[str]] = [
145
+ translate_longopt(x[0]) for x in display_options
146
+ ]
147
+
148
+ # negative options are options that exclude other options
149
+ negative_opt: ClassVar[dict[str, str]] = {'quiet': 'verbose'}
150
+
151
+ # -- Creation/initialization methods -------------------------------
152
+
153
+ # Can't Unpack a TypedDict with optional properties, so using Any instead
154
+ def __init__(self, attrs: MutableMapping[str, Any] | None = None) -> None: # noqa: C901
155
+ """Construct a new Distribution instance: initialize all the
156
+ attributes of a Distribution, and then use 'attrs' (a dictionary
157
+ mapping attribute names to values) to assign some of those
158
+ attributes their "real" values. (Any attributes not mentioned in
159
+ 'attrs' will be assigned to some null value: 0, None, an empty list
160
+ or dictionary, etc.) Most importantly, initialize the
161
+ 'command_obj' attribute to the empty dictionary; this will be
162
+ filled in with real command objects by 'parse_command_line()'.
163
+ """
164
+
165
+ # Default values for our command-line options
166
+ self.verbose = True
167
+ self.dry_run = False
168
+ self.help = False
169
+ for attr in self.display_option_names:
170
+ setattr(self, attr, False)
171
+
172
+ # Store the distribution meta-data (name, version, author, and so
173
+ # forth) in a separate object -- we're getting to have enough
174
+ # information here (and enough command-line options) that it's
175
+ # worth it. Also delegate 'get_XXX()' methods to the 'metadata'
176
+ # object in a sneaky and underhanded (but efficient!) way.
177
+ self.metadata = DistributionMetadata()
178
+ for basename in self.metadata._METHOD_BASENAMES:
179
+ method_name = "get_" + basename
180
+ setattr(self, method_name, getattr(self.metadata, method_name))
181
+
182
+ # 'cmdclass' maps command names to class objects, so we
183
+ # can 1) quickly figure out which class to instantiate when
184
+ # we need to create a new command object, and 2) have a way
185
+ # for the setup script to override command classes
186
+ self.cmdclass: dict[str, type[Command]] = {}
187
+
188
+ # 'command_packages' is a list of packages in which commands
189
+ # are searched for. The factory for command 'foo' is expected
190
+ # to be named 'foo' in the module 'foo' in one of the packages
191
+ # named here. This list is searched from the left; an error
192
+ # is raised if no named package provides the command being
193
+ # searched for. (Always access using get_command_packages().)
194
+ self.command_packages: str | list[str] | None = None
195
+
196
+ # 'script_name' and 'script_args' are usually set to sys.argv[0]
197
+ # and sys.argv[1:], but they can be overridden when the caller is
198
+ # not necessarily a setup script run from the command-line.
199
+ self.script_name: str | os.PathLike[str] | None = None
200
+ self.script_args: list[str] | None = None
201
+
202
+ # 'command_options' is where we store command options between
203
+ # parsing them (from config files, the command-line, etc.) and when
204
+ # they are actually needed -- ie. when the command in question is
205
+ # instantiated. It is a dictionary of dictionaries of 2-tuples:
206
+ # command_options = { command_name : { option : (source, value) } }
207
+ self.command_options: dict[str, dict[str, tuple[str, str]]] = {}
208
+
209
+ # 'dist_files' is the list of (command, pyversion, file) that
210
+ # have been created by any dist commands run so far. This is
211
+ # filled regardless of whether the run is dry or not. pyversion
212
+ # gives sysconfig.get_python_version() if the dist file is
213
+ # specific to a Python version, 'any' if it is good for all
214
+ # Python versions on the target platform, and '' for a source
215
+ # file. pyversion should not be used to specify minimum or
216
+ # maximum required Python versions; use the metainfo for that
217
+ # instead.
218
+ self.dist_files: list[tuple[str, str, str]] = []
219
+
220
+ # These options are really the business of various commands, rather
221
+ # than of the Distribution itself. We provide aliases for them in
222
+ # Distribution as a convenience to the developer.
223
+ self.packages = None
224
+ self.package_data: dict[str, list[str]] = {}
225
+ self.package_dir = None
226
+ self.py_modules = None
227
+ self.libraries = None
228
+ self.headers = None
229
+ self.ext_modules = None
230
+ self.ext_package = None
231
+ self.include_dirs = None
232
+ self.extra_path = None
233
+ self.scripts = None
234
+ self.data_files = None
235
+ self.password = ''
236
+
237
+ # And now initialize bookkeeping stuff that can't be supplied by
238
+ # the caller at all. 'command_obj' maps command names to
239
+ # Command instances -- that's how we enforce that every command
240
+ # class is a singleton.
241
+ self.command_obj: dict[str, Command] = {}
242
+
243
+ # 'have_run' maps command names to boolean values; it keeps track
244
+ # of whether we have actually run a particular command, to make it
245
+ # cheap to "run" a command whenever we think we might need to -- if
246
+ # it's already been done, no need for expensive filesystem
247
+ # operations, we just check the 'have_run' dictionary and carry on.
248
+ # It's only safe to query 'have_run' for a command class that has
249
+ # been instantiated -- a false value will be inserted when the
250
+ # command object is created, and replaced with a true value when
251
+ # the command is successfully run. Thus it's probably best to use
252
+ # '.get()' rather than a straight lookup.
253
+ self.have_run: dict[str, bool] = {}
254
+
255
+ # Now we'll use the attrs dictionary (ultimately, keyword args from
256
+ # the setup script) to possibly override any or all of these
257
+ # distribution options.
258
+
259
+ if attrs:
260
+ # Pull out the set of command options and work on them
261
+ # specifically. Note that this order guarantees that aliased
262
+ # command options will override any supplied redundantly
263
+ # through the general options dictionary.
264
+ options = attrs.get('options')
265
+ if options is not None:
266
+ del attrs['options']
267
+ for command, cmd_options in options.items():
268
+ opt_dict = self.get_option_dict(command)
269
+ for opt, val in cmd_options.items():
270
+ opt_dict[opt] = ("setup script", val)
271
+
272
+ if 'licence' in attrs:
273
+ attrs['license'] = attrs['licence']
274
+ del attrs['licence']
275
+ msg = "'licence' distribution option is deprecated; use 'license'"
276
+ warnings.warn(msg)
277
+
278
+ # Now work on the rest of the attributes. Any attribute that's
279
+ # not already defined is invalid!
280
+ for key, val in attrs.items():
281
+ if hasattr(self.metadata, "set_" + key):
282
+ getattr(self.metadata, "set_" + key)(val)
283
+ elif hasattr(self.metadata, key):
284
+ setattr(self.metadata, key, val)
285
+ elif hasattr(self, key):
286
+ setattr(self, key, val)
287
+ else:
288
+ msg = f"Unknown distribution option: {key!r}"
289
+ warnings.warn(msg)
290
+
291
+ # no-user-cfg is handled before other command line args
292
+ # because other args override the config files, and this
293
+ # one is needed before we can load the config files.
294
+ # If attrs['script_args'] wasn't passed, assume false.
295
+ #
296
+ # This also make sure we just look at the global options
297
+ self.want_user_cfg = True
298
+
299
+ if self.script_args is not None:
300
+ # Coerce any possible iterable from attrs into a list
301
+ self.script_args = list(self.script_args)
302
+ for arg in self.script_args:
303
+ if not arg.startswith('-'):
304
+ break
305
+ if arg == '--no-user-cfg':
306
+ self.want_user_cfg = False
307
+ break
308
+
309
+ self.finalize_options()
310
+
311
+ def get_option_dict(self, command):
312
+ """Get the option dictionary for a given command. If that
313
+ command's option dictionary hasn't been created yet, then create it
314
+ and return the new dictionary; otherwise, return the existing
315
+ option dictionary.
316
+ """
317
+ dict = self.command_options.get(command)
318
+ if dict is None:
319
+ dict = self.command_options[command] = {}
320
+ return dict
321
+
322
+ def dump_option_dicts(self, header=None, commands=None, indent: str = "") -> None:
323
+ from pprint import pformat
324
+
325
+ if commands is None: # dump all command option dicts
326
+ commands = sorted(self.command_options.keys())
327
+
328
+ if header is not None:
329
+ self.announce(indent + header)
330
+ indent = indent + " "
331
+
332
+ if not commands:
333
+ self.announce(indent + "no commands known yet")
334
+ return
335
+
336
+ for cmd_name in commands:
337
+ opt_dict = self.command_options.get(cmd_name)
338
+ if opt_dict is None:
339
+ self.announce(indent + f"no option dict for '{cmd_name}' command")
340
+ else:
341
+ self.announce(indent + f"option dict for '{cmd_name}' command:")
342
+ out = pformat(opt_dict)
343
+ for line in out.split('\n'):
344
+ self.announce(indent + " " + line)
345
+
346
+ # -- Config file finding/parsing methods ---------------------------
347
+
348
+ def find_config_files(self):
349
+ """Find as many configuration files as should be processed for this
350
+ platform, and return a list of filenames in the order in which they
351
+ should be parsed. The filenames returned are guaranteed to exist
352
+ (modulo nasty race conditions).
353
+
354
+ There are multiple possible config files:
355
+ - distutils.cfg in the Distutils installation directory (i.e.
356
+ where the top-level Distutils __inst__.py file lives)
357
+ - a file in the user's home directory named .pydistutils.cfg
358
+ on Unix and pydistutils.cfg on Windows/Mac; may be disabled
359
+ with the ``--no-user-cfg`` option
360
+ - setup.cfg in the current directory
361
+ - a file named by an environment variable
362
+ """
363
+ check_environ()
364
+ files = [str(path) for path in self._gen_paths() if os.path.isfile(path)]
365
+
366
+ if DEBUG:
367
+ self.announce("using config files: {}".format(', '.join(files)))
368
+
369
+ return files
370
+
371
+ def _gen_paths(self):
372
+ # The system-wide Distutils config file
373
+ sys_dir = pathlib.Path(sys.modules['distutils'].__file__).parent
374
+ yield sys_dir / "distutils.cfg"
375
+
376
+ # The per-user config file
377
+ prefix = '.' * (os.name == 'posix')
378
+ filename = prefix + 'pydistutils.cfg'
379
+ if self.want_user_cfg:
380
+ with contextlib.suppress(RuntimeError):
381
+ yield pathlib.Path('~').expanduser() / filename
382
+
383
+ # All platforms support local setup.cfg
384
+ yield pathlib.Path('setup.cfg')
385
+
386
+ # Additional config indicated in the environment
387
+ with contextlib.suppress(TypeError):
388
+ yield pathlib.Path(os.getenv("DIST_EXTRA_CONFIG"))
389
+
390
+ def parse_config_files(self, filenames=None): # noqa: C901
391
+ from configparser import ConfigParser
392
+
393
+ # Ignore install directory options if we have a venv
394
+ if sys.prefix != sys.base_prefix:
395
+ ignore_options = [
396
+ 'install-base',
397
+ 'install-platbase',
398
+ 'install-lib',
399
+ 'install-platlib',
400
+ 'install-purelib',
401
+ 'install-headers',
402
+ 'install-scripts',
403
+ 'install-data',
404
+ 'prefix',
405
+ 'exec-prefix',
406
+ 'home',
407
+ 'user',
408
+ 'root',
409
+ ]
410
+ else:
411
+ ignore_options = []
412
+
413
+ ignore_options = frozenset(ignore_options)
414
+
415
+ if filenames is None:
416
+ filenames = self.find_config_files()
417
+
418
+ if DEBUG:
419
+ self.announce("Distribution.parse_config_files():")
420
+
421
+ parser = ConfigParser()
422
+ for filename in filenames:
423
+ if DEBUG:
424
+ self.announce(f" reading {filename}")
425
+ parser.read(filename, encoding='utf-8')
426
+ for section in parser.sections():
427
+ options = parser.options(section)
428
+ opt_dict = self.get_option_dict(section)
429
+
430
+ for opt in options:
431
+ if opt != '__name__' and opt not in ignore_options:
432
+ val = parser.get(section, opt)
433
+ opt = opt.replace('-', '_')
434
+ opt_dict[opt] = (filename, val)
435
+
436
+ # Make the ConfigParser forget everything (so we retain
437
+ # the original filenames that options come from)
438
+ parser.__init__()
439
+
440
+ # If there was a "global" section in the config file, use it
441
+ # to set Distribution options.
442
+
443
+ if 'global' in self.command_options:
444
+ for opt, (_src, val) in self.command_options['global'].items():
445
+ alias = self.negative_opt.get(opt)
446
+ try:
447
+ if alias:
448
+ setattr(self, alias, not strtobool(val))
449
+ elif opt in ('verbose', 'dry_run'): # ugh!
450
+ setattr(self, opt, strtobool(val))
451
+ else:
452
+ setattr(self, opt, val)
453
+ except ValueError as msg:
454
+ raise DistutilsOptionError(msg)
455
+
456
+ # -- Command-line parsing methods ----------------------------------
457
+
458
+ def parse_command_line(self):
459
+ """Parse the setup script's command line, taken from the
460
+ 'script_args' instance attribute (which defaults to 'sys.argv[1:]'
461
+ -- see 'setup()' in core.py). This list is first processed for
462
+ "global options" -- options that set attributes of the Distribution
463
+ instance. Then, it is alternately scanned for Distutils commands
464
+ and options for that command. Each new command terminates the
465
+ options for the previous command. The allowed options for a
466
+ command are determined by the 'user_options' attribute of the
467
+ command class -- thus, we have to be able to load command classes
468
+ in order to parse the command line. Any error in that 'options'
469
+ attribute raises DistutilsGetoptError; any error on the
470
+ command-line raises DistutilsArgError. If no Distutils commands
471
+ were found on the command line, raises DistutilsArgError. Return
472
+ true if command-line was successfully parsed and we should carry
473
+ on with executing commands; false if no errors but we shouldn't
474
+ execute commands (currently, this only happens if user asks for
475
+ help).
476
+ """
477
+ #
478
+ # We now have enough information to show the Macintosh dialog
479
+ # that allows the user to interactively specify the "command line".
480
+ #
481
+ toplevel_options = self._get_toplevel_options()
482
+
483
+ # We have to parse the command line a bit at a time -- global
484
+ # options, then the first command, then its options, and so on --
485
+ # because each command will be handled by a different class, and
486
+ # the options that are valid for a particular class aren't known
487
+ # until we have loaded the command class, which doesn't happen
488
+ # until we know what the command is.
489
+
490
+ self.commands = []
491
+ parser = FancyGetopt(toplevel_options + self.display_options)
492
+ parser.set_negative_aliases(self.negative_opt)
493
+ parser.set_aliases({'licence': 'license'})
494
+ args = parser.getopt(args=self.script_args, object=self)
495
+ option_order = parser.get_option_order()
496
+ logging.getLogger().setLevel(logging.WARN - 10 * self.verbose)
497
+
498
+ # for display options we return immediately
499
+ if self.handle_display_options(option_order):
500
+ return
501
+ while args:
502
+ args = self._parse_command_opts(parser, args)
503
+ if args is None: # user asked for help (and got it)
504
+ return
505
+
506
+ # Handle the cases of --help as a "global" option, ie.
507
+ # "setup.py --help" and "setup.py --help command ...". For the
508
+ # former, we show global options (--verbose, --dry-run, etc.)
509
+ # and display-only options (--name, --version, etc.); for the
510
+ # latter, we omit the display-only options and show help for
511
+ # each command listed on the command line.
512
+ if self.help:
513
+ self._show_help(
514
+ parser, display_options=len(self.commands) == 0, commands=self.commands
515
+ )
516
+ return
517
+
518
+ # Oops, no commands found -- an end-user error
519
+ if not self.commands:
520
+ raise DistutilsArgError("no commands supplied")
521
+
522
+ # All is well: return true
523
+ return True
524
+
525
+ def _get_toplevel_options(self):
526
+ """Return the non-display options recognized at the top level.
527
+
528
+ This includes options that are recognized *only* at the top
529
+ level as well as options recognized for commands.
530
+ """
531
+ return self.global_options + [
532
+ (
533
+ "command-packages=",
534
+ None,
535
+ "list of packages that provide distutils commands",
536
+ ),
537
+ ]
538
+
539
+ def _parse_command_opts(self, parser, args): # noqa: C901
540
+ """Parse the command-line options for a single command.
541
+ 'parser' must be a FancyGetopt instance; 'args' must be the list
542
+ of arguments, starting with the current command (whose options
543
+ we are about to parse). Returns a new version of 'args' with
544
+ the next command at the front of the list; will be the empty
545
+ list if there are no more commands on the command line. Returns
546
+ None if the user asked for help on this command.
547
+ """
548
+ # late import because of mutual dependence between these modules
549
+ from distutils.cmd import Command
550
+
551
+ # Pull the current command from the head of the command line
552
+ command = args[0]
553
+ if not command_re.match(command):
554
+ raise SystemExit(f"invalid command name '{command}'")
555
+ self.commands.append(command)
556
+
557
+ # Dig up the command class that implements this command, so we
558
+ # 1) know that it's a valid command, and 2) know which options
559
+ # it takes.
560
+ try:
561
+ cmd_class = self.get_command_class(command)
562
+ except DistutilsModuleError as msg:
563
+ raise DistutilsArgError(msg)
564
+
565
+ # Require that the command class be derived from Command -- want
566
+ # to be sure that the basic "command" interface is implemented.
567
+ if not issubclass(cmd_class, Command):
568
+ raise DistutilsClassError(
569
+ f"command class {cmd_class} must subclass Command"
570
+ )
571
+
572
+ # Also make sure that the command object provides a list of its
573
+ # known options.
574
+ if not (
575
+ hasattr(cmd_class, 'user_options')
576
+ and isinstance(cmd_class.user_options, list)
577
+ ):
578
+ msg = (
579
+ "command class %s must provide "
580
+ "'user_options' attribute (a list of tuples)"
581
+ )
582
+ raise DistutilsClassError(msg % cmd_class)
583
+
584
+ # If the command class has a list of negative alias options,
585
+ # merge it in with the global negative aliases.
586
+ negative_opt = self.negative_opt
587
+ if hasattr(cmd_class, 'negative_opt'):
588
+ negative_opt = negative_opt.copy()
589
+ negative_opt.update(cmd_class.negative_opt)
590
+
591
+ # Check for help_options in command class. They have a different
592
+ # format (tuple of four) so we need to preprocess them here.
593
+ if hasattr(cmd_class, 'help_options') and isinstance(
594
+ cmd_class.help_options, list
595
+ ):
596
+ help_options = fix_help_options(cmd_class.help_options)
597
+ else:
598
+ help_options = []
599
+
600
+ # All commands support the global options too, just by adding
601
+ # in 'global_options'.
602
+ parser.set_option_table(
603
+ self.global_options + cmd_class.user_options + help_options
604
+ )
605
+ parser.set_negative_aliases(negative_opt)
606
+ (args, opts) = parser.getopt(args[1:])
607
+ if hasattr(opts, 'help') and opts.help:
608
+ self._show_help(parser, display_options=False, commands=[cmd_class])
609
+ return
610
+
611
+ if hasattr(cmd_class, 'help_options') and isinstance(
612
+ cmd_class.help_options, list
613
+ ):
614
+ help_option_found = 0
615
+ for help_option, _short, _desc, func in cmd_class.help_options:
616
+ if hasattr(opts, parser.get_attr_name(help_option)):
617
+ help_option_found = 1
618
+ if callable(func):
619
+ func()
620
+ else:
621
+ raise DistutilsClassError(
622
+ f"invalid help function {func!r} for help option '{help_option}': "
623
+ "must be a callable object (function, etc.)"
624
+ )
625
+
626
+ if help_option_found:
627
+ return
628
+
629
+ # Put the options from the command-line into their official
630
+ # holding pen, the 'command_options' dictionary.
631
+ opt_dict = self.get_option_dict(command)
632
+ for name, value in vars(opts).items():
633
+ opt_dict[name] = ("command line", value)
634
+
635
+ return args
636
+
637
+ def finalize_options(self) -> None:
638
+ """Set final values for all the options on the Distribution
639
+ instance, analogous to the .finalize_options() method of Command
640
+ objects.
641
+ """
642
+ for attr in ('keywords', 'platforms'):
643
+ value = getattr(self.metadata, attr)
644
+ if value is None:
645
+ continue
646
+ if isinstance(value, str):
647
+ value = [elm.strip() for elm in value.split(',')]
648
+ setattr(self.metadata, attr, value)
649
+
650
+ def _show_help(
651
+ self, parser, global_options=True, display_options=True, commands: Iterable = ()
652
+ ):
653
+ """Show help for the setup script command-line in the form of
654
+ several lists of command-line options. 'parser' should be a
655
+ FancyGetopt instance; do not expect it to be returned in the
656
+ same state, as its option table will be reset to make it
657
+ generate the correct help text.
658
+
659
+ If 'global_options' is true, lists the global options:
660
+ --verbose, --dry-run, etc. If 'display_options' is true, lists
661
+ the "display-only" options: --name, --version, etc. Finally,
662
+ lists per-command help for every command name or command class
663
+ in 'commands'.
664
+ """
665
+ # late import because of mutual dependence between these modules
666
+ from distutils.cmd import Command
667
+ from distutils.core import gen_usage
668
+
669
+ if global_options:
670
+ if display_options:
671
+ options = self._get_toplevel_options()
672
+ else:
673
+ options = self.global_options
674
+ parser.set_option_table(options)
675
+ parser.print_help(self.common_usage + "\nGlobal options:")
676
+ print()
677
+
678
+ if display_options:
679
+ parser.set_option_table(self.display_options)
680
+ parser.print_help(
681
+ "Information display options (just display information, ignore any commands)"
682
+ )
683
+ print()
684
+
685
+ for command in commands:
686
+ if isinstance(command, type) and issubclass(command, Command):
687
+ klass = command
688
+ else:
689
+ klass = self.get_command_class(command)
690
+ if hasattr(klass, 'help_options') and isinstance(klass.help_options, list):
691
+ parser.set_option_table(
692
+ klass.user_options + fix_help_options(klass.help_options)
693
+ )
694
+ else:
695
+ parser.set_option_table(klass.user_options)
696
+ parser.print_help(f"Options for '{klass.__name__}' command:")
697
+ print()
698
+
699
+ print(gen_usage(self.script_name))
700
+
701
+ def handle_display_options(self, option_order):
702
+ """If there were any non-global "display-only" options
703
+ (--help-commands or the metadata display options) on the command
704
+ line, display the requested info and return true; else return
705
+ false.
706
+ """
707
+ from distutils.core import gen_usage
708
+
709
+ # User just wants a list of commands -- we'll print it out and stop
710
+ # processing now (ie. if they ran "setup --help-commands foo bar",
711
+ # we ignore "foo bar").
712
+ if self.help_commands:
713
+ self.print_commands()
714
+ print()
715
+ print(gen_usage(self.script_name))
716
+ return 1
717
+
718
+ # If user supplied any of the "display metadata" options, then
719
+ # display that metadata in the order in which the user supplied the
720
+ # metadata options.
721
+ any_display_options = 0
722
+ is_display_option = set()
723
+ for option in self.display_options:
724
+ is_display_option.add(option[0])
725
+
726
+ for opt, val in option_order:
727
+ if val and opt in is_display_option:
728
+ opt = translate_longopt(opt)
729
+ value = getattr(self.metadata, "get_" + opt)()
730
+ if opt in ('keywords', 'platforms'):
731
+ print(','.join(value))
732
+ elif opt in ('classifiers', 'provides', 'requires', 'obsoletes'):
733
+ print('\n'.join(value))
734
+ else:
735
+ print(value)
736
+ any_display_options = 1
737
+
738
+ return any_display_options
739
+
740
+ def print_command_list(self, commands, header, max_length) -> None:
741
+ """Print a subset of the list of all commands -- used by
742
+ 'print_commands()'.
743
+ """
744
+ print(header + ":")
745
+
746
+ for cmd in commands:
747
+ klass = self.cmdclass.get(cmd)
748
+ if not klass:
749
+ klass = self.get_command_class(cmd)
750
+ try:
751
+ description = klass.description
752
+ except AttributeError:
753
+ description = "(no description available)"
754
+
755
+ print(f" {cmd:<{max_length}} {description}")
756
+
757
+ def print_commands(self) -> None:
758
+ """Print out a help message listing all available commands with a
759
+ description of each. The list is divided into "standard commands"
760
+ (listed in distutils.command.__all__) and "extra commands"
761
+ (mentioned in self.cmdclass, but not a standard command). The
762
+ descriptions come from the command class attribute
763
+ 'description'.
764
+ """
765
+ import distutils.command
766
+
767
+ std_commands = distutils.command.__all__
768
+ is_std = set(std_commands)
769
+
770
+ extra_commands = [cmd for cmd in self.cmdclass.keys() if cmd not in is_std]
771
+
772
+ max_length = 0
773
+ for cmd in std_commands + extra_commands:
774
+ if len(cmd) > max_length:
775
+ max_length = len(cmd)
776
+
777
+ self.print_command_list(std_commands, "Standard commands", max_length)
778
+ if extra_commands:
779
+ print()
780
+ self.print_command_list(extra_commands, "Extra commands", max_length)
781
+
782
+ def get_command_list(self):
783
+ """Get a list of (command, description) tuples.
784
+ The list is divided into "standard commands" (listed in
785
+ distutils.command.__all__) and "extra commands" (mentioned in
786
+ self.cmdclass, but not a standard command). The descriptions come
787
+ from the command class attribute 'description'.
788
+ """
789
+ # Currently this is only used on Mac OS, for the Mac-only GUI
790
+ # Distutils interface (by Jack Jansen)
791
+ import distutils.command
792
+
793
+ std_commands = distutils.command.__all__
794
+ is_std = set(std_commands)
795
+
796
+ extra_commands = [cmd for cmd in self.cmdclass.keys() if cmd not in is_std]
797
+
798
+ rv = []
799
+ for cmd in std_commands + extra_commands:
800
+ klass = self.cmdclass.get(cmd)
801
+ if not klass:
802
+ klass = self.get_command_class(cmd)
803
+ try:
804
+ description = klass.description
805
+ except AttributeError:
806
+ description = "(no description available)"
807
+ rv.append((cmd, description))
808
+ return rv
809
+
810
+ # -- Command class/object methods ----------------------------------
811
+
812
+ def get_command_packages(self):
813
+ """Return a list of packages from which commands are loaded."""
814
+ pkgs = self.command_packages
815
+ if not isinstance(pkgs, list):
816
+ if pkgs is None:
817
+ pkgs = ''
818
+ pkgs = [pkg.strip() for pkg in pkgs.split(',') if pkg != '']
819
+ if "distutils.command" not in pkgs:
820
+ pkgs.insert(0, "distutils.command")
821
+ self.command_packages = pkgs
822
+ return pkgs
823
+
824
+ def get_command_class(self, command: str) -> type[Command]:
825
+ """Return the class that implements the Distutils command named by
826
+ 'command'. First we check the 'cmdclass' dictionary; if the
827
+ command is mentioned there, we fetch the class object from the
828
+ dictionary and return it. Otherwise we load the command module
829
+ ("distutils.command." + command) and fetch the command class from
830
+ the module. The loaded class is also stored in 'cmdclass'
831
+ to speed future calls to 'get_command_class()'.
832
+
833
+ Raises DistutilsModuleError if the expected module could not be
834
+ found, or if that module does not define the expected class.
835
+ """
836
+ klass = self.cmdclass.get(command)
837
+ if klass:
838
+ return klass
839
+
840
+ for pkgname in self.get_command_packages():
841
+ module_name = f"{pkgname}.{command}"
842
+ klass_name = command
843
+
844
+ try:
845
+ __import__(module_name)
846
+ module = sys.modules[module_name]
847
+ except ImportError:
848
+ continue
849
+
850
+ try:
851
+ klass = getattr(module, klass_name)
852
+ except AttributeError:
853
+ raise DistutilsModuleError(
854
+ f"invalid command '{command}' (no class '{klass_name}' in module '{module_name}')"
855
+ )
856
+
857
+ self.cmdclass[command] = klass
858
+ return klass
859
+
860
+ raise DistutilsModuleError(f"invalid command '{command}'")
861
+
862
+ @overload
863
+ def get_command_obj(
864
+ self, command: str, create: Literal[True] = True
865
+ ) -> Command: ...
866
+ @overload
867
+ def get_command_obj(
868
+ self, command: str, create: Literal[False]
869
+ ) -> Command | None: ...
870
+ def get_command_obj(self, command: str, create: bool = True) -> Command | None:
871
+ """Return the command object for 'command'. Normally this object
872
+ is cached on a previous call to 'get_command_obj()'; if no command
873
+ object for 'command' is in the cache, then we either create and
874
+ return it (if 'create' is true) or return None.
875
+ """
876
+ cmd_obj = self.command_obj.get(command)
877
+ if not cmd_obj and create:
878
+ if DEBUG:
879
+ self.announce(
880
+ "Distribution.get_command_obj(): "
881
+ f"creating '{command}' command object"
882
+ )
883
+
884
+ klass = self.get_command_class(command)
885
+ cmd_obj = self.command_obj[command] = klass(self)
886
+ self.have_run[command] = False
887
+
888
+ # Set any options that were supplied in config files
889
+ # or on the command line. (NB. support for error
890
+ # reporting is lame here: any errors aren't reported
891
+ # until 'finalize_options()' is called, which means
892
+ # we won't report the source of the error.)
893
+ options = self.command_options.get(command)
894
+ if options:
895
+ self._set_command_options(cmd_obj, options)
896
+
897
+ return cmd_obj
898
+
899
+ def _set_command_options(self, command_obj, option_dict=None): # noqa: C901
900
+ """Set the options for 'command_obj' from 'option_dict'. Basically
901
+ this means copying elements of a dictionary ('option_dict') to
902
+ attributes of an instance ('command').
903
+
904
+ 'command_obj' must be a Command instance. If 'option_dict' is not
905
+ supplied, uses the standard option dictionary for this command
906
+ (from 'self.command_options').
907
+ """
908
+ command_name = command_obj.get_command_name()
909
+ if option_dict is None:
910
+ option_dict = self.get_option_dict(command_name)
911
+
912
+ if DEBUG:
913
+ self.announce(f" setting options for '{command_name}' command:")
914
+ for option, (source, value) in option_dict.items():
915
+ if DEBUG:
916
+ self.announce(f" {option} = {value} (from {source})")
917
+ try:
918
+ bool_opts = [translate_longopt(o) for o in command_obj.boolean_options]
919
+ except AttributeError:
920
+ bool_opts = []
921
+ try:
922
+ neg_opt = command_obj.negative_opt
923
+ except AttributeError:
924
+ neg_opt = {}
925
+
926
+ try:
927
+ is_string = isinstance(value, str)
928
+ if option in neg_opt and is_string:
929
+ setattr(command_obj, neg_opt[option], not strtobool(value))
930
+ elif option in bool_opts and is_string:
931
+ setattr(command_obj, option, strtobool(value))
932
+ elif hasattr(command_obj, option):
933
+ setattr(command_obj, option, value)
934
+ else:
935
+ raise DistutilsOptionError(
936
+ f"error in {source}: command '{command_name}' has no such option '{option}'"
937
+ )
938
+ except ValueError as msg:
939
+ raise DistutilsOptionError(msg)
940
+
941
+ @overload
942
+ def reinitialize_command(
943
+ self, command: str, reinit_subcommands: bool = False
944
+ ) -> Command: ...
945
+ @overload
946
+ def reinitialize_command(
947
+ self, command: _CommandT, reinit_subcommands: bool = False
948
+ ) -> _CommandT: ...
949
+ def reinitialize_command(
950
+ self, command: str | Command, reinit_subcommands=False
951
+ ) -> Command:
952
+ """Reinitializes a command to the state it was in when first
953
+ returned by 'get_command_obj()': ie., initialized but not yet
954
+ finalized. This provides the opportunity to sneak option
955
+ values in programmatically, overriding or supplementing
956
+ user-supplied values from the config files and command line.
957
+ You'll have to re-finalize the command object (by calling
958
+ 'finalize_options()' or 'ensure_finalized()') before using it for
959
+ real.
960
+
961
+ 'command' should be a command name (string) or command object. If
962
+ 'reinit_subcommands' is true, also reinitializes the command's
963
+ sub-commands, as declared by the 'sub_commands' class attribute (if
964
+ it has one). See the "install" command for an example. Only
965
+ reinitializes the sub-commands that actually matter, ie. those
966
+ whose test predicates return true.
967
+
968
+ Returns the reinitialized command object.
969
+ """
970
+ from distutils.cmd import Command
971
+
972
+ if not isinstance(command, Command):
973
+ command_name = command
974
+ command = self.get_command_obj(command_name)
975
+ else:
976
+ command_name = command.get_command_name()
977
+
978
+ if not command.finalized:
979
+ return command
980
+ command.initialize_options()
981
+ command.finalized = False
982
+ self.have_run[command_name] = False
983
+ self._set_command_options(command)
984
+
985
+ if reinit_subcommands:
986
+ for sub in command.get_sub_commands():
987
+ self.reinitialize_command(sub, reinit_subcommands)
988
+
989
+ return command
990
+
991
+ # -- Methods that operate on the Distribution ----------------------
992
+
993
+ def announce(self, msg, level: int = logging.INFO) -> None:
994
+ log.log(level, msg)
995
+
996
+ def run_commands(self) -> None:
997
+ """Run each command that was seen on the setup script command line.
998
+ Uses the list of commands found and cache of command objects
999
+ created by 'get_command_obj()'.
1000
+ """
1001
+ for cmd in self.commands:
1002
+ self.run_command(cmd)
1003
+
1004
+ # -- Methods that operate on its Commands --------------------------
1005
+
1006
+ def run_command(self, command: str) -> None:
1007
+ """Do whatever it takes to run a command (including nothing at all,
1008
+ if the command has already been run). Specifically: if we have
1009
+ already created and run the command named by 'command', return
1010
+ silently without doing anything. If the command named by 'command'
1011
+ doesn't even have a command object yet, create one. Then invoke
1012
+ 'run()' on that command object (or an existing one).
1013
+ """
1014
+ # Already been here, done that? then return silently.
1015
+ if self.have_run.get(command):
1016
+ return
1017
+
1018
+ log.info("running %s", command)
1019
+ cmd_obj = self.get_command_obj(command)
1020
+ cmd_obj.ensure_finalized()
1021
+ cmd_obj.run()
1022
+ self.have_run[command] = True
1023
+
1024
+ # -- Distribution query methods ------------------------------------
1025
+
1026
+ def has_pure_modules(self) -> bool:
1027
+ return len(self.packages or self.py_modules or []) > 0
1028
+
1029
+ def has_ext_modules(self) -> bool:
1030
+ return self.ext_modules and len(self.ext_modules) > 0
1031
+
1032
+ def has_c_libraries(self) -> bool:
1033
+ return self.libraries and len(self.libraries) > 0
1034
+
1035
+ def has_modules(self) -> bool:
1036
+ return self.has_pure_modules() or self.has_ext_modules()
1037
+
1038
+ def has_headers(self) -> bool:
1039
+ return self.headers and len(self.headers) > 0
1040
+
1041
+ def has_scripts(self) -> bool:
1042
+ return self.scripts and len(self.scripts) > 0
1043
+
1044
+ def has_data_files(self) -> bool:
1045
+ return self.data_files and len(self.data_files) > 0
1046
+
1047
+ def is_pure(self) -> bool:
1048
+ return (
1049
+ self.has_pure_modules()
1050
+ and not self.has_ext_modules()
1051
+ and not self.has_c_libraries()
1052
+ )
1053
+
1054
+ # -- Metadata query methods ----------------------------------------
1055
+
1056
+ # If you're looking for 'get_name()', 'get_version()', and so forth,
1057
+ # they are defined in a sneaky way: the constructor binds self.get_XXX
1058
+ # to self.metadata.get_XXX. The actual code is in the
1059
+ # DistributionMetadata class, below.
1060
+ if TYPE_CHECKING:
1061
+ # Unfortunately this means we need to specify them manually or not expose statically
1062
+ def _(self) -> None:
1063
+ self.get_name = self.metadata.get_name
1064
+ self.get_version = self.metadata.get_version
1065
+ self.get_fullname = self.metadata.get_fullname
1066
+ self.get_author = self.metadata.get_author
1067
+ self.get_author_email = self.metadata.get_author_email
1068
+ self.get_maintainer = self.metadata.get_maintainer
1069
+ self.get_maintainer_email = self.metadata.get_maintainer_email
1070
+ self.get_contact = self.metadata.get_contact
1071
+ self.get_contact_email = self.metadata.get_contact_email
1072
+ self.get_url = self.metadata.get_url
1073
+ self.get_license = self.metadata.get_license
1074
+ self.get_licence = self.metadata.get_licence
1075
+ self.get_description = self.metadata.get_description
1076
+ self.get_long_description = self.metadata.get_long_description
1077
+ self.get_keywords = self.metadata.get_keywords
1078
+ self.get_platforms = self.metadata.get_platforms
1079
+ self.get_classifiers = self.metadata.get_classifiers
1080
+ self.get_download_url = self.metadata.get_download_url
1081
+ self.get_requires = self.metadata.get_requires
1082
+ self.get_provides = self.metadata.get_provides
1083
+ self.get_obsoletes = self.metadata.get_obsoletes
1084
+
1085
+ # Default attributes generated in __init__ from self.display_option_names
1086
+ help_commands: bool
1087
+ name: str | Literal[False]
1088
+ version: str | Literal[False]
1089
+ fullname: str | Literal[False]
1090
+ author: str | Literal[False]
1091
+ author_email: str | Literal[False]
1092
+ maintainer: str | Literal[False]
1093
+ maintainer_email: str | Literal[False]
1094
+ contact: str | Literal[False]
1095
+ contact_email: str | Literal[False]
1096
+ url: str | Literal[False]
1097
+ license: str | Literal[False]
1098
+ licence: str | Literal[False]
1099
+ description: str | Literal[False]
1100
+ long_description: str | Literal[False]
1101
+ platforms: str | list[str] | Literal[False]
1102
+ classifiers: str | list[str] | Literal[False]
1103
+ keywords: str | list[str] | Literal[False]
1104
+ provides: list[str] | Literal[False]
1105
+ requires: list[str] | Literal[False]
1106
+ obsoletes: list[str] | Literal[False]
1107
+
1108
+
1109
+ class DistributionMetadata:
1110
+ """Dummy class to hold the distribution meta-data: name, version,
1111
+ author, and so forth.
1112
+ """
1113
+
1114
+ _METHOD_BASENAMES = (
1115
+ "name",
1116
+ "version",
1117
+ "author",
1118
+ "author_email",
1119
+ "maintainer",
1120
+ "maintainer_email",
1121
+ "url",
1122
+ "license",
1123
+ "description",
1124
+ "long_description",
1125
+ "keywords",
1126
+ "platforms",
1127
+ "fullname",
1128
+ "contact",
1129
+ "contact_email",
1130
+ "classifiers",
1131
+ "download_url",
1132
+ # PEP 314
1133
+ "provides",
1134
+ "requires",
1135
+ "obsoletes",
1136
+ )
1137
+
1138
+ def __init__(
1139
+ self, path: str | bytes | os.PathLike[str] | os.PathLike[bytes] | None = None
1140
+ ) -> None:
1141
+ if path is not None:
1142
+ self.read_pkg_file(open(path))
1143
+ else:
1144
+ self.name: str | None = None
1145
+ self.version: str | None = None
1146
+ self.author: str | None = None
1147
+ self.author_email: str | None = None
1148
+ self.maintainer: str | None = None
1149
+ self.maintainer_email: str | None = None
1150
+ self.url: str | None = None
1151
+ self.license: str | None = None
1152
+ self.description: str | None = None
1153
+ self.long_description: str | None = None
1154
+ self.keywords: str | list[str] | None = None
1155
+ self.platforms: str | list[str] | None = None
1156
+ self.classifiers: str | list[str] | None = None
1157
+ self.download_url: str | None = None
1158
+ # PEP 314
1159
+ self.provides: str | list[str] | None = None
1160
+ self.requires: str | list[str] | None = None
1161
+ self.obsoletes: str | list[str] | None = None
1162
+
1163
+ def read_pkg_file(self, file: IO[str]) -> None:
1164
+ """Reads the metadata values from a file object."""
1165
+ msg = message_from_file(file)
1166
+
1167
+ def _read_field(name: str) -> str | None:
1168
+ value = msg[name]
1169
+ if value and value != "UNKNOWN":
1170
+ return value
1171
+ return None
1172
+
1173
+ def _read_list(name):
1174
+ values = msg.get_all(name, None)
1175
+ if values == []:
1176
+ return None
1177
+ return values
1178
+
1179
+ metadata_version = msg['metadata-version']
1180
+ self.name = _read_field('name')
1181
+ self.version = _read_field('version')
1182
+ self.description = _read_field('summary')
1183
+ # we are filling author only.
1184
+ self.author = _read_field('author')
1185
+ self.maintainer = None
1186
+ self.author_email = _read_field('author-email')
1187
+ self.maintainer_email = None
1188
+ self.url = _read_field('home-page')
1189
+ self.license = _read_field('license')
1190
+
1191
+ if 'download-url' in msg:
1192
+ self.download_url = _read_field('download-url')
1193
+ else:
1194
+ self.download_url = None
1195
+
1196
+ self.long_description = _read_field('description')
1197
+ self.description = _read_field('summary')
1198
+
1199
+ if 'keywords' in msg:
1200
+ self.keywords = _read_field('keywords').split(',')
1201
+
1202
+ self.platforms = _read_list('platform')
1203
+ self.classifiers = _read_list('classifier')
1204
+
1205
+ # PEP 314 - these fields only exist in 1.1
1206
+ if metadata_version == '1.1':
1207
+ self.requires = _read_list('requires')
1208
+ self.provides = _read_list('provides')
1209
+ self.obsoletes = _read_list('obsoletes')
1210
+ else:
1211
+ self.requires = None
1212
+ self.provides = None
1213
+ self.obsoletes = None
1214
+
1215
+ def write_pkg_info(self, base_dir: str | os.PathLike[str]) -> None:
1216
+ """Write the PKG-INFO file into the release tree."""
1217
+ with open(
1218
+ os.path.join(base_dir, 'PKG-INFO'), 'w', encoding='UTF-8'
1219
+ ) as pkg_info:
1220
+ self.write_pkg_file(pkg_info)
1221
+
1222
+ def write_pkg_file(self, file: SupportsWrite[str]) -> None:
1223
+ """Write the PKG-INFO format data to a file object."""
1224
+ version = '1.0'
1225
+ if (
1226
+ self.provides
1227
+ or self.requires
1228
+ or self.obsoletes
1229
+ or self.classifiers
1230
+ or self.download_url
1231
+ ):
1232
+ version = '1.1'
1233
+
1234
+ # required fields
1235
+ file.write(f'Metadata-Version: {version}\n')
1236
+ file.write(f'Name: {self.get_name()}\n')
1237
+ file.write(f'Version: {self.get_version()}\n')
1238
+
1239
+ def maybe_write(header, val):
1240
+ if val:
1241
+ file.write(f"{header}: {val}\n")
1242
+
1243
+ # optional fields
1244
+ maybe_write("Summary", self.get_description())
1245
+ maybe_write("Home-page", self.get_url())
1246
+ maybe_write("Author", self.get_contact())
1247
+ maybe_write("Author-email", self.get_contact_email())
1248
+ maybe_write("License", self.get_license())
1249
+ maybe_write("Download-URL", self.download_url)
1250
+ maybe_write("Description", rfc822_escape(self.get_long_description() or ""))
1251
+ maybe_write("Keywords", ",".join(self.get_keywords()))
1252
+
1253
+ self._write_list(file, 'Platform', self.get_platforms())
1254
+ self._write_list(file, 'Classifier', self.get_classifiers())
1255
+
1256
+ # PEP 314
1257
+ self._write_list(file, 'Requires', self.get_requires())
1258
+ self._write_list(file, 'Provides', self.get_provides())
1259
+ self._write_list(file, 'Obsoletes', self.get_obsoletes())
1260
+
1261
+ def _write_list(self, file, name, values):
1262
+ values = values or []
1263
+ for value in values:
1264
+ file.write(f'{name}: {value}\n')
1265
+
1266
+ # -- Metadata query methods ----------------------------------------
1267
+
1268
+ def get_name(self) -> str:
1269
+ return self.name or "UNKNOWN"
1270
+
1271
+ def get_version(self) -> str:
1272
+ return self.version or "0.0.0"
1273
+
1274
+ def get_fullname(self) -> str:
1275
+ return self._fullname(self.get_name(), self.get_version())
1276
+
1277
+ @staticmethod
1278
+ def _fullname(name: str, version: str) -> str:
1279
+ """
1280
+ >>> DistributionMetadata._fullname('setup.tools', '1.0-2')
1281
+ 'setup_tools-1.0.post2'
1282
+ >>> DistributionMetadata._fullname('setup-tools', '1.2post2')
1283
+ 'setup_tools-1.2.post2'
1284
+ >>> DistributionMetadata._fullname('setup-tools', '1.0-r2')
1285
+ 'setup_tools-1.0.post2'
1286
+ >>> DistributionMetadata._fullname('setup.tools', '1.0.post')
1287
+ 'setup_tools-1.0.post0'
1288
+ >>> DistributionMetadata._fullname('setup.tools', '1.0+ubuntu-1')
1289
+ 'setup_tools-1.0+ubuntu.1'
1290
+ """
1291
+ return "{}-{}".format(
1292
+ canonicalize_name(name).replace('-', '_'),
1293
+ canonicalize_version(version, strip_trailing_zero=False),
1294
+ )
1295
+
1296
+ def get_author(self) -> str | None:
1297
+ return self.author
1298
+
1299
+ def get_author_email(self) -> str | None:
1300
+ return self.author_email
1301
+
1302
+ def get_maintainer(self) -> str | None:
1303
+ return self.maintainer
1304
+
1305
+ def get_maintainer_email(self) -> str | None:
1306
+ return self.maintainer_email
1307
+
1308
+ def get_contact(self) -> str | None:
1309
+ return self.maintainer or self.author
1310
+
1311
+ def get_contact_email(self) -> str | None:
1312
+ return self.maintainer_email or self.author_email
1313
+
1314
+ def get_url(self) -> str | None:
1315
+ return self.url
1316
+
1317
+ def get_license(self) -> str | None:
1318
+ return self.license
1319
+
1320
+ get_licence = get_license
1321
+
1322
+ def get_description(self) -> str | None:
1323
+ return self.description
1324
+
1325
+ def get_long_description(self) -> str | None:
1326
+ return self.long_description
1327
+
1328
+ def get_keywords(self) -> str | list[str]:
1329
+ return self.keywords or []
1330
+
1331
+ def set_keywords(self, value: str | Iterable[str]) -> None:
1332
+ self.keywords = _ensure_list(value, 'keywords')
1333
+
1334
+ def get_platforms(self) -> str | list[str] | None:
1335
+ return self.platforms
1336
+
1337
+ def set_platforms(self, value: str | Iterable[str]) -> None:
1338
+ self.platforms = _ensure_list(value, 'platforms')
1339
+
1340
+ def get_classifiers(self) -> str | list[str]:
1341
+ return self.classifiers or []
1342
+
1343
+ def set_classifiers(self, value: str | Iterable[str]) -> None:
1344
+ self.classifiers = _ensure_list(value, 'classifiers')
1345
+
1346
+ def get_download_url(self) -> str | None:
1347
+ return self.download_url
1348
+
1349
+ # PEP 314
1350
+ def get_requires(self) -> str | list[str]:
1351
+ return self.requires or []
1352
+
1353
+ def set_requires(self, value: Iterable[str]) -> None:
1354
+ import distutils.versionpredicate
1355
+
1356
+ for v in value:
1357
+ distutils.versionpredicate.VersionPredicate(v)
1358
+ self.requires = list(value)
1359
+
1360
+ def get_provides(self) -> str | list[str]:
1361
+ return self.provides or []
1362
+
1363
+ def set_provides(self, value: Iterable[str]) -> None:
1364
+ value = [v.strip() for v in value]
1365
+ for v in value:
1366
+ import distutils.versionpredicate
1367
+
1368
+ distutils.versionpredicate.split_provision(v)
1369
+ self.provides = value
1370
+
1371
+ def get_obsoletes(self) -> str | list[str]:
1372
+ return self.obsoletes or []
1373
+
1374
+ def set_obsoletes(self, value: Iterable[str]) -> None:
1375
+ import distutils.versionpredicate
1376
+
1377
+ for v in value:
1378
+ distutils.versionpredicate.VersionPredicate(v)
1379
+ self.obsoletes = list(value)
1380
+
1381
+
1382
+ def fix_help_options(options):
1383
+ """Convert a 4-tuple 'help_options' list as found in various command
1384
+ classes to the 3-tuple form required by FancyGetopt.
1385
+ """
1386
+ return [opt[0:3] for opt in options]