patch main to ensure click_patch() gets called (#572)

This commit is contained in:
Chuck Wooters 2018-10-29 03:10:32 -07:00 committed by Łukasz Langa
parent 99c97c3d7f
commit 5c2dd96a69
4 changed files with 17 additions and 3 deletions

View File

@ -1351,3 +1351,4 @@ Multiple contributions by:
* [Stavros Korokithakis](mailto:hi@stavros.io)
* [Sunil Kapil](mailto:snlkapil@gmail.com)
* [Vishwas B Sharma](mailto:sharma.vishwas88@gmail.com)
* [Chuck Wooters](mailto:chuck.wooters@microsoft.com)

View File

@ -3662,6 +3662,10 @@ def patch_click() -> None:
module._verify_python3_env = lambda: None
if __name__ == "__main__":
def patched_main() -> None:
patch_click()
main()
if __name__ == "__main__":
patched_main()

View File

@ -108,6 +108,10 @@ async def handle(request: web.Request, executor: Executor) -> web.Response:
return web.Response(status=500, text=str(e))
if __name__ == "__main__":
def patched_main() -> None:
black.patch_click()
main()
if __name__ == "__main__":
patched_main()

View File

@ -57,5 +57,10 @@ def get_version() -> str:
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Quality Assurance",
],
entry_points={"console_scripts": ["black=black:main", "blackd=blackd:main [d]"]},
entry_points={
"console_scripts": [
"black=black:patched_main",
"blackd=blackd:patched_main [d]",
]
},
)