Skip to content

Commit 9b3b0d2

Browse files
committed
Detect trivial cases of ==/!= as well
1 parent 3a0f3c0 commit 9b3b0d2

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

conda_forge_tick/migrators/recipe_v1.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,20 @@ def is_negated_condition(a: str, b: str) -> bool:
3131
if not all(map(is_single_expression, (a, b))):
3232
return False
3333

34+
# X <-> not X
3435
a_not = a.startswith("not")
3536
b_not = b.startswith("not")
36-
return (
37+
if (
3738
a_not != b_not
3839
and a.removeprefix("not").lstrip() == b.removeprefix("not").lstrip()
39-
)
40+
):
41+
return True
42+
43+
# A == B <-> A != B
44+
if a == b.replace("==", "!=") or a == b.replace("!=", "=="):
45+
return True
46+
47+
return False
4048

4149

4250
def fold_branch(source: Any, dest: Any, branch: str, dest_branch: str) -> None:

tests/test_v1_yaml/version_pytorch_correct.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ outputs:
149149
else:
150150
- pytorch-gpu ==${{ version }}
151151
- pytorch-cpu ==99999999
152-
- if: "cuda_compiler_version != \"None\""
153-
then: pytorch =${{ version }} cuda${{ cuda_compiler_version | replace('.', '') }}_${{ blas_impl }}_*_${{ build }}
152+
- pytorch =${{ version }} cuda${{ cuda_compiler_version | replace('.', '') }}_${{ blas_impl }}_*_${{ build }}
154153
- if: "unix and blas_impl != \"mkl\""
155154
then: openblas * openmp_*
156155

@@ -225,9 +224,9 @@ outputs:
225224
then:
226225
- mkl-devel ${{ mkl }}
227226
- libcblas * *_mkl
228-
else: libcblas
229-
- if: "blas_impl != \"mkl\""
230-
then: liblapack
227+
else:
228+
- libcblas
229+
- liblapack
231230
- if: not win
232231
then: llvm-openmp
233232
else: intel-openmp ${{ mkl }}
@@ -252,9 +251,7 @@ outputs:
252251
else: intel-openmp ${{ mkl }}
253252
- if: "blas_impl == \"mkl\""
254253
then: libblas * *${{ blas_impl }}
255-
- if: "blas_impl != \"mkl\""
256-
then: nomkl
257-
# GPU requirements without run_exports
254+
else: nomkl
258255
- if: "cuda_compiler_version != \"None\""
259256
then: ${{ pin_compatible('cudnn') }}
260257
- if: "cuda_compiler_version != \"None\" and not win"

0 commit comments

Comments
 (0)