Skip to content

Commit

Permalink
Error if recipe is in wrong directory (conda-forge#12339)
Browse files Browse the repository at this point in the history
* Error if recipe is in wrong directory

* Add a test recipe

* Debug script

* debug 2

* FIx checking meta.yaml path

* Use abspath

* Remove installing vs2008

* Add recipe in wrong dir

* Remove test recipes
  • Loading branch information
isuruf authored Aug 9, 2020
1 parent 88b9ecb commit e972479
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml.notused
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ install:
build: off

test_script:
- python .ci_support\build_all.py recipes --arch %PLATFORM%
- python .ci_support\build_all.py --arch %PLATFORM%

# copy any newly created conda packages into the conda_packages dir
- cmd: mkdir conda_packages
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/azure-pipelines-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
echo ""
# We just want to build all of the recipes.
python .ci_support/build_all.py ./recipes
python .ci_support/build_all.py
- publish: /usr/local/miniconda/conda-bld/osx-64/
artifact: conda_pkgs_osx
40 changes: 3 additions & 37 deletions .azure-pipelines/azure-pipelines-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,6 @@ jobs:
CF_MAX_PY_VER: 37
timeoutInMinutes: 360
steps:
# TODO: Fast finish on azure pipelines?
- script: |
echo "Fast Finish"
- script: |
choco install vcpython27 -fdv -y --debug
displayName: Install vcpython27.msi (if needed)
- powershell: |
Set-PSDebug -Trace 1
$batchcontent = @"
ECHO ON
SET vcpython=C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0
DIR "%vcpython%"
CALL "%vcpython%\vcvarsall.bat" %*
"@
$batchDir = "C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\VC"
$batchPath = "$batchDir" + "\vcvarsall.bat"
New-Item -Path $batchPath -ItemType "file" -Force
Set-Content -Value $batchcontent -Path $batchPath
Get-ChildItem -Path $batchDir
Get-ChildItem -Path ($batchDir + '\..')
displayName: Patch vs2008 (if needed)
- task: CondaEnvironment@1
inputs:
packageSpecs: 'python=3.6 conda-build>=3.18 conda>4.7.12 conda-forge::conda-forge-ci-setup=2 networkx=2.3 conda-forge-pinning' # Optional
Expand Down Expand Up @@ -85,11 +53,9 @@ jobs:
# Special cased version setting some more things!
- script: |
git fetch --force origin master:master
python .ci_support\build_all.py recipes --arch 64
python .ci_support\build_all.py --arch 64
displayName: Build recipe
displayName: Build recipe (maybe vs2008)
env: {
VS90COMNTOOLS: "C:\\Program Files (x86)\\Common Files\\Microsoft\\Visual C++ for Python\\9.0\\VC\\bin",
}
- publish: C:\\Miniconda\\conda-bld\\win-64\\
artifact: conda_pkgs_win
15 changes: 12 additions & 3 deletions .ci_support/build_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,20 @@ def build_folders(recipes_dir, folders, arch, channel_urls):
conda_build.api.build([recipe], config=get_config(arch, channel_urls))


def check_recipes_in_correct_dir(root_dir, correct_dir):
from pathlib import Path
for path in Path(root_dir).rglob('meta.yaml'):
path = path.absolute().relative_to(root_dir)
if path.parts[0] != correct_dir:
raise RuntimeError(f"recipe {path.parts} in wrong directory")
if len(path.parts) != 3:
raise RuntimeError(f"recipe {path.parts} in wrong directory")

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('recipes_dir', default=os.getcwd(),
help='Directory where the recipes are')
parser.add_argument('--arch', default='64',
help='target architecture (64 or 32)')
args = parser.parse_args()
build_all(args.recipes_dir, args.arch)
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
check_recipes_in_correct_dir(root_dir, "recipes")
build_all(os.path.join(root_dir, "recipes"), args.arch)
15 changes: 7 additions & 8 deletions .circleci/build_steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,17 @@ show_channel_urls: true
CONDARC

# Copy the host recipes folder so we don't ever muck with it
cp -r /home/conda/staged-recipes/recipes ~/conda-recipes
cp -r /home/conda/staged-recipes/.ci_support ~/.ci_support
cp -r /home/conda/staged-recipes ~/staged-recipes-copy

# Find the recipes from master in this PR and remove them.
echo "Pending recipes."
ls -la ~/conda-recipes
ls -la ~/staged-recipes-copy/recipes
echo "Finding recipes merged in master and removing them from the build."
pushd /home/conda/staged-recipes/recipes > /dev/null
if [ "${AZURE}" == "True" ]; then
git fetch --force origin master:master
fi
git ls-tree --name-only master -- . | xargs -I {} sh -c "rm -rf ~/conda-recipes/{} && echo Removing recipe: {}"
git ls-tree --name-only master -- . | xargs -I {} sh -c "rm -rf ~/staged-recipes-copy/recipes/{} && echo Removing recipe: {}"
popd > /dev/null

# Unused, but needed by conda-build currently... :(
Expand All @@ -44,15 +43,15 @@ conda index /home/conda/staged-recipes/build_artifacts

conda install --yes --quiet "conda>4.7.12" conda-forge-ci-setup=3.* conda-forge-pinning networkx=2.3 "conda-build>=3.16"
export FEEDSTOCK_ROOT="${FEEDSTOCK_ROOT:-/home/conda/staged-recipes}"
export CI_SUPPORT="/home/conda/.ci_support"
setup_conda_rc "${FEEDSTOCK_ROOT}" "/home/conda/conda-recipes" "${CI_SUPPORT}/${CONFIG}.yaml"
export CI_SUPPORT="/home/conda/staged-recipes-copy/.ci_support"
setup_conda_rc "${FEEDSTOCK_ROOT}" "/home/conda/staged-recipes-copy/recipes" "${CI_SUPPORT}/${CONFIG}.yaml"
source run_conda_forge_build_setup

# yum installs anything from a "yum_requirements.txt" file that isn't a blank line or comment.
find ~/conda-recipes -mindepth 2 -maxdepth 2 -type f -name "yum_requirements.txt" \
find ~/staged-recipes-copy/recipes -mindepth 2 -maxdepth 2 -type f -name "yum_requirements.txt" \
| xargs -n1 cat | { grep -v -e "^#" -e "^$" || test $? == 1; } | \
xargs -r /usr/bin/sudo -n yum install -y

python ~/.ci_support/build_all.py ~/conda-recipes
python ${CI_SUPPORT}/build_all.py

touch "/home/conda/staged-recipes/build_artifacts/conda-forge-build-done"
2 changes: 1 addition & 1 deletion .travis_scripts/build_all
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ popd > /dev/null
echo ""

# We just want to build all of the recipes.
python .ci_support/build_all.py ./recipes
python .ci_support/build_all.py

0 comments on commit e972479

Please sign in to comment.