Skip to content

Commit

Permalink
Fix pre-commit exlusions (#5023)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard authored Oct 3, 2023
1 parent bb0ca2a commit 7d3b0c5
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exclude: |
test-recipes |
test-skeleton
)/ |
.*\.(patch|diff) |
.*\.(patch|diff)
)
repos:
# generic verification and formatting
Expand Down
15 changes: 7 additions & 8 deletions conda_build/conda_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
from conda.auxlib.packaging import ( # noqa: F401
_get_version_from_git_tag as get_version_from_git_tag,
)
from conda.base.context import context, determine_target_prefix
from conda.base.context import context, determine_target_prefix, reset_context
from conda.base.context import non_x86_machines as non_x86_linux_machines # noqa: F401
from conda.base.context import reset_context
from conda.core.package_cache import ProgressiveFetchExtract # noqa: F401
from conda.exceptions import ( # noqa: F401
CondaError,
Expand All @@ -24,15 +23,12 @@
PaddingError,
UnsatisfiableError,
)
from conda.exports import ArgumentParser # noqa: F401
from conda.exports import CondaSession # noqa: F401
from conda.exports import EntityEncoder # noqa: F401
from conda.exports import VersionOrder # noqa: F401
from conda.exports import _toposort # noqa: F401
from conda.exports import get_index # noqa: F401
from conda.exports import ( # noqa: F401
ArgumentParser, # noqa: F401
Channel,
Completer,
CondaSession, # noqa: F401
EntityEncoder, # noqa: F401
FileMode,
InstalledPackages,
MatchSpec,
Expand All @@ -43,12 +39,15 @@
TemporaryDirectory,
TmpDownload,
Unsatisfiable,
VersionOrder, # noqa: F401
_toposort, # noqa: F401
add_parser_channels,
add_parser_prefix,
display_actions,
download,
execute_actions,
execute_plan,
get_index, # noqa: F401
handle_proxy_407,
hashsum_file,
human_bytes,
Expand Down
16 changes: 10 additions & 6 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1752,18 +1752,20 @@ def has_prefix_files(self):

def ignore_prefix_files(self):
ret = self.get_value("build/ignore_prefix_files", False)
if type(ret) not in (list, bool):
if not isinstance(ret, (list, bool)):
raise RuntimeError(
"build/ignore_prefix_files should be boolean or a list of paths "
"(optionally globs)"
)
if sys.platform == "win32":
if type(ret) is list and any("\\" in i for i in ret):
if isinstance(ret, list) and any("\\" in i for i in ret):
raise RuntimeError(
"build/ignore_prefix_files paths must use / "
"as the path delimiter on Windows"
)
return expand_globs(ret, self.config.host_prefix) if type(ret) is list else ret
return (
expand_globs(ret, self.config.host_prefix) if isinstance(ret, list) else ret
)

def always_include_files(self):
files = ensure_list(self.get_value("build/always_include_files", []))
Expand All @@ -1782,18 +1784,20 @@ def ignore_verify_codes(self):

def binary_relocation(self):
ret = self.get_value("build/binary_relocation", True)
if type(ret) not in (list, bool):
if not isinstance(ret, (list, bool)):
raise RuntimeError(
"build/binary_relocation should be boolean or a list of paths "
"(optionally globs)"
)
if sys.platform == "win32":
if type(ret) is list and any("\\" in i for i in ret):
if isinstance(ret, list) and any("\\" in i for i in ret):
raise RuntimeError(
"build/binary_relocation paths must use / "
"as the path delimiter on Windows"
)
return expand_globs(ret, self.config.host_prefix) if type(ret) is list else ret
return (
expand_globs(ret, self.config.host_prefix) if isinstance(ret, list) else ret
)

def include_recipe(self):
return self.get_value("build/include_recipe", True)
Expand Down
8 changes: 4 additions & 4 deletions conda_build/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@
from conda_build.exceptions import BuildLockError # noqa
from conda_build.os_utils import external # noqa

from .conda_interface import Dist # noqa
from .conda_interface import StringIO # noqa
from .conda_interface import cc_conda_build # noqa
from .conda_interface import context # noqa
from .conda_interface import ( # noqa
CondaHTTPError,
Dist, # noqa
MatchSpec,
StringIO, # noqa
TemporaryDirectory,
VersionOrder,
cc_conda_build, # noqa
context, # noqa
download,
get_conda_channel,
hashsum_file,
Expand Down
15 changes: 7 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ line-length = 180
# E, W = pycodestyle errors and warnings
# F = pyflakes
# I = isort
# D = pydocstyle
select = ["E", "W", "F", "I", "D1"]
select = ["E", "W", "F", "I"]
# E402 module level import not at top of file
# E722 do not use bare 'except'
# E731 do not assign a lambda expression, use a def
Expand All @@ -121,15 +120,15 @@ addopts = [
"--cov-report=xml",
"--durations=16",
"--junitxml=junit.xml",
"--splitting-algorithm=least_duration",
"--store-durations",
# "--splitting-algorithm=least_duration", # not available yet
# "--store-durations", # not available yet
"--strict-markers",
"--tb=native",
"-vv",
]
markers = [
"serial: execute test serially (to avoid race conditions)",
"slow: execute the slow tests if active",
"sanity: execute the sanity tests",
"no_default_testing_config: used internally to disable monkeypatching for testing_config",
"serial: execute test serially (to avoid race conditions)",
"slow: execute the slow tests if active",
"sanity: execute the sanity tests",
"no_default_testing_config: used internally to disable monkeypatching for testing_config",
]

0 comments on commit 7d3b0c5

Please sign in to comment.