Skip to content

Commit

Permalink
Merge pull request #89 from anaconda-distribution/improve_checks
Browse files Browse the repository at this point in the history
Improve checks
  • Loading branch information
marcoesters authored Oct 3, 2022
2 parents 2b47f29 + 4c7213f commit 52b016c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,6 @@ dmypy.json

# Pyre type checker
.pyre/

# VS Code
.idea/
66 changes: 47 additions & 19 deletions anaconda_linter/lint/check_build_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,22 @@ class should_use_compilers(LintCheck):
"""

compilers = ("gcc", "llvm", "libgfortran", "libgcc", "go", "cgo", "toolchain")
compilers = (
"cgo",
"cuda",
"dpcpp",
"gcc",
"go",
"libgcc",
"libgfortran",
"llvm",
"m2w64_c",
"m2w64_cxx",
"m2w64_fortran",
"rust-gnu",
"rust",
"toolchain",
)

def check_deps(self, deps):
for compiler in self.compilers:
Expand Down Expand Up @@ -85,6 +100,23 @@ def check_recipe(self, recipe):
self.message()


class missing_wheel(LintCheck):
"""For pypi packages, wheel should be present in the host section
Add wheel to requirements/host:
requirements:
host:
- wheel
"""

def check_recipe(self, recipe):

if is_pypi_source(recipe) or "pip install" in self.recipe.get("build/script", ""):
if "wheel" not in recipe.get_deps("host"):
self.message(section="requirements/host")


class setup_py_install_args(LintCheck):
"""The recipe uses setuptools without required arguments
Expand Down Expand Up @@ -251,23 +283,6 @@ def check_recipe(self, recipe):
self.message(section="test/commands")


class missing_wheel(LintCheck):
"""For pypi packages, wheel should be present in the host section
Add wheel to requirements/host:
requirements:
host:
- wheel
"""

def check_recipe(self, recipe):

if is_pypi_source(recipe) or "pip install" in self.recipe.get("build/script", ""):
if "wheel" not in recipe.get_deps("host"):
self.message(section="requirements/host")


class missing_python(LintCheck):
"""For pypi packages, python should be present in the host and run sections
Expand Down Expand Up @@ -323,7 +338,20 @@ class gui_app(LintCheck):

severity = INFO

guis = ("qtpy", "pyqt")
guis = (
"enaml",
"glue-core",
"glueviz",
"jupyterhub",
"jupyterlab",
"orange3",
"pyqt",
"qt3dstudio",
"qtcreator",
"qtpy",
"spyder",
"wxpython",
)

def check_recipe(self, recipe):
if set(self.guis).intersection(set(recipe.get_deps("run"))):
Expand Down
1 change: 1 addition & 0 deletions anaconda_linter/lint/check_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def check_source(self, source, section):
acceptable_redirects = [
("pypi.io", "pypi.org"),
("github.com", "objects.githubusercontent.com"),
("github.com", "codeload.github.com"),
]
if response_data["code"] < 0 and "domain_redirect" in response_data:
for redir in acceptable_redirects:
Expand Down

0 comments on commit 52b016c

Please sign in to comment.