From 00e2f2cc6fbb8ed6c9e212434cf442d14ce43c6b Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Fri, 24 Jan 2020 12:23:45 -0500 Subject: [PATCH 1/5] lang/python: add additional checks --- modules/lang/python/doctor.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/modules/lang/python/doctor.el b/modules/lang/python/doctor.el index 2fcb5d7fb..40637a75a 100644 --- a/modules/lang/python/doctor.el +++ b/modules/lang/python/doctor.el @@ -20,6 +20,30 @@ (unless (executable-find "conda") (warn! "Couldn't find conda in your PATH"))) +(when (featurep! +cython) + (unless (executable-find "cython") + (warn! "Couldn't find cython. cython-mode will not work."))) + (when (featurep! +ipython) (unless (executable-find "ipython") (warn! "Couldn't find ipython in your PATH"))) + +(if (and (featurep! :editor format) + (not (executable-find "black"))) + (warn! "Couldn't find black. Code formatting will not work.")) + +(if (not (executable-find "pytest")) + (warn! "Couldn't find pytest. Running tests through pytest will not work.")) + +(if (not (executable-find "nosetests")) + (warn! "Couldn't find nosetests. Running tests through nose will not work.")) + +(if (not (executable-find "pipenv")) + (warn! "Couldn't find pipenv. pipenv support will not work.")) + +(if (not (executable-find "isort")) + (warn! "Couldn't find isort. Import sorting will not work.")) + +(if (and (featurep! :editor format) + (not (executable-find "pyflakes"))) + (warn! "Couldn't find pyflakes. Import management will not work.")) From a9a04a692488f54181a2d3a90412db096e782b82 Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Mon, 10 Feb 2020 19:55:00 -0500 Subject: [PATCH 2/5] lang/python: assert when python isn't installed --- modules/lang/python/doctor.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lang/python/doctor.el b/modules/lang/python/doctor.el index 40637a75a..8ef41ee63 100644 --- a/modules/lang/python/doctor.el +++ b/modules/lang/python/doctor.el @@ -5,7 +5,7 @@ "This module requires (:tools lsp)") (if (not (executable-find "python")) - (warn! "Python isn't installed.") + (assert! "Python isn't installed.") (unless (featurep! +lsp) (unless (zerop (shell-command "python -c 'import setuptools'")) (warn! "setuptools wasn't detected, which anaconda-mode requires")))) From 02271f507eec57d83d61696c3cdbe4744ca61d98 Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Mon, 10 Feb 2020 19:55:49 -0500 Subject: [PATCH 3/5] lang/python: combine :editor format checks --- modules/lang/python/doctor.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/lang/python/doctor.el b/modules/lang/python/doctor.el index 8ef41ee63..085295c37 100644 --- a/modules/lang/python/doctor.el +++ b/modules/lang/python/doctor.el @@ -28,10 +28,6 @@ (unless (executable-find "ipython") (warn! "Couldn't find ipython in your PATH"))) -(if (and (featurep! :editor format) - (not (executable-find "black"))) - (warn! "Couldn't find black. Code formatting will not work.")) - (if (not (executable-find "pytest")) (warn! "Couldn't find pytest. Running tests through pytest will not work.")) @@ -44,6 +40,8 @@ (if (not (executable-find "isort")) (warn! "Couldn't find isort. Import sorting will not work.")) -(if (and (featurep! :editor format) - (not (executable-find "pyflakes"))) +(when (featurep! :editor format) + (unless (executable-find "pyflakes") (warn! "Couldn't find pyflakes. Import management will not work.")) + (unless (executable-find "black") + (warn! "Couldn't find black. Code formatting will not work."))) From fdba4472fc4a5e7cf2b031643cacdee0519cc628 Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Mon, 10 Feb 2020 22:04:08 -0500 Subject: [PATCH 4/5] lang/python: reformat checks to prefer unless --- modules/lang/python/doctor.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/lang/python/doctor.el b/modules/lang/python/doctor.el index 085295c37..a711ca9ea 100644 --- a/modules/lang/python/doctor.el +++ b/modules/lang/python/doctor.el @@ -28,17 +28,17 @@ (unless (executable-find "ipython") (warn! "Couldn't find ipython in your PATH"))) -(if (not (executable-find "pytest")) - (warn! "Couldn't find pytest. Running tests through pytest will not work.")) +(unless (executable-find "pytest") + (warn! "Couldn't find pytest. Running tests through pytest will not work.")) -(if (not (executable-find "nosetests")) - (warn! "Couldn't find nosetests. Running tests through nose will not work.")) +(unless (executable-find "nosetests") + (warn! "Couldn't find nosetests. Running tests through nose will not work.")) -(if (not (executable-find "pipenv")) - (warn! "Couldn't find pipenv. pipenv support will not work.")) +(unless (executable-find "pipenv") + (warn! "Couldn't find pipenv. pipenv support will not work.")) -(if (not (executable-find "isort")) - (warn! "Couldn't find isort. Import sorting will not work.")) +(unless (executable-find "isort") + (warn! "Couldn't find isort. Import sorting will not work.")) (when (featurep! :editor format) (unless (executable-find "pyflakes") From 5a0657ed164b9a8a8822e21d9f8e032fd62e9045 Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Sun, 23 Feb 2020 14:18:54 -0500 Subject: [PATCH 5/5] lang/python: use error! instead of assert! --- modules/lang/python/doctor.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lang/python/doctor.el b/modules/lang/python/doctor.el index a711ca9ea..e4979e5ea 100644 --- a/modules/lang/python/doctor.el +++ b/modules/lang/python/doctor.el @@ -5,7 +5,7 @@ "This module requires (:tools lsp)") (if (not (executable-find "python")) - (assert! "Python isn't installed.") + (error! "Python isn't installed.") (unless (featurep! +lsp) (unless (zerop (shell-command "python -c 'import setuptools'")) (warn! "setuptools wasn't detected, which anaconda-mode requires"))))