Commit graph

2841 commits

Author SHA1 Message Date
Chris Green
15c98fa57c compiler flags: add cxx98 standard support (#7601)
The following improvements are made to cxx standard support
(e.g. compiler.cxxNN_flag functions) in compilers:

* Add cxx98_flag property
* Add support for throwing an exception when a flag is not supported (previously
  if a flag was not supported the application was terminated with tty.die)
* The name of the flag associated with e.g. c++14 standard support changes for
  different compiler versions (e.g. c++1y vs c++14). This makes a few corrections
  on what flag to return for which version.
* Added tests to confirm that versions report expected flags for various c++
  standards (or raise an exception for versions that don't provide a given cxx
  standard)

Note that if a given cxx standard is the default, the associated flag property will
return ""; cxx98 is assumed to be the default standard so this is the behavior for
the associated property in the base compiler class.

Package changes:

* Improvements to the boost spec to take advantage of the improved standard
  flag facility.
* Update the clingo spec to catch the new exception rather than look for an
  empty flag to indicate non-support (which is not part of the compiler flag API)
2018-06-08 13:49:31 -07:00
healther
980817575a add python cache removal to spack clean (#8419)
Remove .pyc and .pyo files along with __pycache__directory if the user provides
the -p/--python-cache option to "spack clean"
2018-06-07 10:33:38 -07:00
scheibelp
c97d058ce3
Fix bug where patches specified by dependents were not applied (#8272)
Fixes #7885

#7193 added the patches_to_apply function to collect patches which are then
applied in Package.do_patch. However this only collects patches that are
associated with the Package object and does not include Spec-related patches
(which are applied by dependents, added in #5476).

Spec.patches already collects patches from the package as well as those applied
by dependents, so the Package.patches_to_apply function isn't necessary. All
uses of Package.patches_to_apply are replaced with Package.spec.patches.

This also updates Package.content_hash to require the associated spec to be
concrete: Spec.patches is only set after concretization. Before this PR, it was
possible for Package.content_hash to be valid before concretizing the associated
Spec if all patches were associated with the Package (vs. being applied by
dependents). This behavior was unreliable though so the change is unlikely to
be disruptive.
2018-06-06 18:28:25 -07:00
Massimiliano Culpo
df1e23335c Preserve Spack CC/FC/F77/CXX settings when loading modules (#8346)
Fixes #8345

Spack environment modifications are applied before modules are loaded; this
includes settings to CC, FC, F77, and CXX, which point to the Spack compiler
wrappers. If the loaded modules set CC, this overrides the Spack compiler
wrappers. This PR adds a context manager to preserve the values of CC etc. that
are set by Spack: any effects on the CC, FC, F77, and CXX variables from modules
are undone and their original values are restored.
2018-06-05 11:26:30 -07:00
Axel Huebl
add7f2b09a pybind11: test functionality (#8304)
* pybind11: test support

Add a test functionality to pybind11.

* CMake: test also on "make check"

Some projects use non-CTest manual targets for tests.
2018-06-04 09:50:02 -05:00
Adam J. Stewart
f42afc6168 Less sensitive error detection in build logs (#8278)
* Less sensitive error detection in build logs
* Fix test_log_parser unit test
2018-06-02 21:07:02 -07:00
Adam J. Stewart
d6458a6ba7 Don't duplicate Python error messages (#8270) 2018-06-02 21:04:36 -07:00
Adam J. Stewart
fec11757d5 Fix coloring of error messages containing '}' symbol (#8277) 2018-06-02 21:02:28 -07:00
Adam J. Stewart
9862c97d38 Fix package error message line numbers (#8271)
Line numbers were reported as zero-indexed, but we need to adjust.
2018-06-02 20:53:18 -07:00
Massimiliano Culpo
8d3a153331 Skip external specs when creating mirrors (#8084)
fixes #8083

External specs are supposed to be installed already, so there's no need
to try to download a tarball for them.
2018-06-01 12:27:11 -07:00
George Hartzell
5de2f1ab75 Typo: an -> and (#8350) 2018-06-01 10:56:16 -07:00
Denis Davydov
8285a1778f extend Prefix class with join() member to support dynamic directories (#8329)
* extend Prefix class with join() member to support dynamic directories

* add more tests for Prefix.join()

* more tests for Prefix.join()

* add docstring

* add example to docstring of Prefix class

* cleanup Prefix.join() tests

* use Prefix.join() in Packaging Guide
2018-06-01 07:16:09 -05:00
George Hartzell
a6867d5cd5 binary caching: skip check if old and new paths are identical (#8281)
Fixes #8217

Trying to relocate a distribution when the new and old paths are
equal leads to failure, because the test that ensures that no
unrelocated bits are left over always fails. As an example, this
occurs if a user installs a package, generates a binary with it
using 'spack buildcache', uninstalls it, and then attempts to
reinstall into the same spack installation using the generated
binary package.

This updates the relocation check to accept the presence of the
old prefix in binaries if the package is being reinstalled into
its original location.
2018-05-31 16:01:32 -07:00
Denis Davydov
939eedcb37 improve Advanced Compiler Configuration part of tutorial (#8325) 2018-05-31 10:28:38 -07:00
scheibelp
43114c2e06 more-flexible user-specified dependency constraints (#8162)
* allow user to constrain dependencies that are added conditionally

* remove check for not-visited deps from normalize, move it to concretize. The check now runs after the concretization loop completes (so an error is only reported if the user-mentioned spec doesnt appear anywhere in the dag)

* remove separate full_spec_deps variable; rename spec_deps to all_spec_deps to clarify that it merges user-specified dependencies with derived dependencies

* add unit test to confirm new functionality
2018-05-30 11:07:13 -07:00
Todd Gamblin
1a677e30f3
config: add spack config blame command (#8081)
- `spack config blame` is similar to `spack config get`, but it prints
  out the config file and line number that each line of the merged
  configuration came from.

- This is a debugging tool for understanding where Spack config settings
  come from.

- add tests for config blame
2018-05-30 10:25:22 -07:00
Adam J. Stewart
87223a531b
Document specs with multiple version ranges (#8284) 2018-05-30 10:36:56 -05:00
Michael Kuhn
c77bc613eb Fix missing spack.compiler import (#8240)
Fixes: #8258

#8090 altered import behavior so that import spack no longer
provides access to many other Spack modules. This addresses
a case which depended on the prior behavior and was not
updated as part of #8090. This particular import error only
came up when users were setting compiler flags on specs.

See also: #8194
2018-05-24 10:59:20 -07:00
Axel Huebl
cd72312940 CUDA 9.2 (#8238)
Add the latest CUDA release, v9.2 and updated CUDA Compatibility Matrix
2018-05-22 12:45:47 +02:00
George Hartzell
e954686e5a Add info about haveged to gpg/randomness note (#8227) 2018-05-21 15:57:03 -05:00
Adam J. Stewart
0ccbc3a479
URL parsing: strip x86-64 from filename (#8200) 2018-05-20 15:01:58 -05:00
Todd Gamblin
22b551f84f fix leftover references to spack.<symbol>
- there were some leftover spack.* names being used after we removed
  globals and moved everything in the top-level namespace to spack.pkgkit

- point those references to their new homes
2018-05-19 07:37:24 -07:00
Todd Gamblin
8d7873e8b2 imports: remove unnecessary import spack statements
- remove most `import spack` statements, except for files that need
  `spack_version`

- import spack is no longer sufficient to use submodules
  (e.g. spack.directives).

  - these submodules must be imported directly. Update references
    accordingly.
2018-05-18 16:06:21 -07:00
Todd Gamblin
6b2c49648a init: move symbols in spack to spack.pkgkit
- Spack packages were originally expected to call `from spack import *`
  themselves, but it has become difficult to manage imports in the
  Spack core.

- the top-level namespace polluted by package symbols, and it's not
  possible to avoid circular dependencies and unnecessary module loads in
  the core, given all the stuff the packages need.

- This makes the top-level `spack` package essentially empty, save for a
  version tuple and a version string, and `from spack import *` is now
  essentially a no-op.

- The common routines and directives that packages need are now in
  `spack.pkgkit`, and the import system forces packages to automatically
  include this so that old packages that call `from spack import *`
  will continue to work without modification.

- Since `from spack import *` is no longer required, we could consider
  removing ``from spack import *`` from packages in the future and
  shifting to ``from spack.pkgkit import *``, but we can wait a while to
  do this.
2018-05-18 16:06:21 -07:00
Todd Gamblin
54201e3c02
locks: add configuration and command-line options to enable/disable locks (#7692)
- spack.util.lock behaves the same as llnl.util.lock, but Lock._lock and
  Lock._unlock do nothing.

- can be disabled with a control variable.

- configuration options can enable/disable locking:
  - `locks` option in spack configuration controls whether Spack will use filesystem locks or not.
  - `-l` and `-L` command-line options can force-disable or force-enable locking.

- Spack will check for group- and world-writability before disabling
  locks, and it will not allow a group- or world-writable instance to
  have locks disabled.

- update documentation
2018-05-18 14:41:03 -07:00
Todd Gamblin
5ef30e0a51 make check_for_compiler_existence an instance variable 2018-05-17 14:10:30 -07:00
Todd Gamblin
e9a3e3bfbb use os.path.join instead of join_path in core
- Spack core has long used llnl.util.filesystem.join_path, but
  os.path.join is pretty much the same thing, and is more efficient.

- Use os.path.join in the core Spack code from now on.
2018-05-17 14:10:30 -07:00
Todd Gamblin
f202198777 Convert lazy singleton functions to Singleton object
- simplify the singleton pattern across the codebase
- reduce lines of code needed for crufty initialization
- reduce functions that need to mess with a global

- Singletons whose semantics changed:
  - spack.store.store() -> spack.store
  - spack.repo.path() -> spack.repo.path
  - spack.config.config() -> spack.config.config
  - spack.caches.fetch_cache() -> spack.caches.fetch_cache
  - spack.caches.misc_cache() -> spack.caches.misc_cache
2018-05-17 14:10:30 -07:00
Todd Gamblin
3493f7e793 init: make spack.cmd.all_commands lazy
- `spack.cmd.all_commands` does a directory listing on
  `lib/spack/spack/cmd`, regardless of whether it is needed

- make this lazy so that the directory listing won't happen unless it's
  necessary.
2018-05-17 14:10:30 -07:00
Todd Gamblin
1fe5dbf338 init: only imoprt jsonschema if needed
- It turns out that jsonschema is one of the more expensive imports.

- move imports of jsonschema into functions to avoid the performance hits
  for calls that don't need config.
2018-05-17 14:10:30 -07:00
Todd Gamblin
6f2cac9565 init: initialize spack.store lazily
- spack.store was previously initialized at the spack.store module level,
  but this means the store has to be initialized on every spack call.

- this moves the state in spack.store to a singleton so that the store is
  only initialized when needed.
2018-05-17 14:10:30 -07:00
Todd Gamblin
c615d2be06 init: move spack.repo global variable into its own module
- spack.repository module is now spack.repo

- `spack.repo` is now `spack.repo.path()` and loaded lazily

- Added `spack.repo.get()` and `spack.repo.all_package_names()` as
  convenience functions to simplify the new lazy interface.

- updated tests and code
2018-05-17 14:10:30 -07:00
Todd Gamblin
2a09b627c9 tests: rename builtin_mock to "mock_packages" for clarity.
- rename `builtin_mock` and `refresh_builtin_mock` to the more clear
  `mock_packages` and `mutable_mock_packages`
2018-05-17 14:10:30 -07:00
Todd Gamblin
d1903f3bf3 init: convert spack.debug global variable to config option 2018-05-17 14:10:30 -07:00
Todd Gamblin
47dc96224d init: remove package_testing global
- refactor the way test dependencies are passed to the concretizer
- remove global state
- update tests
2018-05-17 14:10:30 -07:00
Todd Gamblin
bc9f5f084f init: remove dependency on spack.version
- no longer require `spack_version` to be a Version (it isn't used that
  way anyway)

- use a simple tuple `spack_version_info` with major, minor, patch
  versions

- generate `spack_version` from the tuple
2018-05-17 14:10:30 -07:00
Todd Gamblin
678639749c init: remove binary_cache_retrieved_specs global variable
- remove variable from spack/__init__.py
- clean up imports and some code structure in binary_distribution.py
2018-05-17 14:10:30 -07:00
Todd Gamblin
3e6d85c404 init: remove spack.concretizer global variable 2018-05-17 14:10:30 -07:00
Todd Gamblin
d4709673b5 init: remove build_jobs global variable 2018-05-17 14:10:30 -07:00
Todd Gamblin
2ab7b7a5a0 init: convert spack.dirty global to config option 2018-05-17 14:10:30 -07:00
Todd Gamblin
278933e824 init: remove template_dirs global
- remove template_dirs global variable from __init__.py

- also remove update_template_dirs fixture, which had no effect on test
  correctness
2018-05-17 14:10:30 -07:00
Todd Gamblin
77bd2dd706 init: replace global spack.do_checksum with config option 2018-05-17 14:10:30 -07:00
Todd Gamblin
73ab0e5dd7 init: replace spack.insecure global with spack.config.get 2018-05-17 14:10:30 -07:00
Todd Gamblin
863ccd5e94 config: simplify configuration API to just get and set
- replace `spack.config.get_configuration()` with `spack.config.config()`

- replace `get_config`/`update_config` with `get`, `set`

- add a path syntax that can be used to refer to specific config options
  without firt getting the entire configuration dict

- update usages of `get_config` and `update_config` to use `get` and `set`
2018-05-17 14:10:30 -07:00
Todd Gamblin
c9ea957563 config: create internal config scope for commands to use. 2018-05-17 14:10:30 -07:00
Todd Gamblin
eee502cc3b init: Move file cache initialization out of __init__.py 2018-05-17 14:10:30 -07:00
Todd Gamblin
d3a1ccd2fa config: rework config system into a class instead of globals
- Current configuration code forces the config system to be initialized
  at module scope, so configs are parsed on every Spack run, essentially
  before anything else.

- We need more control over configuration init order, so move the config
  scopes into a class and reduce global state in config.py
2018-05-17 14:10:30 -07:00
Todd Gamblin
6e398c7f08 init: move editor from spack/__init__.py to spack.util.editor 2018-05-17 14:10:30 -07:00
Todd Gamblin
a4d276fbe4 init: factor paths out of spack/__init__.py and into spack.paths module 2018-05-17 14:10:30 -07:00
Todd Gamblin
74aee60f7d init: simplify import ordering in __init__.py 2018-05-17 14:10:30 -07:00