Merge pull request #929 from epfl-scitas/differentiate_framework_from_packages
QA : make qa checking less painful
This commit is contained in:
commit
9030541e4b
20
.flake8
Normal file
20
.flake8
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# -*- conf -*-
|
||||||
|
# flake8 settings for Spack.
|
||||||
|
#
|
||||||
|
# Below we describe which flake8 checks Spack ignores and what the
|
||||||
|
# rationale is.
|
||||||
|
#
|
||||||
|
# Let people line things up nicely:
|
||||||
|
# - E221: multiple spaces before operator
|
||||||
|
# - E241: multiple spaces after ‘,’
|
||||||
|
#
|
||||||
|
# Spack allows wildcard imports:
|
||||||
|
# - F403: disable wildcard import
|
||||||
|
#
|
||||||
|
# These are required to get the package.py files to test clean.
|
||||||
|
# - F821: undefined name (needed for cmake, configure, etc.)
|
||||||
|
# - F999: name name be undefined or undefined from star imports.
|
||||||
|
#
|
||||||
|
[flake8]
|
||||||
|
ignore = E221,E241,F403,F821,F999
|
||||||
|
max-line-length = 79
|
@ -1,3 +0,0 @@
|
|||||||
[style]
|
|
||||||
based_on_style = pep8
|
|
||||||
column_limit = 79
|
|
@ -15,20 +15,22 @@ before_install:
|
|||||||
# Need this for the git tests to succeed.
|
# Need this for the git tests to succeed.
|
||||||
- git config --global user.email "spack@example.com"
|
- git config --global user.email "spack@example.com"
|
||||||
- git config --global user.name "Test User"
|
- git config --global user.name "Test User"
|
||||||
|
|
||||||
# Need this to be able to compute the list of changed files
|
# Need this to be able to compute the list of changed files
|
||||||
- git fetch origin develop:develop
|
- git fetch origin develop:develop
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
# Regular spack setup and tests
|
||||||
- . share/spack/setup-env.sh
|
- . share/spack/setup-env.sh
|
||||||
- spack compilers
|
- spack compilers
|
||||||
- spack config get compilers
|
- spack config get compilers
|
||||||
- spack install -v libdwarf
|
- spack install -v libdwarf
|
||||||
|
|
||||||
# Run unit tests with code coverage
|
# Run unit tests with code coverage
|
||||||
- coverage run bin/spack test
|
- coverage run bin/spack test
|
||||||
# Checks if the file that have been changed are flake8 conformant
|
|
||||||
- CHANGED_PYTHON_FILES=`git diff develop... --name-only | perl -ne 'print if /\.py$/'`
|
|
||||||
- if [[ ${CHANGED_PYTHON_FILES} ]] ; then flake8 --format pylint --config flake8.ini ${CHANGED_PYTHON_FILES} ; fi
|
|
||||||
|
|
||||||
|
# Run flake8 code style checks.
|
||||||
|
- share/spack/qa/run-flake8
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- coveralls
|
- coveralls
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
[flake8]
|
|
||||||
ignore = W391,F403,E221,F821
|
|
||||||
max-line-length = 79
|
|
@ -34,14 +34,14 @@
|
|||||||
|
|
||||||
class InvalidSysTypeError(serr.SpackError):
|
class InvalidSysTypeError(serr.SpackError):
|
||||||
def __init__(self, sys_type):
|
def __init__(self, sys_type):
|
||||||
super(InvalidSysTypeError, self).__init__(
|
super(InvalidSysTypeError,
|
||||||
"Invalid sys_type value for Spack: " + sys_type)
|
self).__init__("Invalid sys_type value for Spack: " + sys_type)
|
||||||
|
|
||||||
|
|
||||||
class NoSysTypeError(serr.SpackError):
|
class NoSysTypeError(serr.SpackError):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(NoSysTypeError, self).__init__(
|
super(NoSysTypeError,
|
||||||
"Could not determine sys_type for this machine.")
|
self).__init__("Could not determine sys_type for this machine.")
|
||||||
|
|
||||||
|
|
||||||
def get_sys_type_from_spack_globals():
|
def get_sys_type_from_spack_globals():
|
||||||
@ -69,15 +69,15 @@ def get_sys_type_from_platform():
|
|||||||
@memoized
|
@memoized
|
||||||
def sys_type():
|
def sys_type():
|
||||||
"""Returns a SysType for the current machine."""
|
"""Returns a SysType for the current machine."""
|
||||||
methods = [get_sys_type_from_spack_globals,
|
methods = [get_sys_type_from_spack_globals, get_sys_type_from_environment,
|
||||||
get_sys_type_from_environment,
|
|
||||||
get_sys_type_from_platform]
|
get_sys_type_from_platform]
|
||||||
|
|
||||||
# search for a method that doesn't return None
|
# search for a method that doesn't return None
|
||||||
sys_type = None
|
sys_type = None
|
||||||
for method in methods:
|
for method in methods:
|
||||||
sys_type = method()
|
sys_type = method()
|
||||||
if sys_type: break
|
if sys_type:
|
||||||
|
break
|
||||||
|
|
||||||
# Couldn't determine the sys_type for this machine.
|
# Couldn't determine the sys_type for this machine.
|
||||||
if sys_type is None:
|
if sys_type is None:
|
||||||
|
55
share/spack/qa/run-flake8
Executable file
55
share/spack/qa/run-flake8
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This script runs source code style checks on Spack.
|
||||||
|
#
|
||||||
|
# It should be executed from the top-level directory of the repo,
|
||||||
|
# e.g.:
|
||||||
|
#
|
||||||
|
# share/spack/qa/run-flake8
|
||||||
|
#
|
||||||
|
# To run it, you'll need to have the Python flake8 installed locally.
|
||||||
|
#
|
||||||
|
PYTHONPATH=./lib/spack:$PYTHONPATH
|
||||||
|
|
||||||
|
flake8="$(which flake8)"
|
||||||
|
if [[ ! $flake8 ]]; then
|
||||||
|
echo "ERROR: flake8 is required to run this script."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if changed files are flake8 conformant [framework]
|
||||||
|
changed=$(git diff --name-only develop... | grep '.py$')
|
||||||
|
|
||||||
|
# Exempt url lines in changed packages from overlong line errors.
|
||||||
|
for file in $changed; do
|
||||||
|
if [[ $file = *package.py ]]; then
|
||||||
|
perl -i~ -pe 's/^(\s*url\s*=.*)$/\1 # NOQA: ignore=E501/' $file;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
return_code=0
|
||||||
|
if [[ $changed ]]; then
|
||||||
|
echo =======================================================
|
||||||
|
echo flake8: running flake8 code checks on spack.
|
||||||
|
echo
|
||||||
|
echo Modified files:
|
||||||
|
echo $changed | perl -pe 's/^/ /;s/ +/\n /g'
|
||||||
|
echo =======================================================
|
||||||
|
if flake8 --format pylint $changed; then
|
||||||
|
echo "Flake8 checks were clean."
|
||||||
|
else
|
||||||
|
echo "Flake8 found errors."
|
||||||
|
return_code=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo No core framework files modified.
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Restore original package files after modifying them.
|
||||||
|
for file in $changed; do
|
||||||
|
if [[ $file = *package.py ]]; then
|
||||||
|
mv "${file}~" "${file}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $return_code
|
@ -1,5 +1,6 @@
|
|||||||
from spack import *
|
from spack import *
|
||||||
|
|
||||||
|
|
||||||
class Imagemagick(Package):
|
class Imagemagick(Package):
|
||||||
"""ImageMagick is a image processing library"""
|
"""ImageMagick is a image processing library"""
|
||||||
homepage = "http://www.imagemagic.org"
|
homepage = "http://www.imagemagic.org"
|
||||||
@ -20,11 +21,13 @@ class Imagemagick(Package):
|
|||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# *-10 versions are archived, so these versions should fetch reliably.
|
# *-10 versions are archived, so these versions should fetch reliably.
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
version('6.8.9-10', 'aa050bf9785e571c956c111377bbf57c',
|
version(
|
||||||
|
'6.8.9-10',
|
||||||
|
'aa050bf9785e571c956c111377bbf57c',
|
||||||
url="http://sourceforge.net/projects/imagemagick/files/old-sources/6.x/6.8/ImageMagick-6.8.9-10.tar.gz/download")
|
url="http://sourceforge.net/projects/imagemagick/files/old-sources/6.x/6.8/ImageMagick-6.8.9-10.tar.gz/download")
|
||||||
|
|
||||||
depends_on('libtool')
|
|
||||||
depends_on('jpeg')
|
depends_on('jpeg')
|
||||||
|
depends_on('libtool')
|
||||||
depends_on('libpng')
|
depends_on('libpng')
|
||||||
depends_on('freetype')
|
depends_on('freetype')
|
||||||
depends_on('fontconfig')
|
depends_on('fontconfig')
|
||||||
@ -32,6 +35,5 @@ class Imagemagick(Package):
|
|||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
configure("--prefix=%s" % prefix)
|
configure("--prefix=%s" % prefix)
|
||||||
|
|
||||||
make()
|
make()
|
||||||
make("install")
|
make("install")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from spack import *
|
from spack import *
|
||||||
|
|
||||||
|
|
||||||
class Mitos(Package):
|
class Mitos(Package):
|
||||||
"""Mitos is a library and a tool for collecting sampled memory
|
"""Mitos is a library and a tool for collecting sampled memory
|
||||||
performance data to view with MemAxes"""
|
performance data to view with MemAxes"""
|
||||||
@ -11,9 +12,7 @@ class Mitos(Package):
|
|||||||
git='https://github.com/llnl/Mitos.git',
|
git='https://github.com/llnl/Mitos.git',
|
||||||
commit='8cb143a2e8c00353ff531a781a9ca0992b0aaa3d')
|
commit='8cb143a2e8c00353ff531a781a9ca0992b0aaa3d')
|
||||||
|
|
||||||
version('0.9.1',
|
version('0.9.1', git='https://github.com/llnl/Mitos.git', tag='v0.9.1')
|
||||||
git='https://github.com/llnl/Mitos.git',
|
|
||||||
tag='v0.9.1')
|
|
||||||
|
|
||||||
depends_on('dyninst@8.2.1:')
|
depends_on('dyninst@8.2.1:')
|
||||||
depends_on('hwloc')
|
depends_on('hwloc')
|
||||||
|
Loading…
Reference in New Issue
Block a user