Commit graph

2583 commits

Author SHA1 Message Date
scheibelp
5a94cee216 Variant satisfaction for indirect dependencies
Fixes #4898

Constraints that were supposed to be conditionally activated for
specified values of a single-valued variant were being activated
unconditionally in the case that the variant was associated with
an implicit dependency. For example if X->Y->Z and Y places a
conditional constraint on Z for a given single-valued variant on
Y, then it would have been applied unconditionally when
concretizing X.
2017-08-07 10:48:48 -07:00
Adam J. Stewart
a31ce17f0b Various fixes to package name URL parsing (#4978) 2017-08-05 10:15:47 -05:00
Adam J. Stewart
c7df12f698 Massive conversion from Package to CMakePackage (#4975) 2017-08-05 10:15:18 -05:00
Adam J. Stewart
7eb263effe Add a SConsPackage base class (#4936)
* Add a SConsPackage base class

* Make Matlab extendable

* Most dependencies are actually required

* Cantera requires older version of fmt
2017-08-04 16:52:10 -05:00
Adam J. Stewart
b8ed61cfea Make CMake the default build system (#4862) 2017-08-04 14:53:05 -05:00
Adam J. Stewart
452f382293 Add a QMakePackage base class (#4925)
* Add a QMakePackage base class

* Fix sqlite linking bug in qt-creator

* Add latest version of qt-creator

* Add latest version of qwt

* Use raw strings for regular expressions

* Increase minimum required version of qt

* Add comment about specific version of sqlite required

* Fixes for latest version of qwt and qt-creator

* Older versions of Qwt only work with older versions of Qt
2017-08-04 08:46:07 -07:00
Adam J. Stewart
4e269510c5 Fix trailing whitespace at the end of headers.cpp_flags (#4957) 2017-08-03 14:24:51 -05:00
George Hartzell
36496b9174 Fix crashes when running spack install under nohup (#4926)
* Fix crashes when running spack install under nohup

Fixes #4919

For reasons that I do not entire understand, duplicate_stream() throws
an '[Errno 22] Invalid argument' exception when it tries to
`os.fdopen()` the duplicated file descriptor generated by
`os.dup(original.fileno())`.  See spack/llnl/util/lang.py, line
394-ish.

This happens when run under `nohup`, which supposedly has hooked
`stdin` to `/dev/null`.

It seems like opening and using `devnull` on the `input_stream` in
this situation is a reasonable way to handle the problem.

* Be more specific about error being handled.

Only catch the specific error that happens when trying to dup
the stdin that nohup provides.

Catching e as a StandardErorr and then
`type(e).__name__` tells me that it's an OSError.

Printing e.errno tells me that it's 22

Double checking tells me that 22 is EINVAL.

Phew.
2017-08-03 10:33:16 -07:00
Sergey Kosukhin
963eb99b7f Account for hyphens in package names when searching for libraries. (#4948) 2017-08-03 09:17:07 +02:00
Todd Gamblin
44ce0adbd5 Fix color bug in Spec.format() introduced by #3013 2017-08-01 17:40:54 -07:00
Todd Gamblin
b88f55e523 Add spack dependencies command and tests for it and dependents. 2017-08-01 17:40:54 -07:00
Todd Gamblin
af3c794ab5 document and make display_specs more versatile 2017-08-01 17:40:54 -07:00
Todd Gamblin
b575d008bd Fix issue with case check and spack -m 2017-08-01 17:40:54 -07:00
Todd Gamblin
c8b2100630 Refactor installed_dependents -> installed_relatives 2017-08-01 17:40:54 -07:00
Todd Gamblin
36b3dd8cfe Package.possible_dependencies() descends into virtuals. 2017-08-01 17:40:54 -07:00
Todd Gamblin
b9606e3157 Add --transitive option to spack dependents 2017-08-01 17:40:54 -07:00
Todd Gamblin
6928cf7a68 spack dependents lists possible dependencies by default. 2017-08-01 17:40:54 -07:00
Todd Gamblin
bd94a17066 Remove last vestiges of "special" deptypes.
- Remove `special_types` dict in spec.py, as only 'all' is still used
- Still allow 'all' to be used as a deptype
- Simplify `canonical_deptype` function
- Clean up args in spack graph
- Add tests
2017-08-01 17:40:54 -07:00
Todd Gamblin
43f576cf19 Remove unused code. 2017-08-01 17:40:54 -07:00
Todd Gamblin
f2ddcfac5f Add --all argument to spack dependents
--all causes spack dependents to list all possible dependents for a
package, rather than actual dependents for an installed spec.
2017-08-01 17:40:54 -07:00
Adam J. Stewart
82735deafd Clarify docs on using a hash in a spec (#4908) 2017-07-31 13:13:39 -07:00
scheibelp
69a6c8ef78 Fix preference for X.Y version when mixed with X.Y.Z versions (#4922)
For packages which contain a mix of versions with formats X.Y and
X.Y.Z, if the user entered an X.Y version as a preference in
packages.yaml, Spack would get confused and favor any version A.B.Z
where X=A and Y=B. In the case where there is a mix of these version
types, this commit updates preferences so Spack will favor an exact
match.
2017-07-31 13:11:08 -07:00
paulhopkins
1c7e5724d9 Add --color=[always|never|auto] argument; fix color when piping (#3013)
* Disable spec colorization when redirecting stdout and add command line flag to re-enable
* Add command line `--color` flag to control output colorization
* Add options to `llnl.util.tty.color` to allow color to be auto/always/never
* Add `Spec.cformat()` function to be used when `format()` should have auto-coloring
2017-07-31 12:57:47 -07:00
Adam J. Stewart
b33f92da34 Improve version detection for URLs with dynamic after version (#4902) 2017-07-26 17:43:54 -05:00
Adam J. Stewart
07aec4366f Add universal build_type variant to CMakePackage (#4797)
* Add universal build_type variant to CMakePackage
* Override build_type in some packages with different possible values
* Remove reference to no longer existent debug variant
* Update CBTF packages with new build_type variant
* Keep note on build size of LLVM
2017-07-25 16:34:43 -07:00
Gregory Lee
42717bd8e8 fix config.guess patch for ppc64le (#4858)
* fix config.guess patch for ppc64le

* explicit patch for config.guess not required
2017-07-25 13:44:51 -07:00
Adam J. Stewart
250ee413e9 Change Version formatting properties and functions to return Version objects (#4834)
* Change version.up_to() to return Version() object
* Add unit tests for Version.up_to()
* Fix packages that expected up_to() to return a string
* Ensure that up_to() preserves separator characters
* Use version indexing instead of up_to
* Make all Version formatting properties return Version objects
* Update docs
* Tests need to test string representation
2017-07-24 13:02:13 -07:00
Todd Gamblin
f159246d1d Make testing spack commands simpler (#4868)
Adds SpackCommand class allowing Spack commands to be easily in Python

Example usage:

    from spack.main import SpackCommand
    info = SpackCommand('info')
    out, err = info('mpich')
    print(info.returncode)

This allows easier testing of Spack commands.

Also:
* Simplify command tests
* Simplify mocking in command tests.
* Simplify module command test
* Simplify python command test
* Simplify uninstall command test
* Simplify url command test
* SpackCommand uses more compatible output redirection
2017-07-22 21:27:54 -07:00
becker33
f962aba6ce Allow packages to control handling of compiler flags (#4421)
* Initial work on flag trapping using functions called <flag>_handler and default_flag_handler

* Update packages so they do not obliterate flags

* Added append to EnvironmentModifications class

* changed EnvironmentModifications to have append_flags method

* changed flag_val to be a tuple

* Increased test coverage

* added documentation of flag handling
2017-07-19 20:12:00 -07:00
Adam J. Stewart
5fc0243d35 Improve version detection of release versions (#4816) 2017-07-18 22:48:39 -05:00
becker33
d2a63d55fa Open ended variants (#4746)
* Change directives to allow open-ended variants more easily

* make None default to open-ended
2017-07-18 10:03:15 -07:00
Adam J. Stewart
1215c3b20c Change path to CMakeLists.txt to be relative to root, not pwd (#4420)
* Change path to CMakeLists.txt to be relative to root, not pwd

* Changes requested during code review

* Revert back to old naming of root_cmakelists_dir
* Make relative directory more clear in docs

* Revert change causing build_type AttributeError

* Fix forgotten abs_path var

* Update CLHEP with new relative path

* Update more packages with new root_cmakelists_dir syntax
2017-07-18 09:58:19 -07:00
Massimiliano Culpo
5a1ee22575 package: removed default no-op patch (#4103)
* package: removed default no-op patch fixes #4085

* do_patch: handles NoSuchMethodError nicely
2017-07-18 09:53:35 -07:00
George Hartzell
ff906faf9a Typo: submdoules -> submodules (#4716) 2017-07-12 07:48:31 +02:00
Gregory Lee
28cb1e4379 patch config.guess after autoreconf step (#4604) 2017-07-06 23:07:54 -05:00
Todd Gamblin
b4d1654e68 Parametrized lock test and make it work with MPI
- Lock test can be run either as a node-local test or as an MPI test.

- Lock test is now parametrized by filesystem, so you can test the
  locking capabilities of your NFS, Lustre, or GPFS filesystem.  See docs
  for details.
2017-07-04 11:41:37 -07:00
Todd Gamblin
bd7a591df1 Make filesytem more resilient to concurrent updates.
- Uses O_CREAT for touch (for guaranteed atomic open on NFS, multi-node)
- Ignore concurrent create errors in mkdirp
2017-07-04 11:41:37 -07:00
Todd Gamblin
326e2f7f66 Ported lock test to pytest. 2017-07-04 11:41:37 -07:00
Adam J. Stewart
9933d759ac Update hdfgroup packages to new URL structure (#4643)
* Update hdfgroup packages to new URL structure

* Update docs now that HDF5 URL isn't that complicated
2017-06-29 21:38:47 -05:00
EmreAtes
898c7f8838 add mpi to providers to remove virtual package error (#4608) 2017-06-28 12:24:29 -05:00
becker33
b1861b29ef Added install option to read spec from file (#4611) 2017-06-27 12:27:16 -07:00
Adam J. Stewart
ad1382e664 Don't immediately raise an error when an editor is not found (#4587)
* Don't immediately raise an error when an editor is not found
* If no editor is found, raise an error only if we try to use it.
2017-06-25 20:42:38 -07:00
Adam J. Stewart
e5ce7b1639 Allow arbitrary Prefix attributes (#4591)
* Allow arbitrary Prefix attributes
* Test attribute type as well

* Flake8 fixes

* Remove __new__ method

* Fewer uses of join_path in the docs
2017-06-24 22:39:31 -07:00
Todd Gamblin
cac4362f64 Make LICENSE recognizable by GitHub. (#4598) 2017-06-24 22:22:55 -07:00
Massimiliano Culpo
b7ca7274b8 mv variants: packages are now needed only during normalization (#4129)
* mv variants: packages are now needed only during normalization

The relationship among different types of variants have been weakened,
in the sense that now it is permitted to compare MV, SV and BV among
each other. The mechanism that permits this is an implicit conversion
of the variant passed as argument to the type of the variant asking
to execute a constrain, satisfies, etc. operation.

* asbtract variant: added a new type of variant

An abstract variant is like a multi valued variant, but behaves
differently on "satisfies" requests, because it will reply "True"
to requests that **it could** satisfy eventually.

Tests have been modified to reflect the fact that abstract variants
are now what get parsed from expressions like `foo=bar` given by users.

* Removed 'concrete=' and 'normal=' kwargs from Spec.__init__

These two keyword arguments where only used in one test module to force
a Spec to 'appear' concrete. I suspect they are just a leftover from
another refactoring, as now there's the private method '_mark_concrete'
that does essentially the same job. Removed them to reduce a bit the
clutter in Spec.

* Moved yaml related functions from MultiValuedVariant to AbstractVariant.

This is to fix the erros that are occurring in epfl-scitas#73, and that
I can't reproduce locally.
2017-06-23 13:36:29 -07:00
becker33
689c1d2f0c fix issue #4577 (#4579) 2017-06-21 18:33:11 -05:00
becker33
a113101126 Module cmd fix (#3250)
* Parse modules in a way that works for both lmod and tcl

* added test and made method more robust

* refactoring for pythonic clarity

* Improved detection of 'module' shell function + refactored module utilities into spack.util.module_cmd

* Improved regex to reject nested parentheses we are not prepared to handle

* make tests backwards compatible with python 2.6

* Improved regex to account for sh being aliased to bash and used in bash module definition on some systems

* Improve test compatibility with lmod

* Added error for None module_cmd

* Add test for get_module_cmd_from_which()

Add test for get_module_cmd_from_which().
Add -c argument to Popen call to typeset -f module in get_module_cmd_from_bash().

* Increased detection options

Included BASH_FUNC_module() variable outside of typeset as a detection option
This should work on bash even in restricted_shell mode
Kept the typeset detection as an option in case the module function is not exported in bash

Also added try statements to tests, with environment recreation in finally blocks.

* More tests added; some hackiness

* increased test coverage for util/module_cmd
2017-06-21 09:58:41 -07:00
becker33
541496dfe1 System config (#4518)
* Code changes to enable system config scope in /etc

Files will go in either /etc/spack or /etc/spack/<platform>
Required minor changes to conftest.

* Updated documentation to match new config scope
2017-06-16 12:31:56 -07:00
Todd Gamblin
790b06e0c3 bugfix: support EDITOR values with spaces (#4523)
- previous code called `which` on $EDITOR, but that doesn't work for
  EDITORs like `emacs -nw` or `emacsclient -t -nw`.

- This patch just trusts EDITOR if it is set (same as previous
  behavior), and only uses the defaults if it's not.
2017-06-16 14:03:21 +02:00
Massimiliano Culpo
8b5e94976d issue 4492: DependencyMap.concrete checks for unconditional dependencies (#4499)
* issue 4492: added xfailing test, added owner to DependencyMap

* DependencyMap.concrete checks if we have unconditional dependencies

This fixes #4492 and #4107 using some heuristics to avoid an infinite
recursion among Spec.satisfies, Spec.concrete and DependencyMap.concrete

The idea, as suggested by @becker33, is to check just for unconditional
dependencies. This is not covering the whole space and a package with
just conditional dependencies can still fail in the same way. It should
cover though all the **real** packages we have in our repo so far.
2017-06-16 12:41:15 +02:00
Mario Melara
da67ee9790 Fix tests on cray (#4298)
* Check for CRAYPE_VERSION instead of path

Architecture tests would fail on Cray since it would not find
the expected path. To make the test correctly work on Cray search
for the CRAYPE version instead.

* Catch SystemExit error in case flake8 not in path

On shared systems having flake8 can involve starting own virtual env.
Skip the test if no flake8 is found to avoid failure reporting.

* Add compatibility to 1.5 svnadmin create

The flag added is needed to correctly create svn repos on NERSC systems.
This could be unnecessary for other sites. I'd like to see others
test before this change gets merged.
2017-06-15 15:16:14 -07:00
Adam J. Stewart
41e4a034ff Add latest version of JDK (#4317)
* Add latest version of JDK

* Use a more specific URL to get curl to work

* Remove failing unit test
2017-06-15 12:40:55 +02:00
Todd Gamblin
8c2447272e Fix dashes in variant parsing (#4498)
- Skip spack flake8 test when flake8 is not installed.
- Fix parsing of dashes in specs broken by new help parser.
    - use argparse.REMAINDER instead of narg='?'
    - don't interpret parts of specs like -mpi as arguments.
2017-06-15 11:32:55 +02:00
Adam J. Stewart
e627447417 Prefer vim to vi for default editor (#4230)
* vim > vi
* Allow which to accept multiple args
* Update __init__ to use which with multiple args
* Fix doc tests
2017-06-15 11:27:18 +02:00
Nicolas Richart
f06c23ef42 Adding package namd (#4321)
* Initial version of the namd package

* Modified charm to consider compile against intel/intel-mpi

* Correction of namd to compile with intel-mkl and intel compiler

* Adding inclue64 in the prefix

* adding property for the build directory

* removing useless function build
2017-06-14 13:11:30 -05:00
scheibelp
1e69d9d1a9 Override partial installs by default - part three (#4331)
* During install, remove prior unfinished installs

If a user performs an installation which fails, in some cases the
install prefix is still present, and the stage path may also be
present. With this commit, unless the user specifies
'--keep-prefix', installs are guaranteed to begin with a clean
slate. The database is used to decide whether an install finished,
since a database record is not added until the end of the install
process.

* test updates

* repair_partial uses keep_prefix and keep_stage

* use of mock stage object to ensure that stage is destroyed when it should be destroyed (and otherwise not)

* add --restage option to 'install' command; when this option is not set, the default is to reuse a stage if it is found.
2017-06-13 09:15:51 -07:00
Adam J. Stewart
0de653ff01 Add an installcheck phase to MakefilePackage (#4476)
* Add an installcheck phase to MakefilePackage

* Minor changes to ESMF
2017-06-12 09:47:46 -05:00
Todd Gamblin
c67f647785 Move description to top of spack info (#4475) 2017-06-09 21:02:16 -07:00
Adam J. Stewart
36b8ea2f92 Add default list_url for GitLab, BitBucket, and CRAN (#4439)
* Add default list_url for GitLab, BitBucket, and CRAN

* Fix flake and doc tests
2017-06-09 12:28:39 -05:00
Adam J. Stewart
218992862c Move gpg section of docs to Getting Started (#4446) 2017-06-09 12:27:29 -05:00
Adam J. Stewart
85fd8f0b31 Fix url parse offset for SourceForge downloads (#4458) 2017-06-09 08:53:40 +02:00
Adam J. Stewart
1b9af88572 Supress output from gpg --version during tests (#4441) 2017-06-07 11:52:28 -05:00
Stas Sergienko
8018f6cdf6 Fixed duplicated spec: nag@6.1 line in getting started guide (#4445) 2017-06-07 11:50:56 -05:00
Adam J. Stewart
d9d5135ec9 Fix spack info bug for Python 3 (#4391) 2017-05-30 13:37:56 -05:00
Adam J. Stewart
f9ac965fb9 Document known issue with R concretization (#4313) 2017-05-27 12:51:03 -05:00
Adam J. Stewart
d3a82ce632 Fix typo in mod_to_class docstring (#4371) 2017-05-26 22:05:54 -05:00
Adam J. Stewart
6f0ac9d54c Add --configure-args/vars support to RPackage (#4289)
* Add --configure-args/vars support to RPackage

* Docstring formatting change
2017-05-26 16:37:06 -05:00
Ben Boeckel
f38d250e50 gpg: add 'spack gpg subcommand (#3845)
- Add a `spack gpg` subcommand in anticipation of signed binaries.
- GPG keys are stored in var/spack/gpg, and the spack gpg command manages them.
- Docs are included on the command.
2017-05-26 10:31:04 -07:00
George Hartzell
26440accab Touch up string expansion. (#4344)
* Touch up string expansion.

I'm chasing this:

```
$ (module purge; spack install perl %gcc/5.4.0)
==> Error: No installed spec matches the hash: '%s'
```

There's something deeper going on, but the error message isn't helpful.

After this change it tells me this:

```
$ (module purge; spack install perl %gcc/5.4.0)
==> Error: No installed spec matches the hash: '5.4.0'
```

Which is weird because `5.4.0` is not a hash...  Whatever is going on here, the error message needs to be fixed.

* Flake8 whitespace
2017-05-25 13:00:58 -05:00
becker33
12ab882eba Fix issues parsing multiple anonymous specs (#4199)
* fix parser
* Removed xfails
* cleaned up debug print statements
* make use of these changes in gcc
* Added comment explaining unreachable line, line left for added protection
2017-05-24 17:13:18 -07:00
Adam J. Stewart
315bda3487 Fix PGI version detection: 17.4-0 -> 17.4 (#4251) 2017-05-24 06:57:31 -05:00
Todd Gamblin
32c570913d Move doc dependencies to requirements.txt for readthedocs (#4280)
* Move doc dependencies to requirements.txt for readthedocs

* Move sphinx to doc requirements.
2017-05-17 20:45:03 -05:00
Todd Gamblin
3e8662aaa7 fix bug with executables setting their own environment. (#4237) 2017-05-17 11:37:06 -05:00
Adam J. Stewart
cafc3cc3ca Sphinx no longer supports Python 2.6 (#4266)
* Sphinx no longer supports Python 2.6

* Update vendored sphinxcontrib.programoutput from 0.9.0 to 0.10.0

* Documentation cannot be built in parallel

* Let Travis install programoutput for us

* Remove vendored sphinxcontrib-programoutput

Recent updates to the sphinx package prevent the vendored version
from being found in sys.path. We don't vendor sphinx, so it doesn't
make sense to vendor sphinxcontrib-programoutput either.
2017-05-17 11:36:02 -05:00
Adam J. Stewart
b630c06773 Sphinx no longer ignores first argument (#4243)
* Sphinx no longer ignores first argument
* Duplicate first argument for maximum compatibility
2017-05-16 14:24:35 -07:00
Adam J. Stewart
1a6b4afe7f Add helpful error message for uncompressed downloads (#4205) 2017-05-12 09:52:01 -05:00
Adam J. Stewart
e7973dd290 Fix typo in PythonPackage documentation (#4221) 2017-05-11 19:05:02 -05:00
Massimiliano Culpo
f8b3eff01c filesystem.py: fixed bug introduced in #3367 (scrambled order in output) (#4156)
PR #3367 inadvertently changed the semantics of _find_recursive and
_find_non_recursive so that the returned list are not ordered as the
input search list. This commit restores the original semantic, and adds
tests to verify it.
2017-05-11 10:29:08 -07:00
Massimiliano Culpo
306f158c73 cp2k: fixed compilation issues for intel stack
Added DFLAGS to the `make.inc` file being written.
These macros are also added to the language specific variables
like CFLAGS, CXXFLAGS and FCFLAGS. Changed `spec.satisfies('foo')`
with `'foo' in spec` in `intel-mkl`, see #4135. Added a basic
build interface to `intel-mpi`.
2017-05-09 18:46:42 +02:00
Massimiliano Culpo
3efa9bd296 spec_syntax: added xfailing tests for cases in #4144 (#4151)
It seems that parse_anonymous_spec may fail if more than one part
(variant, version range, etc.) is given to the function. Added tests to
code against to fix the problem in #4144.
2017-05-08 13:24:37 -07:00
Todd Gamblin
ff3b5d88e4 rework spack help (#3033)
- Full help is now only generated lazily, when needed.
  - Executing specific commands doesn't require loading all of them.
  - All commands are only loaded if we need them for help.

- There is now short and long help:
  - short help (spack help) shows only basic spack options
  - long help (spack help -a) shows all spack options
  - Both divide help on commands into high-level sections

- Commands now specify attributes from which help is auto-generated:
  - description: used in help to describe the command.
  - section: help section
  - level: short or long

- Clean up command descriptions

- Add a `spack docs` command to open full documentation
  in the browser.

- move `spack doc` command to `spack pydoc` for clarity

- Add a `spack --spec` command to show documentation on 
  the spec syntax.
2017-05-08 13:18:29 -07:00
Massimiliano Culpo
85b0ebe836 BarrierTimeoutError must derive from Exception (#4157)
Seen in https://travis-ci.org/LLNL/spack/builds/229484526, very likely
due to a problem in the Travis builder.
2017-05-07 22:06:39 -07:00
Adam J. Stewart
cf93f49462 Fix PGI compiler detection on PowerPC (#4150) 2017-05-07 22:04:52 -07:00
Massimiliano Culpo
4e44d39f1a Spec.__init__: removed dead code (#4146)
The conditionals are repeated in the statement before _add_dependencies
2017-05-07 21:53:02 -07:00
Adam J. Stewart
73896e9481 Remind developers to update tab completion script (#4148) 2017-05-05 18:52:28 -05:00
Adam J. Stewart
9b49dfdc2a Fix typos in Basic Installation Tutorial (#4127) 2017-05-05 13:05:56 -05:00
Massimiliano Culpo
85b4b15d9a SV variants are evaluated correctly in "when=" (#4118)
* SV variants are evaluated correctly in `when=` statements fixes #4113

The problem here was tricky:
```python
spec.satisfies(other)
```
changes already the MV variants in others into SV variants (where
necessary) if spec is concrete. If it is not concrete it does
nothing because we may be acting at a pure syntactical level.

When evaluating a `when=` keyword spec is for sure not concrete
as it is in the middle of the concretization process. In this case we
have to trigger manually the substitution in other to not end up
comparing a MV variant "foo=bar" to a SV variant "foo=bar" and having
False in return. Which is wrong.

* sv variants: improved error message for typos in "when=" statements
2017-05-04 11:01:02 -07:00
Denis Davydov
7592971cb1 add transitive run dependencies of direct build dependencies 2017-05-04 08:43:06 +02:00
scheibelp
bee105fbb9 Merge pull request #4069 from davydden/fix_transitive_build_dep
only add direct build-only dependencies to PATH
2017-05-03 18:41:26 -07:00
Matthew Scott Krafczyk
6e14b97f84 Update cray compiler options (#4086) 2017-05-03 12:05:15 -05:00
Massimiliano Culpo
ae9a9e019a spack: no stacktrace if not in debug mode + fix emacs variant (#4098)
* spack: no stacktrace if not in debug mode + fix emacs variant

* emacs: removed dead code
2017-05-03 06:21:37 +02:00
Adam J. Stewart
1336630f17 Add link to spack view docs in command index (#4082) 2017-05-02 11:20:45 -05:00
Denis Davydov
708d8586ea add run-time dependencies of direct build-time dependencies to PATH 2017-05-02 08:43:37 +02:00
Denis Davydov
ef5da08f80 only add direct build-only dependencies to PATH 2017-05-01 22:58:24 +02:00
Massimiliano Culpo
9e4b0eb34a Multi-valued variants (#2386)
Modifications:
- added support for multi-valued variants
- refactored code related to variants into variant.py
- added new generic features to AutotoolsPackage that leverage multi-valued variants
- modified openmpi to use new features
- added unit tests for the new semantics
2017-05-01 13:08:47 -07:00
Todd Gamblin
32dd20035f Skip fetch tests for tools that are not installed. (#4059)
This allows people on systems that don't have all the fetchers to still
run Spack tests. Mark tests that require git, subversion, or mercurial to
be skipped if they're not installed.
2017-05-01 11:53:16 -07:00
Massimiliano Culpo
aa9da358b5 url_parse: ported to pytest (#3430) 2017-05-01 08:57:49 -07:00
Massimiliano Culpo
f60134cdb1 namespace_trie: ported to pytest (#4060) 2017-05-01 08:53:50 -07:00
Adam J. Stewart
2511520b32 Add a WafPackage base class (#3975)
* Add a WafPackage base class

* Correct comment in docstring

* Be more specific about the Python versions supported
2017-05-01 08:00:09 -07:00
Massimiliano Culpo
b3ce04cba3 url_substitution: ported to pytest (#4032) 2017-05-01 01:41:48 -07:00
Denis Davydov
c7a5b2eaa9 disable rpaths on Darwin when arg=-r mode=ccld (#3930)
This fixes build of Ipopt package.
2017-04-30 19:16:28 -07:00
Sergey Kosukhin
4421013290 Updated cc wrapper: switch from ld to vcheck if version is requested. (#2501) 2017-04-30 19:08:49 -07:00
Adam J. Stewart
1f303c9ac8 Don't add system paths to PATH (#3910)
* Filter all system paths introduced by dependencies from PATH
* Make sure path filtering works *even* for trailing slashes
* Revert some of the changes to `filter_system_paths`
* Yes, `bin64` is a real thing (sigh)
* add tests: /usr, /usr/, /usr/local/../bin, etc.
* Convert from rST to Google-style docstrings
2017-04-30 18:43:44 -07:00
Massimiliano Culpo
8551ef3874 spack_yaml: ported to pytest (#4033) 2017-04-30 17:27:40 -07:00
Massimiliano Culpo
6a01612ad4 file_list: ported to pytest (#4054) 2017-04-30 10:09:04 -07:00
Christoph Junghans
ea2f6b89e9 fetch: do full clone of git submodules (fix #3956) (#3958)
The required hash of a submodule might point to the
non-HEAD commit of the current main branch and hence
would lead to a "no such remote ref" at checkout in
a shallow submodule.
2017-04-29 17:58:52 -07:00
Adam J. Stewart
ce3ab503de Python command, libraries, and headers (#3367)
## Motivation

Python installations are both important and unfortunately inconsistent. Depending on the Python version, OS, and the strength of the Earth's magnetic field when it was installed, the name of the Python executable, directory containing its libraries, library names, and the directory containing its headers can vary drastically. 

I originally got into this mess with #3274, where I discovered that Boost could not be built with Python 3 because the executable is called `python3` and we were telling it to use `python`. I got deeper into this mess when I started hacking on #3140, where I discovered just how difficult it is to find the location and name of the Python libraries and headers.

Currently, half of the packages that depend on Python and need to know this information jump through hoops to determine the correct information. The other half are hard-coded to use `python`, `spec['python'].prefix.lib`, and `spec['python'].prefix.include`. Obviously, none of these packages would work for Python 3, and there's no reason to duplicate the effort. The Python package itself should contain all of the information necessary to use it properly. This is in line with the recent work by @alalazo and @davydden with respect to `spec['blas'].libs` and friends.

## Prefix

For most packages in Spack, we assume that the installation directory is `spec['python'].prefix`. This generally works for anything installed with Spack, but gets complicated when we include external packages. Python is a commonly used external package (it needs to be installed just to run Spack). If it was installed with Homebrew, `which python` would return `/usr/local/bin/python`, and most users would erroneously assume that `/usr/local` is the installation directory. If you peruse through #2173, you'll immediately see why this is not the case. Homebrew actually installs Python in `/usr/local/Cellar/python/2.7.12_2` and symlinks the executable to `/usr/local/bin/python`. `PYTHONHOME` (and presumably most things that need to know where Python is installed) needs to be set to the actual installation directory, not `/usr/local`.

Normally I would say, "sounds like user error, make sure to use the real installation directory in your `packages.yaml`". But I think we can make a special case for Python. That's what we decided in #2173 anyway. If we change our minds, I would be more than happy to simplify things.

To solve this problem, I created a `spec['python'].home` attribute that works the same way as `spec['python'].prefix` but queries Python to figure out where it was actually installed. @tgamblin Is there any way to overwrite `spec['python'].prefix`? I think it's currently immutable.

## Command

In general, Python 2 comes with both `python` and `python2` commands, while Python 3 only comes with a `python3` command. But this is up to the OS developers. For example, `/usr/bin/python` on Gentoo is actually Python 3. Worse yet, if someone is using an externally installed Python, all 3 commands may exist in the same directory! Here's what I'm thinking:

If the spec is for Python 3, try searching for the `python3` command.
If the spec is for Python 2, try searching for the `python2` command.
If neither are found, try searching for the `python` command.

## Libraries

Spack installs Python libraries in `spec['python'].prefix.lib`. Except on openSUSE 13, where it installs to `spec['python'].prefix.lib64` (see #2295 and #2253). On my CentOS 6 machine, the Python libraries are installed in `/usr/lib64`. Both need to work.

The libraries themselves change name depending on OS and Python version. For Python 2.7 on macOS, I'm seeing:
```
lib/libpython2.7.dylib
```
For Python 3.6 on CentOS 6, I'm seeing:
```
lib/libpython3.so
lib/libpython3.6m.so.1.0
lib/libpython3.6m.so -> lib/libpython3.6m.so.1.0
```
Notice the `m` after the version number. Yeah, that's a thing.

## Headers

In Python 2.7, I'm seeing:
```
include/python2.7/pyconfig.h
```
In Python 3.6, I'm seeing:
```
include/python3.6m/pyconfig.h
```
It looks like all Python 3 installations have this `m`. Tested with Python 3.2 and 3.6 on macOS and CentOS 6

Spack has really nice support for libraries (`find_libraries` and `LibraryList`), but nothing for headers. Fixed.
2017-04-29 17:24:13 -07:00
Adam J. Stewart
4bfba146d5 Add tests to MakefilePackage (#4039) 2017-04-28 14:55:28 -05:00
Massimiliano Culpo
59ac047996 No compiler found: fixed error message (#4034)
When a compiler was not found a stacktrace was displayed to user because
there were three arguments to be substituted in a string with only two
substitutions to be done.
2017-04-28 08:37:47 -05:00
scheibelp
9a67e95686 Reindex checks install for non-external packages (#4027)
Fixes #4026

#1167 updated Database.reindex to keep old installation records to
support external packages. However, when a user manually removes a
prefix and reindexes this kept the records so the packages were
still installed according to "spack find" etc. This adds a check
for non-external packages to ensure they are properly installed
according to the directory layout.
2017-04-27 15:23:09 -07:00
Adam J. Stewart
0488654f67 Prevent spack test flake8 from making changes (#4023) 2017-04-27 15:18:38 -05:00
Adam J. Stewart
a0ebce0cb3 Remove 'release' suffix from package name (#4014) 2017-04-27 10:11:59 -07:00
Adam J. Stewart
d83ae6dcff Don't print successfully uninstalled twice (#4019) 2017-04-27 10:11:35 -07:00
Todd Gamblin
2d9dac9af0 Fix Python3 issue with sbang checking; add tests. (#4017) 2017-04-27 09:21:35 -07:00
Todd Gamblin
455cae01c2 Convert rest docstrings to Google docstrings. (#3994)
- Sometimes you need something mindless to do.
- Sometimes it can be helpful, as well.
2017-04-27 07:45:34 -07:00
Massimiliano Culpo
a6986312ba pattern: ported to pytest (#4015) 2017-04-27 07:45:04 -07:00
Adam J. Stewart
91b32f67cc Fix alignment of versions and urls in spack checksum (#4003) 2017-04-26 15:55:35 -07:00
Massimiliano Culpo
0403a08509 link_tree: ported to pytest (#4008) 2017-04-26 15:36:35 -07:00
Todd Gamblin
b3ba9bdb37 Add __format__ support to version for fancy formatting. (#3996)
- add Version.__format__ to support new-style formatting.
- Python3 doesn't handle this well -- it delegates to
  object.__format__(), which raises an error for fancy format strings.
- not sure why it doesn't call str(self).__format__ instead, but that's
  hwo things are.
2017-04-26 11:06:34 -07:00
Adam J. Stewart
eaa50d3b7c Add API Docs for lib/spack/llnl (#3982)
* Add API Docs for lib/spack/llnl
* Clean up after previous builds
* Better fix for purging API docs
2017-04-25 22:24:02 -07:00
Adam J. Stewart
11dae722c2 Fix bug with '# noqa' filtering (#3993) 2017-04-25 22:23:01 -07:00
Todd Gamblin
3e508884fa spack flake8 should exempt line-wrapped directives (#3990)
- Omit final paren from regular expressions in cmd/flake8.py
- Allows long directives to be exempted even if they are wrapped.
2017-04-25 12:58:24 -07:00
Massimiliano Culpo
fc9896ed45 hooks take spec as an argument (instead of pkg) (#3967) 2017-04-25 12:54:53 -07:00
Adam J. Stewart
58f2a947db Properly ignore flake8 F811 redefinition errors (#3932)
* Properly ignore flake8 F811 redefinition errors
* Add unit tests for flake8 command
* Allow spack flake8 to work on systems with older git
* Skip flake8 unit tests for Python 2.6 and 3.3
2017-04-25 11:01:25 -07:00
Todd Gamblin
99a8297add Rename tutorial_sc16.rst to tutorial.rst (#3974)
- make the name more generic for posterity.
2017-04-24 15:25:41 -07:00
Adam J. Stewart
c144c88302 Use six.moves.input instead of raw_input (#3961)
* Use six.moves.input instead of raw_input

* Remove comment mentioning raw_input
2017-04-23 10:32:08 -05:00
Massimiliano Culpo
3b52d0a883 External packages are now registered in the DB (#1167)
* treats correctly a change from `explicit=False` to `explicit=True` in an external package DB entry.
* added unit tests
* fixed issues raised by @tgamblin . In particular the PR is no more hash-changing for packages that are not external.
* added a test to check correctness of a spec/yaml round-trip for things that involve an external
* Don't find external module path at each step of concretization
    * it's not necessary.. The paths are retrieved at the end of concretizaion
* Don't find replacements for external packages.
* Test root of the DAG if external
    * No reason not to test if the root of the DAG is external when external
packages are now first class citizens!
* Create `external` property for Spec (for external_path and external_module)
* Allow users to specify external package paths relative to spack
    * Canonicalize external package paths so that users may specify their
locations relative to spack's directory.
* Update tests to use new external_path and external properly.
* skip license hooks on external
2017-04-22 18:06:27 -07:00
Adam J. Stewart
fc8106afe3 Find more versions from GitHub (#3952) 2017-04-22 17:31:22 -05:00
Denis Davydov
94a0cca080 add Intel mpi package and add MPI wrappers to Intel parallel studio (#3905)
* intel-mpi: add new package

* fix hashes

* fix typo

* flake8

* add install

* blank line

* error

* add bin64

* fix MPI wrappers in intel-parallel-studio

* add missing I_MPI_FC

* use shorter hashes
2017-04-22 07:30:51 -05:00
Todd Gamblin
9f0b94b4e1 PythonPackage builds flat installs instead of egg directories.
- Spack doesn't need eggs -- it manages its own directories

- Simplify install layout and reduce sys.path searches by installing all
  packages flat (eggs are deprecated for wheels, and this is also what
  wheels do).

- We now supply the --single-version-externally-managed argument to
  `setup.py install` for setuptools packages and setuptools.

- modify packages to only use setuptools args if setuptools is an
  immediate dependency

- Remove setuptools from packages that do not need it.

  - Some packages use setuptools *only* when certain args (likeb
    'develop' or 'bdist') are supplied to setup.py, and they specifically
    do not use setuptools for installation.

  - Spack never calls setup.py this way, so just removing the setuptools
    dependency works for these packages.
2017-04-21 23:35:02 -07:00
Christoph Junghans
0b002c2911 fetch git submodules recursively (#3779)
* fetch git submodules recursively

This is useful if the submodules have submodules themselves. On
the other hand doing a recursive update doesn't hurt if there
is only one level.

* fetch submodules with depth=1 as well (fix #2190)

* use git submodule with depth only for git>=1.8.4
2017-04-21 21:59:30 -07:00
Todd Gamblin
ead58cbb90 spack uninstall no longer requires a known package. (#3915)
- Spack install would previously fail if it could not load a package for
  the thing being uninstalled.

- This reworks uninstall to handle cases where the package is no longer
  known, e.g.:
    a) the package has been renamed or is no longer in Spack
    b) the repository the package came from is no longer registered in
       repos.yaml
2017-04-21 16:52:44 -07:00
Todd Gamblin
c67f8e4aa1 Fix ABI detection issues with macOS gcc. (#3854)
- gcc on macOS says it's version 4.2.1, but it's really clang, and it's
  actually the *same* clang as the system clang.

- It also doesn't respond with a full path when called with
  --print-file-name=libstdc++.dylib, which is expected from gcc in abi.py.
  Instead, it gives a relative path and _gcc_compiler_compare doesn't
  understand what to do with it.  This results in errors like:

  ```
  lib/spack/spack/abi.py, line 71, in _gcc_get_libstdcxx_version
      libpath = os.readlink(output.strip())
  OSError: [Errno 2] No such file or directory: 'libstdc++.dylib'
  ```

- This commit does two things:

  1. Ignore any gcc that's actually clang in abi.py.  We can probably do
     better than this, but it's not clear there is a need to, since we
     should handle the compiler as clang, not gcc.

  2. Don't auto-detect any "gcc" that is actually clang anymore.  Ignore
     it and expect people to use clang (which is the default macOS
     compiler anyway).

Users can still add fake gccs to their compilers.yaml if they want, but
it's discouraged.
2017-04-21 15:45:12 -07:00
Todd Gamblin
63c3410370 Fix checksumming in Python3; add more fetch tests (#3941)
* Checksum code wasn't opening binary files as binary.

- Fixes Python 3 issue where files are opened as unicode text by default,
  and decoding fails for binary blobs.

* Simplify fetch test parametrization.

* - add tests for URL fetching and checksumming.
- fix coverage on interface functions in FetchStrategy superclass
- add some extra crypto tests.
2017-04-21 15:36:15 -07:00
Adam J. Stewart
5250e8ee89 Fix HPL build, convert to MakefilePackage (#3777)
* Fix HPL build, convert to MakefilePackage

* Flake8 fix

* Fix: spec -> self.spec

* Properly query for system libraries

* Update Intel-MKL as well

* Recurse in system libs, fix MKL path, fixes lapack_libs
2017-04-21 12:11:29 -05:00
Adam J. Stewart
21e4a81de0 Add Napoleon extension to support Google docstrings (#3920) 2017-04-20 08:32:21 -07:00
Todd Gamblin
beeca6bb54 Revert "Override partial installs by default" (#3918)
* Revert "Override partial installs by default (#3530)"

This reverts commit a65c37f15d.
2017-04-20 03:53:41 -07:00
Massimiliano Culpo
50d7b33563 test/python_version.py: ported to pytest (#3438) 2017-04-20 01:18:52 -07:00
scheibelp
a65c37f15d Override partial installs by default (#3530)
* Package install remove prior unfinished installs

Depending on how spack is terminated in the middle of building a
package it may leave a partially installed package in the install
prefix. Originally Spack treated the package as being installed if
the prefix was present, in which case the user would have to
manually remove the installation prefix before restarting an
install. This commit adds a more thorough check to ensure that a
package is actually installed. If the installation prefix is present
but Spack determines that the install did not complete, it removes
the installation prefix and starts a new install; if the user has
enabled --keep-prefix, then Spack reverts to its old behavior.

* Added test for partial install handling

* Added test for restoring DB

* Style fixes

* Restoring 2.6 compatibility

* Relocated repair logic to separate function

* If --keep-prefix is set, package installs will continue an install from an existing prefix if one is present

* check metadata consistency when continuing partial install

* Added --force option to make spack reinstall a package (and all dependencies) from scratch

* Updated bash completion; removed '-f' shorthand for '--force' for install command

* dont use multiple write modes for completion file
2017-04-19 21:59:18 -07:00
Adam J. Stewart
e12f2c1855 Set proper deptypes for certain build systems (#3866)
* Set proper deptypes for certain build systems

* Add depends_on to namespace
2017-04-19 21:33:14 -07:00
Adam J. Stewart
f4858cb7a7 Rework Spack's Mercurial support (#3834)
* Add tests to mercurial package

* Add support for --insecure with mercurial fetching

* Install man pages and tab-completion scripts

* Add tests and latest version for all deps

* Flake8 fix

* Use certifi module to find CA certificate

* Flake8 fix

* Unset PYTHONPATH when running hg

* svn_fetch should use to svn-test, not hg-test

* Drop Python 3 support in Mercurial

Python 3 support is a work in progress and isn't currently
recommended:

https://www.mercurial-scm.org/wiki/SupportedPythonVersions

* Test both secure and insecure hg fetching

* Test both secure and insecure git and svn fetching
2017-04-19 18:59:04 -07:00
Adam J. Stewart
5aa273b319 Fix flake8 changed files detection (#3855) 2017-04-15 11:46:28 -05:00
Adam J. Stewart
bd1beedaf5 Allow users to set parallel jobs in config.yaml (#3812)
* Allow users to set parallel jobs in config.yaml

* Undo change from endash to emdash

* Remove parallel config, rename jobs to build_jobs
2017-04-15 08:31:00 -07:00
Ben Boeckel
6574ec3143 stage: remove a rogue period (#3846) 2017-04-14 17:51:54 -05:00
Adam J. Stewart
bec6d99b15 Add documentation on explicit param for do_install (#3823) 2017-04-14 08:13:14 -07:00
Mario Melara
0405505e21 Quick fix for #3153 (#3822) 2017-04-14 07:56:51 -07:00
Adam J. Stewart
e12e9996e4 Document commands that no longer work (#3781) 2017-04-12 10:46:00 -05:00
Denis Davydov
c9da92dc97 doc: start with known issues section (#3722) 2017-04-10 08:20:57 -05:00
Adam J. Stewart
8e4ada5e99 Make it more clear that version ranges are inclusive (#3759) 2017-04-10 07:25:48 -05:00
Massimiliano Culpo
10c395b2f5 Abinit: a few modernizations for the package and its dependencies (#3699)
* libxc: added libs interface

* hdf5: added libs interface, added conflicts

* abinit: modernized package to use build interface

* netcdf-fortran: added libs interface

* abinit: added version 8.2.2
2017-04-07 11:18:34 +02:00
George Hartzell
84208523f9 set_executable can set S_IX{GRP,OTH} (#3742)
`set_executable` now checks if a user/group.other had read permission
on a file and if it does then it sets the corresponding executable
bit.

See #1483.
2017-04-06 16:25:13 -05:00
Max Katz
a526bcaf11 Correct uninstall -d to uninstall -R in tutorial (#3740)
-d was changed to -R as of PR #1917
2017-04-06 15:44:43 -05:00
Todd Gamblin
715ac8b7e6 Update copyright on the docs. (#3718) 2017-04-05 18:34:17 -07:00
Adam J. Stewart
df150b3e92 spack create MakefilePackage (#3710)
* spack create MakefilePackage

* Change default Perl template to match other build systems
2017-04-05 18:00:42 -05:00
scheibelp
9e50d16f13 Merge pull request #2789 from paulhopkins/features/allow_package_installation_directory_to_be_configured
Allow installation directory layout to be configured
2017-04-05 10:45:11 -07:00
Paul Hopkins
95c3cff6be Allow installation directory layout to be configured using either hash
length parameter or spec formatting.
2017-04-05 12:08:56 +01:00
scheibelp
0038ea84a1 Avoid null reference in arch concretization (#2596)
Fixes #2587

The concretizer falls back on using the root architecture (followed
by the default system architecture) to fill in unspecified arch
properties for a spec. It failed to check cases where the root could
be None.
2017-04-04 15:03:52 -07:00
Massimiliano Culpo
20f388cebd Fixes #3675: Abinit: invalid spec on concretization #(3686) 2017-04-04 07:03:11 -07:00
Justin Cook
508c96d046 Update getting_started.rst (#3685)
Fixed typo referring to .bashrc file
2017-04-04 06:50:44 -05:00
Adam J. Stewart
50df071ad9 Overhaul Spack's URL parsing (#2972)
* Remove fake URLs from Spack

* Ignore long lines for URLs that start with ftp:

* Preliminary changes to version regexes

* New redesign of version regexes

* Allow letters in version-only

* Fix detection of versions that end in Final

* Rearrange a few regexes and add examples

* Add tests for common download repositories

* Add test cases for common tarball naming schemes

* Finalize version regexes

* spack url test -> spack url summary

* Clean up comments

* Rearrange suffix checks

* Use query strings for name detection

* Remove no longer necessary url_for_version functions

* Strip off extraneous information after package name

* Add one more test

* Dot in square brackets does not need to be escaped

* Move renaming outside of parse_name_offset

* Fix versions for a couple more packages

* Fix flake8 and doc tests

* Correctly parse Python, Lua, and Bio++ package names

* Use effective URLs for mfem

* Add checksummed version to mitos

* Remove url_for_version from STAR-CCM+ package

* Revert changes to version numbers with underscores and dashes

* Fix name detection for tbb

* Correctly parse Ruby gems

* Reverted mfem back to shortened URLs.

* Updated instructions for better security

* Remove preferred=True from newest version

* Add tests for new `spack url list` flags

* Add tests for strip_name_suffixes

* Add unit tests for version separators

* Fix bugs related to parseable name but in parseable version

* Remove dead code, update docstring

* Ignore 'binary' at end of version string

* Remove platform from version

* Flip libedit version numbers

* Re-support weird NCO alpha/beta versions

* Rebase and remove one new fake URL

* Add / to beginning of regex to avoid picking up similarly named packages

* Ignore weird tar versions

* Fix bug in url parse --spider when no versions found

* Less strict version matching for spack versions

* Don't rename Python packages

* Be a little more selective, version must begin with a digit

* Re-add fake URLs

* Fix up several other packages

* Ignore more file endings

* Add parsing support for Miniconda

* Update tab completion

* XFAILS are now PASSES for 2 web tests
2017-04-03 15:34:16 -07:00
Massimiliano Culpo
ffef681377 new directive: conflicts() (#3125)
* Add conflicts(<spec>) directive
* openblas: added conflicts for intel@16 refs #3119
* added brief docs and unit tests
2017-04-02 11:40:09 -07:00
Todd Gamblin
0e785e0500 Add epigraph in docs. 2017-04-01 15:32:06 -07:00
Todd Gamblin
221f179716 Add better tests for web.py; fix some bugs found with spidering.
- _spider in web.py was actually failing to spider deeper than a certain
  point.
- Fixed multiprocessing pools to not use daemons and to allow recursive
  spawning.
- Added detailed tests for spidering and for finding archive versions.
- left some xfail URL finding exercises for the reader.
- Fix noqa annotations for some @when decorators
2017-04-01 15:10:45 -07:00
Adam J. Stewart
28d6d375b4 Fix Python 3 support in spack versions
- Add missing import, fixes spack versions in Python 2
- Fix spack versions in Python 3
2017-04-01 15:10:45 -07:00
Kenneth Hoste
fb98f9ee19 fix annoying 'fatal: Not a git repository' error message (#3657)
fix annoying 'fatal: Not a git repository' error message produced by 'spack list' when Spack is not run from a Git repository (#3657)
2017-04-01 03:29:06 -07:00
Gregory Lee
12c1216c34 fix flake8 ignore syntax (use E instead of ignore) (#3651) 2017-03-31 17:51:09 -07:00
Massimiliano Culpo
0c44dd28bb test/package_sanity.py: ported to pytest (#3474) 2017-03-31 13:42:04 -07:00
Massimiliano Culpo
ee7753a597 test/versions.py: ported to pytest (#3635) 2017-03-31 13:41:48 -07:00
Todd Gamblin
a8bcc23fe7 Spack works with Python 3
- Update version guard in spack script to allow python 3
- Update min required version in the docs
2017-03-31 13:40:41 -07:00
Todd Gamblin
3f21f2b088 Clean up tests and add Python3 to Travis.
- Clean up spec_syntax tests: don't dependend on DB order.
- spec_syntax hash parsing tests were strongly dependent on the order the
  DB was traversed.
- Tests now specifically grab the specs they want from the mock DB.
- Tests are more readable as a result.

- Add Python3 versions to Travis tests.
2017-03-31 13:40:41 -07:00
Todd Gamblin
7f3f493024 Fix concretization bugs with virtuals and deptypes.
1. Fix #2807: Can't depend on virtual and non-virtual package

- This is tested by test_my_dep_depends_on_provider_of_my_virtual_dep in
  the concretize.py test.

- This was actually working in the test suite, but it depended on the
  order the dependencies were resolved in. Resolving non-virtual then
  virtual worked, but virtual, then non-virtual did not.

- Problem was that an unnecessary copy was made of a spec that already
  had some dependencies set up, and the copy lost half of some of the
  dependency relationships.  This caused the "can'd depend on X twice
  error".

- Fix by eliminating unnecessary copy and ensuring that dep parameter of
  _merge_dependency is always safe to own -- i.e. it's a defensive copy
  from somewhere else.

2. Fix bug and simplify concretization of deptypes.

- deptypes weren't being accumulated; they were being set on each
  DependencySpec. This could cause concretization to get into an infinite
  loop.

- Fixed by accumulating deptypes in DependencySpec.update_deptypes()

- Also simplified deptype normalization logic: deptypes are now merged in
  constrain() like everything else -- there is no need to merge them
  specially or to look at dpeendents in _merge_dependency().

- Add some docstrings to deptype tests.
2017-03-31 13:40:41 -07:00
Todd Gamblin
fe6f39b662 Use key sorting instead of cmp()
- Get rid of pkgsort() usage for preferred variants.
- Concretization is now entirely based on key-based sorting.
- Remove PreferredPackages class and various spec cmp() methods.
- Replace with PackagePrefs class that implements a key function for
  sorting according to packages.yaml.
- Clear package pref caches on config test.
- Explicit compare methods instead of total_ordering in Version.
- Our total_ordering backport wasn't making Python 3 happy for some
  reason.
- Python 3's functools.total_ordering and spelling the operators out
  fixes the problem.
- Fix unicode issues with spec hashes, json, & YAML
- Try to use str everywhere and avoid unicode objects in python 2.
2017-03-31 13:40:41 -07:00
Todd Gamblin
0cd6555388 Resolve Python2/Python3 unicode issues by using str()
- Remove ascii encoding assumption from spack_yaml
- proc.communicate() returns bytes; convert to str before adding.
- Fix various byte string/unicode issues for Python 2/3 support
- Need to decode subprocess output as utf-8 in from_sourcing_files.
- Fix comments in strify()
2017-03-31 13:40:41 -07:00
Todd Gamblin
1d1a14dbe9 Convert Python 2 idioms to Python 2/3-compatible ones.
- convert print, StringIO, except as, octals, izip
- convert print statement to print function
- convert StringIO to six.StringIO
  - remove usage of csv reader in Spec, in favor of simple regex
  - csv reader only does byte strings
- convert 0755 octal literals to 0o755
- convert `except Foo, e` to `except Foo as e`
- fix a few places `str` is used.
  - may need to switch everything to str later.
- convert iteritems usages to use six.iteritems
- fix urllib and HTMLParser
- port metaclasses to use six.with_metaclass
- More octal literal conversions for Python 2/3
- Fix a new octal literal.
- Convert `basestring` to `six.string_types`
- Convert xrange -> range
- Fix various issues with encoding, iteritems, and Python3 semantics.
- Convert contextlib.nested to explicitly nexted context managers.
- Convert use of filter() to list comprehensions.
- Replace reduce() with list comprehensions.
-  Clean up composite: replace inspect.ismethod() with callable()
- Python 3 doesn't have "method" objects; inspect.ismethod returns False.
- Need to use callable in Composite to make it work.
- Update colify to use future division.
- Fix zip() usages that need to be lists.
- Python3: Use line-buffered logging instead of unbuffered.
- Python3 raises an error with unbuffered I/O
  - See https://bugs.python.org/issue17404
2017-03-31 13:40:41 -07:00
Todd Gamblin
0331b08c64 Update externals to work with Python 3
- Update YAML version to support Python 3
- Python 3 support for ordereddict backport
- Exclude Python3 YAML from version tests.
- Vendor six into Spack.
- Make Python version-check tests work with Python 3
- Add ability to add version check exceptions with '# nopyqver' line
  comments.
2017-03-31 13:40:41 -07:00
Adam J. Stewart
bc404532ea PythonPackage: Let There Be Tests! (#2869)
* Run python setup.py test if --run-tests
* Attempt to import the Python module after installation
* Add testing support to numpy and scipy
* Remove duplicated comments
* Update to new run-tests callback methodology
* Remove unrelated changes for another PR
2017-03-31 13:39:07 -07:00
Michael Kuhn
0d421137f4 Fix mxml (#3639)
mxml is now hosted on GitHub.
2017-03-31 13:41:08 -05:00
Milton Woods
9e43ff821c Extendable Perl (#3614)
* perl: make extendable and add Module::Build package
* perl: allow 'spack create' to identify perl packages from their contents
* perl-module-build: fix indenting of package docstring
* perl: split install() method for extensions into phases
* perl: auto-detect build method (Makefile.PL vs Build.PL) and define a 'check' method
* PerlPackage: use import statements similar to those in AutotoolsPackage
* PerlModule: fix detection of Build.PL
* PerlPackageTemplate: remove extraneous lines to avoid flake8 warnings
* PerlPackageTemplate: split into separate templates for Makefile.PL and Build.PL
* PerlPackage: add cross-references to docstrings
* AutotoolsPackage: fix ambiguous cross-references to avoid errors in doc tests
* PerlbuildPackageTemplate: depend on perl-module-build if Build.PL exists
2017-03-30 16:38:58 -07:00
Todd Gamblin
782f29bc4b Fix bug in spack find for installations with unknown namespaces. (#3573)
- Spack find would fail with "unknown namespace" for some queries when a
  package from an unknown namespace was installed.

- Solve by being conservative: assume unknown packages are NOT providers
  of virtual dependencies.
2017-03-28 08:43:43 -07:00
Todd Gamblin
e549daa8ce Bugfix: allow deactivating installs that don't have packages anymore. (#3572)
- deactivate -a wouldn't work if the installation's package was no longer
  available.

- Fix installed_extensions_for so that it doesn't need to look at the
  package.py file.
2017-03-28 08:43:15 -07:00
Denis Davydov
61d01a71dd make git fetching quite (#3180)
also output repo and branch/commit/tag in one line
2017-03-24 17:37:47 -07:00
Adam J. Stewart
4ecfc39e1e Add Expect package (#3517)
* Add Expect package

* Ignore patches during flake8 tests for package.py files

* Remove controversial changes
2017-03-23 14:35:11 -05:00
George Hartzell
9b5f5fccf0 Fix for find --explicit #3374 (#3492)
This fixes the problem described in #3374, which describes `spack find` ignore explicit/implicit.

I believe that this was broken in #2626.

This restores the behavior of implicit/explicit for me.

I believe that it does not screw anything else up, but ....
2017-03-21 15:30:38 -07:00
scheibelp
19dca26f3a Improve output for compiler commands (#3480)
* Order listed compiler sections

"spack compiler list" output compiler sections in an arbitrary order.
With this commit compiler sections are ordered primarily by compiler
name and then by operating system and target.

* Compiler search lists config files with compilers

If a compiler entry is already defined in a configuration file that
the user does not know about, they may be confused when that compiler
is not added by "spack compiler find". This commit adds a message at
the end of "spack compiler find" to inform the user of the locations
of all config files where compilers are defined.
2017-03-20 12:36:44 -07:00
Matthew LeGendre
5ac6421f14 Fix issue with config.guess patching when the overwritten config.guess did not have write permissions. (#3494) 2017-03-20 12:35:38 -07:00
Todd Gamblin
1297e47463 Use byte-encoded UTF-8 for sourced environment in Python 2 (#3489)
- Fixes recurring errors on develop with unicode commit characters.
- still Python3-proof: python3 will use str instead of bytestrings.
2017-03-18 22:48:20 -07:00
Adam J. Stewart
10b767b93f Don't use @system in packages.yaml (#3472) 2017-03-17 07:55:55 -07:00
scheibelp
0b27a7e13d Detect when OS updates affect compiler selection (#3410)
Fixes #1476

Concretization uses compilers defined in config files and if those
are not available defaults to searching typical paths where the
detected operating system would have a compiler. If there is an OS
update, the detected OS can change; in this case all compilers
defined in the config files would no longer match (because they would
be associated with the previous OS version). The error message in
this case was too vague. This commit adds logic for detecting when it
is likely that the OS has been updated (in particular when that
affects compiler concretization) and improves the information provided
to the user in the error message.
2017-03-16 21:08:13 -07:00
scheibelp
5936ad2ca7 Dont propagate flags between different compilers (#3379)
* Dont propagate flags between different compilers

Fixes #2786

Previously when a spec had no parents with an equivalent compiler,
Spack would default to adding the compiler flags associated with the
root of the DAG. This eliminates that default.

* added test for compiler flag propagation

* simplify compiler flag propagation logic
2017-03-16 21:07:35 -07:00
scheibelp
9a27dec8e8 Dont auto-init compiler conf for 'compiler find' (#3439)
Fixes #3428

Users can run 'spack compiler find' to automatically initialize their
compilers.yaml configuration file. It also turns out that Spack will
implicitly initialize the compilers configuration file as part of
detecting compilers if none are found (so if a user were to attempt to
concretize a spec without running 'spack compiler find' it would not
fail). However, in this case Spack was overlooking its own implicit
initialization of the config files and would report that no new
compilers were found. This commit removes implicit initialization when
the user calls 'spack compiler find'.

This did not surface until #2999 because the 'spack compiler' command
defaulted to using a scope 'user/platform' that was not accounted for
in get_compiler_config (where the implicit initialization logic
predates the addition of this new scope); #2999 removed the scope
specification when checking through config files, leading to the
implicit initialization.
2017-03-16 11:24:34 -07:00
Adam J. Stewart
dca4d2b15e Consistent docs and usage of env mod methods (#3351) 2017-03-14 22:26:44 -07:00
Denis Davydov
560d28ac7f fix automatic mixing of clang with gfortran 6.3.0 on macOS (#3427)
* fix automatic mixing of clang with gfortran 6.3.0 on macOS
* automatically mix any gfortran with any clang on macOS
* adjust the unit test
2017-03-14 09:48:27 -07:00
Massimiliano Culpo
8c3edfd36f test/file_cache.py: ported to pytest (#3429) 2017-03-14 09:07:04 -07:00
Todd Gamblin
d11e262b36 Fix from_sourcing_files(): decode json input as utf-8 (#3433) 2017-03-13 15:52:36 -07:00
Erik Schnetter
63a8f79980 Correct inconsistency in comment (#3414) 2017-03-11 12:52:08 -06:00
Todd Gamblin
e3101808ae Make multimethods work with inheritance. (#3411)
Previously, this would fail with a NoSuchMethodError:

    class Package(object):
        # this is the default implementation
        def some_method(self):
            ...

    class Foo(Package):
        @when('platform=cray')
        def some_method(self):
            ...

        @when('platform=linux')
        def some_method(self):
            ...

This fixes the implementation of `@when` so that the superclass method
will be invoked when no subclass method matches.

Adds tests to ensure this works, as well.
2017-03-11 05:48:36 -08:00
scheibelp
e727f56d89 Features/compiler config consistency (#2999)
* default scope for config command is made consistent with cmd/__init__ default

* dont specify a scope when looking for compilers with a matching spec (since compiler concretization is scope-independent)

* config edit should default to platform-specific file only for compilers

* when duplicate compiler specs are detected, the exception raised now points the user to the files where the duplicates appear

* updated error message to emphasize that a spec is duplicated (since multiple specs can reference the same compiler)

* 'spack compilers' is now also broken down into sections by os and target

* Added tests for new compiler methods
2017-03-10 13:58:48 -08:00
Gregory Lee
604b75c1f9 created elf virtual package and updated dependent packages (#3317)
* created elf virtual package and updated dependent packages
* added `hide_files` context manager to handle moving files.
2017-03-09 10:36:32 -08:00
Massimiliano Culpo
f1d66467e3 package.py: packages dump build dependencies in prefix (#3373)
Modifications:
- `dump_packages` copies build dependencies into `$prefix/.spack`, as well as the link/run dependencies that we already copied there.
- fake installs copy dependency packages into `$prefix/.spack` as well
2017-03-07 07:05:45 -08:00
Massimiliano Culpo
c6d9a45f18 test/environment.py: ported to pytest, added a test on separators (#3375) 2017-03-07 07:03:12 -08:00