Commit graph

5246 commits

Author SHA1 Message Date
Todd Gamblin
1903e45eec refactor: convert spack.solver.asp.solve() to a class
The solver has a lot of configuration associated with it. Rather
than adding arguments to everything, we should encapsulate that
in a class. This is the start of that work; it replaces `solve()`
and its kwargs with a class and properties.
2022-02-16 10:17:18 -08:00
Mark W. Krentel
87a3b72ef0
Add 'stable' to the list of infinity version names. (#28772)
* Add 'stable' to the list of infinity version names.
Rename libunwind 1.5-head to 1.5-stable.

* Add stable to the infinite version list in packaging_guide.rst.
2022-02-16 09:08:51 -08:00
Adam J. Stewart
3c1b2c0fc9
find_libraries: search for both .so and .dylib on macOS (#28924) 2022-02-16 14:07:44 +01:00
Stephen Sachs
79f22423b8
intel compiler: fix link time error with LLVMgold.so (#28731)
The Intel compiler will, at link time, call `ld -plugin LLVMgold.so`, which
expects libraries like `libimfo.so` to be found either in the `LD_LIBRARY_PATH` or
in `LLVMgold.so`s RPATH.

As `LLVMgold.so` already uses RUNPATH, I used that to extend this to the
necessary library locations.

This PR should fix issues:
https://github.com/spack/spack/issues/10308
https://github.com/spack/spack/issues/18606
https://github.com/spack/spack/issues/17100
https://github.com/spack/spack/issues/21237
https://github.com/spack/spack/issues/4261

Co-authored-by: Stephen Sachs <stesachs@amazon.com>
2022-02-15 17:47:29 +00:00
Harmen Stoppels
cebe4fdf1d
Make spack -e [env] spec show environment root specs (#25941) 2022-02-15 09:42:05 -08:00
Harmen Stoppels
55996d3ad4
Unalias despacktivate only when alias exists (#28939) 2022-02-15 16:21:19 +01:00
Seth R. Johnson
08cad7d0ee
darwin: make sure MACOSX_DEPLOYMENT_TARGET has a minor component (#28926) 2022-02-15 05:50:22 +00:00
Danny McClanahan
e8838109d8
move typing_extensions.py back into typing.py =\ (#28549) 2022-02-11 09:52:01 -08:00
Seth R. Johnson
2fa6cd6d23
macOS: always set MACOSX_DEPLOYMENT_TARGET (#28797)
* core: Make platform environment an instance not class method

In preparation for accessing data constructed in __init__.

* macos: set consistent macosx deployment target

This should silence numerous warnings from mixed gcc/macos toolchains.

* perl: prevent too-new deployment target version

```
*** Unexpected MACOSX_DEPLOYMENT_TARGET=11
***
*** Please either set it to a valid macOS version number (e.g., 10.15) or to empty.
```

* Stylin'

* Add deployment target overrides to failing autoconf packages

* Move configure workaround to base autoconf package

This reverts commit 3c119eaf8b4fb37c943d503beacf5ad2aa513d4c.

* Stylin'

* macos: add utility functions for SDK

These aren't yet used but should probably be added to spack debug
report.
2022-02-10 23:22:30 +00:00
Massimiliano Culpo
e6e109cbc5
ASP-based solver: reduce input facts and add heuristic (#28848)
* Remove node_target_satisfies/3 in favor of target_satisfies/2

When emitting input facts we don't need to couple target with
packages, but we can emit fewer facts independently and let
the grounder combine them.

* Remove compiler_version_satisfies/4 in favor of compiler_version_satisfies/3

When emitting input facts we don't need to couple compilers with
packages, but we can emit fewer facts independently and let
the grounder combine them.

* Introduce heuristic in the ASP-program

With heuristic we can drive clingo to make better
initial guesses, which lead to fewer choices and
conflicts in the overall solve
2022-02-10 11:37:10 -08:00
Seth R. Johnson
92b26257f4
Fix CMakePackage.define for libs/headers (#28838)
The 'libs' property returned by a spec is not a list nor tuple.

Closes #28836.
2022-02-10 13:43:22 +00:00
Greg Becker
130354b867
spack audit: fix spurious failures for target/platform conflicts (#28860) 2022-02-10 09:10:23 +01:00
Tamara Dahlgren
36ef59bc67
Tests: move has_test_method to spack.package (#28813) 2022-02-09 22:27:48 -08:00
Massimiliano Culpo
549c785227
Detecting "Cray" as "linux" during bootstrap (#28726)
* bootstrap: avoid detecting "Cray" and treat the platform as "linux"

* bootstrap: create a proper context manager to disable cray
2022-02-09 17:41:11 -05:00
Stephen Sachs
14902a5821
intel-mkl: BLACS with intel-oneapi-mpi (#28476)
Identify the correct BLACS libaries when `intel-oneapi-mpi` is used.
2022-02-07 13:26:20 +01:00
Jordan Galby
37ae4c0fdb
Support config variables in config.yaml extensions paths (#17772) 2022-02-07 11:40:52 +01:00
Harmen Stoppels
73077f3a67
database: fix reindex with uninstalled deps (#28764)
* Fix reindex with uninstalled deps

When a prefix of a dep is removed, and the db is reindexed, it is added
through the dependent, but until now it incorrectly listed the spec as
'installed'.

There was also some questionable behavior in the db when the same spec
was added multiple times, it would always be marked installed.

* Always reserve path

* Only add installed spec's prefixes to install prefixes set

* Improve warning, and ensure ensure only ensures

* test: reindex with every file system remnant removed except for the old index; it should give a database with nothing installed, including records with installed==False,external==False,ref_count==0,explicit=True, and these should be removable from the database
2022-02-04 19:31:39 +00:00
Massimiliano Culpo
5881a03408
Use Spec.constrain to construct spec lists for stacks (#28783)
* stacks: add regression tests for matrix expansion

* Use constrain semantics to construct spec lists for stacks

* Fix semantics for constraining an anonymous spec. Add tests
2022-02-04 19:17:23 +00:00
Massimiliano Culpo
cd04109e17
Add a "sticky" property to variants (#28630)
* Add sticky variants

* Add unit tests for sticky variants

* Add documentation for sticky variants

* Revert "Revert 19736 because conflicts are avoided by clingo by default (#26721)"

This reverts commit 33ef7d57c1.

* Add stickiness to "allow-unsupported-compiler"
2022-02-02 10:05:24 -08:00
Harmen Stoppels
b93b64ca67
TermStatusLine: fix python 2.7 and add test (#28715)
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2022-02-01 21:59:29 +01:00
Massimiliano Culpo
bc06c1206d
macholib, altgraph: update vendored dependency (#28664) 2022-01-28 10:55:12 -08:00
Massimiliano Culpo
3cf5df7e3b
Ensure "spack unit-test" can bootstrap clingo (#28572) 2022-01-26 14:19:15 +01:00
Harmen Stoppels
e3d62b2f7b
Print 'Waiting for another process to install x, y, z' in distributed builds (#28535)
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2022-01-26 10:42:08 +01:00
Adam J. Stewart
947c270446
Resource stage: no space before colon (#28560) 2022-01-24 10:01:28 +01:00
Jordan Galby
b526eafa45
Fix spack -C command_line_scope with other flags (#28418)
The option `spack -C` was broken if another flag that touched config was
also set (`spack -C ... -d`, `-c config:...` etc...).
2022-01-23 11:02:13 +01:00
Danny McClanahan
0c2de252f1
introduce llnl.util.compat to remove sys.version_info checks (#21720)
- also split typing.py into typing_extensions and add py2 shims
2022-01-21 12:32:52 -08:00
Bram Veenboer
bd43467cbf
CUDA: add v11.6.0 (#28439) 2022-01-21 11:08:20 +00:00
Danny McClanahan
645b40b249
add six.raise_from() to preserve exception traceback (#28532)
* add six.raise_from() to preserve exception traceback

* add tests for code coverage
2022-01-21 00:24:12 -08:00
Adam J. Stewart
22426f17d1
SIPPackage: fix build system (#28447) 2022-01-19 12:35:46 +01:00
Logan Harbour
9723d918bb
spack compiler info exit 1 when no compilers are found (#28493)
fixes #28492
2022-01-19 11:50:15 +01:00
Harmen Stoppels
e72f87ec64
Switch lmod default all:autoload from none to direct (#28357)
* Switch lmod module all autoload default from none to direct

* Fix the docs
2022-01-18 09:06:41 -08:00
Tamara Dahlgren
f238835b65
is_system_path: return False if path is None (#28403) 2022-01-17 08:44:10 -07:00
Todd Gamblin
93377942d1 Update copyright year to 2022 2022-01-14 22:50:21 -08:00
Todd Gamblin
e3527983ac spack license update-copyright-year now updates the LICENSE-MIT file
`spack license update-copyright-year` was updating license headers but not the MIT
license file. Make it do that and add a test.

Also simplify the way we bump the latest copyright year so that we only need to
update it in one place.
2022-01-14 22:50:21 -08:00
Adam J. Stewart
3540f8200a
PythonPackage: install packages with pip (#27798)
* Use pip to bootstrap pip

* Bootstrap wheel from source

* Update PythonPackage to install using pip

* Update several packages

* Add wheel as base class dep

* Build phase no longer exists

* Add py-poetry package, fix py-flit-core bootstrapping

* Fix isort build

* Clean up many more packages

* Remove unused import

* Fix unit tests

* Don't directly run setup.py

* Typo fix

* Remove unused imports

* Fix issues caught by CI

* Remove custom setup.py file handling

* Use PythonPackage for installing wheels

* Remove custom phases in PythonPackages

* Remove <phase>_args methods

* Remove unused import

* Fix various packages

* Try to test Python packages directly in CI

* Actually run the pipeline

* Fix more packages

* Fix mappings, fix packages

* Fix dep version

* Work around bug in concretizer

* Various concretization fixes

* Fix gitlab yaml, packages

* Fix typo in gitlab yaml

* Skip more packages that fail to concretize

* Fix? jupyter ecosystem concretization issues

* Solve Jupyter concretization issues

* Prevent duplicate entries in PYTHONPATH

* Skip fenics-dolfinx

* Build fewer Python packages

* Fix missing npm dep

* Specify image

* More package fixes

* Add backends for every from-source package

* Fix version arg

* Remove GitLab CI stuff, add py-installer package

* Remove test deps, re-add install_options

* Function declaration syntax fix

* More build fixes

* Update spack create template

* Update PythonPackage documentation

* Fix documentation build

* Fix unit tests

* Remove pip flag added only in newer pip

* flux: add explicit dependency on jsonschema

* Update packages that have been added since this was branched off of develop

* Move Python 2 deprecation to a separate PR

* py-neurolab: add build dep on py-setuptools

* Use wheels for pip/wheel

* Allow use of pre-installed pip for external Python

* pip -> python -m pip

* Use python -m pip for all packages

* Fix py-wrapt

* Add both platlib and purelib to PYTHONPATH

* py-pyyaml: setuptools is needed for all versions

* py-pyyaml: link flags aren't needed

* Appease spack audit packages

* Some build backend is required for all versions, distutils -> setuptools

* Correctly handle different setup.py filename

* Use wheels for py-tomli to avoid circular dep on py-flit-core

* Fix busco installation procedure

* Clarify things in spack create template

* Test other Python build backends

* Undo changes to busco

* Various fixes

* Don't test other backends
2022-01-14 12:37:57 -06:00
Adam J. Stewart
e0f044561e
Python: improve site_packages_dir handling (#28346)
* Python: improve site_packages_dir handling

* Replace all site_packages_dir with purelib/platlib
2022-01-13 20:11:16 -06:00
Harmen Stoppels
d74396ad21
Do not initialize config on spack compiler list (#28042)
When `spack compiler list` is run without being restricted to a
particular scope, and no compilers are found, say that none are 
available, and hint that the use should run spack compiler find to 
auto detect compilers.

* Improve docs
* Check if stdin is a tty
* add a test
2022-01-12 16:26:28 +00:00
Massimiliano Culpo
91fc4cf28f
bootstrap: fix bootstrapping GnuPG from different macOS versions (#28350) 2022-01-12 08:18:16 -08:00
Todd Gamblin
54d741ba54 unparser: handle package-level loops, if statements, and with blocks
Many packages implement logic at the class level to handle complex dependencies and
conflicts. Others have started using `with when("@1.0"):` blocks since we added that
capability. The loops and other control logic can cause some pure directive logic not to
be removed by our package hashing logic -- and in many cases that's a lot of code that
will cause unnecessary rebuilds.

This commit changes the unparser so that it will descend into these blocks. Specifically:

  1. Descend into loops, if statements, and with blocks at the class level.
  2. Don't look inside function definitions (in or outside a class).
  3. Don't look at nested class definitions (they don't have directives)
  4. Add logic to *remove* empty loops/with blocks/if statements if all directives
     in them were removed.

This allows our package hash to ignore a lot of pure metadata that it was not ignoring
before, and makes it less sensitive.

In addition, we add `maintainers` and `tags` to the list of metadata attributes that
Spack should remove from packages when constructing canonoical source for a package
hash.

- [x] Make unparser handle if/for/while/with at class level.
- [x] Add tests for control logic removal.
- [x] Add a test to ensure that all packages are not only unparseable, but also
      that their canonical source is still compilable. This is a test for
      our control logic removal.
- [x] Add another unparse test package that has complex logic.
2022-01-12 06:14:18 -08:00
Todd Gamblin
101f080138 unparser: add unparser unit tests
These are the unit tests from astunparse, converted to pytest, with a few backports from
upstream cpython. These should hopefully keep `unparser.py` well covered as we change it.
2022-01-12 06:14:18 -08:00
Todd Gamblin
4d7226832d unparser: rename t to node to mirror upstream
These refactors have happened in upstream `ast.unparse()`
2022-01-12 06:14:18 -08:00
Todd Gamblin
0370324f1f unparser: rename _Class() methods to visit_Class() to mirror upstream
These are refactors that have happened in upstream `ast.unparse()`
2022-01-12 06:14:18 -08:00
Todd Gamblin
ec16c2d7c2 unparser: do a better job of roundtripping strings
Handle complex f-strings.  Backport of:

    a993e901eb#
2022-01-12 06:14:18 -08:00
Todd Gamblin
e9612696fd unparser: treat print(a, b, c) and print((a, b, c)) the same
We can't tell `print(a, b, c)` and `print((a, b, c))` apart -- both of these expressions
generate different ASTs in Python 2 and Python 3.  However, we can decide that we don't
care.  This commit treats both of them the same when `py_ver_consistent` is set with
`unparse()`.

This means that the package hash won't notice changes from printing a tuple to printing
multiple values, but we don't care, because this is extremely unlikely to affect the build.
More than likely this is just an error message for the user of the package.

- [x] treat `print(a, b, c)` and `print((a, b, c))` the same in py2 and py3
- [x] add another package parsing test -- legion -- that exercises this feature
2022-01-12 06:14:18 -08:00
Todd Gamblin
a18a0e7a47 commands: add spack pkg source and spack pkg hash
To make it easier to see how package hashes change and how they are computed, add two
commands:

* `spack pkg source <spec>`: dumps source code for a package to the terminal

* `spack pkg source --canonical <spec>`: dumps canonicalized source code for a
   package to the terminal. It strips comments, directives, and known-unused
   multimethods from the package. It is used to generate package hashes.

* `spack pkg hash <spec>`: This gives the package hash for a particular spec.
  It is generated from the canonical source code for the spec.

- [x] `add spack pkg source` and `spack pkg hash`
- [x] add tests
- [x] fix bug in multimethod resolution with boolean `@when` values

Co-authored-by: Greg Becker <becker33@llnl.gov>
2022-01-12 06:14:18 -08:00
Todd Gamblin
106ae7abe6 package_hash: switch to using canonical source instead of AST repr
We are planning to switch to using full hashes for Spack specs, which means that the
package hash will be included in the deployment descriptor. This means we need a more
robust package hash than simply dumping the `repr` of the AST.

The AST repr that we previously used for package content is unreliable because it can
vary between python versions (Python's AST actually changes fairly frequently).

- [x] change `package_hash`, `package_ast`, and `canonical_source` to accept a string for
      alternate source instead of a filename.
- [x] consolidate package hash tests in `test/util/package_hash.py`.
- [x] remove old `package_content` method.
- [x] make `package_hash` do what `canonical_source_hash` was doing before.
- [x] modify `content_hash` in `package.py` to use the new `package_hash` function.

Co-authored-by: Danny McClanahan <1305167+cosmicexplorer@users.noreply.github.com>
2022-01-12 06:14:18 -08:00
Todd Gamblin
39afe946a0 unparser: Don't omit parenthesis when unparsing a slice
Backport of
  c102a14825

Includes support for Python 2.
2022-01-12 06:14:18 -08:00
Todd Gamblin
0776c3b4d6 unparser: Don't put unnecessary parentheses on class declarations
Backport of
* 25160cdc47
2022-01-12 06:14:18 -08:00
Todd Gamblin
ff5e73d6eb package_hash: add test to ensure that every package in Spack can be unparsed
- [x] add option to canonical source to *not* filter multimethods
- [x] add test to unparse every package in builtin
2022-01-12 06:14:18 -08:00
Todd Gamblin
b6dde510bd package_hash: add test to ensure consistency across Python versions
Our package hash is supposed to be consistent from python version to python version.
Test this by adding some known unparse inputs and ensuring that they always have the
same canonical hash.  This test relies on the fact that we run Spack's unit tests
across many python versions.  We can't compute for several python versions within the
same test run so we precompute the hashes and check them in CI.
2022-01-12 06:14:18 -08:00