From 3dd4a01a5e737a08a211f4e0f58da0a725e70818 Mon Sep 17 00:00:00 2001 From: Elizabeth Fischer Date: Wed, 4 Jan 2017 21:24:07 -0500 Subject: Standardize package names: lower-case, not Mixed_CASE (#2475) * Rename packages * Upcasing depends_on() in packages. * Downcased extends('r') * Fixed erroneously changed URL that had slipped through. * Fixed typo * Fixed link from documentation into package source code. * Fixed another doc problem. * Changed underscores to dashes in package names. * Added test to enforce lowercase, no-underscore naming convention. * Fix r-xgboost * Downcase more instances of 'R' in package auto-creation. * Fix test. * Converted unit test packages to use dashes not underscores * Downcase `r` in the docs. * Update module_file_support.rst Fix r->R for class R. --- lib/spack/docs/module_file_support.rst | 10 +++++----- lib/spack/spack/cmd/create.py | 6 +++--- lib/spack/spack/test/build_system_guess.py | 2 +- lib/spack/spack/test/concretize.py | 2 +- lib/spack/spack/test/install.py | 2 +- lib/spack/spack/test/mirror.py | 4 ++-- lib/spack/spack/test/package_sanity.py | 11 +++++++++++ lib/spack/spack/test/packages.py | 6 +++--- 8 files changed, 27 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/spack/docs/module_file_support.rst b/lib/spack/docs/module_file_support.rst index 5db2ca0285..93c2ee33c6 100644 --- a/lib/spack/docs/module_file_support.rst +++ b/lib/spack/docs/module_file_support.rst @@ -353,9 +353,9 @@ and has similar effects on module file of dependees. Even in this case ``run_env`` must be filled with the desired list of environment modifications. .. note:: - The ``R`` package and callback APIs + The ``r`` package and callback APIs A typical example in which overriding both methods prove to be useful - is given by the ``R`` package. This package installs libraries and headers + is given by the ``r`` package. This package installs libraries and headers in non-standard locations and it is possible to prepend the appropriate directory to the corresponding environment variables: @@ -367,14 +367,14 @@ and has similar effects on module file of dependees. Even in this case with the following snippet: - .. literalinclude:: ../../../var/spack/repos/builtin/packages/R/package.py + .. literalinclude:: ../../../var/spack/repos/builtin/packages/r/package.py :pyobject: R.setup_environment - The ``R`` package also knows which environment variable should be modified + The ``r`` package also knows which environment variable should be modified to make language extensions provided by other packages available, and modifies it appropriately in the override of the second method: - .. literalinclude:: ../../../var/spack/repos/builtin/packages/R/package.py + .. literalinclude:: ../../../var/spack/repos/builtin/packages/r/package.py :lines: 128-129,146-151 .. _modules-yaml: diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index bee75cec4b..f1a5bc5cdb 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -215,7 +215,7 @@ class PythonGuess(DefaultGuess): class RGuess(DefaultGuess): """Provides appropriate overrides for R extensions""" dependencies = """\ - extends('R') + extends('r') # FIXME: Add additional dependencies if required. # depends_on('r-foo', type=nolink)""" @@ -283,7 +283,7 @@ class BuildSystemGuesser(object): 'scons': SconsGuess, 'bazel': BazelGuess, 'python': PythonGuess, - 'R': RGuess, + 'r': RGuess, 'octave': OctaveGuess } @@ -306,7 +306,7 @@ class BuildSystemGuesser(object): (r'/CMakeLists.txt$', 'cmake'), (r'/SConstruct$', 'scons'), (r'/setup.py$', 'python'), - (r'/NAMESPACE$', 'R'), + (r'/NAMESPACE$', 'r'), (r'/WORKSPACE$', 'bazel') ] diff --git a/lib/spack/spack/test/build_system_guess.py b/lib/spack/spack/test/build_system_guess.py index 97a9d67b47..86c1c9da13 100644 --- a/lib/spack/spack/test/build_system_guess.py +++ b/lib/spack/spack/test/build_system_guess.py @@ -36,7 +36,7 @@ import spack.stage ('CMakeLists.txt', 'cmake'), ('SConstruct', 'scons'), ('setup.py', 'python'), - ('NAMESPACE', 'R'), + ('NAMESPACE', 'r'), ('foobar', 'unknown') ] ) diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index 3cc5c70a5f..b7cad503a3 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -240,7 +240,7 @@ class TestConcretize(object): assert 'mpi' in spec def test_my_dep_depends_on_provider_of_my_virtual_dep(self): - spec = Spec('indirect_mpich') + spec = Spec('indirect-mpich') spec.normalize() spec.concretize() diff --git a/lib/spack/spack/test/install.py b/lib/spack/spack/test/install.py index d2ebf8dfb4..f10c3a37e9 100644 --- a/lib/spack/spack/test/install.py +++ b/lib/spack/spack/test/install.py @@ -60,7 +60,7 @@ def fake_fetchify(url, pkg): @pytest.mark.usefixtures('install_mockery') def test_install_and_uninstall(mock_archive): # Get a basic concrete spec for the trivial install package. - spec = Spec('trivial_install_test_package') + spec = Spec('trivial-install-test-package') spec.concretize() assert spec.concrete diff --git a/lib/spack/spack/test/mirror.py b/lib/spack/spack/test/mirror.py index 13219ef878..e5e60e3045 100644 --- a/lib/spack/spack/test/mirror.py +++ b/lib/spack/spack/test/mirror.py @@ -129,7 +129,7 @@ class TestMirror(object): repos.clear() def test_url_mirror(self, mock_archive): - set_up_package('trivial_install_test_package', mock_archive, 'url') + set_up_package('trivial-install-test-package', mock_archive, 'url') check_mirror() repos.clear() @@ -143,6 +143,6 @@ class TestMirror(object): set_up_package('git-test', mock_git_repository, 'git') set_up_package('svn-test', mock_svn_repository, 'svn') set_up_package('hg-test', mock_hg_repository, 'hg') - set_up_package('trivial_install_test_package', mock_archive, 'url') + set_up_package('trivial-install-test-package', mock_archive, 'url') check_mirror() repos.clear() diff --git a/lib/spack/spack/test/package_sanity.py b/lib/spack/spack/test/package_sanity.py index c3c3923855..c75d7cdcc7 100644 --- a/lib/spack/spack/test/package_sanity.py +++ b/lib/spack/spack/test/package_sanity.py @@ -26,6 +26,7 @@ This test does sanity checks on Spack's builtin package database. """ import unittest +import re import spack from spack.repository import RepoPath @@ -57,3 +58,13 @@ class PackageSanityTest(unittest.TestCase): # If there is a url for the version check it. v_url = pkg.url_for_version(v) self.assertEqual(vattrs['url'], v_url) + + def test_all_versions_are_lowercase(self): + """Spack package names must be lowercase, and use `-` instead of `_`. + """ + errors = [] + for name in spack.repo.all_package_names(): + if re.search(r'[_A-Z]', name): + errors.append(name) + + self.assertEqual([], errors) diff --git a/lib/spack/spack/test/packages.py b/lib/spack/spack/test/packages.py index 39bbe4a954..6ae8a33a24 100644 --- a/lib/spack/spack/test/packages.py +++ b/lib/spack/spack/test/packages.py @@ -83,7 +83,7 @@ def test_import_package_as(builtin_mock): def test_inheritance_of_diretives(): - p = spack.repo.get('simple_inheritance') + p = spack.repo.get('simple-inheritance') # Check dictionaries that should have been filled by directives assert len(p.dependencies) == 3 @@ -93,14 +93,14 @@ def test_inheritance_of_diretives(): assert len(p.provided) == 2 # Check that Spec instantiation behaves as we expect - s = Spec('simple_inheritance') + s = Spec('simple-inheritance') s.concretize() assert '^cmake' in s assert '^openblas' in s assert '+openblas' in s assert 'mpi' in s - s = Spec('simple_inheritance~openblas') + s = Spec('simple-inheritance~openblas') s.concretize() assert '^cmake' in s assert '^openblas' not in s -- cgit v1.2.3-60-g2f50