diff --git a/.azure-pipelines/azure-pipelines-osx.yml b/.azure-pipelines/azure-pipelines-osx.yml index 3bb979623..2a55d072b 100644 --- a/.azure-pipelines/azure-pipelines-osx.yml +++ b/.azure-pipelines/azure-pipelines-osx.yml @@ -16,9 +16,8 @@ jobs: free_disk_space: skip pagefile_size: 0 resize_partitions: false - store_build_artifacts: true + store_build_artifacts: false tools_install_dir: ~/miniforge3 - CONFIG_SHORT: osx_64_build_typedebugchannel_targetscon_h34364035 osx_64_build_typereleasechannel_targetsconda-forge_main: CONFIG: osx_64_build_typereleasechannel_targetsconda-forge_main UPLOAD_PACKAGES: 'True' @@ -27,9 +26,8 @@ jobs: free_disk_space: skip pagefile_size: 0 resize_partitions: false - store_build_artifacts: true + store_build_artifacts: false tools_install_dir: ~/miniforge3 - CONFIG_SHORT: osx_64_build_typereleasechannel_targetsc_h21740193 osx_arm64_build_typedebugchannel_targetsconda-forge_python_debug: CONFIG: osx_arm64_build_typedebugchannel_targetsconda-forge_python_debug UPLOAD_PACKAGES: 'True' @@ -38,9 +36,8 @@ jobs: free_disk_space: skip pagefile_size: 0 resize_partitions: false - store_build_artifacts: true + store_build_artifacts: false tools_install_dir: ~/miniforge3 - CONFIG_SHORT: osx_arm64_build_typedebugchannel_targets_h18126b8f osx_arm64_build_typereleasechannel_targetsconda-forge_main: CONFIG: osx_arm64_build_typereleasechannel_targetsconda-forge_main UPLOAD_PACKAGES: 'True' @@ -49,9 +46,8 @@ jobs: free_disk_space: skip pagefile_size: 0 resize_partitions: false - store_build_artifacts: true + store_build_artifacts: false tools_install_dir: ~/miniforge3 - CONFIG_SHORT: osx_arm64_build_typereleasechannel_targe_hbf952199 timeoutInMinutes: 360 variables: {} @@ -78,34 +74,3 @@ jobs: BINSTAR_TOKEN: $(BINSTAR_TOKEN) FEEDSTOCK_TOKEN: $(FEEDSTOCK_TOKEN) STAGING_BINSTAR_TOKEN: $(STAGING_BINSTAR_TOKEN) - - - script: | - export ARTIFACT_STAGING_DIR="$(Build.ArtifactStagingDirectory)" - # Archive everything in CONDA_BLD_PATH except environments - export BLD_ARTIFACT_PREFIX=conda_artifacts - export CI=azure - export CI_RUN_ID=$(build.BuildNumber).$(system.JobAttempt) - export CONDA_BLD_PATH=$(build_workspace_dir) - export FEEDSTOCK_NAME=$(basename ${BUILD_REPOSITORY_NAME}) - export MINIFORGE_HOME=$(tools_install_dir) - if [[ "$AGENT_JOBSTATUS" == "Failed" ]]; then - # Archive the CONDA_BLD_PATH environments only when the job fails - export ENV_ARTIFACT_PREFIX=conda_envs - fi - ./.scripts/create_conda_build_artifacts.sh - displayName: Prepare conda build artifacts - condition: and(succeededOrFailed(), eq(variables.store_build_artifacts, true)) - - - task: PublishPipelineArtifact@1 - displayName: Store conda build artifacts - condition: not(eq(variables.BLD_ARTIFACT_PATH, '')) - inputs: - targetPath: $(BLD_ARTIFACT_PATH) - artifactName: $(BLD_ARTIFACT_NAME) - - - task: PublishPipelineArtifact@1 - displayName: Store conda build environment artifacts - condition: not(eq(variables.ENV_ARTIFACT_PATH, '')) - inputs: - targetPath: $(ENV_ARTIFACT_PATH) - artifactName: $(ENV_ARTIFACT_NAME) diff --git a/.ci_support/linux_64_build_typedebugchannel_targetsconda-forge_python_debug.yaml b/.ci_support/linux_64_build_typedebugchannel_targetsconda-forge_python_debug.yaml index 6f8548651..62c1a75c0 100644 --- a/.ci_support/linux_64_build_typedebugchannel_targetsconda-forge_python_debug.yaml +++ b/.ci_support/linux_64_build_typedebugchannel_targetsconda-forge_python_debug.yaml @@ -5,7 +5,7 @@ bzip2: c_compiler: - gcc c_compiler_version: -- '14' +- '15' c_stdlib: - sysroot c_stdlib_version: @@ -17,7 +17,7 @@ channel_targets: cxx_compiler: - gxx cxx_compiler_version: -- '14' +- '15' docker_image: - quay.io/condaforge/linux-anvil-x86_64:alma10 expat: diff --git a/.ci_support/linux_64_build_typereleasechannel_targetsconda-forge_main.yaml b/.ci_support/linux_64_build_typereleasechannel_targetsconda-forge_main.yaml index f3e2eecdf..c2fb1017e 100644 --- a/.ci_support/linux_64_build_typereleasechannel_targetsconda-forge_main.yaml +++ b/.ci_support/linux_64_build_typereleasechannel_targetsconda-forge_main.yaml @@ -5,7 +5,7 @@ bzip2: c_compiler: - gcc c_compiler_version: -- '14' +- '15' c_stdlib: - sysroot c_stdlib_version: @@ -17,7 +17,7 @@ channel_targets: cxx_compiler: - gxx cxx_compiler_version: -- '14' +- '15' docker_image: - quay.io/condaforge/linux-anvil-x86_64:alma10 expat: diff --git a/.ci_support/linux_aarch64_build_typedebugchannel_targetsconda-forge_python_debug.yaml b/.ci_support/linux_aarch64_build_typedebugchannel_targetsconda-forge_python_debug.yaml index 8b5aac2e8..1337a7ef8 100644 --- a/.ci_support/linux_aarch64_build_typedebugchannel_targetsconda-forge_python_debug.yaml +++ b/.ci_support/linux_aarch64_build_typedebugchannel_targetsconda-forge_python_debug.yaml @@ -5,7 +5,7 @@ bzip2: c_compiler: - gcc c_compiler_version: -- '14' +- '15' c_stdlib: - sysroot c_stdlib_version: @@ -17,7 +17,7 @@ channel_targets: cxx_compiler: - gxx cxx_compiler_version: -- '14' +- '15' docker_image: - quay.io/condaforge/linux-anvil-aarch64:alma10 expat: diff --git a/.ci_support/linux_aarch64_build_typereleasechannel_targetsconda-forge_main.yaml b/.ci_support/linux_aarch64_build_typereleasechannel_targetsconda-forge_main.yaml index cbe51f4bc..2611bc7e7 100644 --- a/.ci_support/linux_aarch64_build_typereleasechannel_targetsconda-forge_main.yaml +++ b/.ci_support/linux_aarch64_build_typereleasechannel_targetsconda-forge_main.yaml @@ -5,7 +5,7 @@ bzip2: c_compiler: - gcc c_compiler_version: -- '14' +- '15' c_stdlib: - sysroot c_stdlib_version: @@ -17,7 +17,7 @@ channel_targets: cxx_compiler: - gxx cxx_compiler_version: -- '14' +- '15' docker_image: - quay.io/condaforge/linux-anvil-aarch64:alma10 expat: diff --git a/.ci_support/linux_ppc64le_build_typedebugchannel_targetsconda-forge_python_debug.yaml b/.ci_support/linux_ppc64le_build_typedebugchannel_targetsconda-forge_python_debug.yaml index e3250ff5a..8862e92bf 100644 --- a/.ci_support/linux_ppc64le_build_typedebugchannel_targetsconda-forge_python_debug.yaml +++ b/.ci_support/linux_ppc64le_build_typedebugchannel_targetsconda-forge_python_debug.yaml @@ -5,7 +5,7 @@ bzip2: c_compiler: - gcc c_compiler_version: -- '14' +- '15' c_stdlib: - sysroot c_stdlib_version: @@ -17,7 +17,7 @@ channel_targets: cxx_compiler: - gxx cxx_compiler_version: -- '14' +- '15' docker_image: - quay.io/condaforge/linux-anvil-x86_64:alma10 expat: diff --git a/.ci_support/linux_ppc64le_build_typereleasechannel_targetsconda-forge_main.yaml b/.ci_support/linux_ppc64le_build_typereleasechannel_targetsconda-forge_main.yaml index 8a4197d67..aea37fb1b 100644 --- a/.ci_support/linux_ppc64le_build_typereleasechannel_targetsconda-forge_main.yaml +++ b/.ci_support/linux_ppc64le_build_typereleasechannel_targetsconda-forge_main.yaml @@ -5,7 +5,7 @@ bzip2: c_compiler: - gcc c_compiler_version: -- '14' +- '15' c_stdlib: - sysroot c_stdlib_version: @@ -17,7 +17,7 @@ channel_targets: cxx_compiler: - gxx cxx_compiler_version: -- '14' +- '15' docker_image: - quay.io/condaforge/linux-anvil-x86_64:alma10 expat: diff --git a/.ci_support/osx_64_build_typedebugchannel_targetsconda-forge_python_debug.yaml b/.ci_support/osx_64_build_typedebugchannel_targetsconda-forge_python_debug.yaml index 1572bbce4..7114381d6 100644 --- a/.ci_support/osx_64_build_typedebugchannel_targetsconda-forge_python_debug.yaml +++ b/.ci_support/osx_64_build_typedebugchannel_targetsconda-forge_python_debug.yaml @@ -9,7 +9,7 @@ bzip2: c_compiler: - clang c_compiler_version: -- '19' +- '21' c_stdlib: - macosx_deployment_target c_stdlib_version: @@ -21,7 +21,7 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '19' +- '21' expat: - '2' libffi: diff --git a/.ci_support/osx_64_build_typereleasechannel_targetsconda-forge_main.yaml b/.ci_support/osx_64_build_typereleasechannel_targetsconda-forge_main.yaml index 9c132cf3f..532bc1a75 100644 --- a/.ci_support/osx_64_build_typereleasechannel_targetsconda-forge_main.yaml +++ b/.ci_support/osx_64_build_typereleasechannel_targetsconda-forge_main.yaml @@ -9,7 +9,7 @@ bzip2: c_compiler: - clang c_compiler_version: -- '19' +- '21' c_stdlib: - macosx_deployment_target c_stdlib_version: @@ -21,7 +21,7 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '19' +- '21' expat: - '2' libffi: diff --git a/.ci_support/osx_arm64_build_typedebugchannel_targetsconda-forge_python_debug.yaml b/.ci_support/osx_arm64_build_typedebugchannel_targetsconda-forge_python_debug.yaml index eb96776ae..fe71ef655 100644 --- a/.ci_support/osx_arm64_build_typedebugchannel_targetsconda-forge_python_debug.yaml +++ b/.ci_support/osx_arm64_build_typedebugchannel_targetsconda-forge_python_debug.yaml @@ -9,7 +9,7 @@ bzip2: c_compiler: - clang c_compiler_version: -- '19' +- '21' c_stdlib: - macosx_deployment_target c_stdlib_version: @@ -21,7 +21,7 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '19' +- '21' expat: - '2' libffi: diff --git a/.ci_support/osx_arm64_build_typereleasechannel_targetsconda-forge_main.yaml b/.ci_support/osx_arm64_build_typereleasechannel_targetsconda-forge_main.yaml index 0c446a451..b75122cb8 100644 --- a/.ci_support/osx_arm64_build_typereleasechannel_targetsconda-forge_main.yaml +++ b/.ci_support/osx_arm64_build_typereleasechannel_targetsconda-forge_main.yaml @@ -9,7 +9,7 @@ bzip2: c_compiler: - clang c_compiler_version: -- '19' +- '21' c_stdlib: - macosx_deployment_target c_stdlib_version: @@ -21,7 +21,7 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '19' +- '21' expat: - '2' libffi: diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 92fb27fc6..5b95939c8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @chrisburr @isuruf @jakirkham @katietz @mbargull @mingwandroid @msarahan @ocefpaf @pelson @scopatz @xhochy \ No newline at end of file +* @chrisburr @isuruf @jakirkham @katietz @mbargull @msarahan @ocefpaf @pelson @scopatz @xhochy \ No newline at end of file diff --git a/.github/workflows/conda-build.yml b/.github/workflows/conda-build.yml index 5cd579732..52b290116 100644 --- a/.github/workflows/conda-build.yml +++ b/.github/workflows/conda-build.yml @@ -23,9 +23,8 @@ jobs: matrix: include: - CONFIG: linux_64_build_typedebugchannel_targetsconda-forge_python_debug - CONFIG_SHORT: linux_64_build_typedebugchannel_targetsc_hcab9fe85 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -36,9 +35,8 @@ jobs: runs_on: ['ubuntu-latest'] tools_install_dir: ~/miniforge3 - CONFIG: linux_64_build_typereleasechannel_targetsconda-forge_main - CONFIG_SHORT: linux_64_build_typereleasechannel_target_h0a44af7c DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -49,9 +47,8 @@ jobs: runs_on: ['ubuntu-latest'] tools_install_dir: ~/miniforge3 - CONFIG: linux_aarch64_build_typedebugchannel_targetsconda-forge_python_debug - CONFIG_SHORT: linux_aarch64_build_typedebugchannel_tar_h4e1127e8 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-aarch64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -62,9 +59,8 @@ jobs: runs_on: ['ubuntu-24.04-arm'] tools_install_dir: ~/miniforge3 - CONFIG: linux_aarch64_build_typereleasechannel_targetsconda-forge_main - CONFIG_SHORT: linux_aarch64_build_typereleasechannel_t_hcde06680 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-aarch64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -75,9 +71,8 @@ jobs: runs_on: ['ubuntu-24.04-arm'] tools_install_dir: ~/miniforge3 - CONFIG: linux_ppc64le_build_typedebugchannel_targetsconda-forge_python_debug - CONFIG_SHORT: linux_ppc64le_build_typedebugchannel_tar_he8193b4f DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -88,9 +83,8 @@ jobs: runs_on: ['ubuntu-latest'] tools_install_dir: ~/miniforge3 - CONFIG: linux_ppc64le_build_typereleasechannel_targetsconda-forge_main - CONFIG_SHORT: linux_ppc64le_build_typereleasechannel_t_h12bca821 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -101,8 +95,7 @@ jobs: runs_on: ['ubuntu-latest'] tools_install_dir: ~/miniforge3 - CONFIG: win_64_ - CONFIG_SHORT: win_64_ - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_platform: win-64 build_workspace_dir: D:\\bld\\ @@ -208,80 +201,4 @@ jobs: RATTLER_BUILD_ENABLE_GITHUB_INTEGRATION: 'true' BINSTAR_TOKEN: ${{ secrets.BINSTAR_TOKEN }} FEEDSTOCK_TOKEN: ${{ secrets.FEEDSTOCK_TOKEN }} - STAGING_BINSTAR_TOKEN: ${{ secrets.STAGING_BINSTAR_TOKEN }} - - - name: Determine build outcome - # this is to merge the status of the linux/osx/win builds into - # something we can easily reuse during artefact generation - id: determine-status - if: ${{ always() }} - shell: bash - env: - OS: ${{ matrix.os }} - run: | - if [[ "$OS" == "ubuntu" ]]; then - STATUS=${{ steps.build-linux.outcome }} - elif [[ "$OS" == "macos" ]]; then - STATUS=${{ steps.build-macos.outcome }} - elif [[ "$OS" == "windows" ]]; then - STATUS=${{ steps.build-windows.outcome }} - fi - if [ -z "$STATUS" ]; then - # steps that never ran will have empty status - STATUS="cancelled" - fi - echo "status=$STATUS" >> $GITHUB_OUTPUT - - - name: Prepare conda build artifacts - continue-on-error: true - id: prepare-artifacts - shell: bash - # we do not want to trigger artefact creation if the build was cancelled - if: ${{ always() && steps.determine-status.outputs.status != 'cancelled' && matrix.STORE_BUILD_ARTIFACTS }} - env: - CI: github_actions - CONDA_BLD_PATH: ${{ matrix.build_workspace_dir }} - CONFIG: ${{ matrix.CONFIG }} - CONFIG_SHORT: ${{ matrix.CONFIG_SHORT }} - JOB_STATUS: ${{ steps.determine-status.outputs.status }} - OS: ${{ matrix.os }} - run: | - export ARTIFACT_STAGING_DIR="$GITHUB_WORKSPACE" - export CI_RUN_ID=$GITHUB_RUN_ID - export CONDA_BLD_PATH="${CONDA_BLD_PATH/#~/${HOME}}" - export FEEDSTOCK_NAME="$(basename $GITHUB_REPOSITORY)" - export MINIFORGE_HOME="${MINIFORGE_HOME/#~/${HOME}}" - # Archive everything in CONDA_BLD_PATH except environments - # Archive the CONDA_BLD_PATH environments only when the job fails - # Use different prefix for successful and failed build artifacts - # so random failures don't prevent rebuilds from creating artifacts. - if [ $JOB_STATUS == "failure" ]; then - export BLD_ARTIFACT_PREFIX="conda_artifacts" - export ENV_ARTIFACT_PREFIX="conda_envs" - else - export BLD_ARTIFACT_PREFIX="conda_pkgs" - fi - if [ $OS == "windows" ]; then - pwsh -Command ". '.scripts/create_conda_build_artifacts.bat'" - else - ./.scripts/create_conda_build_artifacts.sh - fi - - - name: Store conda build artifacts - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - if: ${{ always() && steps.prepare-artifacts.outcome == 'success' }} - with: - name: ${{ steps.prepare-artifacts.outputs.BLD_ARTIFACT_NAME }} - path: ${{ steps.prepare-artifacts.outputs.BLD_ARTIFACT_PATH }} - retention-days: 14 - continue-on-error: true - - - name: Store conda build environment artifacts - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - # only relevant if build failed, see above - if: ${{ always() && steps.determine-status.outputs.status == 'failure' && steps.prepare-artifacts.outcome == 'success' }} - with: - name: ${{ steps.prepare-artifacts.outputs.ENV_ARTIFACT_NAME }} - path: ${{ steps.prepare-artifacts.outputs.ENV_ARTIFACT_PATH }} - retention-days: 14 - continue-on-error: true \ No newline at end of file + STAGING_BINSTAR_TOKEN: ${{ secrets.STAGING_BINSTAR_TOKEN }} \ No newline at end of file diff --git a/.scripts/create_conda_build_artifacts.bat b/.scripts/create_conda_build_artifacts.bat deleted file mode 100755 index 705dc461b..000000000 --- a/.scripts/create_conda_build_artifacts.bat +++ /dev/null @@ -1,78 +0,0 @@ -setlocal enableextensions enabledelayedexpansion - -rem INPUTS (environment variables that need to be set before calling this script): -rem -rem CI (azure/github_actions/UNSET) -rem CI_RUN_ID (unique identifier for the CI job run) -rem CONDA_BLD_PATH (path to the conda-bld directory) -rem CONFIG (build matrix configuration string) -rem CONFIG_SHORT (uniquely-shortened configuration string) -rem FEEDSTOCK_NAME -rem Optional: -rem ARTIFACT_STAGING_DIR (use working directory if unset) -rem BLD_ARTIFACT_PREFIX (prefix for the conda build artifact name, skip if unset) -rem ENV_ARTIFACT_PREFIX (prefix for the conda build environments artifact name, skip if unset) - -rem OUTPUTS -rem -rem BLD_ARTIFACT_NAME -rem BLD_ARTIFACT_PATH -rem ENV_ARTIFACT_NAME -rem ENV_ARTIFACT_PATH - -rem Check that the conda-build directory exists -if not exist %CONDA_BLD_PATH% ( - echo conda-build directory does not exist - exit 1 -) - -if not defined ARTIFACT_STAGING_DIR ( - rem Set staging dir to the working dir - set ARTIFACT_STAGING_DIR=%cd% -) - -rem Set a unique ID for the artifact(s), specialized for this particular job run -set ARTIFACT_UNIQUE_ID=%CI_RUN_ID%_%CONFIG% -if not "%ARTIFACT_UNIQUE_ID%" == "%ARTIFACT_UNIQUE_ID:~0,80%" ( - set ARTIFACT_UNIQUE_ID=%CI_RUN_ID%_%CONFIG_SHORT% -) - -rem Make the build artifact zip -if defined BLD_ARTIFACT_PREFIX ( - set BLD_ARTIFACT_NAME=%BLD_ARTIFACT_PREFIX%_%ARTIFACT_UNIQUE_ID% - echo BLD_ARTIFACT_NAME: !BLD_ARTIFACT_NAME! - - set "BLD_ARTIFACT_PATH=%ARTIFACT_STAGING_DIR%\%FEEDSTOCK_NAME%_%BLD_ARTIFACT_PREFIX%_%ARCHIVE_UNIQUE_ID%.zip" - 7z a "!BLD_ARTIFACT_PATH!" "%CONDA_BLD_PATH%" -xr^^!.git/ -xr^^!_*_env*/ -xr^^!*_cache/ -bb - if errorlevel 1 exit 1 - echo BLD_ARTIFACT_PATH: !BLD_ARTIFACT_PATH! - - if "%CI%" == "azure" ( - echo ##vso[task.setVariable variable=BLD_ARTIFACT_NAME]!BLD_ARTIFACT_NAME! - echo ##vso[task.setVariable variable=BLD_ARTIFACT_PATH]!BLD_ARTIFACT_PATH! - ) - if "%CI%" == "github_actions" ( - echo BLD_ARTIFACT_NAME=!BLD_ARTIFACT_NAME!>> !GITHUB_OUTPUT! - echo BLD_ARTIFACT_PATH=!BLD_ARTIFACT_PATH!>> !GITHUB_OUTPUT! - ) -) - -rem Make the environments artifact zip -if defined ENV_ARTIFACT_PREFIX ( - set ENV_ARTIFACT_NAME=!ENV_ARTIFACT_PREFIX!_%ARTIFACT_UNIQUE_ID% - echo ENV_ARTIFACT_NAME: !ENV_ARTIFACT_NAME! - - set "ENV_ARTIFACT_PATH=%ARTIFACT_STAGING_DIR%\%FEEDSTOCK_NAME%_%ENV_ARTIFACT_PREFIX%_%ARCHIVE_UNIQUE_ID%.zip" - 7z a "!ENV_ARTIFACT_PATH!" -r "%CONDA_BLD_PATH%"/_*_env*/ -bb - if errorlevel 1 exit 1 - echo ENV_ARTIFACT_PATH: !ENV_ARTIFACT_PATH! - - if "%CI%" == "azure" ( - echo ##vso[task.setVariable variable=ENV_ARTIFACT_NAME]!ENV_ARTIFACT_NAME! - echo ##vso[task.setVariable variable=ENV_ARTIFACT_PATH]!ENV_ARTIFACT_PATH! - ) - if "%CI%" == "github_actions" ( - echo ENV_ARTIFACT_NAME=!ENV_ARTIFACT_NAME!>> !GITHUB_OUTPUT! - echo ENV_ARTIFACT_PATH=!ENV_ARTIFACT_PATH!>> !GITHUB_OUTPUT! - ) -) diff --git a/.scripts/create_conda_build_artifacts.sh b/.scripts/create_conda_build_artifacts.sh deleted file mode 100755 index 91095c05d..000000000 --- a/.scripts/create_conda_build_artifacts.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env bash - -# INPUTS (environment variables that need to be set before calling this script): -# -# CI (azure/github_actions/UNSET) -# CI_RUN_ID (unique identifier for the CI job run) -# CONDA_BLD_PATH (path to the conda-bld directory) -# CONFIG (build matrix configuration string) -# CONFIG_SHORT (uniquely-shortened configuration string) -# FEEDSTOCK_NAME -# Optional: -# ARTIFACT_STAGING_DIR (use working directory if unset) -# BLD_ARTIFACT_PREFIX (prefix for the conda build artifact name, skip if unset) -# ENV_ARTIFACT_PREFIX (prefix for the conda build environments artifact name, skip if unset) - -# OUTPUTS -# -# BLD_ARTIFACT_NAME -# BLD_ARTIFACT_PATH -# ENV_ARTIFACT_NAME -# ENV_ARTIFACT_PATH - -source .scripts/logging_utils.sh - -# DON'T do set -x, because it results in double echo-ing pipeline commands -# and that might end up inserting extraneous quotation marks in output variables -set -e - -# Check that the conda-build directory exists -if [ ! -d "$CONDA_BLD_PATH" ]; then - echo "conda-build directory does not exist" - exit 1 -fi - -# Set staging dir to the working dir, in Windows style if applicable -if [[ -z "${ARTIFACT_STAGING_DIR}" ]]; then - if pwd -W; then - ARTIFACT_STAGING_DIR=$(pwd -W) - else - ARTIFACT_STAGING_DIR=$PWD - fi -fi -echo "ARTIFACT_STAGING_DIR: $ARTIFACT_STAGING_DIR" - -FEEDSTOCK_ROOT=$(cd "$(dirname "$0")/.."; pwd;) -if [ -z ${FEEDSTOCK_NAME} ]; then - export FEEDSTOCK_NAME=$(basename ${FEEDSTOCK_ROOT}) -fi - -# Set a unique ID for the artifact(s), specialized for this particular job run -ARTIFACT_UNIQUE_ID="${CI_RUN_ID}_${CONFIG}" -if [[ ${#ARTIFACT_UNIQUE_ID} -gt 80 ]]; then - ARTIFACT_UNIQUE_ID="${CI_RUN_ID}_${CONFIG_SHORT}" -fi -echo "ARTIFACT_UNIQUE_ID: $ARTIFACT_UNIQUE_ID" - -# Set a descriptive ID for the archive(s), specialized for this particular job run -ARCHIVE_UNIQUE_ID="${CI_RUN_ID}_${CONFIG}" - -# Make the build artifact zip -if [[ ! -z "$BLD_ARTIFACT_PREFIX" ]]; then - export BLD_ARTIFACT_NAME="${BLD_ARTIFACT_PREFIX}_${ARTIFACT_UNIQUE_ID}" - export BLD_ARTIFACT_PATH="${ARTIFACT_STAGING_DIR}/${FEEDSTOCK_NAME}_${BLD_ARTIFACT_PREFIX}_${ARCHIVE_UNIQUE_ID}.zip" - - ( startgroup "Archive conda build directory" ) 2> /dev/null - - # Try 7z and fall back to zip if it fails (for cross-platform use) - if ! 7z a "$BLD_ARTIFACT_PATH" "$CONDA_BLD_PATH" '-xr!.git/' '-xr!_*_env*/' '-xr!*_cache/' -bb; then - pushd "$CONDA_BLD_PATH" - zip -r -y -T "$BLD_ARTIFACT_PATH" . -x '*.git/*' '*_*_env*/*' '*_cache/*' - popd - fi - - ( endgroup "Archive conda build directory" ) 2> /dev/null - - echo "BLD_ARTIFACT_NAME: $BLD_ARTIFACT_NAME" - echo "BLD_ARTIFACT_PATH: $BLD_ARTIFACT_PATH" - - if [[ "$CI" == "azure" ]]; then - echo "##vso[task.setVariable variable=BLD_ARTIFACT_NAME]$BLD_ARTIFACT_NAME" - echo "##vso[task.setVariable variable=BLD_ARTIFACT_PATH]$BLD_ARTIFACT_PATH" - elif [[ "$CI" == "github_actions" ]]; then - echo "BLD_ARTIFACT_NAME=$BLD_ARTIFACT_NAME" >> $GITHUB_OUTPUT - echo "BLD_ARTIFACT_PATH=$BLD_ARTIFACT_PATH" >> $GITHUB_OUTPUT - fi -fi - -# Make the environments artifact zip -if [[ ! -z "$ENV_ARTIFACT_PREFIX" ]]; then - export ENV_ARTIFACT_NAME="${ENV_ARTIFACT_PREFIX}_${ARTIFACT_UNIQUE_ID}" - export ENV_ARTIFACT_PATH="${ARTIFACT_STAGING_DIR}/${FEEDSTOCK_NAME}_${ENV_ARTIFACT_PREFIX}_${ARCHIVE_UNIQUE_ID}.zip" - - ( startgroup "Archive conda build environments" ) 2> /dev/null - - # Try 7z and fall back to zip if it fails (for cross-platform use) - if ! 7z a "$ENV_ARTIFACT_PATH" -r "$CONDA_BLD_PATH"/'_*_env*/' -bb; then - pushd "$CONDA_BLD_PATH" - zip -r -y -T "$ENV_ARTIFACT_PATH" . -i '*_*_env*/*' - popd - fi - - ( endgroup "Archive conda build environments" ) 2> /dev/null - - echo "ENV_ARTIFACT_NAME: $ENV_ARTIFACT_NAME" - echo "ENV_ARTIFACT_PATH: $ENV_ARTIFACT_PATH" - - if [[ "$CI" == "azure" ]]; then - echo "##vso[task.setVariable variable=ENV_ARTIFACT_NAME]$ENV_ARTIFACT_NAME" - echo "##vso[task.setVariable variable=ENV_ARTIFACT_PATH]$ENV_ARTIFACT_PATH" - elif [[ "$CI" == "github_actions" ]]; then - echo "ENV_ARTIFACT_NAME=$ENV_ARTIFACT_NAME" >> $GITHUB_OUTPUT - echo "ENV_ARTIFACT_PATH=$ENV_ARTIFACT_PATH" >> $GITHUB_OUTPUT - fi -fi diff --git a/.scripts/run_win_build.bat b/.scripts/run_win_build.bat index 06f61b83b..6a6309e57 100755 --- a/.scripts/run_win_build.bat +++ b/.scripts/run_win_build.bat @@ -42,7 +42,8 @@ call :start_group "Configuring conda" :: Activate the base conda environment echo Activating environment -call "%MINIFORGE_HOME%\Scripts\activate.bat" +set "CONDA_EXE=%MINIFORGE_HOME%\Scripts\conda.exe" +call "%MINIFORGE_HOME%\condabin\conda.bat" activate "%MINIFORGE_HOME%" :: Configure the solver set "CONDA_SOLVER=libmamba" if !errorlevel! neq 0 exit /b !errorlevel! diff --git a/README.md b/README.md index f71c21043..98501a8f6 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ Current release info | Name | Downloads | Version | Platforms | | --- | --- | --- | --- | | [![Conda Recipe](https://img.shields.io/badge/recipe-cpython-green.svg)](https://anaconda.org/conda-forge/cpython) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/cpython.svg)](https://anaconda.org/conda-forge/cpython) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/cpython.svg)](https://anaconda.org/conda-forge/cpython) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/cpython.svg)](https://anaconda.org/conda-forge/cpython) | +| [![Conda Recipe](https://img.shields.io/badge/recipe-libpython-green.svg)](https://anaconda.org/conda-forge/libpython) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libpython.svg)](https://anaconda.org/conda-forge/libpython) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libpython.svg)](https://anaconda.org/conda-forge/libpython) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libpython.svg)](https://anaconda.org/conda-forge/libpython) | | [![Conda Recipe](https://img.shields.io/badge/recipe-libpython--static-green.svg)](https://anaconda.org/conda-forge/libpython-static) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libpython-static.svg)](https://anaconda.org/conda-forge/libpython-static) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libpython-static.svg)](https://anaconda.org/conda-forge/libpython-static) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libpython-static.svg)](https://anaconda.org/conda-forge/libpython-static) | | [![Conda Recipe](https://img.shields.io/badge/recipe-python-green.svg)](https://anaconda.org/conda-forge/python) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/python.svg)](https://anaconda.org/conda-forge/python) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/python.svg)](https://anaconda.org/conda-forge/python) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/python.svg)](https://anaconda.org/conda-forge/python) | | [![Conda Recipe](https://img.shields.io/badge/recipe-python--gil-green.svg)](https://anaconda.org/conda-forge/python-gil) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/python-gil.svg)](https://anaconda.org/conda-forge/python-gil) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/python-gil.svg)](https://anaconda.org/conda-forge/python-gil) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/python-gil.svg)](https://anaconda.org/conda-forge/python-gil) | @@ -94,10 +95,10 @@ Current release info Installing python ================= -Installing `python` from the `conda-forge` channel can be achieved by adding `conda-forge` to your channels with: +Installing `python` from the `conda-forge/label/python_debug` channel can be achieved by adding `conda-forge/label/python_debug` to your channels with: ``` -conda config --add channels conda-forge +conda config --add channels conda-forge/label/python_debug conda config --set channel_priority strict ``` @@ -108,7 +109,7 @@ How to use With conda ``` -conda install cpython libpython-static python python-gil +conda install cpython libpython libpython-static python python-gil ``` @@ -117,7 +118,7 @@ conda install cpython libpython-static python python-gil With mamba ``` -mamba install cpython libpython-static python python-gil +mamba install cpython libpython libpython-static python python-gil ``` @@ -127,9 +128,9 @@ mamba install cpython libpython-static python python-gil ``` # for adding to your local project -pixi add cpython libpython-static python python-gil +pixi add cpython libpython libpython-static python python-gil # for installing globally -pixi global install cpython libpython-static python python-gil +pixi global install cpython libpython libpython-static python python-gil ``` @@ -143,7 +144,7 @@ It is possible to list all of the versions of `cpython` available on your platfo With conda ``` -conda search cpython --channel conda-forge +conda search cpython --channel conda-forge/label/python_debug ``` @@ -152,7 +153,7 @@ conda search cpython --channel conda-forge With mamba ``` -mamba search cpython --channel conda-forge +mamba search cpython --channel conda-forge/label/python_debug ``` @@ -161,7 +162,7 @@ mamba search cpython --channel conda-forge With pixi ``` -pixi search cpython --channel conda-forge +pixi search cpython --channel conda-forge/label/python_debug ``` @@ -171,13 +172,13 @@ pixi search cpython --channel conda-forge ``` # Search all versions available on your platform: -mamba repoquery search cpython --channel conda-forge +mamba repoquery search cpython --channel conda-forge/label/python_debug # List packages depending on `cpython`: -mamba repoquery whoneeds cpython --channel conda-forge +mamba repoquery whoneeds cpython --channel conda-forge/label/python_debug # List dependencies of `cpython`: -mamba repoquery depends cpython --channel conda-forge +mamba repoquery depends cpython --channel conda-forge/label/python_debug ``` @@ -254,7 +255,6 @@ Feedstock Maintainers * [@jakirkham](https://github.com/jakirkham/) * [@katietz](https://github.com/katietz/) * [@mbargull](https://github.com/mbargull/) -* [@mingwandroid](https://github.com/mingwandroid/) * [@msarahan](https://github.com/msarahan/) * [@ocefpaf](https://github.com/ocefpaf/) * [@pelson](https://github.com/pelson/) diff --git a/conda-forge.yml b/conda-forge.yml index 6b27b7732..a2fd2b8e2 100644 --- a/conda-forge.yml +++ b/conda-forge.yml @@ -10,6 +10,3 @@ provider: linux_aarch64: default osx_arm64: default test: native_and_emulated -workflow_settings: - store_build_artifacts: - - value: true diff --git a/recipe/.gitattributes b/recipe/.gitattributes deleted file mode 100644 index 86ff93771..000000000 --- a/recipe/.gitattributes +++ /dev/null @@ -1,24 +0,0 @@ -* text=auto - -*.patch binary -*.diff binary -meta.yaml text eol=lf -build.sh text eol=lf -bld.bat text eol=crlf - -# github helper pieces to make some files not show up in diffs automatically -.azure-pipelines/* linguist-generated=true -.circleci/* linguist-generated=true -.drone/* linguist-generated=true -.drone.yml linguist-generated=true -.github/* linguist-generated=true -.travis/* linguist-generated=true -.appveyor.yml linguist-generated=true -.gitattributes linguist-generated=true -.gitignore linguist-generated=true -.travis.yml linguist-generated=true -LICENSE.txt linguist-generated=true -README.md linguist-generated=true -azure-pipelines.yml linguist-generated=true -build-locally.py linguist-generated=true -shippable.yml linguist-generated=true diff --git a/recipe/.gitignore b/recipe/.gitignore deleted file mode 100644 index c89ecb7d6..000000000 --- a/recipe/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.pyc - -build_artifacts diff --git a/recipe/bld.bat b/recipe/bld.bat new file mode 100644 index 000000000..6d7048c83 --- /dev/null +++ b/recipe/bld.bat @@ -0,0 +1,57 @@ +setlocal EnableDelayedExpansion +echo on + +:: brand Python with conda-forge startup message +%SYS_PYTHON% %RECIPE_DIR%\brand_python.py +if errorlevel 1 exit 1 + +:: Compile python, extensions and external libraries +if "%ARCH%"=="64" ( + set PLATFORM=x64 + set VC_PATH=x64 + set BUILD_PATH=amd64 +) else ( + set PLATFORM=Win32 + set VC_PATH=x86 + set BUILD_PATH=win32 +) + +for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do ( + set "VERNODOTS=%%i%%j" +) + +:: Make sure the "python" value in conda_build_config.yaml is up to date. +for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do ( + if NOT "%PY_VER%"=="%%i.%%j" exit 1 +) + +for /f "usebackq delims=" %%i in (`conda list -p %PREFIX% sqlite --no-show-channel-urls --json ^| findstr "version"`) do set SQLITE3_VERSION_LINE=%%i +for /f "tokens=2 delims==/ " %%i IN ('echo %SQLITE3_VERSION_LINE%') do (set SQLITE3_VERSION=%%~i) +echo SQLITE3_VERSION detected as %SQLITE3_VERSION% + +if "%PY_INTERP_DEBUG%"=="yes" ( + set CONFIG=-d + set _D=_d +) else ( + set CONFIG= + set _D= +) + + +if "%DEBUG_C%"=="yes" ( + set PGO= +) else ( + set PGO=--pgo +) + +:: AP doesn't support PGO atm? +set PGO= + +cd PCbuild + +:: Twice because: +:: error : importlib_zipimport.h updated. You will need to rebuild pythoncore to see the changes. +call build.bat %PGO% %CONFIG% -m -e -v -p %PLATFORM% +call build.bat %PGO% %CONFIG% -m -e -v -p %PLATFORM% +if errorlevel 1 exit 1 +cd .. diff --git a/recipe/build_base.sh b/recipe/build.sh similarity index 60% rename from recipe/build_base.sh rename to recipe/build.sh index 91f55c46f..b1f2ee3a2 100644 --- a/recipe/build_base.sh +++ b/recipe/build.sh @@ -24,14 +24,6 @@ _buildd_shared=build-shared _ENABLE_SHARED=--enable-shared # We *still* build a shared lib here for non-static embedded use cases _DISABLE_SHARED=--disable-shared -# Hack to allow easily comparing static vs shared interpreter performance -# .. hack because we just build it shared in both the build-static and -# build-shared directories. -# Yes this hack is a bit confusing, sorry about that. -if [[ ${PY_INTERP_LINKAGE_NATURE} == shared ]]; then - _DISABLE_SHARED=--enable-shared - _ENABLE_SHARED=--enable-shared -fi # For debugging builds, set this to no to disable profile-guided optimization if [[ ${PY_INTERP_DEBUG} == yes ]]; then @@ -323,29 +315,16 @@ pushd ${_buildd_static} ${_DISABLE_SHARED} "${_PROFILE_TASK[@]}" popd -if [[ "${CI}" == "travis" ]]; then - # Travis has issues with long logs - make -j${CPU_COUNT} -C ${_buildd_static} \ - EXTRA_CFLAGS="${EXTRA_CFLAGS}" \ - ${_MAKE_TARGET} "${_PROFILE_TASK[@]}" 2>&1 >make-static.log -else - make -j${CPU_COUNT} -C ${_buildd_static} \ - EXTRA_CFLAGS="${EXTRA_CFLAGS}" \ - ${_MAKE_TARGET} "${_PROFILE_TASK[@]}" 2>&1 | tee make-static.log -fi +make -j${CPU_COUNT} -C ${_buildd_static} \ + EXTRA_CFLAGS="${EXTRA_CFLAGS}" \ + ${_MAKE_TARGET} "${_PROFILE_TASK[@]}" 2>&1 | tee make-static.log if rg "Failed to build these modules" make-static.log; then echo "(static) :: Failed to build some modules, check the log" exit 1 fi -if [[ "${CI}" == "travis" ]]; then - # Travis has issues with long logs - make -j${CPU_COUNT} -C ${_buildd_shared} \ - EXTRA_CFLAGS="${EXTRA_CFLAGS}" 2>&1 >make-shared.log -else - make -j${CPU_COUNT} -C ${_buildd_shared} \ - EXTRA_CFLAGS="${EXTRA_CFLAGS}" 2>&1 | tee make-shared.log -fi +make -j${CPU_COUNT} -C ${_buildd_shared} \ + EXTRA_CFLAGS="${EXTRA_CFLAGS}" 2>&1 | tee make-shared.log if rg "Failed to build these modules" make-shared.log; then echo "(shared) :: Failed to build some modules, check the log" exit 1 @@ -355,163 +334,3 @@ fi make -j${CPU_COUNT} -C ${_buildd_shared} \ EXTRA_CFLAGS="${EXTRA_CFLAGS}" \ LIBRARY=libpython${VERABI}-pic.a libpython${VERABI}-pic.a - -make -C ${_buildd_static} install - -declare -a _FLAGS_REPLACE=() -if [[ ${_OPTIMIZED} == yes ]]; then - _FLAGS_REPLACE+=(-O3) - _FLAGS_REPLACE+=(-O2) - _FLAGS_REPLACE+=("-fprofile-use") - _FLAGS_REPLACE+=("") - _FLAGS_REPLACE+=("-fprofile-correction") - _FLAGS_REPLACE+=("") - _FLAGS_REPLACE+=("-L.") - _FLAGS_REPLACE+=("") - for _LTO_CFLAG in "${LTO_CFLAGS[@]}"; do - _FLAGS_REPLACE+=(${_LTO_CFLAG}) - _FLAGS_REPLACE+=("") - done -fi -# Install the shared library (for people who embed Python only, e.g. GDB). -# Linking module extensions to this on Linux is redundant (but harmless). -# Linking module extensions to this on Darwin is harmful (multiply defined symbols). -cp -pf ${_buildd_shared}/libpython*${SHLIB_EXT}* ${PREFIX}/lib/ -if [[ ${target_platform} =~ .*linux.* ]]; then - ln -sf ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT}.1.0 ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT} -fi - -SYSCONFIG=$(find ${_buildd_static}/$(cat ${_buildd_static}/pybuilddir.txt) -name "_sysconfigdata*.py" -print0) -cat ${SYSCONFIG} | ${SYS_PYTHON} "${RECIPE_DIR}"/replace-word-pairs.py \ - "${_FLAGS_REPLACE[@]}" \ - > ${PREFIX}/lib/python${VER}/$(basename ${SYSCONFIG}) -MAKEFILE=$(find ${PREFIX}/lib/python${VER}/ -path "*config-*/Makefile" -print0) -cp ${MAKEFILE} /tmp/Makefile-$$ -cat /tmp/Makefile-$$ | ${SYS_PYTHON} "${RECIPE_DIR}"/replace-word-pairs.py \ - "${_FLAGS_REPLACE[@]}" \ - > ${MAKEFILE} -# Check to see that our differences took. -# echo diff -urN ${SYSCONFIG} ${PREFIX}/lib/python${VER}/$(basename ${SYSCONFIG}) -# diff -urN ${SYSCONFIG} ${PREFIX}/lib/python${VER}/$(basename ${SYSCONFIG}) - -# Python installs python${VER}m and python${VER}, one as a hardlink to the other. conda-build breaks these -# by copying. Since the executable may be static it may be very large so change one to be a symlink -# of the other. In this case, python${VER}m will be the symlink. -if [[ -f ${PREFIX}/bin/python${VER}m ]]; then - rm -f ${PREFIX}/bin/python${VER}m - ln -s ${PREFIX}/bin/python${VER} ${PREFIX}/bin/python${VER}m -fi -ln -s ${PREFIX}/bin/python${VER} ${PREFIX}/bin/python -ln -s ${PREFIX}/bin/pydoc${VER} ${PREFIX}/bin/pydoc -# Workaround for https://github.com/conda/conda/issues/10969 -ln -s ${PREFIX}/bin/python3.11 ${PREFIX}/bin/python3.1 - -# Remove test data to save space -# Though keep `support` as some things use that. -# TODO :: Make a subpackage for this once we implement multi-level testing. -pushd ${PREFIX}/lib/python${VER} - mkdir test_keep - mv test/__init__.py test/support test/test_support* test/test_script_helper* test_keep/ - rm -rf test */test - mv test_keep test -popd - -# Size reductions: -pushd ${PREFIX} - if [[ -f lib/libpython${VERABI}.a ]]; then - chmod +w lib/libpython${VERABI}.a - ${STRIP} -S lib/libpython${VERABI}.a - fi - CONFIG_LIBPYTHON=$(find lib/python${VER}/config-${VERABI}* -name "libpython${VERABI}.a") - if [[ -f lib/libpython${VERABI}.a ]] && [[ -f ${CONFIG_LIBPYTHON} ]]; then - chmod +w ${CONFIG_LIBPYTHON} - rm ${CONFIG_LIBPYTHON} - fi -popd - -# Copy sysconfig that gets recorded to a non-default name -# using the new compilers with python will require setting _PYTHON_SYSCONFIGDATA_NAME -# to the name of this file (minus the .py extension) -pushd "${PREFIX}"/lib/python${VER} - # On Python 3.5 _sysconfigdata.py was getting copied in here and compiled for some reason. - # This breaks our attempt to find the right one as recorded_name. - find lib-dynload -name "_sysconfigdata*.py*" -exec rm {} \; - recorded_name=$(find . -name "_sysconfigdata*.py") - our_compilers_name=_sysconfigdata_$(echo ${HOST} | sed -e 's/[.-]/_/g').py - # So we can see if anything has significantly diverged by looking in a built package. - cp ${recorded_name} ${recorded_name}.orig - cp ${recorded_name} sysconfigfile - # fdebug-prefix-map for python work dir is useless for extensions - sed -i.bak "s@-fdebug-prefix-map=$SRC_DIR=/usr/local/src/conda/python-$PKG_VERSION@@g" sysconfigfile - sed -i.bak "s@-fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix@@g" sysconfigfile - # Append the conda-forge zoneinfo to the end - sed -i.bak "s@zoneinfo'@zoneinfo:$PREFIX/share/tzinfo'@g" sysconfigfile - # Remove osx sysroot as it depends on the build machine - # be sure CONDA_BUILD_SYSROOT has value, as other we will remove here instead spaces - if [[ "${target_platform}" == osx-* ]] && [[ -n ${CONDA_BUILD_SYSROOT} ]]; then - sed -i.bak "s@-isysroot @@g" sysconfigfile - sed -i.bak "s@$CONDA_BUILD_SYSROOT @@g" sysconfigfile - fi - # Remove unfilled config option - sed -i.bak "s/@SGI_ABI@//g" sysconfigfile - sed -i.bak "s@$BUILD_PREFIX/bin/${HOST}-llvm-ar@${HOST}-ar@g" sysconfigfile - # Remove GNULD=yes to make sure new-dtags are not used - sed -i.bak "s/'GNULD': 'yes'/'GNULD': 'no'/g" sysconfigfile - cp sysconfigfile ${our_compilers_name} - - # For system gcc remove the triple - sed -i.bak "s@$HOST-c++@g++@g" sysconfigfile - sed -i.bak "s@$HOST-@@g" sysconfigfile - if [[ "$target_platform" == linux* ]]; then - # For linux, make sure the system gcc uses our linker - sed -i.bak "s@-pthread@-pthread -B $PREFIX/compiler_compat@g" sysconfigfile - fi - # Don't set -march and -mtune for system gcc - sed -i.bak "s@-march=[^( |\\\"|\\\')]*@@g" sysconfigfile - sed -i.bak "s@-mtune=[^( |\\\"|\\\')]*@@g" sysconfigfile - # Remove these flags that older compilers and linkers may not know - for flag in "-fstack-protector-strong" "-ffunction-sections" "-pipe" "-fno-plt" \ - "-ftree-vectorize" "-Wl,--sort-common" "-Wl,--as-needed" "-Wl,-z,relro" \ - "-Wl,-z,now" "-Wl,--disable-new-dtags" "-Wl,--gc-sections" "-Wl,-O2" \ - "-fPIE" "-ftree-vectorize" "-mssse3" "-Wl,-pie" "-Wl,-dead_strip_dylibs" \ - "-Wl,-headerpad_max_install_names"; do - sed -i.bak "s@$flag@@g" sysconfigfile - done - # Cleanup some extra spaces from above - sed -i.bak "s@' [ ]*@'@g" sysconfigfile - cp sysconfigfile $recorded_name - echo "========================sysconfig===========================" - cat $recorded_name - echo "============================================================" - - rm sysconfigfile - rm sysconfigfile.bak -popd - -if [[ ${HOST} =~ .*linux.* ]]; then - mkdir -p ${PREFIX}/compiler_compat - ln -s ${PREFIX}/bin/${HOST}-ld ${PREFIX}/compiler_compat/ld - echo "Files in this folder are to enhance backwards compatibility of anaconda software with older compilers." > ${PREFIX}/compiler_compat/README - echo "See: https://github.com/conda/conda/issues/6030 for more information." >> ${PREFIX}/compiler_compat/README -fi - -# There are some strange distutils files around. Delete them -rm -rf ${PREFIX}/lib/python${VER}/distutils/command/*.exe - -python -c "import compileall,os;compileall.compile_dir(os.environ['PREFIX'])" -rm ${PREFIX}/lib/libpython${VERABI}.a - -if [[ ${PY_INTERP_DEBUG} == yes ]]; then - rm ${PREFIX}/bin/python${VER} - ln -s ${PREFIX}/bin/python${VERABI} ${PREFIX}/bin/python${VER} - ln -s ${PREFIX}/lib/libpython${VERABI}.so ${PREFIX}/lib/libpython${VER}.so - ln -s ${PREFIX}/include/python${VERABI} ${PREFIX}/include/python${VER} -fi - -if [[ "$target_platform" == linux-* ]]; then - rm ${PREFIX}/include/uuid.h -fi - -# Workaround for old conda versions which fail to install noarch packages for Python 3.10+ -# https://github.com/conda/conda/issues/10969 -ln -s "${PREFIX}/lib/python3.11" "${PREFIX}/lib/python3.1" diff --git a/recipe/build_static.bat b/recipe/build_static.bat deleted file mode 100644 index e69de29bb..000000000 diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index 737a8587d..17b979abb 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -5,9 +5,7 @@ python_impl: is_python_min: - no numpy: - - 1.16 -MACOSX_SDK_VERSION: # [osx and x86_64] - - 11.0 # [osx and x86_64] + - 2 build_type: - release - debug # [not win] diff --git a/recipe/build_base.bat b/recipe/install_base.bat similarity index 87% rename from recipe/build_base.bat rename to recipe/install_base.bat index 59b894c27..9fb9c02e9 100644 --- a/recipe/build_base.bat +++ b/recipe/install_base.bat @@ -20,42 +20,12 @@ for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do ( set "VERNODOTS=%%i%%j" ) -:: Make sure the "python" value in conda_build_config.yaml is up to date. -for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do ( - if NOT "%PY_VER%"=="%%i.%%j" exit 1 -) - -for /f "usebackq delims=" %%i in (`conda list -p %PREFIX% sqlite --no-show-channel-urls --json ^| findstr "version"`) do set SQLITE3_VERSION_LINE=%%i -for /f "tokens=2 delims==/ " %%i IN ('echo %SQLITE3_VERSION_LINE%') do (set SQLITE3_VERSION=%%~i) -echo SQLITE3_VERSION detected as %SQLITE3_VERSION% - if "%PY_INTERP_DEBUG%"=="yes" ( - set CONFIG=-d set _D=_d ) else ( - set CONFIG= set _D= ) - -if "%DEBUG_C%"=="yes" ( - set PGO= -) else ( - set PGO=--pgo -) - -:: AP doesn't support PGO atm? -set PGO= - -cd PCbuild - -:: Twice because: -:: error : importlib_zipimport.h updated. You will need to rebuild pythoncore to see the changes. -call build.bat %PGO% %CONFIG% -m -e -v -p %PLATFORM% -call build.bat %PGO% %CONFIG% -m -e -v -p %PLATFORM% -if errorlevel 1 exit 1 -cd .. - :: Populate the root package directory for %%x in (python%VERNODOTS%%_D%.dll python3%_D%.dll python%_D%.exe pythonw%_D%.exe) do ( if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x ( diff --git a/recipe/install_base.sh b/recipe/install_base.sh new file mode 100644 index 000000000..5876816f9 --- /dev/null +++ b/recipe/install_base.sh @@ -0,0 +1,203 @@ +#!/bin/bash +set -ex + +VER=${PKG_VERSION%.*} + +_buildd_static=build-static +_buildd_shared=build-shared + +# For debugging builds, set this to no to disable profile-guided optimization +if [[ ${PY_INTERP_DEBUG} == yes ]]; then + _OPTIMIZED=no + DBG=d +else + _OPTIMIZED=yes + DBG= +fi + +# Since these take very long to build in our emulated ci, disable for now +if [[ ${target_platform} == linux-ppc64le ]]; then + _OPTIMIZED=no +fi + +VERABI=${VER}${DBG} + +# This is the mechanism by which we fall back to default gcc, but having it defined here +# would probably break the build by using incorrect settings and/or importing files that +# do not yet exist. +unset _PYTHON_SYSCONFIGDATA_NAME +unset _CONDA_PYTHON_SYSCONFIGDATA_NAME + +declare -a LTO_CFLAGS=() +if [[ ${_OPTIMIZED} == yes ]]; then + if [[ ${c_compiler} =~ .*gcc.* ]]; then + LTO_CFLAGS+=(-fuse-linker-plugin) + LTO_CFLAGS+=(-ffat-lto-objects) + # -flto must come after -flto-partition due to the replacement code + # TODO :: Replace the replacement code using conda-build's in-build regex replacement. + LTO_CFLAGS+=(-flto-partition=none) + LTO_CFLAGS+=(-flto) + else + # TODO :: Check if -flto=thin gives better results. It is about faster + # compilation rather than faster execution so probably not: + # http://clang.llvm.org/docs/ThinLTO.html + # http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html + LTO_CFLAGS+=(-flto) + fi +fi + +make -C ${_buildd_static} install + +declare -a _FLAGS_REPLACE=() +if [[ ${_OPTIMIZED} == yes ]]; then + _FLAGS_REPLACE+=(-O3) + _FLAGS_REPLACE+=(-O2) + _FLAGS_REPLACE+=("-fprofile-use") + _FLAGS_REPLACE+=("") + _FLAGS_REPLACE+=("-fprofile-correction") + _FLAGS_REPLACE+=("") + _FLAGS_REPLACE+=("-L.") + _FLAGS_REPLACE+=("") + _FLAGS_REPLACE+=(-flto-partition=none) + _FLAGS_REPLACE+=("") + _FLAGS_REPLACE+=(-flto) + _FLAGS_REPLACE+=("") + for _LTO_CFLAG in "${LTO_CFLAGS[@]}"; do + _FLAGS_REPLACE+=(${_LTO_CFLAG}) + _FLAGS_REPLACE+=("") + done +fi + +SYSCONFIG=$(find ${_buildd_static}/$(cat ${_buildd_static}/pybuilddir.txt) -name "_sysconfigdata*.py" -print0) +cat ${SYSCONFIG} | ${SYS_PYTHON} "${RECIPE_DIR}"/replace-word-pairs.py \ + "${_FLAGS_REPLACE[@]}" \ + > ${PREFIX}/lib/python${VER}/$(basename ${SYSCONFIG}) +MAKEFILE=$(find ${PREFIX}/lib/python${VER}/ -path "*config-*/Makefile" -print0) +cp ${MAKEFILE} /tmp/Makefile-$$ +cat /tmp/Makefile-$$ | ${SYS_PYTHON} "${RECIPE_DIR}"/replace-word-pairs.py \ + "${_FLAGS_REPLACE[@]}" \ + > ${MAKEFILE} +# Check to see that our differences took. +# echo diff -urN ${SYSCONFIG} ${PREFIX}/lib/python${VER}/$(basename ${SYSCONFIG}) +# diff -urN ${SYSCONFIG} ${PREFIX}/lib/python${VER}/$(basename ${SYSCONFIG}) + +# Python installs python${VER}m and python${VER}, one as a hardlink to the other. conda-build breaks these +# by copying. Since the executable may be static it may be very large so change one to be a symlink +# of the other. In this case, python${VER}m will be the symlink. +if [[ -f ${PREFIX}/bin/python${VER}m ]]; then + rm -f ${PREFIX}/bin/python${VER}m + ln -s ${PREFIX}/bin/python${VER} ${PREFIX}/bin/python${VER}m +fi +ln -s ${PREFIX}/bin/python${VER} ${PREFIX}/bin/python +ln -s ${PREFIX}/bin/pydoc${VER} ${PREFIX}/bin/pydoc +# Workaround for https://github.com/conda/conda/issues/10969 +ln -s ${PREFIX}/bin/python3.11 ${PREFIX}/bin/python3.1 + +# Remove test data to save space +# Though keep `support` as some things use that. +# TODO :: Make a subpackage for this once we implement multi-level testing. +pushd ${PREFIX}/lib/python${VER} + mkdir test_keep + mv test/__init__.py test/support test/test_support* test/test_script_helper* test_keep/ + rm -rf test */test + mv test_keep test +popd + +# Size reductions: +pushd ${PREFIX} + if [[ -f lib/libpython${VERABI}.a ]]; then + chmod +w lib/libpython${VERABI}.a + ${STRIP} -S lib/libpython${VERABI}.a + fi + CONFIG_LIBPYTHON=$(find lib/python${VER}/config-${VERABI}* -name "libpython${VERABI}.a") + if [[ -f lib/libpython${VERABI}.a ]] && [[ -f ${CONFIG_LIBPYTHON} ]]; then + chmod +w ${CONFIG_LIBPYTHON} + rm ${CONFIG_LIBPYTHON} + fi +popd + +# Copy sysconfig that gets recorded to a non-default name +# using the new compilers with python will require setting _PYTHON_SYSCONFIGDATA_NAME +# to the name of this file (minus the .py extension) +pushd "${PREFIX}"/lib/python${VER} + # On Python 3.5 _sysconfigdata.py was getting copied in here and compiled for some reason. + # This breaks our attempt to find the right one as recorded_name. + find lib-dynload -name "_sysconfigdata*.py*" -exec rm {} \; + recorded_name=$(find . -name "_sysconfigdata*.py") + our_compilers_name=_sysconfigdata_$(echo ${HOST} | sed -e 's/[.-]/_/g').py + # So we can see if anything has significantly diverged by looking in a built package. + cp ${recorded_name} ${recorded_name}.orig + cp ${recorded_name} sysconfigfile + # fdebug-prefix-map for python work dir is useless for extensions + sed -i.bak "s@-fdebug-prefix-map=$SRC_DIR=/usr/local/src/conda/python-$PKG_VERSION@@g" sysconfigfile + sed -i.bak "s@-fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix@@g" sysconfigfile + # Append the conda-forge zoneinfo to the end + sed -i.bak "s@zoneinfo'@zoneinfo:$PREFIX/share/tzinfo'@g" sysconfigfile + # Remove osx sysroot as it depends on the build machine + # be sure CONDA_BUILD_SYSROOT has value, as other we will remove here instead spaces + if [[ "${target_platform}" == osx-* ]] && [[ -n ${CONDA_BUILD_SYSROOT} ]]; then + sed -i.bak "s@-isysroot @@g" sysconfigfile + sed -i.bak "s@$CONDA_BUILD_SYSROOT @@g" sysconfigfile + fi + # Remove unfilled config option + sed -i.bak "s/@SGI_ABI@//g" sysconfigfile + sed -i.bak "s@$BUILD_PREFIX/bin/${HOST}-llvm-ar@${HOST}-ar@g" sysconfigfile + # Remove GNULD=yes to make sure new-dtags are not used + sed -i.bak "s/'GNULD': 'yes'/'GNULD': 'no'/g" sysconfigfile + cp sysconfigfile ${our_compilers_name} + + # For system gcc remove the triple + sed -i.bak "s@$HOST-c++@g++@g" sysconfigfile + sed -i.bak "s@$HOST-@@g" sysconfigfile + if [[ "$target_platform" == linux* ]]; then + # For linux, make sure the system gcc uses our linker + sed -i.bak "s@-pthread@-pthread -B $PREFIX/compiler_compat@g" sysconfigfile + fi + # Don't set -march and -mtune for system gcc + sed -i.bak "s@-march=[^( |\\\"|\\\')]*@@g" sysconfigfile + sed -i.bak "s@-mtune=[^( |\\\"|\\\')]*@@g" sysconfigfile + # Remove these flags that older compilers and linkers may not know + for flag in "-fstack-protector-strong" "-ffunction-sections" "-pipe" "-fno-plt" \ + "-ftree-vectorize" "-Wl,--sort-common" "-Wl,--as-needed" "-Wl,-z,relro" \ + "-Wl,-z,now" "-Wl,--disable-new-dtags" "-Wl,--gc-sections" "-Wl,-O2" \ + "-fPIE" "-ftree-vectorize" "-mssse3" "-Wl,-pie" "-Wl,-dead_strip_dylibs" \ + "-Wl,-headerpad_max_install_names"; do + sed -i.bak "s@$flag@@g" sysconfigfile + done + # Cleanup some extra spaces from above + sed -i.bak "s@' [ ]*@'@g" sysconfigfile + cp sysconfigfile $recorded_name + echo "========================sysconfig===========================" + cat $recorded_name + echo "============================================================" + + rm sysconfigfile + rm sysconfigfile.bak +popd + +if [[ ${HOST} =~ .*linux.* ]]; then + mkdir -p ${PREFIX}/compiler_compat + ln -s ${PREFIX}/bin/${HOST}-ld ${PREFIX}/compiler_compat/ld + echo "Files in this folder are to enhance backwards compatibility of anaconda software with older compilers." > ${PREFIX}/compiler_compat/README + echo "See: https://github.com/conda/conda/issues/6030 for more information." >> ${PREFIX}/compiler_compat/README +fi + +# There are some strange distutils files around. Delete them +rm -rf ${PREFIX}/lib/python${VER}/distutils/command/*.exe + +python -c "import compileall,os;compileall.compile_dir(os.environ['PREFIX'])" +rm ${PREFIX}/lib/libpython${VERABI}.a + +if [[ ${PY_INTERP_DEBUG} == yes ]]; then + rm ${PREFIX}/bin/python${VER} + ln -s ${PREFIX}/bin/python${VERABI} ${PREFIX}/bin/python${VER} + ln -s ${PREFIX}/include/python${VERABI} ${PREFIX}/include/python${VER} +fi + +if [[ "$target_platform" == linux-* ]]; then + rm ${PREFIX}/include/uuid.h +fi + +# Workaround for old conda versions which fail to install noarch packages for Python 3.10+ +# https://github.com/conda/conda/issues/10969 +ln -s "${PREFIX}/lib/python3.11" "${PREFIX}/lib/python3.1" diff --git a/recipe/install_shared.sh b/recipe/install_shared.sh new file mode 100644 index 000000000..5dafbd13f --- /dev/null +++ b/recipe/install_shared.sh @@ -0,0 +1,53 @@ +#!/bin/bash +set -ex + +_buildd_shared=build-shared +if [[ ${PY_INTERP_DEBUG} == yes ]]; then + DBG=d +else + DBG= +fi +if [[ ${PY_FREETHREADING} == yes ]]; then + # This Python will not be usable with non-free threading Python modules. + THREAD=t +else + THREAD= +fi + +VER=${PKG_VERSION%.*} +ABIFLAGS=${DBG}${THREAD} +VERABI=${VER}${THREAD}${DBG} +VERABI_NO_DBG=${VER}${THREAD} + +# Install the shared library (for people who embed Python only, e.g. GDB). +# Linking module extensions to this on Linux is redundant (but harmless). +# Linking module extensions to this on Darwin is harmful (multiply defined symbols). +shopt -s extglob +cp -pf ${_buildd_shared}/libpython*${SHLIB_EXT}!(.lto) ${PREFIX}/lib/ +shopt -u extglob +if [[ ${target_platform} =~ .*linux.* ]]; then + ln -sf ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT}.1.0 ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT} +fi +if [[ ${PY_INTERP_DEBUG} == yes ]]; then + ln -s ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT} ${PREFIX}/lib/libpython${VERABI_NO_DBG}${SHLIB_EXT} +fi + +# create libpython3.dylib; linux builds only add this in release mode, do the same on osx +if [[ "$target_platform" == osx-* && ${PY_INTERP_DEBUG} == no ]]; then + # need to filter out windows-specific symbols & PyOS_CheckStack from + # https://github.com/python/cpython/blob/main/Doc/data/stable_abi.dat + awk -F',' ' + ($1 == "func" || $1 == "data") && + $4 != "on Windows" && + $2 != "PyOS_CheckStack" { + print "_" $2 + } + ' Doc/data/stable_abi.dat > stable_abi_exports.txt + + $CC -dynamiclib \ + -install_name @rpath/libpython3.dylib \ + -compatibility_version 3.0 -current_version ${PY_VER}.0 \ + -Wl,-reexport_library,${PREFIX}/lib/libpython${VERABI}.dylib \ + -Wl,-exported_symbols_list,stable_abi_exports.txt \ + -o ${PREFIX}/lib/libpython3.dylib +fi diff --git a/recipe/build_static.sh b/recipe/install_static.sh similarity index 100% rename from recipe/build_static.sh rename to recipe/install_static.sh diff --git a/recipe/meta.yaml b/recipe/meta.yaml index e6bd58bb2..78faefddb 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -4,28 +4,13 @@ {% set ver2 = '.'.join(version.split('.')[0:2]) %} {% set ver2nd = ''.join(version.split('.')[0:2]) %} {% set ver3nd = ''.join(version.split('.')[0:3]) %} -{% set build_number = 1 %} +{% set build_number = 2 %} # this makes the linter happy {% set channel_targets = channel_targets or 'conda-forge main' %} # Sanitize build system env. var tweak parameters # (passed to the build scripts via script_env). -{% set from_source_control = os.environ.get('CONDA_BUILD_FROM_SOURCE_CONTROL', '') %} -{% if from_source_control == '' or from_source_control == 'no' %} - {% set from_source_control = 'no' %} -{% else %} - {% set from_source_control = 'yes' %} -{% endif %} -{% set linkage_nature = os.environ.get('PY_INTERP_LINKAGE_NATURE', '') %} -{% if linkage_nature != '' %} - {% set linkage_nature = "_" ~ linkage_nature %} -{% endif %} -{% if linkage_nature == 'shared' %} - {% set linkage_nature_env = 'shared' %} -{% else %} - {% set linkage_nature_env = 'static' %} -{% endif %} {% set dbg_abi = "" %} {% if build_type == "debug" %} {% set py_interp_debug = "yes" %} @@ -35,19 +20,32 @@ {% set debug = "" %} {% endif %} +# CMake needs to be told that the debug ABI is fine; the option takes a 4-tuple, +# Python_FIND_ABI=;;;; for details see +# https://cmake.org/cmake/help/latest/module/FindPython.html#hints +{% set cmake_test_args=" -DPython_FIND_ABI=\"" ~ ("ON" if build_type == "debug" else "OFF") ~ ";ANY;ANY;ANY\"" %} +{% if unix %} + # for CMake invocations during testing, we need to avoid accidentally picking up python versions from + # the image, but we don't want to use `${CMAKE_ARGS}` from the compiler activation, because that contains + # `CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER`; while that's useful for building (i.e. don't look in `host:`, + # because we want to use binaries from `build:`), we want the exact opposite when running tests. + {% set cmake_test_args=cmake_test_args ~ " -DCMAKE_POLICY_DEFAULT_CMP0094=NEW -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=ONLY -DCMAKE_FIND_ROOT_PATH=${PREFIX}" %} +{% endif %} + +# extremely noisy; only use if needing to debug how CMake finds our libraries +{% set cmake_debug = "" %} +{% if False %} + {% set cmake_debug = "--debug-find --trace --debug-output --debug-trycompile" %} +{% endif %} + package: name: python-split version: {{ version }}{{ dev }} source: -{% if from_source_control == 'yes' %} - - git_url: https://github.com/python/CPython.git - git_tag: v{{ version }}{{ dev }} -{% else %} - url: https://www.python.org/ftp/python/{{ version }}/Python-{{ version }}{{ dev }}.tar.xz # sha256 from: https://www.python.org/downloads/release/python-{{ ver3nd }}/ sha256: 91bcdebfdde239a003ae93738a7fce0f9230fee5c4bc2b86f6e6e8c6f98aabe8 -{% endif %} patches: - patches/0001-Win32-Change-FD_SETSIZE-from-512-to-2048.patch - patches/0002-Win32-distutils-Add-support-to-cygwinccompiler-for-V.patch @@ -85,21 +83,57 @@ source: build: number: {{ build_number }} + script_env: + - PY_INTERP_DEBUG={{ py_interp_debug }} requirements: build: -{% if from_source_control == 'yes' %} - - git -{% else %} - - patch # [not win] - - m2-patch # [win] - - m2-gcc-libs # [win] -{% endif %} + - {{ stdlib('c') }} + - {{ compiler('c') }} + - {{ compiler('cxx') }} + - libtool # [unix] + - make # [unix] + - pkg-config # [unix] + - ld_impl_{{ target_platform }} # [linux] + - binutils_impl_{{ target_platform }} # [linux] + # configure script looks for llvm-ar for lto + - llvm-tools # [osx] + - bzip2 # [build_platform != target_platform] + - expat # [build_platform != target_platform] + - libffi # [build_platform != target_platform] + - liblzma-devel # [build_platform != target_platform] + - libnsl # [build_platform != target_platform and linux] + - libuuid # [build_platform != target_platform and linux] + - libxcrypt # [build_platform != target_platform and linux] + - ncurses # [build_platform != target_platform and unix] + - openssl # [build_platform != target_platform] + - readline # [build_platform != target_platform and unix] + - sqlite # [build_platform != target_platform] + - tk # [build_platform != target_platform] + - zlib # [build_platform != target_platform] + host: + - ld_impl_{{ target_platform }} >=2.36 # [linux] + - bzip2 + - expat + - libffi + - liblzma-devel + - libnsl # [linux] + - libuuid # [linux] + - libxcrypt # [linux] + - ncurses # [unix] + - openssl + - readline # [unix] + - tk + - sqlite + # These two are just to get the headers needed for tk.h, but is unused + - xorg-libx11 # [unix] + - xorg-xorgproto # [unix] + - zlib outputs: - name: python - script: build_base.sh # [unix] - script: build_base.bat # [win] + script: install_base.sh # [unix] + script: install_base.bat # [win] build: number: {{ build_number }} activate_in_script: true @@ -128,9 +162,7 @@ outputs: skip: true # [win and int(float(vc)) < 14] skip_compile_pyc: - '*.py' # [build_platform != target_platform] - string: {{ dev_ }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_cpython # ["conda-forge" in (channel_targets or "")] - string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }} # ["conda-forge" not in (channel_targets or "")] -{% if 'conda-forge' in channel_targets %} + string: {{ dev_ }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ debug }}_cpython run_exports: noarch: - python @@ -138,10 +170,8 @@ outputs: - python_abi {{ ver2 }}.* *_cp{{ ver2nd }} {% if py_interp_debug == "yes" %} - python {{ ver2 }}.* *_debug_cpython -{% endif %} {% endif %} script_env: - - PY_INTERP_LINKAGE_NATURE={{ linkage_nature_env }} - PY_INTERP_DEBUG={{ py_interp_debug }} # Putting these here means they get emitted to build_env_setup.{sh,bat} meaning we can launch IDEs # after sourcing or calling that script without examine the contents of conda_build.{sh,bat} for @@ -158,19 +188,12 @@ outputs: - '**/api-ms-win-core-path-l1-1-0.dll' # [win] requirements: build: - - {{ compiler('c') }} - {{ stdlib('c') }} + - {{ compiler('c') }} - {{ compiler('cxx') }} - make # [not win] - - libtool # [unix] - - pkg-config # [not win] - # configure script looks for llvm-ar for lto - - llvm-tools # [osx] - - ld_impl_{{ target_platform }} # [linux] -{% if 'conda-forge' in channel_targets %} - - binutils_impl_{{ target_platform }} # [linux] -{% endif %} host: + - {{ pin_subpackage('libpython', exact=True) }} - bzip2 - sqlite - liblzma-devel @@ -189,12 +212,11 @@ outputs: - libxcrypt # [linux] - expat run: + - {{ pin_subpackage('libpython', exact=True) }} - ld_impl_{{ target_platform }} >=2.36.1 # [linux] - tzdata -{% if 'conda-forge' in channel_targets %} run_constrained: - python_abi {{ ver2 }}.* *_cp{{ ver2nd }} -{% endif %} test: downstreams: - cython @@ -203,6 +225,9 @@ outputs: - ripgrep - cmake - ninja + # Pin to the openssl version used during the build to check whether + # we load the conda-forge version. + - openssl {{ openssl }} - {{ stdlib('c') }} - {{ compiler('c') }} # Tried to use enable_language(C) to avoid needing this. It does not work. @@ -239,8 +264,8 @@ outputs: - python -c "import sysconfig; print(sysconfig.get_config_var('CC'))" # [not win] - _CONDA_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_x86_64_conda_linux_gnu python -c "import sysconfig; print(sysconfig.get_config_var('CC'))" # [linux64] - for f in ${CONDA_PREFIX}/lib/python*/_sysconfig*.py; do echo "Checking $f:"; if [[ `rg @ $f` ]]; then echo "FAILED ON $f"; cat $f; exit 1; fi; done # [linux64 or osx] - - test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.a # [unix] - - test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.nolto.a # [unix] + - test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.a # [unix] + - test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.nolto.a # [unix] # https://github.com/conda-forge/python-feedstock/issues/384 - if exist %PREFIX%\\Scripts\\pydoc exit 1 # [win] - if exist %PREFIX%\\Scripts\\idle exit 1 # [win] @@ -252,16 +277,12 @@ outputs: - if not exist %PREFIX%\\Scripts\\2to3.exe exit 1 # [win] - if not exist %PREFIX%\\Scripts\\pydoc.exe exit 1 # [win] - pushd tests - - pushd distutils - - python setup.py install -v -v - - python -c "import foobar" - - popd - - pushd prefix-replacement # [unix] - - bash build-and-test.sh # [unix] - - popd # [unix] + - pushd prefix-replacement # [unix] + - bash build-and-test.sh # [unix] + - popd # [unix] - pushd cmake - - cmake -GNinja -DPY_VER={{ version }} - # --trace --debug-output --debug-trycompile . + - cmake -GNinja {{ cmake_test_args }} -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Embed" {{ cmake_debug }} . + - cmake -GNinja {{ cmake_test_args }} -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Module" {{ cmake_debug }} . - popd - popd - python run_test.py @@ -276,9 +297,37 @@ outputs: # crypt module will be removed in 3.13 => this failing is a reminder to remove the libxcrypt dependency - python -c "import crypt" # [unix] + # this output is empty on windows + - name: libpython + script: install_shared.sh # [unix] + build: + number: {{ build_number }} + activate_in_script: true + ignore_run_exports: + - python_abi + script_env: + - PY_INTERP_DEBUG={{ py_interp_debug }} + string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ debug }}_cpython + requirements: + build: + - {{ stdlib('c') }} + - {{ compiler('c') }} + - {{ compiler('cxx') }} + test: + commands: + - VER=${PKG_VERSION%.*} # [not win] + - VERABI=${VER} # [not win] + - VERABI_NO_DBG=${VERABI} # [not win] +{% if py_interp_debug == "yes" %} + - VERABI=${VERABI}d # [not win] +{% endif %} + - test -f ${PREFIX}/lib/libpython${VERABI}.so # [linux] + - test -f ${PREFIX}/lib/libpython${VERABI}.dylib # [osx] + - test -f ${PREFIX}/lib/libpython3.so # [linux and build_type == "release"] + - test -f ${PREFIX}/lib/libpython3.dylib # [osx and build_type == "release"] + - name: libpython-static - script: build_static.sh # [unix] - script: build_static.bat # [win] + script: install_static.sh # [unix] build: number: {{ build_number }} activate_in_script: true @@ -286,26 +335,28 @@ outputs: - python_abi script_env: - PY_INTERP_DEBUG={{ py_interp_debug }} - string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_cpython # ["conda-forge" in (channel_targets or "")] - string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }} # ["conda-forge" not in (channel_targets or "")] + string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ debug }}_cpython requirements: build: - {{ compiler('c') }} - {{ stdlib('c') }} - {{ compiler('cxx') }} -{% if from_source_control == 'yes' %} - - git -{% endif %} host: - {{ pin_subpackage('python', exact=True) }} run: - {{ pin_subpackage('python', exact=True) }} test: files: + - tests/cmake/* - tests/prefix-replacement/* requires: - {{ stdlib('c') }} - {{ compiler('c') }} + # cmake expects a C++ compiler for some reason + - {{ compiler('cxx') }} + - ripgrep + - cmake + - ninja commands: - VER=${PKG_VERSION%.*} # [not win] {% if py_interp_debug == "yes" %} @@ -316,9 +367,14 @@ outputs: - test -f ${PREFIX}/lib/libpython${VERABI}.a # [unix] - test -f ${PREFIX}/lib/libpython${VERABI}.nolto.a # [unix] - test -f ${PREFIX}/lib/python${VER}/config-${VERABI}-darwin/libpython${VERABI}.a # [osx] - - pushd tests/prefix-replacement # [unix] - - bash build-and-test.sh # [unix] - - popd # [unix] + - pushd tests + - pushd prefix-replacement # [unix] + - bash build-and-test.sh # [unix] + - popd # [unix] + - pushd cmake + - cmake -GNinja {{ cmake_test_args }} -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Embed" {{ cmake_debug }} . + - popd + - popd - name: cpython build: @@ -357,7 +413,6 @@ extra: - isuruf - jakirkham - mbargull - - mingwandroid - msarahan - pelson - ocefpaf diff --git a/recipe/run_test.py b/recipe/run_test.py index 1f64b3078..88f48a32e 100644 --- a/recipe/run_test.py +++ b/recipe/run_test.py @@ -102,8 +102,8 @@ import ssl print('OPENSSL_VERSION:', ssl.OPENSSL_VERSION) -CONDA_OPENSSL_VERSION = os.getenv('openssl').split(".")[0] -assert CONDA_OPENSSL_VERSION in ssl.OPENSSL_VERSION +CONDA_OPENSSL_VERSION = os.getenv('openssl') +assert CONDA_OPENSSL_VERSION in ssl.OPENSSL_VERSION, f"{CONDA_OPENSSL_VERSION} not found in {ssl.OPENSSL_VERSION}" # See https://github.com/conda-forge/python-feedstock/issues/718 for context: assert sys.hash_info.algorithm.startswith("siphash") diff --git a/recipe/tests/cmake/CMakeLists.txt b/recipe/tests/cmake/CMakeLists.txt index a13e20ae1..f3e41560c 100644 --- a/recipe/tests/cmake/CMakeLists.txt +++ b/recipe/tests/cmake/CMakeLists.txt @@ -1,16 +1,10 @@ -# https://martinopilia.com/posts/2018/09/15/building-python-extension.html -# FindPythonInterp and FindPythonLibs are deprecated since cmake 3.12 -# These can be replaced by find_package(Python ${PY_VER} REQUIRED) -# But these are still used by other packages, so we keep them. +# https://scikit-build-core.readthedocs.io/en/latest/guide/cmakelists.html#finding-python cmake_minimum_required(VERSION 3.10) enable_language(C) project(mymath) -option(PY_VER, "Python version to use") +option(PY_VER "Python version to use") +option(EXTRA_COMPONENTS "Additional Python components to check for") -find_package(PythonInterp ${PY_VER} REQUIRED) -# PATHS $ENV{CONDA_PREFIX} - -# This goes after, since it uses PythonInterp as hint -find_package(PythonLibs ${PY_VER} REQUIRED) +find_package(Python ${PY_VER} COMPONENTS Interpreter ${EXTRA_COMPONENTS} REQUIRED) diff --git a/recipe/tests/prefix-replacement/build-and-test.sh b/recipe/tests/prefix-replacement/build-and-test.sh index 633b741a3..670d76d63 100644 --- a/recipe/tests/prefix-replacement/build-and-test.sh +++ b/recipe/tests/prefix-replacement/build-and-test.sh @@ -2,46 +2,47 @@ set -ex -if [[ "$PKG_NAME" == "libpython-static" ]]; then - # see bpo44182 for why -L${CONDA_PREFIX}/lib is added - ${CC} a.c $(python3-config --cflags) $(python3-config --embed --ldflags) -L${CONDA_PREFIX}/lib -o ${CONDA_PREFIX}/bin/embedded-python-static - if [[ "$target_platform" == linux-* ]]; then - if ${READELF} -d ${CONDA_PREFIX}/bin/embedded-python-static | rg libpython; then - echo "ERROR :: Embedded python linked to shared python library. It is expected to link to the static library." - fi - elif [[ "$target_platform" == osx-* ]]; then - if ${OTOOL} -l ${CONDA_PREFIX}/bin/embedded-python-static | rg libpython; then - echo "ERROR :: Embedded python linked to shared python library. It is expected to link to the static library." - fi - fi - ${CONDA_PREFIX}/bin/embedded-python-static - - # I thought this would prefer the shared library for Python. I was wrong: - # EMBED_LDFLAGS=$(python3-config --ldflags) - # re='^(.*)(-lpython[^ ]*)(.*)$' - # if [[ ${EMBED_LDFLAGS} =~ $re ]]; then - # EMBED_LDFLAGS="${BASH_REMATCH[1]} ${BASH_REMATCH[3]} -Wl,-Bdynamic ${BASH_REMATCH[2]}" - # fi - # ${CC} a.c $(python3-config --cflags) ${EMBED_LDFLAGS} -o ${CONDA_PREFIX}/bin/embedded-python-shared +case ${PKG_NAME} in + python) + # see bpo44182 for why -L${CONDA_PREFIX}/lib is added + ${CC} a.c $(python3-config --cflags) \ + $(python3-config --embed --ldflags) \ + -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib \ + -o ${CONDA_PREFIX}/bin/embedded-python-shared - # Brute-force way of linking to the shared library, sorry! - rm -rf ${CONDA_PREFIX}/lib/libpython*.a -fi + if [[ "$target_platform" == linux-* ]]; then + if ! ${READELF} -d ${CONDA_PREFIX}/bin/embedded-python-shared | rg libpython; then + echo "ERROR :: Embedded python linked to static python library. We tried to force it to use the shared library." + fi + elif [[ "$target_platform" == osx-* ]]; then + if ! ${OTOOL} -l ${CONDA_PREFIX}/bin/embedded-python-shared | rg libpython; then + echo "ERROR :: Embedded python linked to static python library. We tried to force it to use the shared library." + fi + fi + ${CONDA_PREFIX}/bin/embedded-python-shared + ;; -${CC} a.c $(python3-config --cflags) \ - $(python3-config --embed --ldflags) \ - -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib \ - -o ${CONDA_PREFIX}/bin/embedded-python-shared + libpython-static) + ${CC} a.c $(python3-config --cflags) \ + $(python3-config --embed --ldflags) \ + -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib \ + -o ${CONDA_PREFIX}/bin/embedded-python-static + if [[ "$target_platform" == linux-* ]]; then + if ${READELF} -d ${CONDA_PREFIX}/bin/embedded-python-static | rg libpython; then + echo "ERROR :: Embedded python linked to shared python library. It is expected to link to the static library." + fi + elif [[ "$target_platform" == osx-* ]]; then + if ${OTOOL} -l ${CONDA_PREFIX}/bin/embedded-python-static | rg libpython; then + echo "ERROR :: Embedded python linked to shared python library. It is expected to link to the static library." + fi + fi + ${CONDA_PREFIX}/bin/embedded-python-static + ;; -if [[ "$target_platform" == linux-* ]]; then - if ! ${READELF} -d ${CONDA_PREFIX}/bin/embedded-python-shared | rg libpython; then - echo "ERROR :: Embedded python linked to static python library. We tried to force it to use the shared library." - fi -elif [[ "$target_platform" == osx-* ]]; then - if ! ${OTOOL} -l ${CONDA_PREFIX}/bin/embedded-python-shared | rg libpython; then - echo "ERROR :: Embedded python linked to static python library. We tried to force it to use the shared library." - fi -fi -${CONDA_PREFIX}/bin/embedded-python-shared + *) + # invalid package + exit 1 + ;; +esac set +x