File: spec-includes

package info (click to toggle)
puppetdb 8.8.1-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 19,692 kB
  • sloc: javascript: 23,285; ruby: 5,620; sh: 3,457; python: 389; xml: 114; makefile: 38
file content (29 lines) | stat: -rwxr-xr-x 857 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""": # -*-python-*-
command -v python3 > /dev/null && exec python3 "$0" "$@"
command -v python2 > /dev/null && exec python2 "$0" "$@"
echo "error: unable to find python3 or python2" 1>&2; exit 2
"""

# Prints search string if its a component of test spec
# First argument is test spec, second is search string
# Ex: spec-includes core/openjdk8/pg-9.6/rich rich => rich
# Ex: spec-includes core/openjdk8/pg-9.6/rich openjdk8 => openjdk8
# Ex: spec-includes core/openjdk8/pg-9.6/rich foo =>

from __future__ import print_function
from sys import exit, stderr
import os, sys

def usage(stream):
    print('Usage: spec-includes .../pup-5.3.x/srv-5.1.x/something something',
          file=stream)

def misuse():
    usage(stderr)
    exit(2)

len(sys.argv) == 3 or misuse()
specs, what = sys.argv[1:]
specs = specs.split('/')
if what in specs:
    print(what)