Skip to content

Commit

Permalink
Merge branch 'main' into stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
jakirkham authored Oct 18, 2023
2 parents 9ad1a81 + f7cf445 commit 5bbfaf8
Show file tree
Hide file tree
Showing 16 changed files with 307 additions and 163 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/1_feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ body:
id: what
attributes:
label: What should happen?
description: What should be the user experience with the feature? Describe from a user perpective what they would do and see.
description: What should be the user experience with the feature? Describe from a user perspective what they would do and see.
- type: textarea
id: context
attributes:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check CLA
uses: conda/actions/check-cla@v23.7.0
uses: conda/actions/check-cla@v23.10.0
with:
# [required]
# A token with ability to comment, label, and modify the commit status
Expand All @@ -31,6 +31,6 @@ jobs:
label: cla-signed

# [required]
# Token for opening singee PR in the provided `cla_repo`
# Token for opening signee PR in the provided `cla_repo`
# (`pull_request: write` for fine-grained PAT; `repo` and `workflow` for classic PAT)
cla_token: ${{ secrets.CLA_FORK_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
days-before-issue-stale: 90
days-before-issue-close: 21
steps:
- uses: conda/actions/read-yaml@v23.7.0
- uses: conda/actions/read-yaml@v23.10.0
id: read_yaml
with:
path: https://raw.githubusercontent.com/conda/infra/main/.github/messages.yml
Expand Down
3 changes: 3 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ To publish the release, go to the project's release page (e.g., https://github.c
## 10. Hand off to Anaconda's packaging team.
> **Note:**
> This step should NOT be done past Thursday morning EST; please start the process on a Monday, Tuesday, or Wednesday instead in order to avoid any potential debugging sessions over evenings or weekends.
<details>
<summary>Internal process</summary>
Expand Down
13 changes: 0 additions & 13 deletions conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
env_path_backup_var_exists,
get_conda_channel,
get_rc_urls,
pkgs_dirs,
prefix_placeholder,
reset_context,
root_dir,
Expand Down Expand Up @@ -3420,18 +3419,6 @@ def test(
# folder destination
_extract_test_files_from_package(metadata)

# When testing a .tar.bz2 in the pkgs dir, clean_pkg_cache() will remove it.
# Prevent this. When https://github.com/conda/conda/issues/5708 gets fixed
# I think we can remove this call to clean_pkg_cache().
in_pkg_cache = (
not hasattr(recipedir_or_package_or_metadata, "config")
and os.path.isfile(recipedir_or_package_or_metadata)
and recipedir_or_package_or_metadata.endswith(CONDA_PACKAGE_EXTENSIONS)
and os.path.dirname(recipedir_or_package_or_metadata) in pkgs_dirs[0]
)
if not in_pkg_cache:
environ.clean_pkg_cache(metadata.dist(), metadata.config)

copy_test_source_files(metadata, metadata.config.test_dir)
# this is also copying tests/source_files from work_dir to testing workdir

Expand Down
11 changes: 10 additions & 1 deletion conda_build/conda_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,19 @@
win_path_to_unix,
)
from conda.models.channel import get_conda_build_local_url # noqa: F401
from conda.models.dist import Dist, IndexRecord # noqa: F401
from conda.models.dist import Dist # noqa: F401
from conda.models.records import PackageRecord

from .deprecations import deprecated

deprecated.constant(
"3.28.0",
"4.0.0",
"IndexRecord",
PackageRecord,
addendum="Use `conda.models.records.PackageRecord` instead.",
)

# TODO: Go to references of all properties below and import them from `context` instead
binstar_upload = context.binstar_upload
default_python = context.default_python
Expand Down
2 changes: 2 additions & 0 deletions conda_build/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
reset_context,
root_dir,
)
from .deprecations import deprecated

# these are things that we provide env vars for more explicitly. This list disables the
# pass-through of variant values to env vars for these keys.
Expand Down Expand Up @@ -1214,6 +1215,7 @@ def remove_existing_packages(dirs, fns, config):
utils.rm_rf(entry)


@deprecated("3.28.0", "4.0.0")
def clean_pkg_cache(dist, config):
locks = []

Expand Down
40 changes: 25 additions & 15 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from conda_build.features import feature_list
from conda_build.license_family import ensure_valid_license_family
from conda_build.utils import (
DEFAULT_SUBDIRS,
HashableDict,
ensure_list,
expand_globs,
Expand All @@ -29,7 +30,7 @@
insert_variant_versions,
)

from .conda_interface import MatchSpec, envs_dirs, md5_file, non_x86_linux_machines
from .conda_interface import MatchSpec, envs_dirs, md5_file

try:
import yaml
Expand Down Expand Up @@ -121,41 +122,53 @@ def get_selectors(config: Config) -> dict[str, bool]:
# Remember to update the docs of any of this changes
plat = config.host_subdir
d = dict(
linux=plat.startswith("linux-"),
linux32=bool(plat == "linux-32"),
linux64=bool(plat == "linux-64"),
emscripten=plat.startswith("emscripten-"),
wasi=plat.startswith("wasi-"),
arm=plat.startswith("linux-arm"),
osx=plat.startswith("osx-"),
unix=plat.startswith(("linux-", "osx-", "emscripten-")),
win=plat.startswith("win-"),
win32=bool(plat == "win-32"),
win64=bool(plat == "win-64"),
x86=plat.endswith(("-32", "-64")),
x86_64=plat.endswith("-64"),
wasm32=bool(plat.endswith("-wasm32")),
os=os,
environ=os.environ,
nomkl=bool(int(os.environ.get("FEATURE_NOMKL", False))),
)

# Add the current platform to the list of subdirs to enable conda-build
# to bootstrap new platforms without a new conda release.
subdirs = list(DEFAULT_SUBDIRS) + [plat]

# filter out noarch and other weird subdirs
subdirs = [subdir for subdir in subdirs if "-" in subdir]

subdir_oses = {subdir.split("-")[0] for subdir in subdirs}
subdir_archs = {subdir.split("-")[1] for subdir in subdirs}

for subdir_os in subdir_oses:
d[subdir_os] = plat.startswith(f"{subdir_os}-")

for arch in subdir_archs:
arch_full = ARCH_MAP.get(arch, arch)
d[arch_full] = plat.endswith(f"-{arch}")
if arch == "32":
d["x86"] = plat.endswith(("-32", "-64"))

defaults = variants.get_default_variant(config)
py = config.variant.get("python", defaults["python"])
# there are times when python comes in as a tuple
if not hasattr(py, "split"):
py = py[0]
# go from "3.6 *_cython" -> "36"
# or from "3.6.9" -> "36"
py = int("".join(py.split(" ")[0].split(".")[:2]))
py_major, py_minor, *_ = py.split(" ")[0].split(".")
py = int(f"{py_major}{py_minor}")

d["build_platform"] = config.build_subdir

d.update(
dict(
py=py,
py3k=bool(30 <= py < 40),
py2k=bool(20 <= py < 30),
py3k=bool(py_major == "3"),
py2k=bool(py_major == "2"),
py26=bool(py == 26),
py27=bool(py == 27),
py33=bool(py == 33),
Expand All @@ -182,9 +195,6 @@ def get_selectors(config: Config) -> dict[str, bool]:
d["lua"] = lua
d["luajit"] = bool(lua[0] == "2")

for machine in non_x86_linux_machines:
d[machine] = bool(plat.endswith("-%s" % machine))

for feature, value in feature_list:
d[feature] = value
d.update(os.environ)
Expand Down
2 changes: 1 addition & 1 deletion conda_build/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def execute_download_actions(m, actions, env, package_subset=None, require_files
with utils.LoggingContext():
pfe.execute()
for pkg_dir in pkgs_dirs:
_loc = os.path.join(pkg_dir, index[pkg].fn)
_loc = os.path.join(pkg_dir, index.get(pkg, pkg).fn)
if os.path.isfile(_loc):
pkg_loc = _loc
break
Expand Down
21 changes: 2 additions & 19 deletions conda_build/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
from glob import glob

from conda.api import PackageCacheData # noqa
from conda.base.constants import KNOWN_SUBDIRS

# NOQA because it is not used in this file.
from conda_build.conda_interface import rm_rf as _rm_rf # noqa
Expand Down Expand Up @@ -104,25 +105,7 @@
mmap_PROT_READ = 0 if on_win else mmap.PROT_READ
mmap_PROT_WRITE = 0 if on_win else mmap.PROT_WRITE

DEFAULT_SUBDIRS = {
"emscripten-wasm32",
"wasi-wasm32",
"linux-64",
"linux-32",
"linux-s390x",
"linux-ppc64",
"linux-ppc64le",
"linux-armv6l",
"linux-armv7l",
"linux-aarch64",
"win-64",
"win-32",
"win-arm64",
"osx-64",
"osx-arm64",
"zos-z",
"noarch",
}
DEFAULT_SUBDIRS = set(KNOWN_SUBDIRS)

RUN_EXPORTS_TYPES = {
"weak",
Expand Down
11 changes: 8 additions & 3 deletions docs/source/resources/define-metadata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1928,10 +1928,10 @@ variables are booleans.
* - osx
- True if the platform is macOS.
* - arm64
- True if the platform is macOS and the Python architecture
is arm64.
- True if the platform is either macOS or Windows and the
Python architecture is arm64.
* - unix
- True if the platform is either macOS or Linux.
- True if the platform is either macOS or Linux or emscripten.
* - win
- True if the platform is Windows.
* - win32
Expand Down Expand Up @@ -1965,6 +1965,11 @@ The use of the Python version selectors, `py27`, `py34`, etc. is discouraged in
favor of the more general comparison operators. Additional selectors in this
series will not be added to conda-build.

Note that for each subdir with OS and architecture that `conda` supports,
two preprocessing selectors are created for the OS and the architecture separately
except when the architecture is not a valid python expression (`*-32` and `*-64`
in particular).

Because the selector is any valid Python expression, complicated
logic is possible:

Expand Down
24 changes: 24 additions & 0 deletions news/5009-use-conda-known-subdirs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### Enhancements

* Use subdirs known to conda for selector definitions. (#5009)
This allows conda_build to support new architectures with just
a new version of conda. For new OSes, there are more information
needed for conda_build to work properly, including whether the
new OS is a UNIX-like platform, the shared library prefix, and
the binary archive format for the platform.

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
19 changes: 19 additions & 0 deletions news/5031-post-conda-5708-cleanup
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* Remove unnecessary cache clearing from `conda_buidl.build.test`. (#5031)

### Bug fixes

* <news item>

### Deprecations

* Mark `conda_build.environ.clean_pkg_cache` as pending deprecation. (#5031)

### Docs

* <news item>

### Other

* <news item>
19 changes: 19 additions & 0 deletions news/5037-conda-libmamba-solver-pins
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Fallback to solved record filename to find the downloaded tarball in `get_upstream_pins`. (#4991 via #5037)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
Loading

0 comments on commit 5bbfaf8

Please sign in to comment.