Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 5713937

Browse files
author
Matthias Koeppe
committed
sage -package list --has-file, --no-file: Handle disjunctions
1 parent ca6d163 commit 5713937

File tree

4 files changed

+15
-39
lines changed

4 files changed

+15
-39
lines changed

.github/workflows/ci-linux.yml

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,8 @@ jobs:
116116
tox_packages_factors: >-
117117
["maximal"]
118118
docker_targets: "with-targets-optional"
119-
targets_optional: >-
120-
$( echo $(export PATH=build/bin:$PATH
121-
&& (for a in spkg-install.in spkg-install requirements.txt; do
122-
sage-package list :optional:
123-
--has-file $a
124-
--no-file huge
125-
--no-file has_nonfree_dependencies;
126-
done) | grep -v ^_ | grep -v sagemath_doc | grep ^[0-o] ) )
119+
targets_optional: '$(echo $(export PATH=build/bin:$PATH && sage-package list :optional: --has-file "spkg-install.in|spkg-install|requirements.txt" --no-file "huge|has_nonfree_dependencies" | grep -v sagemath_doc | grep ^[0-o]))'
120+
127121

128122
optional-p-z:
129123
if: ${{ success() || failure() }}
@@ -136,14 +130,7 @@ jobs:
136130
tox_packages_factors: >-
137131
["maximal"]
138132
docker_targets: "with-targets-optional"
139-
targets_optional: >-
140-
$( echo $(export PATH=build/bin:$PATH
141-
&& (for a in spkg-install.in spkg-install requirements.txt; do
142-
sage-package list :optional:
143-
--has-file $a
144-
--no-file huge
145-
--no-file has_nonfree_dependencies;
146-
done) | grep -v ^_ | grep -v sagemath_doc | grep ^[p-z] ) )
133+
targets_optional: '$(echo $(export PATH=build/bin:$PATH && sage-package list :optional: --has-file "spkg-install.in|spkg-install|requirements.txt" --no-file "huge|has_nonfree_dependencies" | grep -v sagemath_doc | grep ^[p-z]))'
147134

148135
experimental-0-o:
149136
if: ${{ success() || failure() }}
@@ -156,14 +143,7 @@ jobs:
156143
tox_packages_factors: >-
157144
["maximal"]
158145
docker_targets: "with-targets-optional"
159-
targets_optional: >-
160-
$( echo $(export PATH=build/bin:$PATH
161-
&& (for a in spkg-install.in spkg-install requirements.txt; do
162-
sage-package list :experimental:
163-
--has-file $a
164-
--no-file huge
165-
--no-file has_nonfree_dependencies;
166-
done) | grep -v ^_ | grep -v sagemath_doc | grep ^[0-o] ) )
146+
targets_optional: '$(echo $(export PATH=build/bin:$PATH && sage-package list :experimental: --has-file "spkg-install.in|spkg-install|requirements.txt" --no-file "huge|has_nonfree_dependencies" | grep -v sagemath_doc | grep ^[0-o]))'
167147

168148
experimental-p-z:
169149
if: ${{ success() || failure() }}
@@ -176,15 +156,7 @@ jobs:
176156
tox_packages_factors: >-
177157
["maximal"]
178158
docker_targets: "with-targets-optional"
179-
targets_optional: >-
180-
$( echo $(export PATH=build/bin:$PATH
181-
&& (for a in spkg-install.in spkg-install requirements.txt; do
182-
sage-package list :experimental:
183-
--has-file $a
184-
--no-file huge
185-
--no-file has_nonfree_dependencies;
186-
done) | grep -v ^_ | grep -v sagemath_doc | grep ^[p-z] ) )
187-
159+
targets_optional: '$(echo $(export PATH=build/bin:$PATH && sage-package list :experimental: --has-file "spkg-install.in|spkg-install|requirements.txt" --no-file "huge|has_nonfree_dependencies" | grep -v sagemath_doc | grep ^[p-z]))'
188160

