~simplestreams-dev/simplestreams/artful

« back to all changes in this revision

Viewing changes to tools/run-flake8

  • Committer: Scott Moser
  • Date: 2017-09-14 14:38:05 UTC
  • mfrom: (1.1.25)
  • Revision ID: smoser@ubuntu.com-20170914143805-1aaqucihabga3b16
* New upstream snapshot.
  - Keystone v3 Support [David Ames] (LP: #1686437)
  - flake8/pycodestyle updates.
  - tests: change to having http server select its own port
  - Support filters that contain a '-' in the tag name
  - Improvements for running flake8 in different Ubuntu release
    environments.
  - add running of tox.
  - json2streams: Accept items with no size.
  - tools changes (not related to package functionality)
    - tools/ubuntu_versions.py: Exclude old versions by version not name
    - Update default LTS alias to point to Xenial (LP: #1606606)
    - Create chksum for LXD metadata+root for squashfs (LP: #1577922)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
# old versions of flake8 (trusty) cannot be called as python3 -m flake8
 
4
# newer versions can.  Its preferable to run as python -m because
 
5
# that allows us to run explicitly python or python3.
 
6
mode=""
 
7
case "$1" in
 
8
    any|cmd) mode="$1"; shift;;
 
9
esac
 
10
 
 
11
if [ "$mode" = "cmd" ] ||
 
12
    { [ "$mode" = "any" ] && command -v flake8 >/dev/null; }; then
 
13
    cmd=( flake8 )
 
14
else
 
15
    case "$1" in
 
16
        python|python2|python3) python="$1"; shift;;
 
17
        *) python=python3;;
 
18
    esac
 
19
    cmd=( "$python" -m "flake8" )
 
20
fi
 
21
 
 
22
if [ $# -eq 0 ]; then
 
23
   exes=( )
 
24
   # these dirs have python files that do not end in .py
 
25
   for f in tools/* bin/*; do
 
26
      [ -f "$f" -a "${f%.py}" = "$f" ] || continue
 
27
      read line <"$f" && [ "${line#*python}" != "$line" ] &&
 
28
         exes[${#exes[@]}]="$f"
 
29
   done
 
30
   files=( "${exes[@]}" setup.py simplestreams/ tools/ tests/ )
 
31
else
 
32
   files=( "$@" );
 
33
fi
 
34
 
 
35
cmd=( "${cmd[@]}" "${files[@]}" )
 
36
 
 
37
echo -e "\nRunning flake8:"
 
38
echo "${cmd[@]}"
 
39
"${cmd[@]}"