Commit graph

94 commits

Author SHA1 Message Date
Todd Gamblin
54f97d1dec
Update copyright on LLNL files for 2018. (#7592) 2018-03-24 12:13:52 -07:00
Massimiliano Culpo
1fb38c9e04
Vendor ordereddict for python2.6 only (#6931)
* Vendor ordereddict for python2.6 only

This commit substitutes the custom module 'ordereddict_backport' with
the more known 'ordereddict' and vendors it only for python 2.6. Other
supported versions of python will use 'collections.OrderedDict'.

* Use absolute imports also for python 2.6

See PEP-328 for more information on the subject

* Added provenance of vendored ordereddict
2018-01-16 07:00:39 +01:00
Todd Gamblin
05fa302655
Replace github.com/llnl/spack with github.com/spack/spack (#6142)
We moved to a new GitHub org! Now make the code and docs reflect that.
2017-11-04 17:08:04 -07:00
Michael Kuhn
84ae7872d3 Update copyright notices for 2017 (#5295) 2017-09-06 17:44:16 -10:00
healther
d6d2dff324 sbang support: add node-js and fix lua
This adds sbang hook support for node-js and fixes the sbang filter
for lua (the character class exclusion was swallowing newlines and
reporting a false positive if lua was mentioned anywhere in the 
file).
2017-08-18 11:57:52 -07:00
Todd Gamblin
cac4362f64 Make LICENSE recognizable by GitHub. (#4598) 2017-06-24 22:22:55 -07:00
Luigi Calori
daa5cf7e73 fix intltool_sbang issue #4191 (#4192)
* fix intltool_sbang issue #4191

* add per dep even if already depending on perl-xml-parser

* adding more comment, properly spaced
2017-06-14 13:24:01 -05: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
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
Todd Gamblin
094d47bff1 Allow user to specify profile sort column on the command line. (#4056)
- Add -P <STAT> argument so that caller can specify a sort column for
  cProfile. Can specify multiple columns with commas. e.g.:
      spack -P cumtime,module

- Add --lines option to Spack spec to control number of profile lines
  displayed

- Sort by time by default (because it works in all Python versions)

- Show sort column options in command help.

- Do a short profile run in the unit tests.
2017-05-01 14:32:33 -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
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
897d0f3f3e Fix unexpected keyword error in Python 2.6 (#2954) 2017-03-03 15:24:44 -06:00
Adam J. Stewart
6158115ca8 Standardize argparse help messages (#2847) 2017-01-26 02:33:01 -08:00
Todd Gamblin
d6390c159f Fix issues related to the switchover to pytest. (#2685)
- Remove stale reference to `import nose` from `bin/spack` script.
- Add `py` to externals (missing dependency for `pytest`)
2016-12-29 11:59:45 -08:00
Massimiliano Culpo
7ea10e768e unit tests: replace nose with pytest (#2502)
* Porting: substitute nose with ytest

This huge commit substitutes nose with pytest as a testing system. Things done here:

* deleted external/nose as it is no longer used
* moved mock resources in their own directory 'test/mock/'
* ported two tests (cmd/find, build_system) to pytest native syntax as an example
* build_environment, log: used monkeypatch instead of try/catch
* moved global mocking of fetch_cache to an auto-used fixture
* moved global mocking from test/__init__.py to conftest.py
* made `spack test` a wrapper around pytest
* run-unit-tests: avoid running python 2.6 tests under coverage to speed them up
* use `pytest --cov` instead of coverage run to cut down testing time

* mock/packages_test: moved mock yaml configuration to files instead of leaving it in the code as string literals

* concretize.py: ported tests to native pytest, reverted multiprocessing in pytest.ini as it was creating the wrong report for coveralls

* conftest.py, fixtures: added docstrings

* concretize_preferences.py: uses fixtures instead of subclassing MockPackagesTest

* directory_layout.py: uses fixtures instead of subclassing MockPackagesTest

* install.py: uses fixtures instead of subclassing MockPackagesTest

* optional_deps.py: uses fixtures instead of subclassing MockPackagesTest

optional_deps.py: uses fixtures instead of subclassing MockPackagesTest

* packages.py: uses fixtures instead of subclassing MockPackagesTest

* provider_index.py: uses fixtures instead of subclassing MockPackagesTest

* spec_yaml.py: uses fixtures instead of subclassing MockPackagesTest

* multimethod.py: uses fixtures instead of subclassing MockPackagesTest

* install.py: now uses mock_archive_url

* git_fetch.py: uses fixtures instead of subclassing MockPackagesTest

* hg_fetch.py: uses fixtures instead of subclassing MockPackagesTest

* svn_fetch.py, mirror.py: uses fixtures instead of subclassing MockPackagesTest
repo.py: deleted

* test_compiler_cmd.py: uses fixtures instead of subclassing MockPackagesTest

* cmd/module.py, cmd/uninstall.py: uses fixtures instead of subclassing MockDatabase

* database.py: uses fixtures instead of subclassing MockDatabase, removed mock/database

* pytest: uncluttering fixture implementations

* database: changing the scope to 'module'

* config.py: uses fixtures instead of subclassing MockPackagesTest

* spec_dag.py, spec_semantics.py: uses fixtures instead of subclassing MockPackagesTest

* stage.py: uses fixtures instead of subclassing MockPackagesTest. Removed mock directory

* pytest: added docstrings to all the fixtures

* pytest: final cleanup

* build_system_guess.py: fixed naming and docstrings as suggested by @scheibelp

* spec_syntax.py: added expected failure on parsing multiple specs closes #1976

* Add pytest and pytest-cov to Spack externals.

* Make `spack flake8` ignore externals.

* run-unit-tests runs spack test and not pytest.

* Remove all the special stuff for `spack test`

- Remove `conftest.py` magic and all the special case stuff in `bin/spack`

- Spack commands can optionally take unknown arguments, if they want to
  handle them.

- `spack test` is now a command like the others.

- `spack test` now just delegates its arguments to `pytest`, but it does
  it by receiving unknown arguments and NOT taking an explicit
  help argument.

* Fix error in fixtures.

* Improve `spack test` command a bit.

- Now supports an approximation of the old simple interface
- Also supports full pytest options if you want them.

* Use external coverage instead of pytest-cov

* Make coverage use parallel-mode.

* change __init__.py docs to include pytest
2016-12-29 07:48:48 -08:00
Todd Gamblin
8496d8ff77 Add a test to ensure package names have the right case. (#2562) 2016-12-13 01:23:40 -08:00
Todd Gamblin
41b8f31bcd Use JSON for the database instead of YAML. (#2189)
* Use JSON for the database instead of YAML.

- JSON is much faster than YAML *and* can preserve ordered keys.
  - 170x+ faster than Python YAML when using unordered dicts
  - 55x faster than Python YAML (both using OrderedDicts)
  - 8x faster than C YAML (with OrderedDicts)

- JSON is built into Python, unlike C YAML, so doesn't add a dependency.
- Don't need human readability for the package database.
- JSON requires no major changes to the code -- same object model as YAML.
- add to_json, from_json methods to spec.

* Add tests to ensure JSON and YAML don't need to be ordered in DB.

* Write index.json first time it's not found instead of requiring reindex.

* flake8 bug.
2016-12-05 10:03:58 -08:00
Matthew Krafczyk
8e6d890a19 -s now includes the file and line number with info
The option -s now causes file and line number information to be printed
along with any invocation of msg, info, etc...

This will greatly ease debugging.
2016-11-16 11:58:36 -05:00
Todd Gamblin
8f21332fec Bugfix: '::' only worked on top-level key in config.
- generalized and fixed to work with any key in YAML file
- simplified schema writing, as well
- add more unit tests for the config system
- Rename test/yaml.py to test/spack_yaml.py
  - Add test/yaml.pyc to ignored pyc files.
2016-10-30 23:55:00 -07:00
Todd Gamblin
d861a52ebe Use cYAML if it is available in Python. (#2010) 2016-10-12 18:25:18 -07:00
Todd Gamblin
488e1bab2c Make insecure option work with curl AND git. (#1786) 2016-10-11 23:13:40 -07:00
Elizabeth Fischer
9aa77178f3 Prohibit Python3 in Python version check. (#1872) 2016-09-28 12:36:25 -04:00
Eric
025b779a30 Fix sbang for perl (#1802)
* Perform shebang fix for all files

* Fix sbang for perl scripts

Otherwise perl would look at the #! line and call sbang again, resulting
in an infinite loop.
2016-09-22 00:43:47 -07:00
Adam J. Stewart
cc7df29e81 Keep dashes in command names, translate to underscores 2016-08-30 15:37:23 -05:00
Adam J. Stewart
ae2a803496 Make subcommands importable, '-' -> '_', fixes #1642 2016-08-30 15:36:33 -05:00
Todd Gamblin
2850ca60be Change spack --profile sort key for 2.6 compatibility. (#1656) 2016-08-29 09:56:54 -07:00
Todd Gamblin
bf1072c902 Make Spack core PEP8 compliant. 2016-08-10 16:33:37 -07:00
Todd Gamblin
ece72e5337 Merge pull request #1030 from opoplawski/external
Remove last two remaining from external imports
2016-06-26 22:41:58 -07:00
Todd Gamblin
27e9bc6d02 Make sbang handle lua
- use --! instead of #! for patched lua scripts.
2016-06-23 00:03:23 -07:00
Orion Poplawski
4952c4c7de Also remove from external from bin/spack 2016-06-08 14:22:26 -06:00
Gregory Becker
a2f90453f4 Fixed backwards compatibility for compilers.yaml config file 2016-05-26 20:30:05 -07:00
Todd Gamblin
e7ced54369 Correct LLNL LGPL license template for clarity. 2016-05-11 21:22:25 -07:00
alalazo
80678b2188 fix : proper update of config file (before it was discarding architectures that were not the current one) fixes #774 2016-04-12 16:54:51 +02:00
Todd Gamblin
fc6aa7374a Fix #104, #54: issues with overlong shebang in deep directories.
This does several things:

- Add `sbang`: a script to run scripts with long shebang lines.
  - Documentation for `sbang` is in `bin/sbang`.

- Add an `sbang` hook that filters the `bin` directory after install
  and modifies any scripts wtih shebangs that are too long to use
  `sbang` instead.

- `sbang` is at the top level, so it should be runnable (not much we
  can do if spack itself is too deep for shebang)
  - `sbang`, when used as the interpreter, runs the *second* shebang
    line it finds in a script.
  - shoud fix issues with too long shebang paths.
2016-03-05 04:18:48 -08:00
Adam J. Stewart
323bba99f1 Fix variable name bug 2016-01-25 09:29:51 -06:00
Todd Gamblin
8d6342c53d Merge branch 'mplegendre-multi_pkgsrc_roots' into develop
- This moves var/spack/packages to var/spack/repos/builtin/packages.

- Packages that did not exist in the source branch, or were changed in
  develop, were moved into var/spack/repos/builtin/packages as part of
  the integration.

Conflicts:
	lib/spack/spack/test/unit_install.py
	var/spack/repos/builtin/packages/clang/package.py
2016-01-19 01:16:08 -08:00
Todd Gamblin
c1e57e49ae Merge pull request #202 from scheibelp/features/unittest-xml-output-nose
Features/unittest xml output nose
2016-01-17 19:14:49 -08:00
Todd Gamblin
c65fd3a289 Merge branch 'develop' into mplegendre-multi_pkgsrc_roots
Conflicts:
	lib/spack/spack/cmd/create.py
	lib/spack/spack/cmd/extensions.py
	lib/spack/spack/cmd/fetch.py
	lib/spack/spack/cmd/uninstall.py
	lib/spack/spack/config.py
	lib/spack/spack/database.py
	lib/spack/spack/directory_layout.py
	lib/spack/spack/packages.py
	lib/spack/spack/spec.py
2015-12-25 16:35:55 -08:00
Mike Nolta
61f07b0c4d fix a few comment typos 2015-12-21 19:24:16 -05:00
Gregory L. Lee
107c0dd1a8 added option to enable pdb debug 2015-12-16 15:54:15 -08:00
Todd Gamblin
c41b9b7ddc Change github.com/scalability-llnl to github.com/llnl everywhere. 2015-12-09 01:24:15 -08:00
Peter Scheibel
b98b612204 Try to be more careful to only suppress the warning about nose already being
imported. Other warnings should be output.
2015-12-02 18:10:28 -08:00
Todd Gamblin
a338e0efd5 Fix spack.db -> spack.repo in bin/spack 2015-11-28 16:21:31 -08:00
Peter Scheibel
c5ed7e2a15 On systems which have already installed nose (perhaps an older version)
importing nose (which is also in Spack's external/ directory) outputs a warning
(since there is more than one nose package). This avoids printing the warning
to the user.
2015-11-25 18:33:52 -08:00
Todd Gamblin
894fcd90e7 Add a fix/warning so that stale .pyc files don't kill Spack.
- Can't think of a better way to do this.
- The externals integration will cause spack to die in weird ways for
  users who just pull from develop.
2015-11-23 17:49:39 -08:00
Todd Gamblin
55662eca69 Merge branch 'develop' into mplegendre-multi_pkgsrc_roots
Conflicts:
	lib/spack/spack/__init__.py
	lib/spack/spack/directives.py
	lib/spack/spack/packages.py
2015-11-12 15:16:06 -08:00
Peter Scheibel
6d7b26d4e0 Insert lib/spack/external into sys.path. This avoids cases where the system
python install and lib/spack/external have the same library installed. This
requires modifying the names of some modules in lib/spack/external in cases
where both the system python and backported features of future python versions
(i.e. after 2.6) are used (previously distinguished by "from external import X"
and "import X").
2015-11-11 18:04:22 -08:00
Todd Gamblin
58c5373890 update warning message for spack -k.
- warning said it didn't do checksums; really does.
2015-10-08 00:14:44 -07:00