From c2bfe2b44ad34b06d8930aa4239995367f3eaf12 Mon Sep 17 00:00:00 2001 From: Daniel Holth Date: Thu, 17 Aug 2023 10:17:36 -0400 Subject: [PATCH] 3.26.1 (#4970) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Conda Bot Co-authored-by: Ken Odegard Co-authored-by: Jannis Leidel Co-authored-by: Bianca Henderson Co-authored-by: conda-bot <18747875+conda-bot@users.noreply.github.com> fix islist (#4184) --- .authors.yml | 28 +++++------ .github/workflows/cla.yml | 2 +- .pre-commit-config.yaml | 8 +-- CHANGELOG.md | 18 +++++++ RELEASE.md | 101 ++++++++++++++++++++++++-------------- conda_build/__init__.py | 3 +- conda_build/metadata.py | 55 ++++++++++++--------- conda_build/plugin.py | 64 ++++++++++++++++++++---- conda_build/utils.py | 17 ++++--- recipe/meta.yaml | 2 +- rever.xsh | 6 +++ tests/test_metadata.py | 65 +++++++++++++++++++++++- 12 files changed, 269 insertions(+), 100 deletions(-) diff --git a/.authors.yml b/.authors.yml index 3a4cc66964..2989dbcb6a 100644 --- a/.authors.yml +++ b/.authors.yml @@ -7,7 +7,7 @@ aliases: - Mike Sarahan - Michael Sarahan - num_commits: 4000 + num_commits: 2000 first_commit: 2015-09-04 21:31:08 - name: Jonathan J. Helmus email: jjhelmus@gmail.com @@ -63,7 +63,7 @@ alternate_emails: - mandeep@users.noreply.github.com - mbhutani@continuum.io - num_commits: 86 + num_commits: 43 first_commit: 2017-05-17 23:54:01 github: mandeep - name: Filipe Fernandes @@ -117,7 +117,7 @@ - heather999@users.noreply.github.com aliases: - heather999 - num_commits: 4 + num_commits: 2 first_commit: 2016-04-11 12:02:50 github: heather999 - name: Ryan Grout @@ -571,7 +571,7 @@ alternate_emails: - scastellarin95@gmail.com - scastellarin@anaconda.com - num_commits: 196 + num_commits: 98 first_commit: 2016-09-06 16:58:21 github: soapy1 - name: Bruno Oliveira @@ -754,7 +754,7 @@ alternate_emails: - kirkhamj@janelia.hhmi.org - jakirkham@gmail.com - num_commits: 146 + num_commits: 73 first_commit: 2015-04-21 13:26:39 github: jakirkham - name: Anthony Scopatz @@ -873,7 +873,7 @@ alternate_emails: - 5738695+183amir@users.noreply.github.com - amir.mohammadi@idiap.ch - num_commits: 12 + num_commits: 6 first_commit: 2018-02-27 16:37:19 - name: David Li email: li.davidm96@gmail.com @@ -967,7 +967,7 @@ first_commit: 2019-01-26 13:17:33 - name: Rachel Rigdon email: rrigdon@anaconda.com - num_commits: 268 + num_commits: 134 first_commit: 2019-01-24 15:12:09 github: rrigdon aliases: @@ -1118,7 +1118,7 @@ alternate_emails: - becker.mr@gmail.com - beckermr@users.noreply.github.com - num_commits: 38 + num_commits: 19 first_commit: 2019-10-17 23:05:16 github: beckermr - name: Jinzhe Zeng @@ -1199,7 +1199,7 @@ alternate_emails: - clee@anaconda.com - name: Ken Odegard - num_commits: 128 + num_commits: 130 email: kodegard@anaconda.com first_commit: 2020-09-08 19:53:41 github: kenodegard @@ -1222,7 +1222,7 @@ first_commit: 2020-11-19 10:46:41 - name: Jannis Leidel email: jannis@leidel.info - num_commits: 26 + num_commits: 27 github: jezdez first_commit: 2020-11-19 10:46:41 - name: Christof Kaufmann @@ -1237,7 +1237,7 @@ github: pre-commit-ci[bot] aliases: - pre-commit-ci[bot] - num_commits: 44 + num_commits: 48 first_commit: 2021-11-20 01:47:17 - name: Jacob Walls email: jacobtylerwalls@gmail.com @@ -1248,7 +1248,7 @@ github: beeankha alternate_emails: - beeankha@gmail.com - num_commits: 20 + num_commits: 19 first_commit: 2022-01-19 16:40:06 - name: Conda Bot email: 18747875+conda-bot@users.noreply.github.com @@ -1259,7 +1259,7 @@ alternate_emails: - ad-team+condabot@anaconda.com - 18747875+conda-bot@users.noreply.github.com - num_commits: 66 + num_commits: 35 first_commit: 2022-01-17 18:09:22 - name: Uwe L. Korn email: xhochy@users.noreply.github.com @@ -1268,7 +1268,7 @@ - name: Daniel Holth email: dholth@anaconda.com github: dholth - num_commits: 10 + num_commits: 12 first_commit: 2022-04-28 05:22:14 - name: Rylan Chord email: rchord@users.noreply.github.com diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 24c7a8b967..ed22cae254 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -27,7 +27,7 @@ jobs: # (default: secrets.GITHUB_TOKEN) token: ${{ secrets.CLA_ACTION_TOKEN }} # [required] - # Label to apply to contributor's PR once CLA is singed + # Label to apply to contributor's PR once CLA is signed label: cla-signed # [required] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 370d8fb9bd..da87844dfb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,7 @@ repos: - id: check-merge-conflict # Python verification and formatting - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.1 + rev: v1.5.4 hooks: # auto inject license blurb - id: insert-license @@ -47,7 +47,7 @@ repos: args: [--license-filepath, .github/disclaimer.txt, --no-extra-eol] exclude: ^conda_build/version.py - repo: https://github.com/asottile/pyupgrade - rev: v3.9.0 + rev: v3.10.1 hooks: # upgrade standard Python codes - id: pyupgrade @@ -58,7 +58,7 @@ repos: # auto sort Python imports - id: isort - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.7.0 hooks: # auto format Python codes - id: black @@ -69,7 +69,7 @@ repos: - id: blacken-docs additional_dependencies: [black] - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 6.1.0 hooks: # lint Python codes - id: flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index ac91b42cbb..59f76eb623 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ [//]: # (current developments) +## 3.26.1 (2023-08-17) + +### Bug fixes + +* Delay imports in conda command plugin until the command is used, avoiding + import-time side effects including unwanted logging configuration. (#4949) + +### Contributors + +* @beeankha +* @conda-bot +* @dholth +* @jezdez +* @kenodegard +* @pre-commit-ci[bot] + + + ## 3.26.0 (2023-07-18) ### Enhancements diff --git a/RELEASE.md b/RELEASE.md index 4f6199512e..5f0648df52 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -14,12 +14,12 @@ # Release Process -> **Note** +> **Note:** > Throughout this document are references to the version number as `YY.M.0`, this should be replaced with the correct version number. Do **not** prefix the version with a lowercase `v`. ## 1. Open the release issue and cut a release branch. (do this ~1 week prior to release) -> **Note** +> **Note:** > The [epic template][epic template] is perfect for this; remember to remove the **`epic`** label. Use the issue template below to create the release issue. After creating the release issue, pin it for easy access. @@ -48,7 +48,7 @@ Placeholder for `{{ repo.name }} YY.M.0` release. #### The week before release week - [ ] Create release branch (named `YY.M.x`) -- [ ] Ensure release candidates are being successfully built (see `conda-canary/label/YY.M.x`) +- [ ] Ensure release candidates are being successfully built (see `conda-canary/label/rc-{{ repo.name }}-YY.M.x`) - [ ] [Complete outstanding PRs][milestone] - [ ] Test release candidates @@ -76,7 +76,7 @@ Placeholder for `{{ repo.name }} YY.M.0` release. -> **Note** +> **Note:** > The new release branch should adhere to the naming convention of `YY.M.x`. ## 2. Alert various parties of the upcoming release. (do this ~1 week prior to release) @@ -122,7 +122,7 @@ Currently, there are only 2 activities we use rever for, (1) aggregating the aut 2. Run `rever --activities authors`: - > **Note** + > **Note:** > Include `--force` when re-running any rever commands for the same ``, otherwise, rever will skip the activity and no changes will be made (i.e., rever remembers if an activity has been run for a given version). ```bash @@ -164,7 +164,7 @@ Currently, there are only 2 activities we use rever for, (1) aggregating the aut ```bash (rever) $ git add . - (rever) $ git commit -m "Updated .authors.yml" + (rever) $ git commit -m "Update .authors.yml" ``` - Rerun `rever --activities authors` and finally check that your `.mailmap` is correct by running: @@ -189,21 +189,21 @@ Currently, there are only 2 activities we use rever for, (1) aggregating the aut ```bash (rever) $ git add . - (rever) $ git commit -m "Updated .mailmap" + (rever) $ git commit -m "Update .mailmap" ``` - Continue repeating the above processes until the `.authors.yml` and `.mailmap` are corrected to your liking. After completing this, you will have at most two commits on your release branch: ```bash (rever) $ git cherry -v main - + 86957814cf235879498ed7806029b8ff5f400034 Updated .authors.yml - + 3ec7491f2f58494a62f1491987d66f499f8113ad Updated .mailmap + + 86957814cf235879498ed7806029b8ff5f400034 Update .authors.yml + + 3ec7491f2f58494a62f1491987d66f499f8113ad Update .mailmap ``` 4. Review news snippets (ensure they are all using the correct Markdown format, **not** reStructuredText) and add additional snippets for undocumented PRs/changes as necessary. - > **Note** + > **Note:** > We've found it useful to name news snippets with the following format: `-`. > > We've also found that we like to include the PR #s inline with the text itself, e.g.: @@ -222,21 +222,21 @@ Currently, there are only 2 activities we use rever for, (1) aggregating the aut ```bash (rever) $ git add . - (rever) $ git commit -m "Updated news" + (rever) $ git commit -m "Update news" ``` - After completing this, you will have at most three commits on your release branch: ```bash (rever) $ git cherry -v main - + 86957814cf235879498ed7806029b8ff5f400034 Updated .authors.yml - + 3ec7491f2f58494a62f1491987d66f499f8113ad Updated .mailmap - + 432a9e1b41a3dec8f95a7556632f9a93fdf029fd Updated news + + 86957814cf235879498ed7806029b8ff5f400034 Update .authors.yml + + 3ec7491f2f58494a62f1491987d66f499f8113ad Update .mailmap + + 432a9e1b41a3dec8f95a7556632f9a93fdf029fd Update news ``` 5. Run `rever --activities changelog`: - > **Note** + > **Note:** > This has previously been a notoriously fickle step (likely due to incorrect regex patterns in the `rever.xsh` config file and missing `github` keys in `.authors.yml`) so beware of potential hiccups. If this fails, it's highly likely to be an innocent issue. ```bash @@ -256,9 +256,9 @@ Currently, there are only 2 activities we use rever for, (1) aggregating the aut ```bash (rever) $ git cherry -v main - + 86957814cf235879498ed7806029b8ff5f400034 Updated .authors.yml - + 3ec7491f2f58494a62f1491987d66f499f8113ad Updated .mailmap - + 432a9e1b41a3dec8f95a7556632f9a93fdf029fd Updated news + + 86957814cf235879498ed7806029b8ff5f400034 Update .authors.yml + + 3ec7491f2f58494a62f1491987d66f499f8113ad Update .mailmap + + 432a9e1b41a3dec8f95a7556632f9a93fdf029fd Update news ``` 6. Now that we have successfully run the activities separately, we wish to run both together. This will ensure that the contributor list, a side-effect of the authors activity, is included in the changelog activity. @@ -271,11 +271,11 @@ Currently, there are only 2 activities we use rever for, (1) aggregating the aut ```bash (rever) $ git cherry -v main - + 86957814cf235879498ed7806029b8ff5f400034 Updated .authors.yml - + 3ec7491f2f58494a62f1491987d66f499f8113ad Updated .mailmap - + 432a9e1b41a3dec8f95a7556632f9a93fdf029fd Updated news - + a5c0db938893d2c12cab12a1f7eb3e646ed80373 Updated authorship for YY.M.0 - + 5e95169d0df4bcdc2da9a6ba4a2561d90e49f75d Updated CHANGELOG for YY.M.0 + + 86957814cf235879498ed7806029b8ff5f400034 Update .authors.yml + + 3ec7491f2f58494a62f1491987d66f499f8113ad Update .mailmap + + 432a9e1b41a3dec8f95a7556632f9a93fdf029fd Update news + + a5c0db938893d2c12cab12a1f7eb3e646ed80373 Update authorship for YY.M.0 + + 5e95169d0df4bcdc2da9a6ba4a2561d90e49f75d Update CHANGELOG for YY.M.0 ``` 7. Since rever does not include stats on first-time contributors, we will need to add this manually. @@ -286,19 +286,19 @@ Currently, there are only 2 activities we use rever for, (1) aggregating the aut ```bash (rever) $ git add . - (rever) $ git commit -m "Added first contributions" + (rever) $ git commit -m "Add first-time contributions" ``` - After completing this, you will have at most six commits on your release branch: ```bash (rever) $ git cherry -v main - + 86957814cf235879498ed7806029b8ff5f400034 Updated .authors.yml - + 3ec7491f2f58494a62f1491987d66f499f8113ad Updated .mailmap - + 432a9e1b41a3dec8f95a7556632f9a93fdf029fd Updated news - + a5c0db938893d2c12cab12a1f7eb3e646ed80373 Updated authorship for YY.M.0 - + 5e95169d0df4bcdc2da9a6ba4a2561d90e49f75d Updated CHANGELOG for YY.M.0 - + 93fdf029fd4cf235872c12cab12a1f7e8f95a755 Added first contributions + + 86957814cf235879498ed7806029b8ff5f400034 Update .authors.yml + + 3ec7491f2f58494a62f1491987d66f499f8113ad Update .mailmap + + 432a9e1b41a3dec8f95a7556632f9a93fdf029fd Update news + + a5c0db938893d2c12cab12a1f7eb3e646ed80373 Update authorship for YY.M.0 + + 5e95169d0df4bcdc2da9a6ba4a2561d90e49f75d Update CHANGELOG for YY.M.0 + + 93fdf029fd4cf235872c12cab12a1f7e8f95a755 Add first-time contributions ``` 8. Push this versioned branch. @@ -326,7 +326,7 @@ Currently, there are only 2 activities we use rever for, (1) aggregating the aut 11. [Create][new release] the release and **SAVE AS A DRAFT** with the following values: - > **Note** + > **Note:** > Only publish the release after the release PR is merged, until then always **save as draft**. | Field | Value | @@ -339,9 +339,23 @@ Currently, there are only 2 activities we use rever for, (1) aggregating the aut ## 5. Wait for review and approval of release PR. -## 6. Merge release PR and publish release. +## 6. Manually test canary build(s). -## 7. Merge/cherry pick the release branch over to the `main` branch. +### Canary Builds for Manual Testing + +Once the release PRs are filed, successful canary builds will be available on `https://anaconda.org/conda-canary/conda/files?channel=rc-{{ repo.name }}-YY.M.x` for manual testing. + +> **Note:** +> You do not need to apply the `build::review` label for release PRs; every commit to the release branch builds and uploads canary builds to the respective `rc-` label. + +## 7. Merge release PR and publish release. + +To publish the release, go to the project's release page (e.g., https://github.com/conda/conda/releases) and add the release notes from `CHANGELOG.md` to the draft release you created earlier. Then publish the release. + +> **Note:** +> Release notes can be drafted and saved ahead of time. + +## 8. Merge/cherry pick the release branch over to the `main` branch.
Internal process @@ -354,19 +368,30 @@ Currently, there are only 2 activities we use rever for, (1) aggregating the aut 4. Ensure that all of the commits being pulled in look accurate, then select "Create pull request". -> **Note** +> **Note:** > Make sure NOT to push the "Update Branch" button. If there are [merge conflicts][merge conflicts], create a temporary "connector branch" dedicated to fixing merge conflicts separately from the `YY.M.0` and `main` branches. 5. Review and merge the pull request the same as any code change pull request. -> **Note** +> **Note:** > The commits from the release branch need to be retained in order to be able to compare individual commits; in other words, a "merge commit" is required when merging the resulting pull request vs. a "squash merge". Protected branches will require permissions to be temporarily relaxed in order to enable this action.
-## 8. Open PRs to bump [Anaconda Recipes][Anaconda Recipes] and [conda-forge][conda-forge] feedstocks to use `YY.M.0`. +## 9. Open PRs to bump [Anaconda Recipes][Anaconda Recipes] and [conda-forge][conda-forge] feedstocks to use `YY.M.0`. + +> **Note:** +> Conda-forge's PRs will be auto-created via the `regro-cf-autotick-bot`. Follow the instructions below if any changes need to be made to the recipe that were not automatically added (these instructions are only necessary for anyone who is _not_ a conda-forge feedstock maintainer, since maintainers can push changes directly to the autotick branch): +> - Create a new branch based off of autotick's branch (autotick's branches usually use the `regro-cf-autotick-bot:XX.YY.0_[short hash]` syntax) +> - Add any changes via commits to that new branch +> - Open a new PR and push it against the `main` branch +> +> Make sure to include a comment on the original `autotick-bot` PR that a new pull request has been created, in order to avoid duplicating work! `regro-cf-autotick-bot` will close the auto-created PR once the new PR is merged. +> +> For more information about this process, please read the ["Pushing to regro-cf-autotick-bot branch" section of the conda-forge documentation](https://conda-forge.org/docs/maintainer/updating_pkgs.html#pushing-to-regro-cf-autotick-bot-branch). + -## 9. Hand off to Anaconda's packaging team. +## 10. Hand off to Anaconda's packaging team.
Internal process @@ -377,6 +402,6 @@ Currently, there are only 2 activities we use rever for, (1) aggregating the aut
-## 10. Continue championing and shepherding. +## 11. Continue championing and shepherding. Remember to make all relevant announcements and continue to update the release issue with the latest details as tasks are completed. diff --git a/conda_build/__init__.py b/conda_build/__init__.py index 943084b6f4..91367d0d86 100644 --- a/conda_build/__init__.py +++ b/conda_build/__init__.py @@ -12,5 +12,6 @@ "index", "inspect", "metapackage", - "render" "skeleton", + "render", + "skeleton", ] diff --git a/conda_build/metadata.py b/conda_build/metadata.py index d158af6223..33c3230573 100644 --- a/conda_build/metadata.py +++ b/conda_build/metadata.py @@ -2,7 +2,6 @@ # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations -import contextlib import copy import hashlib import json @@ -41,9 +40,37 @@ ) try: - loader = yaml.CLoader -except: - loader = yaml.Loader + Loader = yaml.CLoader +except AttributeError: + Loader = yaml.Loader + + +class StringifyNumbersLoader(Loader): + @classmethod + def remove_implicit_resolver(cls, tag): + if "yaml_implicit_resolvers" not in cls.__dict__: + cls.yaml_implicit_resolvers = { + k: v[:] for k, v in cls.yaml_implicit_resolvers.items() + } + for ch in tuple(cls.yaml_implicit_resolvers): + resolvers = [(t, r) for t, r in cls.yaml_implicit_resolvers[ch] if t != tag] + if resolvers: + cls.yaml_implicit_resolvers[ch] = resolvers + else: + del cls.yaml_implicit_resolvers[ch] + + @classmethod + def remove_constructor(cls, tag): + if "yaml_constructors" not in cls.__dict__: + cls.yaml_constructors = cls.yaml_constructors.copy() + if tag in cls.yaml_constructors: + del cls.yaml_constructors[tag] + + +StringifyNumbersLoader.remove_implicit_resolver("tag:yaml.org,2002:float") +StringifyNumbersLoader.remove_implicit_resolver("tag:yaml.org,2002:int") +StringifyNumbersLoader.remove_constructor("tag:yaml.org,2002:float") +StringifyNumbersLoader.remove_constructor("tag:yaml.org,2002:int") on_win = sys.platform == "win32" @@ -261,9 +288,7 @@ def select_lines(data, namespace, variants_in_place): def yamlize(data): try: - with stringify_numbers(): - loaded_data = yaml.load(data, Loader=loader) - return loaded_data + return yaml.load(data, Loader=StringifyNumbersLoader) except yaml.error.YAMLError as e: if "{{" in data: try: @@ -1056,23 +1081,7 @@ def _hash_dependencies(hashing_dependencies, hash_length): return f"h{hash_.hexdigest()}"[: hash_length + 1] -@contextlib.contextmanager -def stringify_numbers(): - # ensure that numbers are not interpreted as ints or floats. That trips up versions - # with trailing zeros. - implicit_resolver_backup = loader.yaml_implicit_resolvers.copy() - for ch in list("0123456789"): - if ch in loader.yaml_implicit_resolvers: - del loader.yaml_implicit_resolvers[ch] - yield - for ch in list("0123456789"): - if ch in implicit_resolver_backup: - loader.yaml_implicit_resolvers[ch] = implicit_resolver_backup[ch] - - class MetaData: - __hash__ = None # declare as non-hashable to avoid its use with memoization - def __init__(self, path, config=None, variant=None): self.undefined_jinja_vars = [] self.config = get_or_merge_config(config, variant=variant) diff --git a/conda_build/plugin.py b/conda_build/plugin.py index 03a3949f44..eddb85fe66 100644 --- a/conda_build/plugin.py +++ b/conda_build/plugin.py @@ -2,15 +2,61 @@ # SPDX-License-Identifier: BSD-3-Clause import conda.plugins -from .cli.main_build import execute as build -from .cli.main_convert import execute as convert -from .cli.main_debug import execute as debug -from .cli.main_develop import execute as develop -from .cli.main_index import execute as index -from .cli.main_inspect import execute as inspect -from .cli.main_metapackage import execute as metapackage -from .cli.main_render import execute as render -from .cli.main_skeleton import execute as skeleton + +# lazy-import to avoid nasty import-time side effects when not using conda-build +def build(*args, **kwargs): + from .cli.main_build import execute + + execute(*args, **kwargs) + + +def convert(*args, **kwargs): + from .cli.main_convert import execute + + execute(*args, **kwargs) + + +def debug(*args, **kwargs): + from .cli.main_debug import execute + + execute(*args, **kwargs) + + +def develop(*args, **kwargs): + from .cli.main_develop import execute + + execute(*args, **kwargs) + + +def index(*args, **kwargs): + # deprecated! use conda-index! + from .cli.main_index import execute + + execute(*args, **kwargs) + + +def inspect(*args, **kwargs): + from .cli.main_inspect import execute + + execute(*args, **kwargs) + + +def metapackage(*args, **kwargs): + from .cli.main_metapackage import execute + + execute(*args, **kwargs) + + +def render(*args, **kwargs): + from .cli.main_render import execute + + execute(*args, **kwargs) + + +def skeleton(*args, **kwargs): + from .cli.main_skeleton import execute + + execute(*args, **kwargs) @conda.plugins.hookimpl diff --git a/conda_build/utils.py b/conda_build/utils.py index 49b95b7ca1..aa375790f3 100644 --- a/conda_build/utils.py +++ b/conda_build/utils.py @@ -34,6 +34,7 @@ ) from pathlib import Path from threading import Thread +from typing import Iterable import libarchive @@ -941,7 +942,7 @@ def file_info(path): } -def comma_join(items): +def comma_join(items: Iterable[str], conjunction: str = "and") -> str: """ Like ', '.join(items) but with and @@ -954,11 +955,10 @@ def comma_join(items): >>> comma_join(['a', 'b', 'c']) 'a, b, and c' """ - return ( - " and ".join(items) - if len(items) <= 2 - else ", ".join(items[:-1]) + ", and " + items[-1] - ) + items = tuple(items) + if len(items) <= 2: + return f"{items[0]} {conjunction} {items[1]}" + return f"{', '.join(items[:-1])}, {conjunction} {items[-1]}" def safe_print_unicode(*args, **kwargs): @@ -1268,7 +1268,7 @@ def islist(arg, uniform=False, include_dict=True): :return: Whether `arg` is a `list` :rtype: bool """ - if isinstance(arg, str) or not hasattr(arg, "__iter__"): + if isinstance(arg, str) or not isinstance(arg, Iterable): # str and non-iterables are not lists return False elif not include_dict and isinstance(arg, dict): @@ -1279,6 +1279,7 @@ def islist(arg, uniform=False, include_dict=True): return True # NOTE: not checking for Falsy arg since arg may be a generator + # WARNING: if uniform != False and arg is a generator then arg will be consumed if uniform is True: arg = iter(arg) @@ -1288,7 +1289,7 @@ def islist(arg, uniform=False, include_dict=True): # StopIteration: list is empty, an empty list is still uniform return True # check for explicit type match, do not allow the ambiguity of isinstance - uniform = lambda e: type(e) == etype + uniform = lambda e: type(e) == etype # noqa: E721 try: return all(uniform(e) for e in arg) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index bc307a23a4..9ca9a95a27 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -53,7 +53,7 @@ requirements: - tomli # [py<311] - tqdm run_constrained: - - conda-verify >=3.0.2 + - conda-verify >=3.1.0 test: imports: diff --git a/rever.xsh b/rever.xsh index 644107dfd9..577ecfa980 100644 --- a/rever.xsh +++ b/rever.xsh @@ -26,3 +26,9 @@ $CHANGELOG_CATEGORIES = [ $CHANGELOG_CATEGORY_TITLE_FORMAT = "### {category}\n\n" $CHANGELOG_AUTHORS_TITLE = "Contributors" $CHANGELOG_AUTHORS_FORMAT = "* @{github}\n" + +try: + # allow repository to customize synchronized-from-infa rever config + from rever_overrides import * +except ImportError: + pass diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 99545c50c9..b5a696ff6f 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -8,7 +8,7 @@ import pytest from conda_build import api -from conda_build.metadata import MetaData, _hash_dependencies, select_lines +from conda_build.metadata import MetaData, _hash_dependencies, select_lines, yamlize from conda_build.utils import DEFAULT_SUBDIRS from .utils import metadata_dir, thisdir @@ -260,3 +260,66 @@ def test_config_member_decoupling(testing_metadata): b = testing_metadata.copy() b.config.some_member = "123" assert b.config.some_member != testing_metadata.config.some_member + + +# ensure that numbers are not interpreted as ints or floats, doing so trips up versions +# with trailing zeros +def test_yamlize_zero(): + yml = yamlize( + """ + - 0 + - 0. + - 0.0 + - .0 + """ + ) + + assert yml == ["0", "0.", "0.0", ".0"] + + +def test_yamlize_positive(): + yml = yamlize( + """ + - +1 + - +1. + - +1.2 + - +.2 + """ + ) + + assert yml == ["+1", "+1.", "+1.2", "+.2"] + + +def test_yamlize_negative(): + yml = yamlize( + """ + - -1 + - -1. + - -1.2 + - -.2 + """ + ) + + assert yml == ["-1", "-1.", "-1.2", "-.2"] + + +def test_yamlize_numbers(): + yml = yamlize( + """ + - 1 + - 1.2 + """ + ) + + assert yml == ["1", "1.2"] + + +def test_yamlize_versions(): + yml = yamlize( + """ + - 1.2.3 + - 1.2.3.4 + """ + ) + + assert yml == ["1.2.3", "1.2.3.4"]