From 81fc7aa73272bf1306c6d031567fbeb7553e9796 Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Thu, 7 Sep 2023 17:30:34 +0200 Subject: [PATCH 01/24] Python 3.12 --- .github/workflows/tests.yml | 22 +++++++++---------- conda_build/skeletons/pypi.py | 2 +- pyproject.toml | 4 ++-- recipe/conda_build_config.yaml | 2 +- .../metadata/_pyyaml_find_header/meta.yaml | 2 +- tests/test_api_build.py | 2 +- tests/test_api_render.py | 6 ++--- tests/test_metadata.py | 9 ++++---- tests/test_variants.py | 4 ++-- 9 files changed, 27 insertions(+), 26 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 47b744cdd9..67acc56860 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -69,14 +69,14 @@ jobs: fail-fast: false matrix: # test all lower versions (w/ stable conda) and upper version (w/ canary conda) - python-version: ['3.8', '3.9', '3.10'] + python-version: ['3.9', '3.10', '3.11'] conda-version: [release] test-type: [serial, parallel] include: - - python-version: '3.11' + - python-version: '3.12' conda-version: canary test-type: serial - - python-version: '3.11' + - python-version: '3.12' conda-version: canary test-type: parallel env: @@ -173,14 +173,14 @@ 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: - - python-version: '3.11' + - python-version: '3.12' conda-version: canary test-type: serial - - python-version: '3.11' + - python-version: '3.12' conda-version: canary test-type: parallel env: @@ -284,14 +284,14 @@ 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: - - python-version: '3.11' + - python-version: '3.12' conda-version: canary test-type: serial - - python-version: '3.11' + - python-version: '3.12' conda-version: canary test-type: parallel env: @@ -452,10 +452,10 @@ jobs: clean: true fetch-depth: 0 - # Explicitly use Python 3.11 since each of the OSes has a different default Python + # Explicitly use Python 3.12 since each of the OSes has a different default Python - uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.12' - name: Detect label shell: python diff --git a/conda_build/skeletons/pypi.py b/conda_build/skeletons/pypi.py index b1194e6a8b..221d6bcc99 100644 --- a/conda_build/skeletons/pypi.py +++ b/conda_build/skeletons/pypi.py @@ -560,7 +560,7 @@ def add_parser(repos): action="store", default=default_python, help="""Version of Python to use to run setup.py. Default is %(default)s.""", - choices=["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"], + choices=["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"], ) pypi.add_argument( diff --git a/pyproject.toml b/pyproject.toml index 9fb3b5f222..3f101584e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,10 +18,10 @@ classifiers = [ "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ] @@ -43,7 +43,7 @@ dependencies = [ "pyyaml", "requests", "six", - "tomli ; python_version<'3.11'", + "tomli ; python_version<'3.12'", "tqdm", ] dynamic = ["version"] diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index a75aff37d1..cbfd2b0e81 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -1,5 +1,5 @@ python: - - 3.8 - 3.9 - 3.10 - 3.11 + - 3.12 diff --git a/tests/test-recipes/metadata/_pyyaml_find_header/meta.yaml b/tests/test-recipes/metadata/_pyyaml_find_header/meta.yaml index d9c04895c6..32b2231fd7 100644 --- a/tests/test-recipes/metadata/_pyyaml_find_header/meta.yaml +++ b/tests/test-recipes/metadata/_pyyaml_find_header/meta.yaml @@ -1,7 +1,7 @@ # recipe from conda forge, downloaded 2016/06/03 # problem report was https://github.com/conda/conda-build/issues/993 -{% set version = "3.11" %} +{% set version = "3.12" %} package: diff --git a/tests/test_api_build.py b/tests/test_api_build.py index e0c786dcc8..85eb31dad7 100644 --- a/tests/test_api_build.py +++ b/tests/test_api_build.py @@ -430,7 +430,7 @@ def test_checkout_tool_as_dependency(testing_workdir, testing_config, monkeypatc platforms = ["64" if sys.maxsize > 2**32 else "32"] if sys.platform == "win32": platforms = sorted({"32", *platforms}) - compilers = ["3.10", "3.11"] + compilers = ["3.10", "3.11", "3.12"] msvc_vers = ["14.0"] else: msvc_vers = [] diff --git a/tests/test_api_render.py b/tests/test_api_render.py index a68f69135e..644f9377b3 100644 --- a/tests/test_api_render.py +++ b/tests/test_api_render.py @@ -213,7 +213,7 @@ def test_noarch_with_no_platform_deps(testing_workdir, testing_config): def test_setting_condarc_vars_with_env_var_expansion(testing_workdir): os.makedirs("config") # python won't be used - the stuff in the recipe folder will override it - python_versions = ["2.6", "3.4", "3.11"] + python_versions = ["2.6", "3.4", "3.11", "3.12"] config = {"python": python_versions, "bzip2": ["0.9", "1.0"]} with open(os.path.join("config", "conda_build_config.yaml"), "w") as f: yaml.dump(config, f, default_flow_style=False) @@ -289,7 +289,7 @@ def test_pin_expression_works_with_prereleases(testing_config): ms = api.render(recipe, config=testing_config) assert len(ms) == 2 m = next(m_[0] for m_ in ms if m_[0].meta["package"]["name"] == "bar") - assert "foo >=3.10.0.rc1,<3.11.0a0" in m.meta["requirements"]["run"] + assert "foo >=3.10.0.rc1,<3.12.0a0" in m.meta["requirements"]["run"] def test_pin_expression_works_with_python_prereleases(testing_config): @@ -297,4 +297,4 @@ def test_pin_expression_works_with_python_prereleases(testing_config): ms = api.render(recipe, config=testing_config) assert len(ms) == 2 m = next(m_[0] for m_ in ms if m_[0].meta["package"]["name"] == "bar") - assert "python >=3.10.0rc1,<3.11.0a0" in m.meta["requirements"]["run"] + assert "python >=3.10.0rc1,<3.12.0a0" in m.meta["requirements"]["run"] diff --git a/tests/test_metadata.py b/tests/test_metadata.py index b5a696ff6f..f7b79f4768 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -175,10 +175,11 @@ def test_build_bootstrap_env_by_path(testing_metadata): ("win", "x86_64", "3.9", {"vs2017_win-x86_64"}), ("win", "x86_64", "3.10", {"vs2017_win-x86_64"}), ("win", "x86_64", "3.11", {"vs2017_win-x86_64"}), - ("linux", "32", "3.11", {"gcc_linux-32", "gxx_linux-32"}), - ("linux", "64", "3.11", {"gcc_linux-64", "gxx_linux-64"}), - ("osx", "32", "3.11", {"clang_osx-32", "clangxx_osx-32"}), - ("osx", "64", "3.11", {"clang_osx-64", "clangxx_osx-64"}), + ("win", "x86_64", "3.12", {"vs2017_win-x86_64"}), + ("linux", "32", "3.12", {"gcc_linux-32", "gxx_linux-32"}), + ("linux", "64", "3.12", {"gcc_linux-64", "gxx_linux-64"}), + ("osx", "32", "3.12", {"clang_osx-32", "clangxx_osx-32"}), + ("osx", "64", "3.12", {"clang_osx-64", "clangxx_osx-64"}), ], ) def test_native_compiler_metadata( diff --git a/tests/test_variants.py b/tests/test_variants.py index 3e7ba621a5..29d54aa452 100644 --- a/tests/test_variants.py +++ b/tests/test_variants.py @@ -59,7 +59,7 @@ def test_python_variants(testing_workdir, testing_config, as_yaml): python 3.5 -> python >=3.5,<3.6.0a0 otherPackages 3.5 -> otherPackages 3.5 """ - variants = {"python": ["3.10", "3.11"]} + variants = {"python": ["3.10", "3.11", "3.12"]} testing_config.ignore_system_config = True # write variants to disk @@ -86,7 +86,7 @@ def test_python_variants(testing_workdir, testing_config, as_yaml): assert { *metadata[0][0].meta["requirements"]["run"], *metadata[1][0].meta["requirements"]["run"], - } == {"python >=3.10,<3.11.0a0", "python >=3.11,<3.12.0a0"} + } == {"python >=3.10,<3.12.0a0", "python >=3.12,<3.13.0a0"} def test_use_selectors_in_variants(testing_workdir, testing_config): From f9140d1888f352c7adf4b000df11621c9087d5d6 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Thu, 7 Dec 2023 12:00:19 -0600 Subject: [PATCH 02/24] Add back Python 3.8 support --- .github/workflows/tests.yml | 4 ++-- pyproject.toml | 1 + recipe/conda_build_config.yaml | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3360077e11..5cbbb5268d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -182,7 +182,7 @@ jobs: fail-fast: false matrix: # test lower version (w/ stable conda) and upper version (w/ canary conda) - python-version: ['3.9'] + python-version: ['3.8'] conda-version: [release] test-type: [serial, parallel] include: @@ -299,7 +299,7 @@ jobs: fail-fast: false matrix: # test lower version (w/ stable conda) and upper version (w/ canary conda) - python-version: ['3.9'] + python-version: ['3.8'] conda-version: [release] test-type: [serial, parallel] include: diff --git a/pyproject.toml b/pyproject.toml index 551108e806..2b6828cf25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ classifiers = [ "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index cbfd2b0e81..d7d85008cc 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -1,4 +1,5 @@ python: + - 3.8 - 3.9 - 3.10 - 3.11 From 44adf25d94d0b6f7dc9ba0999540f3cb36667756 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Thu, 7 Dec 2023 12:01:29 -0600 Subject: [PATCH 03/24] Revert undesired changes to tests --- tests/test_api_render.py | 6 +++--- tests/test_variants.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_api_render.py b/tests/test_api_render.py index 2d60297bc5..1451fbbbe0 100644 --- a/tests/test_api_render.py +++ b/tests/test_api_render.py @@ -214,7 +214,7 @@ def test_noarch_with_no_platform_deps(testing_workdir, testing_config): def test_setting_condarc_vars_with_env_var_expansion(testing_workdir): os.makedirs("config") # python won't be used - the stuff in the recipe folder will override it - python_versions = ["2.6", "3.4", "3.11", "3.12"] + python_versions = ["2.6", "3.4", "3.11"] config = {"python": python_versions, "bzip2": ["0.9", "1.0"]} with open(os.path.join("config", "conda_build_config.yaml"), "w") as f: yaml.dump(config, f, default_flow_style=False) @@ -290,7 +290,7 @@ def test_pin_expression_works_with_prereleases(testing_config): ms = api.render(recipe, config=testing_config) assert len(ms) == 2 m = next(m_[0] for m_ in ms if m_[0].meta["package"]["name"] == "bar") - assert "foo >=3.10.0.rc1,<3.12.0a0" in m.meta["requirements"]["run"] + assert "foo >=3.10.0.rc1,<3.11.0a0" in m.meta["requirements"]["run"] def test_pin_expression_works_with_python_prereleases(testing_config): @@ -298,4 +298,4 @@ def test_pin_expression_works_with_python_prereleases(testing_config): ms = api.render(recipe, config=testing_config) assert len(ms) == 2 m = next(m_[0] for m_ in ms if m_[0].meta["package"]["name"] == "bar") - assert "python >=3.10.0rc1,<3.12.0a0" in m.meta["requirements"]["run"] + assert "python >=3.10.0rc1,<3.11.0a0" in m.meta["requirements"]["run"] diff --git a/tests/test_variants.py b/tests/test_variants.py index 6acf557e22..07d5110f82 100644 --- a/tests/test_variants.py +++ b/tests/test_variants.py @@ -87,7 +87,7 @@ def test_python_variants(testing_workdir, testing_config, as_yaml): assert { *metadata[0][0].meta["requirements"]["run"], *metadata[1][0].meta["requirements"]["run"], - } == {"python >=3.10,<3.12.0a0", "python >=3.12,<3.13.0a0"} + } == {"python >=3.10,<3.11.0a0", "python >=3.11,<3.12.0a0", "python >=3.12,<3.13.0a0"} def test_use_selectors_in_variants(testing_workdir, testing_config): From 920e58dcce87e0f92aee3c141da845b8eb938e4c Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Thu, 7 Dec 2023 12:02:49 -0600 Subject: [PATCH 04/24] Quote versions in cbc.yaml so we don't loose trailing zeros --- recipe/conda_build_config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index d7d85008cc..42847d7ead 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -1,6 +1,6 @@ python: - - 3.8 - - 3.9 - - 3.10 - - 3.11 - - 3.12 + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" From 62023644526a400f453d75ddb336cd3cad08d7c9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 18:12:01 +0000 Subject: [PATCH 05/24] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_variants.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_variants.py b/tests/test_variants.py index 07d5110f82..7146bba48b 100644 --- a/tests/test_variants.py +++ b/tests/test_variants.py @@ -87,7 +87,11 @@ def test_python_variants(testing_workdir, testing_config, as_yaml): assert { *metadata[0][0].meta["requirements"]["run"], *metadata[1][0].meta["requirements"]["run"], - } == {"python >=3.10,<3.11.0a0", "python >=3.11,<3.12.0a0", "python >=3.12,<3.13.0a0"} + } == { + "python >=3.10,<3.11.0a0", + "python >=3.11,<3.12.0a0", + "python >=3.12,<3.13.0a0", + } def test_use_selectors_in_variants(testing_workdir, testing_config): From d96db06937615309d60a81ab243c3ff0496870fb Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Wed, 3 Jan 2024 16:47:18 -0600 Subject: [PATCH 06/24] Correct tests --- tests/test-recipes/metadata/_pyyaml_find_header/meta.yaml | 2 +- tests/test_variants.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test-recipes/metadata/_pyyaml_find_header/meta.yaml b/tests/test-recipes/metadata/_pyyaml_find_header/meta.yaml index 32b2231fd7..d9c04895c6 100644 --- a/tests/test-recipes/metadata/_pyyaml_find_header/meta.yaml +++ b/tests/test-recipes/metadata/_pyyaml_find_header/meta.yaml @@ -1,7 +1,7 @@ # recipe from conda forge, downloaded 2016/06/03 # problem report was https://github.com/conda/conda-build/issues/993 -{% set version = "3.12" %} +{% set version = "3.11" %} package: diff --git a/tests/test_variants.py b/tests/test_variants.py index 7146bba48b..ea3b20e439 100644 --- a/tests/test_variants.py +++ b/tests/test_variants.py @@ -79,14 +79,16 @@ def test_python_variants(testing_workdir, testing_config, as_yaml): ) # we should have one package/metadata per python version - assert len(metadata) == 2 + assert len(metadata) == 3 # there should only be one run requirement for each package/metadata assert len(metadata[0][0].meta["requirements"]["run"]) == 1 assert len(metadata[1][0].meta["requirements"]["run"]) == 1 + assert len(metadata[2][0].meta["requirements"]["run"]) == 1 # the run requirements should be python ranges assert { *metadata[0][0].meta["requirements"]["run"], *metadata[1][0].meta["requirements"]["run"], + *metadata[2][0].meta["requirements"]["run"], } == { "python >=3.10,<3.11.0a0", "python >=3.11,<3.12.0a0", From 5caca6e9c083a170074b592b3712ff6a045828d4 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Wed, 3 Jan 2024 16:50:31 -0600 Subject: [PATCH 07/24] Revert python variants test --- tests/test_variants.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/test_variants.py b/tests/test_variants.py index ea3b20e439..37ac3978d5 100644 --- a/tests/test_variants.py +++ b/tests/test_variants.py @@ -60,7 +60,7 @@ def test_python_variants(testing_workdir, testing_config, as_yaml): python 3.5 -> python >=3.5,<3.6.0a0 otherPackages 3.5 -> otherPackages 3.5 """ - variants = {"python": ["3.10", "3.11", "3.12"]} + variants = {"python": ["3.11", "3.12"]} testing_config.ignore_system_config = True # write variants to disk @@ -79,18 +79,15 @@ def test_python_variants(testing_workdir, testing_config, as_yaml): ) # we should have one package/metadata per python version - assert len(metadata) == 3 + assert len(metadata) == 2 # there should only be one run requirement for each package/metadata assert len(metadata[0][0].meta["requirements"]["run"]) == 1 assert len(metadata[1][0].meta["requirements"]["run"]) == 1 - assert len(metadata[2][0].meta["requirements"]["run"]) == 1 # the run requirements should be python ranges assert { *metadata[0][0].meta["requirements"]["run"], *metadata[1][0].meta["requirements"]["run"], - *metadata[2][0].meta["requirements"]["run"], } == { - "python >=3.10,<3.11.0a0", "python >=3.11,<3.12.0a0", "python >=3.12,<3.13.0a0", } From de1c5b3f3584157c36123513de4c0ba3c6a30827 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Wed, 3 Jan 2024 16:50:59 -0600 Subject: [PATCH 08/24] Format --- tests/test_variants.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/test_variants.py b/tests/test_variants.py index 37ac3978d5..89ebb67999 100644 --- a/tests/test_variants.py +++ b/tests/test_variants.py @@ -87,10 +87,7 @@ def test_python_variants(testing_workdir, testing_config, as_yaml): assert { *metadata[0][0].meta["requirements"]["run"], *metadata[1][0].meta["requirements"]["run"], - } == { - "python >=3.11,<3.12.0a0", - "python >=3.12,<3.13.0a0", - } + } == {"python >=3.11,<3.12.0a0", "python >=3.12,<3.13.0a0"} def test_use_selectors_in_variants(testing_workdir, testing_config): From e05416e7193c81113fc7ff7e586b6b4a7f610d37 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Thu, 4 Jan 2024 10:49:55 -0600 Subject: [PATCH 09/24] Update requirements.txt --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index a7140e8673..a4ecdd07a8 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,7 +1,7 @@ -anaconda-client beautifulsoup4 chardet conda >=22.11.0 +conda-forge::anaconda-client conda-index conda-package-handling >=1.3 conda-verify From cd370446e084834c64bcf70ee83407924b7d52a7 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Mon, 8 Jan 2024 14:30:34 -0600 Subject: [PATCH 10/24] Update default numpy variant --- conda_build/variants.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/conda_build/variants.py b/conda_build/variants.py index 7e9dfc7ff0..0bbc3fc462 100644 --- a/conda_build/variants.py +++ b/conda_build/variants.py @@ -19,14 +19,24 @@ DEFAULT_VARIANTS = { "python": f"{sys.version_info.major}.{sys.version_info.minor}", - "numpy": "1.22", + "numpy": { + # (python): numpy_version, # range of versions built for given python + (3, 8): "1.22", # 1.19-1.24 + (3, 9): "1.22", # 1.19-1.26 + (3, 10): "1.22", # 1.21-1.26 + (3, 11): "1.23", # 1.23-1.26 + (3, 12): "1.26", # 1.26- + }.get(sys.version_info[:2], "1.26"), # this one actually needs to be pretty specific. The reason is that cpan skeleton uses the # version to say what's in their standard library. "perl": "5.26.2", "lua": "5", "r_base": "3.4" if on_win else "3.5", "cpu_optimization_target": "nocona", - "pin_run_as_build": OrderedDict(python=OrderedDict(min_pin="x.x", max_pin="x.x")), + "pin_run_as_build": { + "python": {"min_pin": "x.x", "max_pin": "x.x"}, + "r-base": {"min_pin": "x.x", "max_pin": "x.x"}, + }, "ignore_version": [], "ignore_build_only_deps": ["python", "numpy"], "extend_keys": [ @@ -38,11 +48,6 @@ "cran_mirror": "https://cran.r-project.org", } -# set this outside the initialization because of the dash in the key -DEFAULT_VARIANTS["pin_run_as_build"]["r-base"] = OrderedDict( - min_pin="x.x", max_pin="x.x" -) - # map python version to default compiler on windows, to match upstream python # This mapping only sets the "native" compiler, and can be overridden by specifying a compiler # in the conda-build variant configuration From 0765a417cf84a28d92e179f837467c912fe6be27 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Mon, 8 Jan 2024 15:43:02 -0600 Subject: [PATCH 11/24] Fix test_get_selectors --- tests/test_metadata.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 5e5ef762ff..05e67b540b 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -24,6 +24,7 @@ yamlize, ) from conda_build.utils import DEFAULT_SUBDIRS +from conda_build.variants import DEFAULT_VARIANTS from .utils import metadata_dir, metadata_path, thisdir @@ -439,19 +440,19 @@ def test_get_selectors( assert get_selectors(config) == { # defaults "build_platform": context.subdir, - "lua": "5", # see conda_build.variants.DEFAULT_VARIANTS["lua"] - "luajit": False, # lua[0] == 2 - "np": 122, # see conda_build.variants.DEFAULT_VARIANTS["numpy"] + "lua": DEFAULT_VARIANTS["lua"], + "luajit": DEFAULT_VARIANTS["lua"] == 2, + "np": int(float(DEFAULT_VARIANTS["numpy"]) * 100), "os": os, - "pl": "5.26.2", # see conda_build.variants.DEFAULT_VARIANTS["perl"] + "pl": DEFAULT_VARIANTS["perl"], "py": int(f"{sys.version_info.major}{sys.version_info.minor}"), - "py26": sys.version_info.major == 2 and sys.version_info.minor == 6, - "py27": sys.version_info.major == 2 and sys.version_info.minor == 7, + "py26": sys.version_info[:2] == (2, 6), + "py27": sys.version_info[:2] == (2, 7), "py2k": sys.version_info.major == 2, - "py33": sys.version_info.major == 3 and sys.version_info.minor == 3, - "py34": sys.version_info.major == 3 and sys.version_info.minor == 4, - "py35": sys.version_info.major == 3 and sys.version_info.minor == 5, - "py36": sys.version_info.major == 3 and sys.version_info.minor == 6, + "py33": sys.version_info[:2] == (3, 3), + "py34": sys.version_info[:2] == (3, 4), + "py35": sys.version_info[:2] == (3, 5), + "py36": sys.version_info[:2] == (3, 6), "py3k": sys.version_info.major == 3, "nomkl": bool(nomkl), # default OS/arch values From 96011bbb61aea8b291b4f00dae14a9dcdf14beed Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Mon, 8 Jan 2024 16:33:40 -0600 Subject: [PATCH 12/24] Skipif test_numpy_setup_py_data --- conda_build/_load_setup_py_data.py | 2 ++ tests/test_api_build.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/conda_build/_load_setup_py_data.py b/conda_build/_load_setup_py_data.py index efeb14c69d..9180c404fc 100644 --- a/conda_build/_load_setup_py_data.py +++ b/conda_build/_load_setup_py_data.py @@ -90,6 +90,8 @@ def setup(**kw): del sys.modules["versioneer"] try: + # numpy.distutils deprecated in Python 3.12+ + # see https://numpy.org/doc/stable/reference/distutils_status_migration.html import numpy.distutils.core numpy_setup = numpy.distutils.core.setup diff --git a/tests/test_api_build.py b/tests/test_api_build.py index b39340aae0..ef5f9dc071 100644 --- a/tests/test_api_build.py +++ b/tests/test_api_build.py @@ -599,6 +599,10 @@ def test_build_metadata_object(testing_metadata): @pytest.mark.serial +@pytest.mark.skipif( + sys.version_info >= (3, 12), + reason="numpy.distutils deprecated in Python 3.12+", +) def test_numpy_setup_py_data(testing_config): recipe_path = os.path.join(metadata_dir, "_numpy_setup_py_data") # this shows an error that is OK to ignore: From 345b8d1cc0ddf905bc080ef0180ec1ca0558fecf Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Mon, 8 Jan 2024 16:55:56 -0600 Subject: [PATCH 13/24] Switch to correct assertions --- tests/cli/test_main_build.py | 7 +++---- tests/test_api_build.py | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/cli/test_main_build.py b/tests/cli/test_main_build.py index 59a080eace..44113ad13d 100644 --- a/tests/cli/test_main_build.py +++ b/tests/cli/test_main_build.py @@ -6,7 +6,6 @@ import pytest -import conda_build from conda_build import api from conda_build.cli import main_build, main_render from conda_build.conda_interface import ( @@ -274,17 +273,17 @@ def test_no_force_upload(mocker, testing_workdir, testing_metadata, request): del testing_metadata.meta["test"] api.output_yaml(testing_metadata, "meta.yaml") args = ["--no-force-upload", testing_workdir] - call = mocker.patch.object(conda_build.build.subprocess, "call") + call = mocker.patch("subprocess.call") request.addfinalizer(_reset_config) _reset_config([os.path.join(testing_workdir, ".condarc")]) main_build.execute(args) pkg = api.get_output_file_path(testing_metadata) - assert call.called_once_with(["anaconda", "upload", pkg]) + call.assert_called_once_with(["anaconda", "upload", pkg]) args = [testing_workdir] with open(os.path.join(testing_workdir, ".condarc"), "w") as f: f.write("anaconda_upload: True\n") main_build.execute(args) - assert call.called_once_with(["anaconda", "upload", "--force", pkg]) + call.assert_called_once_with(["anaconda", "upload", "--force", pkg]) @pytest.mark.slow diff --git a/tests/test_api_build.py b/tests/test_api_build.py index ef5f9dc071..2f31e4bc6e 100644 --- a/tests/test_api_build.py +++ b/tests/test_api_build.py @@ -26,7 +26,6 @@ from conda.common.compat import on_linux, on_mac, on_win from conda.exceptions import ClobberError, CondaMultiError -import conda_build from conda_build import __version__, api, exceptions from conda_build.conda_interface import ( CONDA_VERSION, @@ -1494,13 +1493,13 @@ def test_no_force_upload_condarc_setting(mocker, testing_workdir, testing_metada testing_metadata.config.anaconda_upload = True del testing_metadata.meta["test"] api.output_yaml(testing_metadata, "meta.yaml") - call = mocker.patch.object(conda_build.build.subprocess, "call") + call = mocker.patch("subprocess.call") cc_conda_build["force_upload"] = False pkg = api.build(testing_workdir) - assert call.called_once_with(["anaconda", "upload", pkg]) + call.assert_called_once_with(["anaconda", "upload", pkg]) del cc_conda_build["force_upload"] pkg = api.build(testing_workdir) - assert call.called_once_with(["anaconda", "upload", "--force", pkg]) + call.assert_called_once_with(["anaconda", "upload", "--force", pkg]) @pytest.mark.sanity From 3b5550cbd848b8d85c4b02ba64830df60ca3cec6 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 9 Jan 2024 11:53:39 -0600 Subject: [PATCH 14/24] Fix test_no_force_upload --- tests/cli/test_main_build.py | 60 +++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/tests/cli/test_main_build.py b/tests/cli/test_main_build.py index 44113ad13d..ceab6a2df9 100644 --- a/tests/cli/test_main_build.py +++ b/tests/cli/test_main_build.py @@ -1,10 +1,14 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +from __future__ import annotations + import os import re from pathlib import Path import pytest +from pytest import FixtureRequest, MonkeyPatch +from pytest_mock import MockerFixture from conda_build import api from conda_build.cli import main_build, main_render @@ -14,8 +18,13 @@ context, reset_context, ) -from conda_build.config import Config, zstd_compression_level_default +from conda_build.config import ( + Config, + zstd_compression_level_default, +) from conda_build.exceptions import DependencyNeedsBuildingError +from conda_build.metadata import MetaData +from conda_build.os_utils.external import find_executable from conda_build.utils import get_build_folders, on_win, package_has_file from ..utils import metadata_dir @@ -265,25 +274,40 @@ def test_purge_all(testing_workdir, testing_metadata): @pytest.mark.serial -def test_no_force_upload(mocker, testing_workdir, testing_metadata, request): - with open(os.path.join(testing_workdir, ".condarc"), "w") as f: - f.write("anaconda_upload: True\n") - f.write("conda_build:\n") - f.write(" force_upload: False\n") - del testing_metadata.meta["test"] - api.output_yaml(testing_metadata, "meta.yaml") - args = ["--no-force-upload", testing_workdir] - call = mocker.patch("subprocess.call") +def test_no_force_upload( + mocker: MockerFixture, + monkeypatch: MonkeyPatch, + testing_workdir: str | os.PathLike | Path, + testing_metadata: MetaData, + request: FixtureRequest, +): request.addfinalizer(_reset_config) - _reset_config([os.path.join(testing_workdir, ".condarc")]) - main_build.execute(args) + call = mocker.patch("subprocess.call") + anaconda = find_executable("anaconda") + + # render recipe + api.output_yaml(testing_metadata, "meta.yaml") pkg = api.get_output_file_path(testing_metadata) - call.assert_called_once_with(["anaconda", "upload", pkg]) - args = [testing_workdir] - with open(os.path.join(testing_workdir, ".condarc"), "w") as f: - f.write("anaconda_upload: True\n") - main_build.execute(args) - call.assert_called_once_with(["anaconda", "upload", "--force", pkg]) + + # mock Config.set_keys to always set anaconda_upload to True + # conda's Context + conda_build's MetaData & Config objects interact in such an + # awful way that mocking these configurations is ugly and confusing, all of it + # needs major refactoring + set_keys = Config.set_keys # store original method + monkeypatch.setattr( + Config, + "set_keys", + lambda self, **kwargs: set_keys(self, **{**kwargs, "anaconda_upload": True}), + ) + + # check for normal upload + main_build.execute(["--no-force-upload", testing_workdir]) + call.assert_called_once_with([anaconda, "upload", *pkg]) + call.reset_mock() + + # check for force upload + main_build.execute([testing_workdir]) + call.assert_called_once_with([anaconda, "upload", "--force", *pkg]) @pytest.mark.slow From b6ca44a839f48bc766ed100a7b32af1d61a685a5 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 9 Jan 2024 12:35:33 -0600 Subject: [PATCH 15/24] Fix test_no_force_upload in test_api_build --- tests/cli/test_main_build.py | 18 +++---------- tests/test_api_build.py | 50 +++++++++++++++++++++++++++++------- tests/utils.py | 10 ++++++++ 3 files changed, 55 insertions(+), 23 deletions(-) diff --git a/tests/cli/test_main_build.py b/tests/cli/test_main_build.py index ceab6a2df9..90d1c4a629 100644 --- a/tests/cli/test_main_build.py +++ b/tests/cli/test_main_build.py @@ -12,12 +12,7 @@ from conda_build import api from conda_build.cli import main_build, main_render -from conda_build.conda_interface import ( - TemporaryDirectory, - cc_conda_build, - context, - reset_context, -) +from conda_build.conda_interface import TemporaryDirectory from conda_build.config import ( Config, zstd_compression_level_default, @@ -28,14 +23,7 @@ from conda_build.utils import get_build_folders, on_win, package_has_file from ..utils import metadata_dir - - -def _reset_config(search_path=None): - reset_context(search_path) - cc_conda_build.clear() - cc_conda_build.update( - context.conda_build if hasattr(context, "conda_build") else {} - ) +from ..utils import reset_config as _reset_config @pytest.mark.sanity @@ -281,6 +269,8 @@ def test_no_force_upload( testing_metadata: MetaData, request: FixtureRequest, ): + # this is nearly identical to tests/test_api_build.py::test_no_force_upload + # only difference is this tests `conda_build.cli.main_build.execute` request.addfinalizer(_reset_config) call = mocker.patch("subprocess.call") anaconda = find_executable("anaconda") diff --git a/tests/test_api_build.py b/tests/test_api_build.py index 2f31e4bc6e..1ac2ca06d2 100644 --- a/tests/test_api_build.py +++ b/tests/test_api_build.py @@ -3,6 +3,8 @@ """ This module tests the build API. These are high-level integration tests. """ +from __future__ import annotations + import json import logging import os @@ -25,6 +27,8 @@ from binstar_client.errors import NotFound from conda.common.compat import on_linux, on_mac, on_win from conda.exceptions import ClobberError, CondaMultiError +from pytest import FixtureRequest, MonkeyPatch +from pytest_mock import MockerFixture from conda_build import __version__, api, exceptions from conda_build.conda_interface import ( @@ -32,7 +36,6 @@ CondaError, LinkError, VersionOrder, - cc_conda_build, context, reset_context, url_path, @@ -44,6 +47,7 @@ OverDependingError, OverLinkingError, ) +from conda_build.metadata import MetaData from conda_build.os_utils.external import find_executable from conda_build.render import finalize_metadata from conda_build.utils import ( @@ -65,6 +69,7 @@ get_valid_recipes, metadata_dir, metadata_path, + reset_config, ) @@ -1489,17 +1494,44 @@ def test_runtime_dependencies(testing_config): @pytest.mark.sanity -def test_no_force_upload_condarc_setting(mocker, testing_workdir, testing_metadata): - testing_metadata.config.anaconda_upload = True - del testing_metadata.meta["test"] - api.output_yaml(testing_metadata, "meta.yaml") +def test_no_force_upload( + mocker: MockerFixture, + monkeypatch: MonkeyPatch, + testing_workdir: str | os.PathLike | Path, + testing_metadata: MetaData, + request: FixtureRequest, +): + # this is nearly identical to tests/cli/test_main_build.py::test_no_force_upload + # only difference is this tests `conda_build.api.build` + request.addfinalizer(reset_config) call = mocker.patch("subprocess.call") - cc_conda_build["force_upload"] = False + anaconda = find_executable("anaconda") + + # render recipe + api.output_yaml(testing_metadata, "meta.yaml") + + # mock Config.set_keys to always set anaconda_upload to True + # conda's Context + conda_build's MetaData & Config objects interact in such an + # awful way that mocking these configurations is ugly and confusing, all of it + # needs major refactoring + set_keys = Config.set_keys # store original method + override = {"anaconda_upload": True} + monkeypatch.setattr( + Config, + "set_keys", + lambda self, **kwargs: set_keys(self, **{**kwargs, **override}), + ) + + # check for normal upload + override["force_upload"] = False pkg = api.build(testing_workdir) - call.assert_called_once_with(["anaconda", "upload", pkg]) - del cc_conda_build["force_upload"] + call.assert_called_once_with([anaconda, "upload", *pkg]) + call.reset_mock() + + # check for force upload + override["force_upload"] = True pkg = api.build(testing_workdir) - call.assert_called_once_with(["anaconda", "upload", "--force", pkg]) + call.assert_called_once_with([anaconda, "upload", "--force", *pkg]) @pytest.mark.sanity diff --git a/tests/utils.py b/tests/utils.py index d7bd5b479d..692f852fff 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -8,8 +8,10 @@ from pathlib import Path from typing import Generator +from conda.base.context import context, reset_context from conda.common.compat import on_mac +from conda_build.conda_interface import cc_conda_build from conda_build.metadata import MetaData tests_path = Path(__file__).parent @@ -144,3 +146,11 @@ def get_noarch_python_meta(meta): d = meta.meta d["build"]["noarch"] = "python" return MetaData.fromdict(d, config=meta.config) + + +def reset_config(search_path=None): + reset_context(search_path) + cc_conda_build.clear() + cc_conda_build.update( + context.conda_build if hasattr(context, "conda_build") else {} + ) From a9e38f6fb107930f571425899e7037572774347d Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 9 Jan 2024 15:06:44 -0600 Subject: [PATCH 16/24] Bump conda_build_test_recipe to 1.22.0 --- tests/test-recipes/metadata/source_setup_py_data/bld.bat | 4 ++-- tests/test-recipes/metadata/source_setup_py_data/build.sh | 4 ++-- tests/test-recipes/metadata/source_setup_py_data/meta.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test-recipes/metadata/source_setup_py_data/bld.bat b/tests/test-recipes/metadata/source_setup_py_data/bld.bat index 4168d5d6f0..3399daa92d 100644 --- a/tests/test-recipes/metadata/source_setup_py_data/bld.bat +++ b/tests/test-recipes/metadata/source_setup_py_data/bld.bat @@ -6,6 +6,6 @@ if errorlevel 1 exit 1 for /f "delims=" %%i in ('git describe') do set gitdesc=%%i if errorlevel 1 exit 1 echo "%gitdesc%" -if not "%gitdesc%"=="1.21.0" exit 1 +if not "%gitdesc%"=="1.22.0" exit 1 echo "%PKG_VERSION%" -if not "%PKG_VERSION%"=="1.21.0" exit 1 +if not "%PKG_VERSION%"=="1.22.0" exit 1 diff --git a/tests/test-recipes/metadata/source_setup_py_data/build.sh b/tests/test-recipes/metadata/source_setup_py_data/build.sh index ecde5ca3c3..3c8cd9361a 100644 --- a/tests/test-recipes/metadata/source_setup_py_data/build.sh +++ b/tests/test-recipes/metadata/source_setup_py_data/build.sh @@ -3,6 +3,6 @@ # Ensure we are in a git repo [ -d .git ] git describe -[ "$(git describe)" = 1.21.0 ] +[ "$(git describe)" = 1.22.0 ] echo "\$PKG_VERSION = $PKG_VERSION" -[ "${PKG_VERSION}" = 1.21.0 ] +[ "${PKG_VERSION}" = 1.22.0 ] diff --git a/tests/test-recipes/metadata/source_setup_py_data/meta.yaml b/tests/test-recipes/metadata/source_setup_py_data/meta.yaml index d4a3b21e7b..459c19ba74 100644 --- a/tests/test-recipes/metadata/source_setup_py_data/meta.yaml +++ b/tests/test-recipes/metadata/source_setup_py_data/meta.yaml @@ -12,7 +12,7 @@ package: source: git_url: {{ environ.get('CONDA_BUILD_TEST_RECIPE_PATH') }} - git_tag: 1.21.0 + git_tag: 1.22.0 build: entry_points: From 78e4652d22b7b8e361f29ce4167ae36959a1feba Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 9 Jan 2024 15:29:18 -0600 Subject: [PATCH 17/24] Only patch distutils if present --- conda_build/skeletons/pypi.py | 60 +++++++++++++++++------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/conda_build/skeletons/pypi.py b/conda_build/skeletons/pypi.py index d0bec9e929..493d55d9d6 100644 --- a/conda_build/skeletons/pypi.py +++ b/conda_build/skeletons/pypi.py @@ -1371,39 +1371,39 @@ def run_setuppy(src_dir, temp_dir, python_version, extra_specs, config, setup_op with open(patch, "wb") as f: f.write(DISTUTILS_PATCH.format(temp_dir.replace("\\", "\\\\")).encode("utf-8")) - if exists(join(stdlib_dir, "distutils", "core.py-copy")): - rm_rf(join(stdlib_dir, "distutils", "core.py")) - copy2( - join(stdlib_dir, "distutils", "core.py-copy"), - join(stdlib_dir, "distutils", "core.py"), - ) - # Avoid race conditions. Invalidate the cache. - rm_rf( - join( - stdlib_dir, - "distutils", - "__pycache__", - f"core.cpython-{sys.version_info[0]}{sys.version_info[1]}.pyc", + distutils = join(stdlib_dir, "distutils") + if isdir(distutils): + if exists(join(distutils, "core.py-copy")): + rm_rf(join(distutils, "core.py")) + copy2( + join(distutils, "core.py-copy"), + join(distutils, "core.py"), ) - ) - rm_rf( - join( - stdlib_dir, - "distutils", - "__pycache__", - f"core.cpython-{sys.version_info[0]}{sys.version_info[1]}.pyo", + # Avoid race conditions. Invalidate the cache. + rm_rf( + join( + distutils, + "__pycache__", + f"core.cpython-{sys.version_info[0]}{sys.version_info[1]}.pyc", + ) ) - ) - else: - copy2( - join(stdlib_dir, "distutils", "core.py"), - join(stdlib_dir, "distutils", "core.py-copy"), - ) - apply_patch(join(stdlib_dir, "distutils"), patch, config=config) + rm_rf( + join( + distutils, + "__pycache__", + f"core.cpython-{sys.version_info[0]}{sys.version_info[1]}.pyo", + ) + ) + else: + copy2( + join(distutils, "core.py"), + join(distutils, "core.py-copy"), + ) + apply_patch(distutils, patch, config=config) - vendored = join(stdlib_dir, "site-packages", "setuptools", "_distutils") - if os.path.isdir(vendored): - apply_patch(vendored, patch, config=config) + setuptools = join(stdlib_dir, "site-packages", "setuptools", "_distutils") + if isdir(setuptools): + apply_patch(setuptools, patch, config=config) # Save PYTHONPATH for later env = os.environ.copy() From 27d2ff01c3548de121744178d9bd92d6f33cb55e Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 9 Jan 2024 16:32:38 -0600 Subject: [PATCH 18/24] Update skeleton pypi with args tests --- tests/cli/test_main_skeleton.py | 16 +++++++++++----- tests/test_api_skeleton.py | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/cli/test_main_skeleton.py b/tests/cli/test_main_skeleton.py index 64eb300878..0333d77c1f 100644 --- a/tests/cli/test_main_skeleton.py +++ b/tests/cli/test_main_skeleton.py @@ -34,20 +34,26 @@ def test_skeleton_pypi_arguments_work(testing_workdir): https://github.com/conda/conda-build/pull/1384 """ - args = ["pypi", "msumastro", "--version=1.1.6", "--pin-numpy"] + args = ["pypi", "fasttext", "--version=0.9.2", "--pin-numpy"] main_skeleton.execute(args) - assert os.path.isdir("msumastro") + assert os.path.isdir("fasttext") # Deliberately bypass metadata reading in conda build to get as # close to the "ground truth" as possible. - with open(os.path.join("msumastro", "meta.yaml")) as f: + with open(os.path.join("fasttext", "meta.yaml")) as f: assert f.read().count("numpy x.x") == 2 - args = ["pypi", "photutils", "--version=0.2.2", "--setup-options=--offline"] + args = [ + "pypi", + "photutils", + "--version=1.10.0", + "--setup-options=--offline", + "--extra-specs=extension-helpers", + ] main_skeleton.execute(args) assert os.path.isdir("photutils") # Check that the setup option occurs in bld.bat and build.sh. m = api.render("photutils")[0][0] assert "--offline" in m.meta["build"]["script"] - assert m.version() == "0.2.2" + assert m.version() == "1.10.0" diff --git a/tests/test_api_skeleton.py b/tests/test_api_skeleton.py index 514d469c56..d4b5398af3 100644 --- a/tests/test_api_skeleton.py +++ b/tests/test_api_skeleton.py @@ -321,10 +321,11 @@ def test_pypi_with_setup_options(tmp_path: Path, testing_config): api.skeletonize( packages="photutils", repo="pypi", - version="0.2.2", + version="1.10.0", setup_options="--offline", config=testing_config, output_dir=tmp_path, + extra_specs=["extension-helpers"], ) # Check that the setup option occurs in bld.bat and build.sh. From da8f6503d959735521f8802e78e1799eeabe5890 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 9 Jan 2024 16:55:34 -0600 Subject: [PATCH 19/24] Fix test_git_in_output_version --- tests/test_subpackages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_subpackages.py b/tests/test_subpackages.py index ca6004eefd..d89b888758 100644 --- a/tests/test_subpackages.py +++ b/tests/test_subpackages.py @@ -125,7 +125,7 @@ def test_git_in_output_version(testing_config, conda_build_test_recipe_envvar: s recipe, config=testing_config, finalize=False, bypass_env_check=True ) assert len(outputs) == 1 - assert outputs[0][0].version() == "1.21.11" + assert outputs[0][0].version() == "1.22.0" def test_intradep_with_templated_output_name(testing_config): From e96a046308b4845fd86c4c9ded778bc37f9f8ae8 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 9 Jan 2024 17:04:58 -0600 Subject: [PATCH 20/24] Bump version --- .../published_code/building_jinja2_setup_py_data/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-recipes/published_code/building_jinja2_setup_py_data/meta.yaml b/tests/test-recipes/published_code/building_jinja2_setup_py_data/meta.yaml index 8596e5c574..9d7b9dd2df 100644 --- a/tests/test-recipes/published_code/building_jinja2_setup_py_data/meta.yaml +++ b/tests/test-recipes/published_code/building_jinja2_setup_py_data/meta.yaml @@ -8,7 +8,7 @@ package: # Example assumes that this folder has setup.py in it source: git_url: {{ environ.get('CONDA_BUILD_TEST_RECIPE_PATH') }} - git_tag: 1.21.0 + git_tag: 1.22.0 requirements: build: From b8d261307653a6e08b031e127a44ee7dc514d7aa Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 9 Jan 2024 17:44:22 -0600 Subject: [PATCH 21/24] Switch from msumastro to fasttext --- tests/test_api_skeleton.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/test_api_skeleton.py b/tests/test_api_skeleton.py index d4b5398af3..fdf015c025 100644 --- a/tests/test_api_skeleton.py +++ b/tests/test_api_skeleton.py @@ -11,7 +11,7 @@ import ruamel.yaml from conda_build import api -from conda_build.exceptions import DependencyNeedsBuildingError +from conda_build.config import Config from conda_build.skeletons.pypi import ( clean_license_name, convert_to_flat_list, @@ -333,30 +333,32 @@ def test_pypi_with_setup_options(tmp_path: Path, testing_config): assert "--offline" in m.meta["build"]["script"] -def test_pypi_pin_numpy(tmp_path: Path, testing_config): +def test_pypi_pin_numpy(tmp_path: Path, testing_config: Config): # The package used here must have a numpy dependence for pin-numpy to have # any effect. api.skeletonize( - packages="msumastro", + packages="fasttext", repo="pypi", - version="0.9.0", + version="0.9.2", config=testing_config, pin_numpy=True, output_dir=tmp_path, ) - assert (tmp_path / "msumastro" / "meta.yaml").read_text().count("numpy x.x") == 2 - with pytest.raises(DependencyNeedsBuildingError): - api.build("msumastro") + assert (tmp_path / "fasttext" / "meta.yaml").read_text().count("numpy x.x") == 2 + api.build("fasttext") -def test_pypi_version_sorting(tmp_path: Path, testing_config): +def test_pypi_version_sorting(tmp_path: Path, testing_config: Config): # The package used here must have a numpy dependence for pin-numpy to have # any effect. api.skeletonize( - packages="impyla", repo="pypi", config=testing_config, output_dir=tmp_path + packages="fasttext", + repo="pypi", + config=testing_config, + output_dir=tmp_path, ) - m = api.render(str(tmp_path / "impyla"))[0][0] - assert parse_version(m.version()) >= parse_version("0.13.8") + m = api.render(str(tmp_path / "fasttext"))[0][0] + assert parse_version(m.version()) >= parse_version("0.9.2") def test_list_skeletons(): From d513b114723605042c94fece0a9239b6db99bdbc Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 9 Jan 2024 17:49:45 -0600 Subject: [PATCH 22/24] Apply suggestions from code review --- conda_build/skeletons/pypi.py | 1 + tests/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/conda_build/skeletons/pypi.py b/conda_build/skeletons/pypi.py index 493d55d9d6..fbe59199b3 100644 --- a/conda_build/skeletons/pypi.py +++ b/conda_build/skeletons/pypi.py @@ -1371,6 +1371,7 @@ def run_setuppy(src_dir, temp_dir, python_version, extra_specs, config, setup_op with open(patch, "wb") as f: f.write(DISTUTILS_PATCH.format(temp_dir.replace("\\", "\\\\")).encode("utf-8")) + # distutils deprecated in Python 3.10+, removed in Python 3.12+ distutils = join(stdlib_dir, "distutils") if isdir(distutils): if exists(join(distutils, "core.py-copy")): diff --git a/tests/requirements.txt b/tests/requirements.txt index a4ecdd07a8..a7140e8673 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,7 +1,7 @@ +anaconda-client beautifulsoup4 chardet conda >=22.11.0 -conda-forge::anaconda-client conda-index conda-package-handling >=1.3 conda-verify From fc956a211ab4639d0a1e24c8fca500aafbd83a66 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 9 Jan 2024 20:00:50 -0600 Subject: [PATCH 23/24] Revert anaconda-client change --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index a7140e8673..a4ecdd07a8 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,7 +1,7 @@ -anaconda-client beautifulsoup4 chardet conda >=22.11.0 +conda-forge::anaconda-client conda-index conda-package-handling >=1.3 conda-verify From 17f9a1adaf1430e7bfcc0b8420d08d9f3b0e63b7 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Wed, 10 Jan 2024 08:55:16 -0600 Subject: [PATCH 24/24] Drop building fasttext (not necessary for test) --- tests/test_api_skeleton.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_api_skeleton.py b/tests/test_api_skeleton.py index fdf015c025..52039b9ed4 100644 --- a/tests/test_api_skeleton.py +++ b/tests/test_api_skeleton.py @@ -345,7 +345,6 @@ def test_pypi_pin_numpy(tmp_path: Path, testing_config: Config): output_dir=tmp_path, ) assert (tmp_path / "fasttext" / "meta.yaml").read_text().count("numpy x.x") == 2 - api.build("fasttext") def test_pypi_version_sorting(tmp_path: Path, testing_config: Config):