Skip to content

Commit 75b9e85

Browse files
authored
Add JSON schema to manifest so it is installed (#1017)
1 parent e39990d commit 75b9e85

7 files changed

Lines changed: 55 additions & 10 deletions

File tree

.github/workflows/main.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ jobs:
9393
activate-environment: constructor-dev
9494
environment-file: dev/environment.yml
9595
python-version: ${{ matrix.python-version }}
96+
miniconda-version: latest
9697
- name: Install AzureSignTool
9798
if: startswith(matrix.os, 'windows')
9899
run: dotnet.exe tool install --global AzureSignTool
@@ -196,18 +197,13 @@ jobs:
196197
build:
197198
name: Canary Build
198199
needs: [tests]
199-
# only build canary build if
200-
# only build canary build if
200+
# only upload canary build if
201201
# - prior steps succeeded,
202202
# - this is the main repo, and
203203
# - we are on the main (or feature) branch
204204
if: >-
205205
success()
206206
&& !github.event.repository.fork
207-
&& (
208-
github.ref_name == 'main'
209-
|| startsWith(github.ref_name, 'feature/')
210-
)
211207
strategy:
212208
matrix:
213209
include:
@@ -228,8 +224,16 @@ jobs:
228224
ref: ${{ github.ref }}
229225
clean: true
230226
fetch-depth: 0
227+
228+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
229+
- name: Build Python sdist and wheel
230+
run: |
231+
python -m pip install build
232+
python -m build --sdist --wheel . --outdir dist
233+
231234
- name: Create and upload canary build
232235
uses: conda/actions/canary-release@eb545bb8ab48d499b31c057a6df3cf46753fdbcb # v25.3.1
236+
if: github.ref_name == 'main' || startsWith(github.ref_name, 'feature/')
233237
with:
234238
package-name: ${{ github.event.repository.name }}
235239
subdir: ${{ matrix.subdir }}

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
include versioneer.py
21
include constructor/_version.py
2+
include constructor/data/construct.schema.json

constructor/fcp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def _main(
443443
input_dir=input_dir,
444444
)
445445
if dry_run:
446-
return None, None, None, None, None, None, None
446+
return None, None, None, None, None, None, None, None
447447
pc_recs, _urls, dists, has_conda = _fetch_precs(
448448
precs, download_dir, transmute_file_type=transmute_file_type
449449
)

constructor/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def _build_message(self):
369369
)
370370

371371

372-
def main():
372+
def main(argv=None):
373373
logging.basicConfig(level=logging.INFO)
374374
p = argparse.ArgumentParser(description="build an installer from <DIRECTORY>/construct.yaml")
375375

@@ -448,7 +448,7 @@ def main():
448448
metavar="DIRECTORY",
449449
)
450450

451-
args = p.parse_args()
451+
args = p.parse_args(argv)
452452
logger.info("Got the following cli arguments: '%s'", args)
453453

454454
if args.verbose or args.debug:

news/740-manifest-data

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
### Enhancements
2+
3+
* <news item>
4+
5+
### Bug fixes
6+
7+
* Include `construct.schema.json` file as part of the source distribution. (#740)
8+
* Fix return value when running `constructor --dry-run` mode. (#740)
9+
10+
### Deprecations
11+
12+
* <news item>
13+
14+
### Docs
15+
16+
* <news item>
17+
18+
### Other
19+
20+
* <news item>

recipe/meta.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ test:
4747
- constructor --help
4848
# Run unit tests
4949
- pytest -v tests -k "not examples"
50+
# Run _one_ example as a smoke integration test
51+
- pytest -v tests/test_examples.py::test_example_miniforge
5052

5153
about:
5254
home: https://conda.io

tests/test_main.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from textwrap import dedent
2+
3+
from constructor.main import main
4+
5+
6+
def test_dry_run(tmp_path):
7+
inputfile = dedent(
8+
"""
9+
name: test_schema_validation
10+
version: X
11+
installer_type: all
12+
channels:
13+
- http://repo.anaconda.com/pkgs/main/
14+
specs:
15+
- ca-certificates
16+
"""
17+
)
18+
(tmp_path / "construct.yaml").write_text(inputfile)
19+
main([str(tmp_path), "--dry-run"])

0 commit comments

Comments
 (0)