Skip to content

Commit a489211

Browse files
committed
update schema for package content tests
1 parent 1f0ed4b commit a489211

File tree

2 files changed

+96
-5
lines changed

2 files changed

+96
-5
lines changed

conda_recipe_v2_schema/model.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,23 +475,36 @@ class DownstreamTestElement(StrictBaseModel):
475475
)
476476

477477

478+
class FileExistenceCheck(StrictBaseModel):
479+
exists: ConditionalList[NonEmptyStr] = Field(
480+
default=[], description="Files or glob patterns that should exist"
481+
)
482+
not_exists: ConditionalList[NonEmptyStr] = Field(
483+
default=[], description="Files or glob patterns that should not exist"
484+
)
485+
486+
487+
# Type alias for file content test fields - can be either simple list or existence check dict
488+
FileContentTest = ConditionalList[NonEmptyStr] | FileExistenceCheck
489+
490+
478491
class PackageContentTestInner(StrictBaseModel):
479-
files: ConditionalList[NonEmptyStr] | None = Field(
492+
files: FileContentTest | None = Field(
480493
default=[], description="Files that should be in the package"
481494
)
482-
include: ConditionalList[NonEmptyStr] | None = Field(
495+
include: FileContentTest | None = Field(
483496
default=[],
484497
description="Files that should be in the `include/` folder of the package. This folder is found under `$PREFIX/include` on Unix and `$PREFIX/Library/include` on Windows.",
485498
)
486-
site_packages: ConditionalList[NonEmptyStr] | None = Field(
499+
site_packages: FileContentTest | None = Field(
487500
default=[],
488501
description="Files that should be in the `site-packages/` folder of the package. This folder is found under `$PREFIX/lib/pythonX.Y/site-packages` on Unix and `$PREFIX/Lib/site-packages` on Windows.",
489502
)
490-
bin: ConditionalList[NonEmptyStr] | None = Field(
503+
bin: FileContentTest | None = Field(
491504
default=[],
492505
description="Files that should be in the `bin/` folder of the package. This folder is found under `$PREFIX/bin` on Unix. On Windows this searches for files in `%PREFIX`, `%PREFIX%/bin`, `%PREFIX%/Scripts`, `%PREFIX%/Library/bin`, `%PREFIX/Library/usr/bin` and `%PREFIX/Library/mingw-w64/bin`.",
493506
)
494-
lib: ConditionalList[NonEmptyStr] | None = Field(
507+
lib: FileContentTest | None = Field(
495508
default=[],
496509
description="Files that should be in the `lib/` folder of the package. This folder is found under `$PREFIX/lib` on Unix and %PREFIX%/Library/lib on Windows.",
497510
)

schema.json

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,69 @@
12301230
"title": "DynamicLinking",
12311231
"type": "object"
12321232
},
1233+
"FileExistenceCheck": {
1234+
"additionalProperties": false,
1235+
"properties": {
1236+
"exists": {
1237+
"anyOf": [
1238+
{
1239+
"minLength": 1,
1240+
"type": "string"
1241+
},
1242+
{
1243+
"$ref": "#/$defs/IfStatement"
1244+
},
1245+
{
1246+
"items": {
1247+
"anyOf": [
1248+
{
1249+
"minLength": 1,
1250+
"type": "string"
1251+
},
1252+
{
1253+
"$ref": "#/$defs/IfStatement"
1254+
}
1255+
]
1256+
},
1257+
"type": "array"
1258+
}
1259+
],
1260+
"default": [],
1261+
"description": "Files or glob patterns that should exist",
1262+
"title": "Exists"
1263+
},
1264+
"not_exists": {
1265+
"anyOf": [
1266+
{
1267+
"minLength": 1,
1268+
"type": "string"
1269+
},
1270+
{
1271+
"$ref": "#/$defs/IfStatement"
1272+
},
1273+
{
1274+
"items": {
1275+
"anyOf": [
1276+
{
1277+
"minLength": 1,
1278+
"type": "string"
1279+
},
1280+
{
1281+
"$ref": "#/$defs/IfStatement"
1282+
}
1283+
]
1284+
},
1285+
"type": "array"
1286+
}
1287+
],
1288+
"default": [],
1289+
"description": "Files or glob patterns that should not exist",
1290+
"title": "Not Exists"
1291+
}
1292+
},
1293+
"title": "FileExistenceCheck",
1294+
"type": "object"
1295+
},
12331296
"FileScript": {
12341297
"additionalProperties": false,
12351298
"properties": {
@@ -2834,6 +2897,9 @@
28342897
},
28352898
"type": "array"
28362899
},
2900+
{
2901+
"$ref": "#/$defs/FileExistenceCheck"
2902+
},
28372903
{
28382904
"type": "null"
28392905
}
@@ -2865,6 +2931,9 @@
28652931
},
28662932
"type": "array"
28672933
},
2934+
{
2935+
"$ref": "#/$defs/FileExistenceCheck"
2936+
},
28682937
{
28692938
"type": "null"
28702939
}
@@ -2896,6 +2965,9 @@
28962965
},
28972966
"type": "array"
28982967
},
2968+
{
2969+
"$ref": "#/$defs/FileExistenceCheck"
2970+
},
28992971
{
29002972
"type": "null"
29012973
}
@@ -2927,6 +2999,9 @@
29272999
},
29283000
"type": "array"
29293001
},
3002+
{
3003+
"$ref": "#/$defs/FileExistenceCheck"
3004+
},
29303005
{
29313006
"type": "null"
29323007
}
@@ -2958,6 +3033,9 @@
29583033
},
29593034
"type": "array"
29603035
},
3036+
{
3037+
"$ref": "#/$defs/FileExistenceCheck"
3038+
},
29613039
{
29623040
"type": "null"
29633041
}

0 commit comments

Comments
 (0)