189161
local-ubuntu:
190162

.github/workflows/ci-macos.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ jobs:
8383
2-optional*) export TARGETS_PRE="build/make/Makefile" TARGETS="build/make/Makefile"
8484
targets_pattern="${{ matrix.stage }}"
8585
targets_pattern="${targets_pattern#2-optional-}"
86-
export TARGETS_OPTIONAL=$( echo $(export PATH=build/bin:$PATH && (for a in spkg-install.in spkg-install requirements.txt; do sage-package list :optional: --has-file $a --no-file huge --no-file has_nonfree_dependencies; done) | grep -v ^_ | grep -v sagemath_doc | grep "^[$targets_pattern]" ) )
86+
export TARGETS_OPTIONAL=$( echo $(export PATH=build/bin:$PATH && sage-package list :optional: --has-file 'spkg-install.in|spkg-install|requirements.txt' --no-file huge|has_nonfree_dependencies | grep -v sagemath_doc | grep "^[$targets_pattern]" ) )
8787
;;
8888
2-experimental*) export TARGETS_PRE="build/make/Makefile" TARGETS="build/make/Makefile"
8989
targets_pattern="${{ matrix.stage }}"
9090
targets_pattern="${targets_pattern#2-experimental-}"
91-
export TARGETS_OPTIONAL=$( echo $(export PATH=build/bin:$PATH && (for a in spkg-install.in spkg-install requirements.txt; do sage-package list :experimental: --has-file $a --no-file huge --no-file has_nonfree_dependencies; done) | grep -v ^_ | grep -v sagemath_doc | grep "^[$targets_pattern]" ) )
91+
export TARGETS_OPTIONAL=$( echo $(export PATH=build/bin:$PATH && sage-package list :experimental: --has-file 'spkg-install.in|spkg-install|requirements.txt' --no-file huge|has_nonfree_dependencies | grep -v sagemath_doc | grep "^[$targets_pattern]" ) )
9292
;;
9393
esac
9494
MAKE="make -j12" tox -e $TOX_ENV -- SAGE_NUM_THREADS=4 $TARGETS

build/sage_bootstrap/cmdline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ def make_parser():
206206
parser_list.add_argument(
207207
'--has-file', action='append', default=[], metavar='FILENAME', dest='has_files',
208208
help=('only include packages that have this file in their metadata directory '
209-
'(examples: SPKG.rst, spkg-configure.m4, distros/debian.txt)'))
209+
'(examples: SPKG.rst, spkg-configure.m4, distros/debian.txt, spkg-install|spkg-install.in)'))
210210
parser_list.add_argument(
211211
'--no-file', action='append', default=[], metavar='FILENAME', dest='no_files',
212212
help=('only include packages that do not have this file in their metadata directory '
213-
'(examples: huge, patches)'))
213+
'(examples: huge, patches, huge|has_nonfree_dependencies)'))
214214
parser_list.add_argument(
215215
'--exclude', action='append', default=[], metavar='PACKAGE_NAME',
216216
help='exclude package from list')

build/sage_bootstrap/expand_class.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ def __init__(self, *package_names_or_classes, **filters):
3232
def included_in_filter(pkg):
3333
if pkg.name in excluded:
3434
return False
35-
if not all(pkg.has_file(filename) for filename in filenames):
35+
if not all(any(pkg.has_file(filename)
36+
for filename in filename_disjunction.split('|'))
37+
for filename_disjunction in filenames):
3638
return False
37-
return not any(pkg.has_file(filename) for filename in no_filenames)
39+
return not any(any(pkg.has_file(filename)
40+
for filename in no_filename_disjunction.split('|'))
41+
for no_filename_disjunction in no_filenames)
3842

3943
for package_name_or_class in package_names_or_classes:
4044
if package_name_or_class == ':all:':

0 commit comments

Comments
 (0)