{"action":"created","issue":{"url":"https://api.github.com/repos/LLNL/spack/issues/552","repository_url":"https://api.github.com/repos/LLNL/spack","labels_url":"https://api.github.com/repos/LLNL/spack/issues/552/labels{/name}","comments_url":"https://api.github.com/repos/LLNL/spack/issues/552/comments","events_url":"https://api.github.com/repos/LLNL/spack/issues/552/events","html_url":"https://github.com/LLNL/spack/pull/552","id":141010681,"number":552,"title":"enhancement proposal : customization of module files ","user":{"login":"alalazo","id":4199709,"avatar_url":"https://avatars.githubusercontent.com/u/4199709?v=3","gravatar_id":"","url":"https://api.github.com/users/alalazo","html_url":"https://github.com/alalazo","followers_url":"https://api.github.com/users/alalazo/followers","following_url":"https://api.github.com/users/alalazo/following{/other_user}","gists_url":"https://api.github.com/users/alalazo/gists{/gist_id}","starred_url":"https://api.github.com/users/alalazo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alalazo/subscriptions","organizations_url":"https://api.github.com/users/alalazo/orgs","repos_url":"https://api.github.com/users/alalazo/repos","events_url":"https://api.github.com/users/alalazo/events{/privacy}","received_events_url":"https://api.github.com/users/alalazo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2016-03-15T15:36:06Z","updated_at":"2016-03-21T22:38:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/LLNL/spack/pulls/552","html_url":"https://github.com/LLNL/spack/pull/552","diff_url":"https://github.com/LLNL/spack/pull/552.diff","patch_url":"https://github.com/LLNL/spack/pull/552.patch"},"body":"##### Objective \r\nBeing able to customize what gets written in a module file\r\n\r\n##### TLDR\r\nCurrently the modifications that gets written in a module file are:\r\n\r\n- generic modifications to some list of paths in the environment\r\n\r\nThese modifications are obtained inspecting `pkg.prefix` according to the same set of rules for every package. I would like to extend this process allowing:\r\n\r\n- package-specific modifications to the environment (this PR)\r\n- site-specific modifications via a configuration file (a subsequent PR)\r\n\r\n##### Current Status\r\n- [x] class that manages environment modifications during both installation and module file creation (module + unit tests)\r\n- [x] environment variables set in a package are written to tcl or dotkit module files\r\n- [x] polished the interface that package maintainers will need to use\r\n- [x] validation of environment modifications (i.e. detect conflicting changes to the same variable issued by different packages)\r\n\r\n##### Examples of use\r\n1. `openmpi` and `mpich` packages in this PR set the environment variables for compiler wrappers differently depending on whether they are used as a dependency during an installation or outside of spack via module files\r\n\r\n##### Details\r\nThe biggest change done in this PR is the introduction of a class (`EnvironmentModifications`) to manage environment modifications both during install and module file creation. An object of this class is essentially a FIFO queue containing requests to modify the environment. Those requests can be executed at a later time and from a scope other than where they were created (in which case the environment is modified and the list is cleared.) \r\n\r\nAlternatively the requests can be inspected and processed. This is what is done during module file creation when each module file writer (`TclModule`, `Dotkit`) maps each single request to a formatted line and writes that line to a file.\r\n\r\nAn interesting side effect of this design is the possibility to inspect the whole set of requests done by different packages before applying them. This could permit to reveal inconsistencies (e.g.  variables that are set by a package and unset by another) and output diagnostic messages to the user."},"comment":{"url":"https://api.github.com/repos/LLNL/spack/issues/comments/199520098","html_url":"https://github.com/LLNL/spack/pull/552#issuecomment-199520098","issue_url":"https://api.github.com/repos/LLNL/spack/issues/552","id":199520098,"user":{"login":"tgamblin","id":299842,"avatar_url":"https://avatars.githubusercontent.com/u/299842?v=3","gravatar_id":"","url":"https://api.github.com/users/tgamblin","html_url":"https://github.com/tgamblin","followers_url":"https://api.github.com/users/tgamblin/followers","following_url":"https://api.github.com/users/tgamblin/following{/other_user}","gists_url":"https://api.github.com/users/tgamblin/gists{/gist_id}","starred_url":"https://api.github.com/users/tgamblin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgamblin/subscriptions","organizations_url":"https://api.github.com/users/tgamblin/orgs","repos_url":"https://api.github.com/users/tgamblin/repos","events_url":"https://api.github.com/users/tgamblin/events{/privacy}","received_events_url":"https://api.github.com/users/tgamblin/received_events","type":"User","site_admin":false},"created_at":"2016-03-21T22:38:38Z","updated_at":"2016-03-21T22:38:38Z","body":"@alalazo: awesome!  So is this one ready to be merged?"}}