File tree Expand file tree Collapse file tree 3 files changed +65
-1
lines changed
Expand file tree Collapse file tree 3 files changed +65
-1
lines changed Original file line number Diff line number Diff line change @@ -272,6 +272,21 @@ def setup_instparser(instparser):
272272 ),
273273 )
274274
275+ listparser = subparsers .add_parser (
276+ "list" ,
277+ help = "List all packages with their relative paths" ,
278+ )
279+ listparser .set_defaults (func = list_args )
280+ listparser .add_argument (
281+ "--mode" ,
282+ "-m" ,
283+ default = "DEFAULT" ,
284+ help = cleandoc (
285+ """Section of config file to use for target selection configuration.
286+ See description of exec for available options."""
287+ ),
288+ )
289+
275290 return parser .parse_args (args )
276291
277292
@@ -741,6 +756,22 @@ def version_args(args):
741756 print (cfg [args .mode ]["version" ])
742757
743758
759+ def list_args (args ):
760+ rootpath = find_projectroot ()
761+ targets = find_targets (args .mode , rootpath )
762+
763+ if not targets :
764+ sys .exit (f"Error: No targets selected (root: { rootpath } )" )
765+
766+ excluded_dirs = ["docs" , "scripts" ]
767+
768+ for target in targets :
769+ rel_path = target .relative_to (rootpath )
770+ if any (excluded in str (rel_path ) for excluded in excluded_dirs ):
771+ continue
772+ print (str (rel_path ))
773+
774+
744775def main ():
745776 args = parse_args ()
746777 args .func (args )
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ OVERALL_EXIT_CODE=0
4+ BRANCH_TO_COMPARE=" main"
5+ GRIFFE_CMD=" griffe check -v -a $BRANCH_TO_COMPARE "
6+
7+ run_griffe_check () {
8+ local package_spec=" $1 "
9+ local package_name
10+ local search_path=" "
11+
12+ if [[ " $package_spec " == * " /" * ]]; then
13+ search_path=$( echo " $package_spec " | cut -d' /' -f1)
14+ package_name=$( echo " $package_spec " | cut -d' /' -f2)
15+ $GRIFFE_CMD -s " $search_path " " $package_name "
16+ else
17+ package_name=" $package_spec "
18+ $GRIFFE_CMD " $package_name "
19+ fi
20+ }
21+
22+ while read -r package; do
23+ if ! run_griffe_check " $package " ; then
24+ OVERALL_EXIT_CODE=1
25+ fi
26+ done < <( python " $( dirname " $0 " ) /eachdist.py" list)
27+
28+ exit $OVERALL_EXIT_CODE
Original file line number Diff line number Diff line change @@ -309,11 +309,16 @@ commands_post =
309309 docker-compose down -v
310310
311311[testenv:public-symbols-check]
312- basepython: python3
313312recreate = True
313+ allowlist_externals =
314+ {toxinidir}/scripts/griffe_check.sh
314315deps =
315316 GitPython ==3.1.40
317+ griffe ==1.7.3
318+ toml
316319commands =
320+ ; griffe check before to fail fast if there are any issues
321+ {toxinidir}/scripts/griffe_check.sh
317322 python {toxinidir}/scripts/public_symbols_checker.py
318323
319324[testenv:generate-workflows]
You can’t perform that action at this time.
0 commit comments