{"action":"created","comment":{"url":"https://api.github.com/repos/LLNL/spack/pulls/comments/77447764","id":77447764,"diff_hunk":"@@ -440,35 +444,154 @@ def fix_darwin_install_name(path):\n                         stdout=subprocess.PIPE).communicate()[0]\n                     break\n \n+# Utilities for libraries\n \n-def to_lib_name(library):\n-    \"\"\"Transforms a path to the library /path/to/lib<name>.xyz into <name>\n+\n+class LibraryList(collections.Sequence):\n+    \"\"\"Sequence of absolute paths to libraries\n+\n+    Provides a few convenience methods to manipulate library paths and get\n+    commonly used compiler flags or names\n     \"\"\"\n-    # Assume libXYZ.suffix\n-    return os.path.basename(library)[3:].split(\".\")[0]\n \n+    def __init__(self, libraries):\n+        self.libraries = list(libraries)\n \n-def to_link_flags(library):\n-    \"\"\"Transforms a path to a <library> into linking flags -L<dir> -l<name>.\n+    @property\n+    def directories(self):\n+        \"\"\"Stable de-duplication of the directories where the libraries\n+        reside\n \n-    Return:\n-      A string of linking flags.\n-    \"\"\"\n-    dir  = os.path.dirname(library)\n-    name = to_lib_name(library)\n-    res = '-L%s -l%s' % (dir, name)\n-    return res\n+        >>> l = LibraryList(['/dir1/liba.a', '/dir2/libb.a', '/dir1/libc.a'])\n+        >>> assert l.directories == ['/dir1', '/dir2']\n+        \"\"\"\n+        return list(dedupe(\n+            os.path.dirname(x) for x in self.libraries if os.path.dirname(x)\n+        ))\n+\n+    @property\n+    def libnames(self):\n+        \"\"\"Stable de-duplication of the base-names in the list\n+\n+        >>> l = LibraryList(['/dir1/liba.a', '/dir2/libb.a', '/dir3/liba.a'])\n+        >>> assert l.libnames == ['liba.a', 'libb.a']\n+        \"\"\"\n+        return list(dedupe(os.path.basename(x) for x in self.libraries))\n+\n+    @property\n+    def names(self):\n+        \"\"\"Stable de-duplication of library names in the list\n+\n+        >>> l = LibraryList(['/dir1/liba.a', '/dir2/libb.a', '/dir3/liba.so'])\n+        >>> assert l.names == ['a', 'b']\n+        \"\"\"\n+        return list(dedupe(x.split('.')[0][3:] for x in self.libnames))\n+\n+    @property\n+    def search_flags(self):\n+        \"\"\"Search flags for the libraries\n+\n+        >>> l = LibraryList(['/dir1/liba.a', '/dir2/libb.a', '/dir1/liba.so'])\n+        >>> assert l.search_flags == '-L/dir1 -L/dir2'\n+        \"\"\"\n+        return ' '.join(['-L' + x for x in self.directories])\n+\n+    @property\n+    def link_flags(self):\n+        \"\"\"Link flags for the libraries\n \n+        >>> l = LibraryList(['/dir1/liba.a', '/dir2/libb.a', '/dir1/liba.so'])\n+        >>> assert l.search_flags == '-la -lb'\n+        \"\"\"\n+        return ' '.join(['-l' + name for name in self.names])\n \n-def find_library_path(libname, *paths):\n-    \"\"\"Searches for a file called <libname> in each path.\n+    @property","path":"lib/spack/llnl/util/filesystem.py","position":148,"original_position":148,"commit_id":"cb8882bb676550c9b27688c86399553f117245c1","original_commit_id":"cb8882bb676550c9b27688c86399553f117245c1","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},"body":"Do you think it's necessary ? I thought the line below was quite self explanatory : \r\n```\r\nself.search_flags + ' ' + self.link_flags\r\n```","created_at":"2016-09-04T06:59:57Z","updated_at":"2016-09-04T06:59:57Z","html_url":"https://github.com/LLNL/spack/pull/1682#discussion_r77447764","pull_request_url":"https://api.github.com/repos/LLNL/spack/pulls/1682","_links":{"self":{"href":"https://api.github.com/repos/LLNL/spack/pulls/comments/77447764"},"html":{"href":"https://github.com/LLNL/spack/pull/1682#discussion_r77447764"},"pull_request":{"href":"https://api.github.com/repos/LLNL/spack/pulls/1682"}}},"pull_request":{"url":"https://api.github.com/repos/LLNL/spack/pulls/1682","id":83501747,"html_url":"https://github.com/LLNL/spack/pull/1682","diff_url":"https://github.com/LLNL/spack/pull/1682.diff","patch_url":"https://github.com/LLNL/spack/pull/1682.patch","issue_url":"https://api.github.com/repos/LLNL/spack/issues/1682","number":1682,"state":"open","locked":false,"title":"Reworking of `lapack_shared_libs` and similar properties","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},"body":"Fixes #1670 \r\n\r\n#### Modifications\r\n\r\n- [x] added class `LibraryList` + unit tests\r\n- [x] added convenience functions `find_libraries` and `dedupe`\r\n- [x] modifed non Intel blas/lapack providers to not use `setup_dependent_package` and define properties instead\r\n- [x] modified packages using blas_shared_libs and similar functions\r\n- [x] updated `intel-parallel-studio` and `mkl`\r\n- [x] updated variants in `atlas`","created_at":"2016-08-31T18:10:59Z","updated_at":"2016-09-04T06:59:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2f50b9f71466f55445d699faaede5f386acb2ca1","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/LLNL/spack/pulls/1682/commits","review_comments_url":"https://api.github.com/repos/LLNL/spack/pulls/1682/comments","review_comment_url":"https://api.github.com/repos/LLNL/spack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/LLNL/spack/issues/1682/comments","statuses_url":"https://api.github.com/repos/LLNL/spack/statuses/cb8882bb676550c9b27688c86399553f117245c1","head":{"label":"epfl-scitas:features/share_lib_as_iterables","ref":"features/share_lib_as_iterables","sha":"cb8882bb676550c9b27688c86399553f117245c1","user":{"login":"epfl-scitas","id":14820957,"avatar_url":"https://avatars.githubusercontent.com/u/14820957?v=3","gravatar_id":"","url":"https://api.github.com/users/epfl-scitas","html_url":"https://github.com/epfl-scitas","followers_url":"https://api.github.com/users/epfl-scitas/followers","following_url":"https://api.github.com/users/epfl-scitas/following{/other_user}","gists_url":"https://api.github.com/users/epfl-scitas/gists{/gist_id}","starred_url":"https://api.github.com/users/epfl-scitas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epfl-scitas/subscriptions","organizations_url":"https://api.github.com/users/epfl-scitas/orgs","repos_url":"https://api.github.com/users/epfl-scitas/repos","events_url":"https://api.github.com/users/epfl-scitas/events{/privacy}","received_events_url":"https://api.github.com/users/epfl-scitas/received_events","type":"Organization","site_admin":false},"repo":{"id":43118298,"name":"spack","full_name":"epfl-scitas/spack","owner":{"login":"epfl-scitas","id":14820957,"avatar_url":"https://avatars.githubusercontent.com/u/14820957?v=3","gravatar_id":"","url":"https://api.github.com/users/epfl-scitas","html_url":"https://github.com/epfl-scitas","followers_url":"https://api.github.com/users/epfl-scitas/followers","following_url":"https://api.github.com/users/epfl-scitas/following{/other_user}","gists_url":"https://api.github.com/users/epfl-scitas/gists{/gist_id}","starred_url":"https://api.github.com/users/epfl-scitas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epfl-scitas/subscriptions","organizations_url":"https://api.github.com/users/epfl-scitas/orgs","repos_url":"https://api.github.com/users/epfl-scitas/repos","events_url":"https://api.github.com/users/epfl-scitas/events{/privacy}","received_events_url":"https://api.github.com/users/epfl-scitas/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/epfl-scitas/spack","description":"A flexible package manager designed to support multiple versions, configurations, platforms, and compilers.","fork":true,"url":"https://api.github.com/repos/epfl-scitas/spack","forks_url":"https://api.github.com/repos/epfl-scitas/spack/forks","keys_url":"https://api.github.com/repos/epfl-scitas/spack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/epfl-scitas/spack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/epfl-scitas/spack/teams","hooks_url":"https://api.github.com/repos/epfl-scitas/spack/hooks","issue_events_url":"https://api.github.com/repos/epfl-scitas/spack/issues/events{/number}","events_url":"https://api.github.com/repos/epfl-scitas/spack/events","assignees_url":"https://api.github.com/repos/epfl-scitas/spack/assignees{/user}","branches_url":"https://api.github.com/repos/epfl-scitas/spack/branches{/branch}","tags_url":"https://api.github.com/repos/epfl-scitas/spack/tags","blobs_url":"https://api.github.com/repos/epfl-scitas/spack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/epfl-scitas/spack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/epfl-scitas/spack/git/refs{/sha}","trees_url":"https://api.github.com/repos/epfl-scitas/spack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/epfl-scitas/spack/statuses/{sha}","languages_url":"https://api.github.com/repos/epfl-scitas/spack/languages","stargazers_url":"https://api.github.com/repos/epfl-scitas/spack/stargazers","contributors_url":"https://api.github.com/repos/epfl-scitas/spack/contributors","subscribers_url":"https://api.github.com/repos/epfl-scitas/spack/subscribers","subscription_url":"https://api.github.com/repos/epfl-scitas/spack/subscription","commits_url":"https://api.github.com/repos/epfl-scitas/spack/commits{/sha}","git_commits_url":"https://api.github.com/repos/epfl-scitas/spack/git/commits{/sha}","comments_url":"https://api.github.com/repos/epfl-scitas/spack/comments{/number}","issue_comment_url":"https://api.github.com/repos/epfl-scitas/spack/issues/comments{/number}","contents_url":"https://api.github.com/repos/epfl-scitas/spack/contents/{+path}","compare_url":"https://api.github.com/repos/epfl-scitas/spack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/epfl-scitas/spack/merges","archive_url":"https://api.github.com/repos/epfl-scitas/spack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/epfl-scitas/spack/downloads","issues_url":"https://api.github.com/repos/epfl-scitas/spack/issues{/number}","pulls_url":"https://api.github.com/repos/epfl-scitas/spack/pulls{/number}","milestones_url":"https://api.github.com/repos/epfl-scitas/spack/milestones{/number}","notifications_url":"https://api.github.com/repos/epfl-scitas/spack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/epfl-scitas/spack/labels{/name}","releases_url":"https://api.github.com/repos/epfl-scitas/spack/releases{/id}","deployments_url":"https://api.github.com/repos/epfl-scitas/spack/deployments","created_at":"2015-09-25T08:01:24Z","updated_at":"2016-01-12T20:14:40Z","pushed_at":"2016-09-03T19:37:27Z","git_url":"git://github.com/epfl-scitas/spack.git","ssh_url":"git@github.com:epfl-scitas/spack.git","clone_url":"https://github.com/epfl-scitas/spack.git","svn_url":"https://github.com/epfl-scitas/spack","homepage":"http://scalability-llnl.github.io/spack","size":10986,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":1,"default_branch":"releases/lafnetscha"}},"base":{"label":"LLNL:develop","ref":"develop","sha":"16c5403ab3ca35dfa6d715ce2c5434c65de81c17","user":{"login":"LLNL","id":5921419,"avatar_url":"https://avatars.githubusercontent.com/u/5921419?v=3","gravatar_id":"","url":"https://api.github.com/users/LLNL","html_url":"https://github.com/LLNL","followers_url":"https://api.github.com/users/LLNL/followers","following_url":"https://api.github.com/users/LLNL/following{/other_user}","gists_url":"https://api.github.com/users/LLNL/gists{/gist_id}","starred_url":"https://api.github.com/users/LLNL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LLNL/subscriptions","organizations_url":"https://api.github.com/users/LLNL/orgs","repos_url":"https://api.github.com/users/LLNL/repos","events_url":"https://api.github.com/users/LLNL/events{/privacy}","received_events_url":"https://api.github.com/users/LLNL/received_events","type":"Organization","site_admin":false},"repo":{"id":15730865,"name":"spack","full_name":"LLNL/spack","owner":{"login":"LLNL","id":5921419,"avatar_url":"https://avatars.githubusercontent.com/u/5921419?v=3","gravatar_id":"","url":"https://api.github.com/users/LLNL","html_url":"https://github.com/LLNL","followers_url":"https://api.github.com/users/LLNL/followers","following_url":"https://api.github.com/users/LLNL/following{/other_user}","gists_url":"https://api.github.com/users/LLNL/gists{/gist_id}","starred_url":"https://api.github.com/users/LLNL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LLNL/subscriptions","organizations_url":"https://api.github.com/users/LLNL/orgs","repos_url":"https://api.github.com/users/LLNL/repos","events_url":"https://api.github.com/users/LLNL/events{/privacy}","received_events_url":"https://api.github.com/users/LLNL/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LLNL/spack","description":"A flexible package manager designed to support multiple versions, configurations, platforms, and compilers.","fork":false,"url":"https://api.github.com/repos/LLNL/spack","forks_url":"https://api.github.com/repos/LLNL/spack/forks","keys_url":"https://api.github.com/repos/LLNL/spack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LLNL/spack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LLNL/spack/teams","hooks_url":"https://api.github.com/repos/LLNL/spack/hooks","issue_events_url":"https://api.github.com/repos/LLNL/spack/issues/events{/number}","events_url":"https://api.github.com/repos/LLNL/spack/events","assignees_url":"https://api.github.com/repos/LLNL/spack/assignees{/user}","branches_url":"https://api.github.com/repos/LLNL/spack/branches{/branch}","tags_url":"https://api.github.com/repos/LLNL/spack/tags","blobs_url":"https://api.github.com/repos/LLNL/spack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LLNL/spack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LLNL/spack/git/refs{/sha}","trees_url":"https://api.github.com/repos/LLNL/spack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LLNL/spack/statuses/{sha}","languages_url":"https://api.github.com/repos/LLNL/spack/languages","stargazers_url":"https://api.github.com/repos/LLNL/spack/stargazers","contributors_url":"https://api.github.com/repos/LLNL/spack/contributors","subscribers_url":"https://api.github.com/repos/LLNL/spack/subscribers","subscription_url":"https://api.github.com/repos/LLNL/spack/subscription","commits_url":"https://api.github.com/repos/LLNL/spack/commits{/sha}","git_commits_url":"https://api.github.com/repos/LLNL/spack/git/commits{/sha}","comments_url":"https://api.github.com/repos/LLNL/spack/comments{/number}","issue_comment_url":"https://api.github.com/repos/LLNL/spack/issues/comments{/number}","contents_url":"https://api.github.com/repos/LLNL/spack/contents/{+path}","compare_url":"https://api.github.com/repos/LLNL/spack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LLNL/spack/merges","archive_url":"https://api.github.com/repos/LLNL/spack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LLNL/spack/downloads","issues_url":"https://api.github.com/repos/LLNL/spack/issues{/number}","pulls_url":"https://api.github.com/repos/LLNL/spack/pulls{/number}","milestones_url":"https://api.github.com/repos/LLNL/spack/milestones{/number}","notifications_url":"https://api.github.com/repos/LLNL/spack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LLNL/spack/labels{/name}","releases_url":"https://api.github.com/repos/LLNL/spack/releases{/id}","deployments_url":"https://api.github.com/repos/LLNL/spack/deployments","created_at":"2014-01-08T09:22:12Z","updated_at":"2016-08-30T23:08:01Z","pushed_at":"2016-09-03T19:37:27Z","git_url":"git://github.com/LLNL/spack.git","ssh_url":"git@github.com:LLNL/spack.git","clone_url":"https://github.com/LLNL/spack.git","svn_url":"https://github.com/LLNL/spack","homepage":"http://software.llnl.gov/spack","size":18467,"stargazers_count":149,"watchers_count":149,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":133,"mirror_url":null,"open_issues_count":332,"forks":133,"open_issues":332,"watchers":149,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/LLNL/spack/pulls/1682"},"html":{"href":"https://github.com/LLNL/spack/pull/1682"},"issue":{"href":"https://api.github.com/repos/LLNL/spack/issues/1682"},"comments":{"href":"https://api.github.com/repos/LLNL/spack/issues/1682/comments"},"review_comments":{"href":"https://api.github.com/repos/LLNL/spack/pulls/1682/comments"},"review_comment":{"href":"https://api.github.com/repos/LLNL/spack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/LLNL/spack/pulls/1682/commits"},"statuses":{"href":"https://api.github.com/repos/LLNL/spack/statuses/cb8882bb676550c9b27688c86399553f117245c1"}}}}
{"actor":{"display_login":"alalazo"}}