From aca5941a0e670e6bcc5873ecf08ce33bfe569955 Mon Sep 17 00:00:00 2001 From: Benedikt Hegner Date: Tue, 10 May 2016 11:48:18 +0200 Subject: Add a few more python packages py-Genshi py-astroid py-jinja2 py-logilab-common py-markupsafe py-mistune py-prettytable py-py2neo py-storm --- .../repos/builtin/packages/py-Genshi/package.py | 16 ++++++++++++++ .../repos/builtin/packages/py-astroid/package.py | 20 +++++++++++++++++ .../repos/builtin/packages/py-jinja2/package.py | 25 ++++++++++++++++++++++ .../builtin/packages/py-logilab-common/package.py | 16 ++++++++++++++ .../builtin/packages/py-markupsafe/package.py | 25 ++++++++++++++++++++++ .../repos/builtin/packages/py-mistune/package.py | 20 +++++++++++++++++ .../builtin/packages/py-prettytable/package.py | 18 ++++++++++++++++ .../repos/builtin/packages/py-py2neo/package.py | 20 +++++++++++++++++ .../repos/builtin/packages/py-storm/package.py | 15 +++++++++++++ 9 files changed, 175 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-Genshi/package.py create mode 100644 var/spack/repos/builtin/packages/py-astroid/package.py create mode 100644 var/spack/repos/builtin/packages/py-jinja2/package.py create mode 100644 var/spack/repos/builtin/packages/py-logilab-common/package.py create mode 100644 var/spack/repos/builtin/packages/py-markupsafe/package.py create mode 100644 var/spack/repos/builtin/packages/py-mistune/package.py create mode 100644 var/spack/repos/builtin/packages/py-prettytable/package.py create mode 100644 var/spack/repos/builtin/packages/py-py2neo/package.py create mode 100644 var/spack/repos/builtin/packages/py-storm/package.py diff --git a/var/spack/repos/builtin/packages/py-Genshi/package.py b/var/spack/repos/builtin/packages/py-Genshi/package.py new file mode 100644 index 0000000000..6feb4a5bcf --- /dev/null +++ b/var/spack/repos/builtin/packages/py-Genshi/package.py @@ -0,0 +1,16 @@ +from spack import * + +class PyGenshi(Package): + """Python toolkit for generation of output for the web""" + homepage = "https://genshi.edgewall.org/" + url = "http://ftp.edgewall.com/pub/genshi/Genshi-0.7.tar.gz" + + version('0.7' , '54e64dd69da3ec961f86e686e0848a82') + version('0.6.1', '372c368c8931110b0a521fa6091742d7') + version('0.6' , '604e8b23b4697655d36a69c2d8ef7187') + + extends("python") + depends_on("py-setuptools") + + def install(self, spec, prefix): + python('setup.py', 'install', '--prefix=%s' % prefix) diff --git a/var/spack/repos/builtin/packages/py-astroid/package.py b/var/spack/repos/builtin/packages/py-astroid/package.py new file mode 100644 index 0000000000..0c7971b27c --- /dev/null +++ b/var/spack/repos/builtin/packages/py-astroid/package.py @@ -0,0 +1,20 @@ +from spack import * + +class PyAstroid(Package): + homepage = "https://www.astroid.org/" + url = "https://github.com/PyCQA/astroid/archive/astroid-1.4.5.tar.gz" + + version('1.4.5', '7adfc55809908297ef430efe4ea20ac3') + version('1.4.4', '8ae6f63f6a2b260bb7f647dafccbc796') + version('1.4.3', '4647159de7d4d0c4b1de23ecbfb8e246') + version('1.4.2', '677f7965840f375af51b0e86403bee6a') + version('1.4.1', 'ed70bfed5e4b25be4292e7fe72da2c02') + + extends('python') + depends_on('py-logilab-common') + depends_on('py-setuptools') + depends_on('py-six') + + def install(self, spec, prefix): + python('setup.py', 'install', '--prefix=%s' % prefix) + diff --git a/var/spack/repos/builtin/packages/py-jinja2/package.py b/var/spack/repos/builtin/packages/py-jinja2/package.py new file mode 100644 index 0000000000..bf1fcb74d2 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-jinja2/package.py @@ -0,0 +1,25 @@ +from spack import * + +class PyJinja2(Package): + """ + Jinja2 is a template engine written in pure Python. It provides + a Django inspired non-XML syntax but supports inline expressions + and an optional sandboxed environment. + """ + + homepage = "http://jinja.pocoo.org/" + url = "https://github.com/pallets/jinja/archive/2.8.tar.gz" + + version('2.8' , '4114200650d7630594e3bc70af23f59e') + version('2.7.3', '55b87bdc8e585b8b5b86734eefce2621') + version('2.7.2', '8e8f226809ae6363009b9296e30adf30') + version('2.7.1', '69b6675553c81b1087f95cae7f2179bb') + version('2.7' , 'ec70433f325051dcedacbb2465028a35') + + extends("python") + depends_on("py-setuptools") + depends_on("py-markupsafe") + + def install(self, spec, prefix): + python('setup.py', 'install', '--prefix=%s' % prefix) + diff --git a/var/spack/repos/builtin/packages/py-logilab-common/package.py b/var/spack/repos/builtin/packages/py-logilab-common/package.py new file mode 100644 index 0000000000..2cbe7abcef --- /dev/null +++ b/var/spack/repos/builtin/packages/py-logilab-common/package.py @@ -0,0 +1,16 @@ +from spack import * + +class PyLogilabCommon(Package): + """Common modules used by Logilab projects""" + homepage = "https://www.logilab.org/project/logilab-common" + url = "https://pypi.python.org/packages/a7/31/1650d23e44794d46935d82b86e73454cc83b814cbe1365260ccce8a2f4c6/logilab-common-1.2.0.tar.gz" + + version('1.2.0', 'f7b51351b7bfe052746fa04c03253c0b') + + extends("python") + depends_on("py-setuptools") + depends_on("py-six") + + def install(self, spec, prefix): + python('setup.py', 'install', '--prefix=%s' % prefix) + diff --git a/var/spack/repos/builtin/packages/py-markupsafe/package.py b/var/spack/repos/builtin/packages/py-markupsafe/package.py new file mode 100644 index 0000000000..78cbdd7a99 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-markupsafe/package.py @@ -0,0 +1,25 @@ +from spack import * + +class PyMarkupsafe(Package): + """ + MarkupSafe is a library for Python that implements a unicode + string that is aware of HTML escaping rules and can be used + to implement automatic string escaping. It is used by Jinja 2, + the Mako templating engine, the Pylons web framework and many more. + """ + + homepage = "http://www.pocoo.org/projects/markupsafe/" + url = "https://github.com/pallets/markupsafe/archive/0.23.tar.gz" + + version('0.23', '1a0dadc95169832367c9dcf142155cde') + version('0.22', '7a2ac7427b58def567628d06dc328396') + version('0.21', 'aebcd93ee05269773c8b80bb6c86fc2f') + version('0.20', '0c1fef97c8fd6a986d708f08d7f84a02') + version('0.19', '64b05361adb92c11839fc470e308c593') + + extends("python") + depends_on("py-setuptools") + + def install(self, spec, prefix): + python('setup.py', 'install', '--prefix=%s' % prefix) + diff --git a/var/spack/repos/builtin/packages/py-mistune/package.py b/var/spack/repos/builtin/packages/py-mistune/package.py new file mode 100644 index 0000000000..4a9d5b5eb4 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-mistune/package.py @@ -0,0 +1,20 @@ +from spack import * + +class PyMistune(Package): + """ + Python markdown parser + """ + homepage = "http://mistune.readthedocs.org/en/latest/" + url = "https://github.com/lepture/mistune/archive/v0.7.1.tar.gz" + + version('0.7.1', '0d9c29700c670790c5b2471070d32ec2') + version('0.7' , '77750ae8b8d0d584894224a7e0c0523a') + version('0.6' , 'd4f3d4f28a69e715f82b591d5dacf9a6') + version('0.5.1', '1c6cfce28a4aa90cf125217cd6c6fe6c') + version('0.5' , '997736554f1f95eea78c66ae339b5722') + + extends('python') + depends_on('py-setuptools') + + def install(self, spec, prefix): + python('setup.py', 'install', '--prefix=%s' % prefix) diff --git a/var/spack/repos/builtin/packages/py-prettytable/package.py b/var/spack/repos/builtin/packages/py-prettytable/package.py new file mode 100644 index 0000000000..2f7577d8c4 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-prettytable/package.py @@ -0,0 +1,18 @@ +from spack import * + +class PyPrettytable(Package): + """ + PrettyTable is a simple Python library designed to make + it quick and easy to represent tabular data in visually + appealing ASCII tables + """ + homepage = "https://code.google.com/archive/p/prettytable/" + url = "https://pypi.python.org/packages/e0/a1/36203205f77ccf98f3c6cf17cf068c972e6458d7e58509ca66da949ca347/prettytable-0.7.2.tar.gz" + + version('0.7.2', 'a6b80afeef286ce66733d54a0296b13b') + + extends("python") + depends_on("py-setuptools") + + def install(self, spec, prefix): + python('setup.py', 'install', '--prefix=%s' % prefix) diff --git a/var/spack/repos/builtin/packages/py-py2neo/package.py b/var/spack/repos/builtin/packages/py-py2neo/package.py new file mode 100644 index 0000000000..c9cfdade2c --- /dev/null +++ b/var/spack/repos/builtin/packages/py-py2neo/package.py @@ -0,0 +1,20 @@ +from spack import * + +class PyPy2neo(Package): + """FIXME: put a proper description of your package here.""" + # FIXME: add a proper url for your package's homepage here. + homepage = "http://www.example.com" + url = "https://github.com/nigelsmall/py2neo/archive/py2neo-2.0.8.tar.gz" + + version('2.0.8', 'e3ec5172a9e006515ef4155688a05a55') + version('2.0.7', '4cfbc5b7dfd7757f3d2e324805faa639') + version('2.0.6', '53e4cdb1a95fbae501c66e541d5f4929') + version('2.0.5', '143b1f9c0aa22faf170c1b9f84c7343b') + version('2.0.4', 'b3f7efd3344dc3f66db4eda11e5899f7') + + depends_on("py-setuptools") + extends("python") + + def install(self, spec, prefix): + python('setup.py', 'install', '--prefix=%s' % prefix) + diff --git a/var/spack/repos/builtin/packages/py-storm/package.py b/var/spack/repos/builtin/packages/py-storm/package.py new file mode 100644 index 0000000000..d504b231d4 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-storm/package.py @@ -0,0 +1,15 @@ +from spack import * + +class PyStorm(Package): + """Storm is an object-relational mapper (ORM) for Python""" + homepage = "https://storm.canonical.com/" + url = "https://launchpad.net/storm/trunk/0.20/+download/storm-0.20.tar.gz" + + version('0.20', '8628503141f0f06c0749d607ac09b9c7') + + extends('python') + depends_on('py-setuptools') + + def install(self, spec, prefix): + python('setup.py', 'install', '--prefix=%s' % prefix) + -- cgit v1.2.3-60-g2f50 From ad42579f0896a295cbbfb8daf7f02917ef35bc0e Mon Sep 17 00:00:00 2001 From: Benedikt Hegner Date: Tue, 10 May 2016 13:17:36 +0200 Subject: addressing coding style rules --- var/spack/repos/builtin/packages/py-Genshi/package.py | 8 +++++--- var/spack/repos/builtin/packages/py-astroid/package.py | 4 +++- var/spack/repos/builtin/packages/py-jinja2/package.py | 12 +++++++----- .../repos/builtin/packages/py-logilab-common/package.py | 4 +++- var/spack/repos/builtin/packages/py-markupsafe/package.py | 10 ++++++---- var/spack/repos/builtin/packages/py-mistune/package.py | 10 ++++++---- var/spack/repos/builtin/packages/py-prettytable/package.py | 8 +++++--- var/spack/repos/builtin/packages/py-py2neo/package.py | 4 +++- var/spack/repos/builtin/packages/py-storm/package.py | 5 +++-- 9 files changed, 41 insertions(+), 24 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-Genshi/package.py b/var/spack/repos/builtin/packages/py-Genshi/package.py index 6feb4a5bcf..7e0629200e 100644 --- a/var/spack/repos/builtin/packages/py-Genshi/package.py +++ b/var/spack/repos/builtin/packages/py-Genshi/package.py @@ -1,13 +1,15 @@ -from spack import * +from spack import version, extends, depends_on, python +from spack import Package + class PyGenshi(Package): """Python toolkit for generation of output for the web""" homepage = "https://genshi.edgewall.org/" url = "http://ftp.edgewall.com/pub/genshi/Genshi-0.7.tar.gz" - version('0.7' , '54e64dd69da3ec961f86e686e0848a82') + version('0.7', '54e64dd69da3ec961f86e686e0848a82') version('0.6.1', '372c368c8931110b0a521fa6091742d7') - version('0.6' , '604e8b23b4697655d36a69c2d8ef7187') + version('0.6', '604e8b23b4697655d36a69c2d8ef7187') extends("python") depends_on("py-setuptools") diff --git a/var/spack/repos/builtin/packages/py-astroid/package.py b/var/spack/repos/builtin/packages/py-astroid/package.py index 0c7971b27c..a8420d86c4 100644 --- a/var/spack/repos/builtin/packages/py-astroid/package.py +++ b/var/spack/repos/builtin/packages/py-astroid/package.py @@ -1,4 +1,6 @@ -from spack import * +from spack import depends_on, extends, python, version +from spack import Package + class PyAstroid(Package): homepage = "https://www.astroid.org/" diff --git a/var/spack/repos/builtin/packages/py-jinja2/package.py b/var/spack/repos/builtin/packages/py-jinja2/package.py index bf1fcb74d2..a745877786 100644 --- a/var/spack/repos/builtin/packages/py-jinja2/package.py +++ b/var/spack/repos/builtin/packages/py-jinja2/package.py @@ -1,25 +1,27 @@ -from spack import * +from spack import depends_on, extends, python, version +from spack import Package + class PyJinja2(Package): """ Jinja2 is a template engine written in pure Python. It provides - a Django inspired non-XML syntax but supports inline expressions + a Django inspired non-XML syntax but supports inline expressions and an optional sandboxed environment. """ homepage = "http://jinja.pocoo.org/" url = "https://github.com/pallets/jinja/archive/2.8.tar.gz" - version('2.8' , '4114200650d7630594e3bc70af23f59e') + version('2.8', '4114200650d7630594e3bc70af23f59e') version('2.7.3', '55b87bdc8e585b8b5b86734eefce2621') version('2.7.2', '8e8f226809ae6363009b9296e30adf30') version('2.7.1', '69b6675553c81b1087f95cae7f2179bb') - version('2.7' , 'ec70433f325051dcedacbb2465028a35') + version('2.7', 'ec70433f325051dcedacbb2465028a35') extends("python") depends_on("py-setuptools") depends_on("py-markupsafe") - + def install(self, spec, prefix): python('setup.py', 'install', '--prefix=%s' % prefix) diff --git a/var/spack/repos/builtin/packages/py-logilab-common/package.py b/var/spack/repos/builtin/packages/py-logilab-common/package.py index 2cbe7abcef..5b3c6e26cc 100644 --- a/var/spack/repos/builtin/packages/py-logilab-common/package.py +++ b/var/spack/repos/builtin/packages/py-logilab-common/package.py @@ -1,4 +1,6 @@ -from spack import * +from spack import depends_on, extends, python, version +from spack import Package + class PyLogilabCommon(Package): """Common modules used by Logilab projects""" diff --git a/var/spack/repos/builtin/packages/py-markupsafe/package.py b/var/spack/repos/builtin/packages/py-markupsafe/package.py index 78cbdd7a99..ac55e5ae28 100644 --- a/var/spack/repos/builtin/packages/py-markupsafe/package.py +++ b/var/spack/repos/builtin/packages/py-markupsafe/package.py @@ -1,13 +1,15 @@ -from spack import * +from spack import depends_on, extends, python, version +from spack import Package + class PyMarkupsafe(Package): """ - MarkupSafe is a library for Python that implements a unicode - string that is aware of HTML escaping rules and can be used + MarkupSafe is a library for Python that implements a unicode + string that is aware of HTML escaping rules and can be used to implement automatic string escaping. It is used by Jinja 2, the Mako templating engine, the Pylons web framework and many more. """ - + homepage = "http://www.pocoo.org/projects/markupsafe/" url = "https://github.com/pallets/markupsafe/archive/0.23.tar.gz" diff --git a/var/spack/repos/builtin/packages/py-mistune/package.py b/var/spack/repos/builtin/packages/py-mistune/package.py index 4a9d5b5eb4..aacd921d7b 100644 --- a/var/spack/repos/builtin/packages/py-mistune/package.py +++ b/var/spack/repos/builtin/packages/py-mistune/package.py @@ -1,4 +1,6 @@ -from spack import * +from spack import depends_on, extends, python, version +from spack import Package + class PyMistune(Package): """ @@ -8,10 +10,10 @@ class PyMistune(Package): url = "https://github.com/lepture/mistune/archive/v0.7.1.tar.gz" version('0.7.1', '0d9c29700c670790c5b2471070d32ec2') - version('0.7' , '77750ae8b8d0d584894224a7e0c0523a') - version('0.6' , 'd4f3d4f28a69e715f82b591d5dacf9a6') + version('0.7', '77750ae8b8d0d584894224a7e0c0523a') + version('0.6', 'd4f3d4f28a69e715f82b591d5dacf9a6') version('0.5.1', '1c6cfce28a4aa90cf125217cd6c6fe6c') - version('0.5' , '997736554f1f95eea78c66ae339b5722') + version('0.5', '997736554f1f95eea78c66ae339b5722') extends('python') depends_on('py-setuptools') diff --git a/var/spack/repos/builtin/packages/py-prettytable/package.py b/var/spack/repos/builtin/packages/py-prettytable/package.py index 2f7577d8c4..1adfba3d1b 100644 --- a/var/spack/repos/builtin/packages/py-prettytable/package.py +++ b/var/spack/repos/builtin/packages/py-prettytable/package.py @@ -1,9 +1,11 @@ -from spack import * +from spack import depends_on, extends, python, version +from Spack import Package + class PyPrettytable(Package): """ PrettyTable is a simple Python library designed to make - it quick and easy to represent tabular data in visually + it quick and easy to represent tabular data in visually appealing ASCII tables """ homepage = "https://code.google.com/archive/p/prettytable/" @@ -13,6 +15,6 @@ class PyPrettytable(Package): extends("python") depends_on("py-setuptools") - + def install(self, spec, prefix): python('setup.py', 'install', '--prefix=%s' % prefix) diff --git a/var/spack/repos/builtin/packages/py-py2neo/package.py b/var/spack/repos/builtin/packages/py-py2neo/package.py index c9cfdade2c..1697bdb0ee 100644 --- a/var/spack/repos/builtin/packages/py-py2neo/package.py +++ b/var/spack/repos/builtin/packages/py-py2neo/package.py @@ -1,4 +1,6 @@ -from spack import * +from spack import depends_on, extends, python, version +from spack import Package + class PyPy2neo(Package): """FIXME: put a proper description of your package here.""" diff --git a/var/spack/repos/builtin/packages/py-storm/package.py b/var/spack/repos/builtin/packages/py-storm/package.py index d504b231d4..1953f285c4 100644 --- a/var/spack/repos/builtin/packages/py-storm/package.py +++ b/var/spack/repos/builtin/packages/py-storm/package.py @@ -1,4 +1,6 @@ -from spack import * +from spack import depends_on, extends, python, version +from spack import Package + class PyStorm(Package): """Storm is an object-relational mapper (ORM) for Python""" @@ -12,4 +14,3 @@ class PyStorm(Package): def install(self, spec, prefix): python('setup.py', 'install', '--prefix=%s' % prefix) - -- cgit v1.2.3-60-g2f50 From cd9cdd641062c5e4254feccd2f358cf8c7bbef01 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Tue, 10 May 2016 13:37:57 +0200 Subject: astyle: compile with spack_cxx --- var/spack/repos/builtin/packages/astyle/package.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/astyle/package.py b/var/spack/repos/builtin/packages/astyle/package.py index 5274fc018f..c8e8c3cbec 100644 --- a/var/spack/repos/builtin/packages/astyle/package.py +++ b/var/spack/repos/builtin/packages/astyle/package.py @@ -11,8 +11,13 @@ class Astyle(Package): def install(self, spec, prefix): with working_dir('src'): + # unfortunately we need to edit the makefile in place to set compiler: + make_file = join_path(self.stage.source_path,'build','gcc','Makefile') + filter_file(r'^CXX\s*=.*', 'CXX=%s' % spack_cxx, make_file) + make('-f', - join_path(self.stage.source_path,'build','clang','Makefile'), + make_file, parallel=False) + mkdirp(self.prefix.bin) install(join_path(self.stage.source_path, 'src','bin','astyle'), self.prefix.bin) -- cgit v1.2.3-60-g2f50 From f5fb77157360a29215486fbaa70dd4995017e5ff Mon Sep 17 00:00:00 2001 From: Benedikt Hegner Date: Tue, 10 May 2016 14:52:14 +0200 Subject: fixing imports; configure commands aren't available at import time yet --- var/spack/repos/builtin/packages/py-Genshi/package.py | 2 +- var/spack/repos/builtin/packages/py-astroid/package.py | 2 +- var/spack/repos/builtin/packages/py-jinja2/package.py | 2 +- var/spack/repos/builtin/packages/py-logilab-common/package.py | 2 +- var/spack/repos/builtin/packages/py-markupsafe/package.py | 2 +- var/spack/repos/builtin/packages/py-mistune/package.py | 2 +- var/spack/repos/builtin/packages/py-prettytable/package.py | 4 ++-- var/spack/repos/builtin/packages/py-py2neo/package.py | 2 +- var/spack/repos/builtin/packages/py-storm/package.py | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-Genshi/package.py b/var/spack/repos/builtin/packages/py-Genshi/package.py index 7e0629200e..d485c89429 100644 --- a/var/spack/repos/builtin/packages/py-Genshi/package.py +++ b/var/spack/repos/builtin/packages/py-Genshi/package.py @@ -1,4 +1,4 @@ -from spack import version, extends, depends_on, python +from spack import version, extends, depends_on from spack import Package diff --git a/var/spack/repos/builtin/packages/py-astroid/package.py b/var/spack/repos/builtin/packages/py-astroid/package.py index a8420d86c4..1ecb5eecee 100644 --- a/var/spack/repos/builtin/packages/py-astroid/package.py +++ b/var/spack/repos/builtin/packages/py-astroid/package.py @@ -1,4 +1,4 @@ -from spack import depends_on, extends, python, version +from spack import depends_on, extends, version from spack import Package diff --git a/var/spack/repos/builtin/packages/py-jinja2/package.py b/var/spack/repos/builtin/packages/py-jinja2/package.py index a745877786..5d92cdd49a 100644 --- a/var/spack/repos/builtin/packages/py-jinja2/package.py +++ b/var/spack/repos/builtin/packages/py-jinja2/package.py @@ -1,4 +1,4 @@ -from spack import depends_on, extends, python, version +from spack import depends_on, extends, version from spack import Package diff --git a/var/spack/repos/builtin/packages/py-logilab-common/package.py b/var/spack/repos/builtin/packages/py-logilab-common/package.py index 5b3c6e26cc..a47c4ac0ec 100644 --- a/var/spack/repos/builtin/packages/py-logilab-common/package.py +++ b/var/spack/repos/builtin/packages/py-logilab-common/package.py @@ -1,4 +1,4 @@ -from spack import depends_on, extends, python, version +from spack import depends_on, extends, version from spack import Package diff --git a/var/spack/repos/builtin/packages/py-markupsafe/package.py b/var/spack/repos/builtin/packages/py-markupsafe/package.py index ac55e5ae28..0a0c3a724a 100644 --- a/var/spack/repos/builtin/packages/py-markupsafe/package.py +++ b/var/spack/repos/builtin/packages/py-markupsafe/package.py @@ -1,4 +1,4 @@ -from spack import depends_on, extends, python, version +from spack import depends_on, extends, version from spack import Package diff --git a/var/spack/repos/builtin/packages/py-mistune/package.py b/var/spack/repos/builtin/packages/py-mistune/package.py index aacd921d7b..44a114b173 100644 --- a/var/spack/repos/builtin/packages/py-mistune/package.py +++ b/var/spack/repos/builtin/packages/py-mistune/package.py @@ -1,4 +1,4 @@ -from spack import depends_on, extends, python, version +from spack import depends_on, extends, version from spack import Package diff --git a/var/spack/repos/builtin/packages/py-prettytable/package.py b/var/spack/repos/builtin/packages/py-prettytable/package.py index 1adfba3d1b..27fab7c046 100644 --- a/var/spack/repos/builtin/packages/py-prettytable/package.py +++ b/var/spack/repos/builtin/packages/py-prettytable/package.py @@ -1,5 +1,5 @@ -from spack import depends_on, extends, python, version -from Spack import Package +from spack import depends_on, extends, version +from spack import Package class PyPrettytable(Package): diff --git a/var/spack/repos/builtin/packages/py-py2neo/package.py b/var/spack/repos/builtin/packages/py-py2neo/package.py index 1697bdb0ee..d30b823a87 100644 --- a/var/spack/repos/builtin/packages/py-py2neo/package.py +++ b/var/spack/repos/builtin/packages/py-py2neo/package.py @@ -1,4 +1,4 @@ -from spack import depends_on, extends, python, version +from spack import depends_on, extends, version from spack import Package diff --git a/var/spack/repos/builtin/packages/py-storm/package.py b/var/spack/repos/builtin/packages/py-storm/package.py index 1953f285c4..abc121d30b 100644 --- a/var/spack/repos/builtin/packages/py-storm/package.py +++ b/var/spack/repos/builtin/packages/py-storm/package.py @@ -1,4 +1,4 @@ -from spack import depends_on, extends, python, version +from spack import depends_on, extends, version from spack import Package -- cgit v1.2.3-60-g2f50 From fa44cd5cefae8890ece95b9870e24058dcd0a10f Mon Sep 17 00:00:00 2001 From: Benedikt Hegner Date: Tue, 10 May 2016 17:30:44 +0200 Subject: renaming py-Genshi into py-genshi --- var/spack/repos/builtin/packages/py-Genshi/package.py | 18 ------------------ var/spack/repos/builtin/packages/py-genshi/package.py | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) delete mode 100644 var/spack/repos/builtin/packages/py-Genshi/package.py create mode 100644 var/spack/repos/builtin/packages/py-genshi/package.py diff --git a/var/spack/repos/builtin/packages/py-Genshi/package.py b/var/spack/repos/builtin/packages/py-Genshi/package.py deleted file mode 100644 index d485c89429..0000000000 --- a/var/spack/repos/builtin/packages/py-Genshi/package.py +++ /dev/null @@ -1,18 +0,0 @@ -from spack import version, extends, depends_on -from spack import Package - - -class PyGenshi(Package): - """Python toolkit for generation of output for the web""" - homepage = "https://genshi.edgewall.org/" - url = "http://ftp.edgewall.com/pub/genshi/Genshi-0.7.tar.gz" - - version('0.7', '54e64dd69da3ec961f86e686e0848a82') - version('0.6.1', '372c368c8931110b0a521fa6091742d7') - version('0.6', '604e8b23b4697655d36a69c2d8ef7187') - - extends("python") - depends_on("py-setuptools") - - def install(self, spec, prefix): - python('setup.py', 'install', '--prefix=%s' % prefix) diff --git a/var/spack/repos/builtin/packages/py-genshi/package.py b/var/spack/repos/builtin/packages/py-genshi/package.py new file mode 100644 index 0000000000..d485c89429 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-genshi/package.py @@ -0,0 +1,18 @@ +from spack import version, extends, depends_on +from spack import Package + + +class PyGenshi(Package): + """Python toolkit for generation of output for the web""" + homepage = "https://genshi.edgewall.org/" + url = "http://ftp.edgewall.com/pub/genshi/Genshi-0.7.tar.gz" + + version('0.7', '54e64dd69da3ec961f86e686e0848a82') + version('0.6.1', '372c368c8931110b0a521fa6091742d7') + version('0.6', '604e8b23b4697655d36a69c2d8ef7187') + + extends("python") + depends_on("py-setuptools") + + def install(self, spec, prefix): + python('setup.py', 'install', '--prefix=%s' % prefix) -- cgit v1.2.3-60-g2f50 From c8d88607425866413c0d3c931e760c89c01a00fd Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Tue, 10 May 2016 17:46:11 +0200 Subject: astyle: fix formatting --- var/spack/repos/builtin/packages/astyle/package.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/var/spack/repos/builtin/packages/astyle/package.py b/var/spack/repos/builtin/packages/astyle/package.py index c8e8c3cbec..57083bb947 100644 --- a/var/spack/repos/builtin/packages/astyle/package.py +++ b/var/spack/repos/builtin/packages/astyle/package.py @@ -1,8 +1,11 @@ from spack import * -import os + class Astyle(Package): - """A Free, Fast, and Small Automatic Formatter for C, C++, C++/CLI, Objective-C, C#, and Java Source Code.""" + """ + A Free, Fast, and Small Automatic Formatter for C, C++, C++/CLI, + Objective-C, C#, and Java Source Code. + """ homepage = "http://astyle.sourceforge.net/" url = "http://downloads.sourceforge.net/project/astyle/astyle/astyle%202.04/astyle_2.04_linux.tar.gz" @@ -11,13 +14,15 @@ class Astyle(Package): def install(self, spec, prefix): with working_dir('src'): - # unfortunately we need to edit the makefile in place to set compiler: - make_file = join_path(self.stage.source_path,'build','gcc','Makefile') - filter_file(r'^CXX\s*=.*', 'CXX=%s' % spack_cxx, make_file) + # we need to edit the makefile in place to set compiler: + make_file = join_path(self.stage.source_path, + 'build', 'gcc', 'Makefile') + filter_file(r'^CXX\s*=.*', 'CXX=%s'.format(spack_cxx), make_file) make('-f', - make_file, - parallel=False) + make_file, + parallel=False) mkdirp(self.prefix.bin) - install(join_path(self.stage.source_path, 'src','bin','astyle'), self.prefix.bin) + install(join_path(self.stage.source_path, 'src', 'bin', 'astyle'), + self.prefix.bin) -- cgit v1.2.3-60-g2f50 From 979b53cab605d250dfe23edaacc6b0d2ff88d978 Mon Sep 17 00:00:00 2001 From: alalazo Date: Tue, 10 May 2016 18:33:07 +0200 Subject: qa : modifying 2 packages and a framework file just for the sake of it --- lib/spack/spack/architecture.py | 1 + var/spack/repos/builtin/packages/ImageMagick/package.py | 4 +++- var/spack/repos/builtin/packages/Mitos/package.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index 2701fab90c..eec7636d00 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -44,6 +44,7 @@ class NoSysTypeError(serr.SpackError): "Could not determine sys_type for this machine.") + def get_sys_type_from_spack_globals(): """Return the SYS_TYPE from spack globals, or None if it isn't set.""" if not hasattr(spack, "sys_type"): diff --git a/var/spack/repos/builtin/packages/ImageMagick/package.py b/var/spack/repos/builtin/packages/ImageMagick/package.py index 753ea80ca6..d0a820b5fc 100644 --- a/var/spack/repos/builtin/packages/ImageMagick/package.py +++ b/var/spack/repos/builtin/packages/ImageMagick/package.py @@ -23,8 +23,10 @@ class Imagemagick(Package): 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") - depends_on('libtool') + + depends_on('jpeg') + depends_on('libtool') depends_on('libpng') depends_on('freetype') depends_on('fontconfig') diff --git a/var/spack/repos/builtin/packages/Mitos/package.py b/var/spack/repos/builtin/packages/Mitos/package.py index ea131872dd..073c473b93 100644 --- a/var/spack/repos/builtin/packages/Mitos/package.py +++ b/var/spack/repos/builtin/packages/Mitos/package.py @@ -19,6 +19,8 @@ class Mitos(Package): depends_on('hwloc') depends_on('mpi') + + def install(self, spec, prefix): with working_dir('spack-build', create=True): cmake('..', *std_cmake_args) -- cgit v1.2.3-60-g2f50 From 190c437980ecb7e1710643b05278cfd4f4b77b1b Mon Sep 17 00:00:00 2001 From: alalazo Date: Tue, 10 May 2016 18:38:30 +0200 Subject: qa : copied flake8 configuration, updated travis.yml --- .travis.yml | 2 +- flake8-framework.ini | 3 +++ flake8-packages.ini | 3 +++ flake8.ini | 3 --- 4 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 flake8-framework.ini create mode 100644 flake8-packages.ini delete mode 100644 flake8.ini diff --git a/.travis.yml b/.travis.yml index 4ff4d5f483..96138813e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ script: - 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 + - if [[ ${CHANGED_PYTHON_FILES} ]] ; then flake8 --format pylint --config flake8-framework.ini ${CHANGED_PYTHON_FILES} ; fi after_success: diff --git a/flake8-framework.ini b/flake8-framework.ini new file mode 100644 index 0000000000..32ced73dd7 --- /dev/null +++ b/flake8-framework.ini @@ -0,0 +1,3 @@ +[flake8] +ignore = W391,F403,E221,F821 +max-line-length = 79 diff --git a/flake8-packages.ini b/flake8-packages.ini new file mode 100644 index 0000000000..32ced73dd7 --- /dev/null +++ b/flake8-packages.ini @@ -0,0 +1,3 @@ +[flake8] +ignore = W391,F403,E221,F821 +max-line-length = 79 diff --git a/flake8.ini b/flake8.ini deleted file mode 100644 index 32ced73dd7..0000000000 --- a/flake8.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flake8] -ignore = W391,F403,E221,F821 -max-line-length = 79 -- cgit v1.2.3-60-g2f50 From 3f20014f335f50e6bac8f8ced7a36fae00537c61 Mon Sep 17 00:00:00 2001 From: alalazo Date: Tue, 10 May 2016 18:45:11 +0200 Subject: qa : differentiate framework from packages --- .travis.yml | 7 +++++-- flake8-framework.ini | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 96138813e2..c41692c08e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,9 +25,12 @@ script: - spack install -v libdwarf # Run unit tests with code coverage - 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$/'` + # Checks if the file that have been changed are flake8 conformant [framework] + - CHANGED_PYTHON_FILES=`git diff develop... --name-only | perl -ne 'print if /\.py$/' | perl -ne 'print if not /var/' ` - if [[ ${CHANGED_PYTHON_FILES} ]] ; then flake8 --format pylint --config flake8-framework.ini ${CHANGED_PYTHON_FILES} ; fi + # Checks if the file that have been changed are flake8 conformant [packages] + - CHANGED_PACKAGES=`git diff develop... --name-only | perl -ne 'print if /\.py$/' | perl -ne 'print if /var/' ` + - if [[ ${CHANGED_PACKAGES} ]] ; then flake8 --format pylint --config flake8-packages.ini ${CHANGED_PACKAGES} ; fi after_success: diff --git a/flake8-framework.ini b/flake8-framework.ini index 32ced73dd7..f8bff04355 100644 --- a/flake8-framework.ini +++ b/flake8-framework.ini @@ -1,3 +1,3 @@ [flake8] -ignore = W391,F403,E221,F821 +ignore = W391,F403,E221 max-line-length = 79 -- cgit v1.2.3-60-g2f50 From 7d74e209f365ba135acd9dfe738737bcf37d4b79 Mon Sep 17 00:00:00 2001 From: alalazo Date: Tue, 10 May 2016 19:20:26 +0200 Subject: qa : this should still fail due to F821 --- lib/spack/spack/architecture.py | 15 +++++++-------- var/spack/repos/builtin/packages/ImageMagick/package.py | 14 +++++++------- var/spack/repos/builtin/packages/Mitos/package.py | 9 +++------ 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index eec7636d00..62c25c8003 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -34,15 +34,14 @@ import spack.error as serr class InvalidSysTypeError(serr.SpackError): def __init__(self, sys_type): - super(InvalidSysTypeError, self).__init__( - "Invalid sys_type value for Spack: " + sys_type) + super(InvalidSysTypeError, + self).__init__("Invalid sys_type value for Spack: " + sys_type) class NoSysTypeError(serr.SpackError): def __init__(self): - super(NoSysTypeError, self).__init__( - "Could not determine sys_type for this machine.") - + super(NoSysTypeError, + self).__init__("Could not determine sys_type for this machine.") def get_sys_type_from_spack_globals(): @@ -70,15 +69,15 @@ def get_sys_type_from_platform(): @memoized def sys_type(): """Returns a SysType for the current machine.""" - methods = [get_sys_type_from_spack_globals, - get_sys_type_from_environment, + methods = [get_sys_type_from_spack_globals, get_sys_type_from_environment, get_sys_type_from_platform] # search for a method that doesn't return None sys_type = None for method in methods: sys_type = method() - if sys_type: break + if sys_type: + break # Couldn't determine the sys_type for this machine. if sys_type is None: diff --git a/var/spack/repos/builtin/packages/ImageMagick/package.py b/var/spack/repos/builtin/packages/ImageMagick/package.py index d0a820b5fc..7a3d12e364 100644 --- a/var/spack/repos/builtin/packages/ImageMagick/package.py +++ b/var/spack/repos/builtin/packages/ImageMagick/package.py @@ -1,10 +1,11 @@ from spack import * + class Imagemagick(Package): """ImageMagick is a image processing library""" homepage = "http://www.imagemagic.org" - #------------------------------------------------------------------------- + # ------------------------------------------------------------------------- # ImageMagick does not keep around anything but *-10 versions, so # this URL may change. If you want the bleeding edge, you can # uncomment it and see if it works but you may need to try to @@ -17,13 +18,13 @@ class Imagemagick(Package): # version('6.9.0-6', 'c1bce7396c22995b8bdb56b7797b4a1b', # url="http://www.imagemagick.org/download/ImageMagick-6.9.0-6.tar.bz2") - #------------------------------------------------------------------------- + # ------------------------------------------------------------------------- # *-10 versions are archived, so these versions should fetch reliably. # ------------------------------------------------------------------------- - 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") - - + 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") # NOQA: ignore=E501 depends_on('jpeg') depends_on('libtool') @@ -34,6 +35,5 @@ class Imagemagick(Package): def install(self, spec, prefix): configure("--prefix=%s" % prefix) - make() make("install") diff --git a/var/spack/repos/builtin/packages/Mitos/package.py b/var/spack/repos/builtin/packages/Mitos/package.py index 073c473b93..ec1d56a5c7 100644 --- a/var/spack/repos/builtin/packages/Mitos/package.py +++ b/var/spack/repos/builtin/packages/Mitos/package.py @@ -1,26 +1,23 @@ from spack import * + class Mitos(Package): """Mitos is a library and a tool for collecting sampled memory performance data to view with MemAxes""" homepage = "https://github.com/llnl/Mitos" - url = "https://github.com/llnl/Mitos" + url = "https://github.com/llnl/Mitos" version('0.9.2', git='https://github.com/llnl/Mitos.git', commit='8cb143a2e8c00353ff531a781a9ca0992b0aaa3d') - version('0.9.1', - git='https://github.com/llnl/Mitos.git', - tag='v0.9.1') + version('0.9.1', git='https://github.com/llnl/Mitos.git', tag='v0.9.1') depends_on('dyninst@8.2.1:') depends_on('hwloc') depends_on('mpi') - - def install(self, spec, prefix): with working_dir('spack-build', create=True): cmake('..', *std_cmake_args) -- cgit v1.2.3-60-g2f50 From 4cb91d6f7b6680140e0011da1f7965c430920067 Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Tue, 10 May 2016 19:46:24 +0200 Subject: Added documentation on lockf/flock. --- lib/spack/docs/basic_usage.rst | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/spack/docs/basic_usage.rst b/lib/spack/docs/basic_usage.rst index 29791d98c4..58e67e4550 100644 --- a/lib/spack/docs/basic_usage.rst +++ b/lib/spack/docs/basic_usage.rst @@ -1246,6 +1246,38 @@ several variants: spack deactivate -a python +A word of warning +----------------------- + +If you run `spack find` and you get an error similar to the following: + +.. code-block:: sh + + $ ./spack find + Traceback (most recent call last): + File "./spack", line 176, in + main() + File "./spack", line 154, in main + return_val = command(parser, args) + File "./spack/lib/spack/spack/cmd/find.py", line 170, in find + specs = set(spack.installed_db.query(**q_args)) + File "./spack/lib/spack/spack/database.py", line 551, in query + with self.read_transaction(): + File "./spack/lib/spack/spack/database.py", line 598, in __enter__ + if self._enter() and self._acquire_fn: + File "./spack/lib/spack/spack/database.py", line 608, in _enter + return self._db.lock.acquire_read(self._timeout) + File "./spack/lib/spack/llnl/util/lock.py", line 103, in acquire_read + self._lock(fcntl.LOCK_SH, timeout) # can raise LockError. + File "./spack/lib/spack/llnl/util/lock.py", line 64, in _lock + fcntl.lockf(self._fd, op | fcntl.LOCK_NB) + IOError: [Errno 38] Function not implemented + + +it most likely means that you are trying to run spack in a shared +network filesystem without support for lockf/flock. Currently this is not +supported, and you should ask your system administrator to enable lockf/flock. + Getting Help ----------------------- -- cgit v1.2.3-60-g2f50 From 98faee1d5c24ddacaeb1bc630ff8c31ba0d74f9b Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 10 May 2016 11:19:17 -0700 Subject: Minor tweaks to `flock` docs. --- lib/spack/docs/basic_usage.rst | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/spack/docs/basic_usage.rst b/lib/spack/docs/basic_usage.rst index 58e67e4550..f08a2bb675 100644 --- a/lib/spack/docs/basic_usage.rst +++ b/lib/spack/docs/basic_usage.rst @@ -1246,13 +1246,30 @@ several variants: spack deactivate -a python -A word of warning ------------------------ +Filesystem requirements +-------------------------- -If you run `spack find` and you get an error similar to the following: +Spack currently needs to be run from a filesystem that supports +``flock`` locking semantics. Nearly all local filesystems and recent +versions of NFS support this, but parallel filesystems may be mounted +without ``flock`` support enabled. You can determine how your +filesystems are mounted with ``mount -p``. The output for a Lustre +filesystem might look like this: .. code-block:: sh - + + $ mount -l | grep lscratch + pilsner-mds1-lnet0@o2ib100:/lsd on /p/lscratchd type lustre (rw,nosuid,noauto,_netdev,lazystatfs,flock) + porter-mds1-lnet0@o2ib100:/lse on /p/lscratche type lustre (rw,nosuid,noauto,_netdev,lazystatfs,flock) + +Note the ``flock`` option on both Lustre mounts. If you do not see +this or a similar option for your filesystem, you may need ot ask your +system administrator to enable ``flock``. + +This issue typically manifests with the error below: + +.. code-block:: sh + $ ./spack find Traceback (most recent call last): File "./spack", line 176, in @@ -1273,11 +1290,7 @@ If you run `spack find` and you get an error similar to the following: fcntl.lockf(self._fd, op | fcntl.LOCK_NB) IOError: [Errno 38] Function not implemented - -it most likely means that you are trying to run spack in a shared -network filesystem without support for lockf/flock. Currently this is not -supported, and you should ask your system administrator to enable lockf/flock. - +A nicer error message is TBD in future versions of Spack. Getting Help ----------------------- -- cgit v1.2.3-60-g2f50 From 5d477bc956e0033bd2816d48df1f4096856bc5fe Mon Sep 17 00:00:00 2001 From: Benedikt Hegner Date: Tue, 10 May 2016 23:19:30 +0200 Subject: fix setting config for list parameters --- lib/spack/spack/config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py index 336d47cbb7..06954f535b 100644 --- a/lib/spack/spack/config.py +++ b/lib/spack/spack/config.py @@ -545,7 +545,10 @@ def update_config(section, update_data, scope=None): # read in the config to ensure we've got current data configuration = get_config(section) - configuration.update(update_data) + if isinstance(update_data, list): + configuration = update_data + else: + configuration.extend(update_data) # read only the requested section's data. scope.sections[section] = {section: configuration} -- cgit v1.2.3-60-g2f50 From 6e462abb4d208584cb5f984f2f4c177bcec37dd4 Mon Sep 17 00:00:00 2001 From: Benedikt Hegner Date: Tue, 10 May 2016 23:31:29 +0200 Subject: hmm... test before commit --- lib/spack/spack/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py index 06954f535b..3bdefd3a6c 100644 --- a/lib/spack/spack/config.py +++ b/lib/spack/spack/config.py @@ -548,7 +548,7 @@ def update_config(section, update_data, scope=None): if isinstance(update_data, list): configuration = update_data else: - configuration.extend(update_data) + configuration.update(update_data) # read only the requested section's data. scope.sections[section] = {section: configuration} -- cgit v1.2.3-60-g2f50 From 05b6c3f8cfd065dcf4173613a64ed94fa1815d31 Mon Sep 17 00:00:00 2001 From: Benedikt Hegner Date: Wed, 11 May 2016 00:14:24 +0200 Subject: add test for list parameters --- lib/spack/spack/test/config.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/spack/spack/test/config.py b/lib/spack/spack/test/config.py index 3977f0e7d4..ed0797a541 100644 --- a/lib/spack/spack/test/config.py +++ b/lib/spack/spack/test/config.py @@ -72,6 +72,10 @@ b_comps = { } } +# Some Sample repo data +repos_low = [ "/some/path" ] +repos_high = [ "/some/other/path" ] + class ConfigTest(MockPackagesTest): def setUp(self): @@ -95,6 +99,12 @@ class ConfigTest(MockPackagesTest): actual = config[arch][key][c] self.assertEqual(expected, actual) + def test_write_list_in_memory(self): + spack.config.update_config('repos', repos_low, 'test_low_priority') + spack.config.update_config('repos', repos_high, 'test_high_priority') + config = spack.config.get_config('repos') + self.assertEqual(config, repos_high+repos_low) + def test_write_key_in_memory(self): # Write b_comps "on top of" a_comps. spack.config.update_config('compilers', a_comps, 'test_low_priority') -- cgit v1.2.3-60-g2f50 From c1e6b5218438988d7dc2da5ca577fe5a8752d6e1 Mon Sep 17 00:00:00 2001 From: Benedikt Hegner Date: Wed, 11 May 2016 00:28:12 +0200 Subject: first round of coding rules --- lib/spack/spack/config.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py index 3bdefd3a6c..9da5d7aaf0 100644 --- a/lib/spack/spack/config.py +++ b/lib/spack/spack/config.py @@ -129,7 +129,6 @@ from ordereddict_backport import OrderedDict import llnl.util.tty as tty from llnl.util.filesystem import mkdirp -import copy import spack from spack.error import SpackError @@ -306,13 +305,14 @@ def extend_with_default(validator_class): yield err return validators.extend(validator_class, { - "properties" : set_defaults, - "patternProperties" : set_pp_defaults + "properties": set_defaults, + "patternProperties": set_pp_defaults }) DefaultSettingValidator = extend_with_default(Draft4Validator) + def validate_section(data, schema): """Validate data read in from a Spack YAML file. @@ -347,16 +347,14 @@ class ConfigScope(object): validate_section_name(section) return os.path.join(self.path, "%s.yaml" % section) - def get_section(self, section): - if not section in self.sections: + if section not in self.sections: path = self.get_section_filename(section) schema = section_schemas[section] data = _read_config_file(path, schema) self.sections[section] = data return self.sections[section] - def write_section(self, section): filename = self.get_section_filename(section) data = self.get_section(section) @@ -370,7 +368,6 @@ class ConfigScope(object): except (yaml.YAMLError, IOError) as e: raise ConfigFileError("Error writing to config file: '%s'" % str(e)) - def clear(self): """Empty cached config information.""" self.sections = {} @@ -476,7 +473,7 @@ def _merge_yaml(dest, source): # Source dict is merged into dest. elif they_are(dict): for sk, sv in source.iteritems(): - if not sk in dest: + if sk not in dest: dest[sk] = copy.copy(sv) else: dest[sk] = _merge_yaml(dest[sk], source[sk]) @@ -590,16 +587,20 @@ def spec_externals(spec): def is_spec_buildable(spec): """Return true if the spec pkgspec is configured as buildable""" allpkgs = get_config('packages') - name = spec.name - if not spec.name in allpkgs: + if spec.name not in allpkgs: return True - if not 'buildable' in allpkgs[spec.name]: + if 'buildable' not in allpkgs[spec.name]: return True return allpkgs[spec.name]['buildable'] -class ConfigError(SpackError): pass -class ConfigFileError(ConfigError): pass +class ConfigError(SpackError): + pass + + +class ConfigFileError(ConfigError): + pass + def get_path(path, data): if path: @@ -607,6 +608,7 @@ def get_path(path, data): else: return data + class ConfigFormatError(ConfigError): """Raised when a configuration format does not match its schema.""" def __init__(self, validation_error, data): @@ -641,5 +643,6 @@ class ConfigFormatError(ConfigError): message = '%s: %s' % (location, validation_error.message) super(ConfigError, self).__init__(message) + class ConfigSanityError(ConfigFormatError): """Same as ConfigFormatError, raised when config is written by Spack.""" -- cgit v1.2.3-60-g2f50 From 2aa4387ebac307285c1b2c90bc6527b82fe83839 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 10 May 2016 23:45:41 -0700 Subject: Update code style checking. - Exempt overlong URL lines from checks. - Omit some of the more painful PEP items. --- .style.yapf | 3 --- .travis.yml | 24 ++++++++++++++++++------ flake8-framework.ini | 3 --- flake8-packages.ini | 3 --- share/spack/qa/flake8-framework | 10 ++++++++++ share/spack/qa/flake8-packages | 11 +++++++++++ 6 files changed, 39 insertions(+), 15 deletions(-) delete mode 100644 .style.yapf delete mode 100644 flake8-framework.ini delete mode 100644 flake8-packages.ini create mode 100644 share/spack/qa/flake8-framework create mode 100644 share/spack/qa/flake8-packages diff --git a/.style.yapf b/.style.yapf deleted file mode 100644 index a4b3f65252..0000000000 --- a/.style.yapf +++ /dev/null @@ -1,3 +0,0 @@ -[style] -based_on_style = pep8 -column_limit = 79 diff --git a/.travis.yml b/.travis.yml index c41692c08e..9acba991c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,23 +15,35 @@ before_install: # Need this for the git tests to succeed. - git config --global user.email "spack@example.com" - git config --global user.name "Test User" + # Need this to be able to compute the list of changed files - git fetch origin develop:develop script: + # Regular spack setup and tests - . share/spack/setup-env.sh - spack compilers - spack config get compilers - spack install -v libdwarf + # Run unit tests with code coverage - coverage run bin/spack test - # Checks if the file that have been changed are flake8 conformant [framework] - - CHANGED_PYTHON_FILES=`git diff develop... --name-only | perl -ne 'print if /\.py$/' | perl -ne 'print if not /var/' ` - - if [[ ${CHANGED_PYTHON_FILES} ]] ; then flake8 --format pylint --config flake8-framework.ini ${CHANGED_PYTHON_FILES} ; fi - # Checks if the file that have been changed are flake8 conformant [packages] - - CHANGED_PACKAGES=`git diff develop... --name-only | perl -ne 'print if /\.py$/' | perl -ne 'print if /var/' ` - - if [[ ${CHANGED_PACKAGES} ]] ; then flake8 --format pylint --config flake8-packages.ini ${CHANGED_PACKAGES} ; fi + # Check if changed files are flake8 conformant [framework] + - changed=$(git diff --name-only develop... | grep '.py$' | grep -v ^var/) + - [[ $changed ]] && \ + flake8 --format pylint --config share/spack/qa/flake8-framework $changed + + # Check if changed files are flake8 conformant [packages] + - changed=$(git diff --name-only develop... | grep '.py$' | grep ^var/) + + # Exempt url lines in changed packages from overlong errors. + - for file in $changed; do \ + [[ file = *package.py ]] && \ + perl -i~ -pe 's/^(\s*url\s*=.*)$/\1 # NOQA/' $file; \ + done + - [[ $changed ]] && \ + flake8 --format pylint --config share/spack/qa/flake8-packages $changed after_success: - coveralls diff --git a/flake8-framework.ini b/flake8-framework.ini deleted file mode 100644 index f8bff04355..0000000000 --- a/flake8-framework.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flake8] -ignore = W391,F403,E221 -max-line-length = 79 diff --git a/flake8-packages.ini b/flake8-packages.ini deleted file mode 100644 index 32ced73dd7..0000000000 --- a/flake8-packages.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flake8] -ignore = W391,F403,E221,F821 -max-line-length = 79 diff --git a/share/spack/qa/flake8-framework b/share/spack/qa/flake8-framework new file mode 100644 index 0000000000..b1ad00b80f --- /dev/null +++ b/share/spack/qa/flake8-framework @@ -0,0 +1,10 @@ +# -*- conf -*- +[flake8] +# Descriptions of ignored checks: +# +# E221: multiple spaces before operator +# E241: multiple spaces after ‘,’ +# F403: disable wildcard import +# +ignore = E221,E241,F403 +max-line-length = 79 diff --git a/share/spack/qa/flake8-packages b/share/spack/qa/flake8-packages new file mode 100644 index 0000000000..0e5be249fb --- /dev/null +++ b/share/spack/qa/flake8-packages @@ -0,0 +1,11 @@ +# -*- conf -*- +[flake8] +# Descriptions of ignored checks: +# +# E221: multiple spaces before operator +# E241: multiple spaces after ‘,’ +# F403: disable wildcard import +# F821: undefined name (needed for build commands) +# +ignore = E221,E241,F403,F821 +max-line-length = 79 -- cgit v1.2.3-60-g2f50 From d7847ff7685a52670a9d01cf39bd44eff1a57684 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 11 May 2016 01:16:41 -0700 Subject: Use just one flake8 file; mark package.py files to avoid E501 w/url. --- .flake8 | 12 ++++++++++++ share/spack/qa/flake8-framework | 10 ---------- share/spack/qa/flake8-packages | 11 ----------- var/spack/repos/builtin/packages/ImageMagick/package.py | 2 +- 4 files changed, 13 insertions(+), 22 deletions(-) create mode 100644 .flake8 delete mode 100644 share/spack/qa/flake8-framework delete mode 100644 share/spack/qa/flake8-packages diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000000..ab1e14b66e --- /dev/null +++ b/.flake8 @@ -0,0 +1,12 @@ +# -*- conf -*- +[flake8] +# Descriptions of ignored checks: +# +# E221: multiple spaces before operator +# E241: multiple spaces after ‘,’ +# F403: disable wildcard import +# F821: undefined name (needed for build commands) +# F999: Undefined undefined name (needed for build commands) +# +ignore = E221,E241,F403,F821,F999 +max-line-length = 79 diff --git a/share/spack/qa/flake8-framework b/share/spack/qa/flake8-framework deleted file mode 100644 index b1ad00b80f..0000000000 --- a/share/spack/qa/flake8-framework +++ /dev/null @@ -1,10 +0,0 @@ -# -*- conf -*- -[flake8] -# Descriptions of ignored checks: -# -# E221: multiple spaces before operator -# E241: multiple spaces after ‘,’ -# F403: disable wildcard import -# -ignore = E221,E241,F403 -max-line-length = 79 diff --git a/share/spack/qa/flake8-packages b/share/spack/qa/flake8-packages deleted file mode 100644 index 0e5be249fb..0000000000 --- a/share/spack/qa/flake8-packages +++ /dev/null @@ -1,11 +0,0 @@ -# -*- conf -*- -[flake8] -# Descriptions of ignored checks: -# -# E221: multiple spaces before operator -# E241: multiple spaces after ‘,’ -# F403: disable wildcard import -# F821: undefined name (needed for build commands) -# -ignore = E221,E241,F403,F821 -max-line-length = 79 diff --git a/var/spack/repos/builtin/packages/ImageMagick/package.py b/var/spack/repos/builtin/packages/ImageMagick/package.py index 7a3d12e364..3a86d9fb7c 100644 --- a/var/spack/repos/builtin/packages/ImageMagick/package.py +++ b/var/spack/repos/builtin/packages/ImageMagick/package.py @@ -24,7 +24,7 @@ class Imagemagick(Package): 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") # NOQA: ignore=E501 + url="http://sourceforge.net/projects/imagemagick/files/old-sources/6.x/6.8/ImageMagick-6.8.9-10.tar.gz/download") depends_on('jpeg') depends_on('libtool') -- cgit v1.2.3-60-g2f50 From f15837505420e878e7b5ec2139686985deb54401 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 11 May 2016 01:17:52 -0700 Subject: .travis.yml uses a script now. - user can run the same script. --- .travis.yml | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9acba991c7..904143a00f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,21 +29,8 @@ script: # Run unit tests with code coverage - coverage run bin/spack test - # Check if changed files are flake8 conformant [framework] - - changed=$(git diff --name-only develop... | grep '.py$' | grep -v ^var/) - - [[ $changed ]] && \ - flake8 --format pylint --config share/spack/qa/flake8-framework $changed - - # Check if changed files are flake8 conformant [packages] - - changed=$(git diff --name-only develop... | grep '.py$' | grep ^var/) - - # Exempt url lines in changed packages from overlong errors. - - for file in $changed; do \ - [[ file = *package.py ]] && \ - perl -i~ -pe 's/^(\s*url\s*=.*)$/\1 # NOQA/' $file; \ - done - - [[ $changed ]] && \ - flake8 --format pylint --config share/spack/qa/flake8-packages $changed + # Run flake8 code style checks. + - share/spack/qa/run-flake8 after_success: - coveralls -- cgit v1.2.3-60-g2f50 From c512b37a4e26bb639893d06c9f2df30fb6dd6892 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 11 May 2016 01:25:40 -0700 Subject: format .flake8 more nicely. --- .flake8 | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.flake8 b/.flake8 index ab1e14b66e..a1e2fcc1f8 100644 --- a/.flake8 +++ b/.flake8 @@ -1,12 +1,20 @@ # -*- conf -*- -[flake8] -# Descriptions of ignored checks: +# 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 ‘,’ # -# E221: multiple spaces before operator -# E241: multiple spaces after ‘,’ -# F403: disable wildcard import -# F821: undefined name (needed for build commands) -# F999: Undefined undefined name (needed for build commands) +# 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 -- cgit v1.2.3-60-g2f50 From 78d25ad337e2faaa8cfd589607801acb78aec4d9 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 11 May 2016 02:01:24 -0700 Subject: Add run-flake8 script. - was missing the obvious. --- share/spack/qa/run-flake8 | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 share/spack/qa/run-flake8 diff --git a/share/spack/qa/run-flake8 b/share/spack/qa/run-flake8 new file mode 100755 index 0000000000..722c7fcba6 --- /dev/null +++ b/share/spack/qa/run-flake8 @@ -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 -- cgit v1.2.3-60-g2f50 From 6d6eb0f2d1e1f5f4fd340f8e5f3a5159be7e7f40 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 11 May 2016 02:32:13 -0700 Subject: Remove config.py from flake checking for now. --- lib/spack/spack/config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py index 9da5d7aaf0..21e08ff666 100644 --- a/lib/spack/spack/config.py +++ b/lib/spack/spack/config.py @@ -1,3 +1,4 @@ +# flake8: noqa ############################################################################## # Copyright (c) 2013-2015, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. -- cgit v1.2.3-60-g2f50 From 3d3a520a7d79f40f167f2856c5787ef94739eedc Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 11 May 2016 02:59:08 -0700 Subject: update readme for flake8 checking --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 1f7bcc5c61..fe00e2af27 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,11 @@ a [pull request](https://help.github.com/articles/using-pull-requests/). When you send your request, make ``develop`` the destination branch on the [Spack repository](https://github.com/LLNL/spack). +Your contribution will need to pass all the tests run by the `spack test` +command, as well as the formatting checks in `share/spack/qa/run-flake8`. +You should run both of these before submitting your pull request, to +ensure that the online checks succeed. + Spack is using a rough approximation of the [Git Flow](http://nvie.com/posts/a-successful-git-branching-model/) branching model. The ``develop`` branch contains the latest -- cgit v1.2.3-60-g2f50