Skip to content

Commit

Permalink
Drop Python 3.8 (#5525)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
jaimergp and pre-commit-ci[bot] authored Nov 5, 2024
1 parent a8c9883 commit d8a4148
Show file tree
Hide file tree
Showing 34 changed files with 107 additions and 72 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ jobs:
test-type: [serial, parallel]
include:
# minimum Python/conda combo
- python-version: '3.8'
- python-version: '3.9'
conda-version: 23.7.0
test-type: serial
- python-version: '3.8'
- python-version: '3.9'
conda-version: 23.7.0
test-type: parallel
# maximum Python/conda combo
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
fail-fast: false
matrix:
# test lower version (w/ stable conda) and upper version (w/ canary conda)
python-version: ['3.8']
python-version: ['3.9']
conda-version: [release]
test-type: [serial, parallel]
include:
Expand Down Expand Up @@ -349,7 +349,7 @@ jobs:
fail-fast: false
matrix:
# test lower version (w/ stable conda) and upper version (w/ canary conda)
python-version: ['3.8']
python-version: ['3.9']
conda-version: [release]
test-type: [serial, parallel]
include:
Expand Down
3 changes: 2 additions & 1 deletion conda_build/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
# to conda-build's functionality.
import os
import sys
from collections.abc import Iterable
from os.path import dirname, expanduser, join
from pathlib import Path
from typing import TYPE_CHECKING, Iterable
from typing import TYPE_CHECKING

# make the Config class available in the api namespace
from .config import DEFAULT_PREFIX_LENGTH as _prefix_length
Expand Down
3 changes: 2 additions & 1 deletion conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
from . import windows

if TYPE_CHECKING:
from typing import Any, Iterable
from collections.abc import Iterable
from typing import Any

if "bsd" in sys.platform:
shell_path = "/bin/sh"
Expand Down
2 changes: 1 addition & 1 deletion conda_build/cli/main_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

if TYPE_CHECKING:
from argparse import ArgumentParser, Namespace
from typing import Sequence
from collections.abc import Sequence


def parse_args(args: Sequence[str] | None) -> tuple[ArgumentParser, Namespace]:
Expand Down
2 changes: 1 addition & 1 deletion conda_build/cli/main_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

if TYPE_CHECKING:
from argparse import ArgumentParser, Namespace
from typing import Sequence
from collections.abc import Sequence

logging.basicConfig(level=logging.INFO)

Expand Down
2 changes: 1 addition & 1 deletion conda_build/cli/main_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

if TYPE_CHECKING:
from argparse import ArgumentParser
from typing import Sequence
from collections.abc import Sequence

logging.basicConfig(level=logging.INFO)

Expand Down
2 changes: 1 addition & 1 deletion conda_build/cli/main_develop.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

if TYPE_CHECKING:
from argparse import ArgumentParser, Namespace
from typing import Sequence
from collections.abc import Sequence

logging.basicConfig(level=logging.INFO)

Expand Down
2 changes: 1 addition & 1 deletion conda_build/cli/main_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

if TYPE_CHECKING:
from argparse import ArgumentParser, Namespace
from typing import Sequence
from collections.abc import Sequence

logging.basicConfig(level=logging.INFO)

Expand Down
2 changes: 1 addition & 1 deletion conda_build/cli/main_metapackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

if TYPE_CHECKING:
from argparse import ArgumentParser, Namespace
from typing import Sequence
from collections.abc import Sequence

logging.basicConfig(level=logging.INFO)

Expand Down
2 changes: 1 addition & 1 deletion conda_build/cli/main_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

if TYPE_CHECKING:
from argparse import ArgumentParser, Namespace
from typing import Sequence
from collections.abc import Sequence

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion conda_build/cli/main_skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

if TYPE_CHECKING:
from argparse import ArgumentParser, Namespace
from typing import Sequence
from collections.abc import Sequence

thisdir = os.path.dirname(os.path.abspath(__file__))
logging.basicConfig(level=logging.INFO)
Expand Down
2 changes: 1 addition & 1 deletion conda_build/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .utils import ensure_list, filter_info_files, walk

if TYPE_CHECKING:
from typing import Iterable
from collections.abc import Iterable


def retrieve_c_extensions(file_path, show_imports=False):
Expand Down
11 changes: 6 additions & 5 deletions conda_build/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import sys
import warnings
from collections import defaultdict
from functools import lru_cache
from functools import cache
from glob import glob
from logging import getLogger
from os.path import join, normpath
Expand Down Expand Up @@ -58,8 +58,9 @@
from .variants import get_default_variant

if TYPE_CHECKING:
from collections.abc import Iterable
from pathlib import Path
from typing import Any, Iterable, TypedDict
from typing import Any, TypedDict

from .config import Config
from .metadata import MetaData
Expand Down Expand Up @@ -120,7 +121,7 @@ def get_lua_include_dir(config):
return join(config.host_prefix, "include")


@lru_cache(maxsize=None)
@cache
def verify_git_repo(
git_exe, git_dir, git_url, git_commits_since_tag, debug=False, expected_rev="HEAD"
):
Expand Down Expand Up @@ -602,7 +603,7 @@ def meta_vars(meta: MetaData, skip_build_id=False):
return d


@lru_cache(maxsize=None)
@cache
def get_cpu_count():
if on_mac:
# multiprocessing.cpu_count() is not reliable on OSX
Expand Down Expand Up @@ -724,7 +725,7 @@ def osx_vars(m, get_default, prefix):
get_default("BUILD", BUILD)


@lru_cache(maxsize=None)
@cache
def _machine_and_architecture():
return platform.machine(), platform.architecture()

Expand Down
3 changes: 2 additions & 1 deletion conda_build/inspect_pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
from conda_build.index import Index

if TYPE_CHECKING:
from typing import Iterable, Literal
from collections.abc import Iterable
from typing import Literal

log = get_logger(__name__)

Expand Down
6 changes: 3 additions & 3 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import time
import warnings
from collections import OrderedDict
from functools import lru_cache
from functools import cache, lru_cache
from os.path import isdir, isfile, join
from typing import TYPE_CHECKING, NamedTuple, overload

Expand Down Expand Up @@ -289,7 +289,7 @@ def eval_selector(selector_string, namespace, variants_in_place):
return eval_selector(next_string, namespace, variants_in_place)


@lru_cache(maxsize=None)
@cache
def _split_line_selector(text: str) -> tuple[tuple[str | None, str], ...]:
lines: list[tuple[str | None, str]] = []
for line in text.splitlines():
Expand Down Expand Up @@ -1069,7 +1069,7 @@ def _filter_recipe_text(text, extract_pattern=None):
return text


@lru_cache(maxsize=None)
@cache
def read_meta_file(meta_path):
with open(meta_path, "rb") as f:
recipe_text = UnicodeDammit(f.read()).unicode_markup
Expand Down
10 changes: 5 additions & 5 deletions conda_build/os_utils/ldd.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import re
import subprocess
from functools import lru_cache
from functools import cache
from os.path import basename
from pathlib import Path
from typing import TYPE_CHECKING
Expand All @@ -17,7 +17,7 @@

if TYPE_CHECKING:
import os
from typing import Iterable
from collections.abc import Iterable

from conda.models.records import PrefixRecord

Expand Down Expand Up @@ -57,7 +57,7 @@ def get_linkages(
return _get_linkages(tuple(obj_files), Path(prefix), sysroot)


@lru_cache(maxsize=None)
@cache
def _get_linkages(
obj_files: tuple[str],
prefix: Path,
Expand Down Expand Up @@ -111,7 +111,7 @@ def _get_linkages(
return linkages


@lru_cache(maxsize=None)
@cache
def get_package_obj_files(
prec: PrefixRecord, prefix: str | os.PathLike | Path
) -> list[str]:
Expand All @@ -122,7 +122,7 @@ def get_package_obj_files(
]


@lru_cache(maxsize=None)
@cache
def get_untracked_obj_files(prefix: str | os.PathLike | Path) -> list[str]:
return [
file
Expand Down
2 changes: 1 addition & 1 deletion conda_build/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import conda.plugins

if TYPE_CHECKING:
from typing import Sequence
from collections.abc import Sequence


# lazy-import to avoid nasty import-time side effects when not using conda-build
Expand Down
7 changes: 4 additions & 3 deletions conda_build/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations

import functools
import json
import os
import random
Expand All @@ -12,7 +13,6 @@
import tarfile
from collections import OrderedDict, defaultdict
from contextlib import contextmanager
from functools import lru_cache
from os.path import (
isabs,
isdir,
Expand Down Expand Up @@ -49,7 +49,8 @@

if TYPE_CHECKING:
import os
from typing import Any, Iterable, Iterator
from collections.abc import Iterable, Iterator
from typing import Any

from .config import Config

Expand Down Expand Up @@ -281,7 +282,7 @@ def find_pkg_dir_or_file_in_pkgs_dirs(
return None


@lru_cache(maxsize=None)
@functools.cache
def _read_specs_from_package(pkg_loc, pkg_dist):
specs = {}
if pkg_loc and isdir(pkg_loc):
Expand Down
8 changes: 4 additions & 4 deletions conda_build/skeletons/cpan.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import subprocess
import sys
import tempfile
from functools import lru_cache, partial
from functools import cache, partial
from glob import glob
from os import makedirs
from os.path import basename, dirname, exists, join
Expand Down Expand Up @@ -639,7 +639,7 @@ def skeletonize(
f.write(CPAN_BLD_BAT.format(**d))


@lru_cache(maxsize=None)
@cache
def is_core_version(core_version, version):
if core_version is None:
return False
Expand Down Expand Up @@ -695,7 +695,7 @@ def add_parser(repos):
)


@lru_cache(maxsize=None)
@cache
def latest_pkg_version(pkg):
"""
:returns: the latest version of the specified conda package available
Expand Down Expand Up @@ -1037,7 +1037,7 @@ def core_module_dict(core_modules, module):
return None


@lru_cache(maxsize=None)
@cache
def metacpan_api_is_core_version(cpan_url, module):
if "FindBin" in module:
print("debug")
Expand Down
2 changes: 1 addition & 1 deletion conda_build/skeletons/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
from ..version import _parse as parse_version

if TYPE_CHECKING:
from typing import Iterable
from collections.abc import Iterable

pypi_example = """
Examples:
Expand Down
2 changes: 1 addition & 1 deletion conda_build/skeletons/rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .cran import yaml_quote_string

if TYPE_CHECKING:
from typing import Iterable
from collections.abc import Iterable

from ..config import Config

Expand Down
10 changes: 6 additions & 4 deletions conda_build/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
)

if TYPE_CHECKING:
from typing import Iterable
from collections.abc import Iterable

log = get_logger(__name__)

Expand Down Expand Up @@ -811,9 +811,11 @@ def __exit__(self, exc, value, tb):
fmts = OrderedDict(native=["--binary"], lf=[], crlf=[])
if patch_exe:
# Good, we have a patch executable so we can perform some checks:
with noop_context(
retained_tmpdir
) if retained_tmpdir else TemporaryDirectory() as tmpdir:
with (
noop_context(retained_tmpdir)
if retained_tmpdir
else TemporaryDirectory() as tmpdir
):
# Make all the fmts.
result["patches"] = {}
for fmt, _ in fmts.items():
Expand Down
Loading

0 comments on commit d8a4148

Please sign in to comment.