Skip to content

Commit a21ee4c

Browse files
authored
Only generate catalog info when in DiamondLightSource (#197)
2 parents cefd623 + 81248ff commit a21ee4c

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

copier.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
package_name:
33
type: str
44
help: |
5-
Name of the python import package.
5+
Name of the python import package.
66
Must be a valid python identifier, i.e. my_package
77
validator: >-
88
{% if not (package_name | regex_search('^[a-zA-Z][a-zA-Z_0-9]+$')) %}
@@ -58,20 +58,22 @@ author_email:
5858
help: Your email address
5959
placeholder: email@diamond.ac.uk
6060

61+
# Catalog info
6162
component_owner:
6263
type: str
64+
when: "{{ github_org == 'DiamondLightSource' }}"
6365
help: |
64-
The unique name of the person or group who owns this component in
66+
The unique name of the person or group who owns this component in
6567
the Developer Portal Software Catalogue.
66-
This will normally be group:default/<your_group>. For a full list of groups visit
68+
This will normally be group:default/<your_group>. For a full list of groups visit
6769
https://dev-portal.diamond.ac.uk/catalog?filters%5Bkind%5D=group&filters%5Buser%5D=all
6870
and hover over each group link to see its group ID, e.g.
6971
https://dev-portal.diamond.ac.uk/catalog/default/group/accelerator-controls
7072
would go here as group:default/accelerator-controls.
71-
7273
7374
component_type:
7475
type: str
76+
when: "{{ github_org == 'DiamondLightSource' }}"
7577
help: |
7678
Type of the component in the Developer Portal Software Catalogue.
7779
Most likely service, library or application (without quotes).
@@ -84,8 +86,9 @@ component_type:
8486

8587
component_lifecycle:
8688
type: str
89+
when: "{{ github_org == 'DiamondLightSource' }}"
8790
help: |
88-
Project's current lifecycle stage, to be displayed in the Developer
91+
Project's current lifecycle stage, to be displayed in the Developer
8992
Portal Software Catalogue.
9093
choices:
9194
- experimental
@@ -147,6 +150,6 @@ _tasks:
147150
_migrations:
148151
- version: 2.0.0
149152
before:
150-
- echo This update will require you to login to pypi.org and make changes before you can make a new release to PyPI. If you do not have time to do this now, press CTRL+C to abort this update.
153+
- echo This update will require you to login to pypi.org and make changes before you can make a new release to PyPI. If you do not have time to do this now, press CTRL+C to abort this update.
151154
after:
152-
- echo Visit https://diamondlightsource.github.io/python-copier-template/main/how-to/pypi.html to find out how to set up PyPI trusted publishing
155+
- echo Visit https://diamondlightsource.github.io/python-copier-template/main/how-to/pypi.html to find out how to set up PyPI trusted publishing

tests/test_example.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def test_template_defaults(tmp_path: Path):
4949
run = make_venv(tmp_path)
5050
container_doc = tmp_path / "docs" / "how-to" / "run-container.md"
5151
assert container_doc.exists()
52+
catalog_info = tmp_path / "catalog-info.yaml"
53+
assert catalog_info.exists()
5254
run("./venv/bin/tox -p")
5355
run("./venv/bin/pip install build twine")
5456
run("./venv/bin/python -m build")
@@ -114,6 +116,12 @@ def test_template_no_docs(tmp_path: Path):
114116
run("./venv/bin/tox -p")
115117

116118

119+
def test_template_in_different_org_has_no_catalog(tmp_path: Path):
120+
copy_project(tmp_path, github_org="bluesky")
121+
catalog_info = tmp_path / "catalog-info.yaml"
122+
assert not catalog_info.exists()
123+
124+
117125
def test_template_no_docker_has_no_docs_and_works(tmp_path: Path):
118126
copy_project(tmp_path, docker=False)
119127
container_doc = tmp_path / "docs" / "how-to" / "run-container.md"

0 commit comments

Comments
 (0)