{"action":"created","comment":{"url":"https://api.github.com/repos/Toblerity/Shapely/pulls/comments/24051782","id":24051782,"diff_hunk":"@@ -183,6 +136,70 @@ def load_dll(libname, fallbacks=None):\n         include_package_data=True,\n     )\n \n+# Build cython extensions, which require development parameters\n+include_dirs = [get_config_var('INCLUDEDIR')]\n+library_dirs = []\n+libraries = []\n+extra_link_args = []\n+\n+# Use geos-config utility to get development parameters\n+# (Note: not available for Windows, since it is a shell script)\n+geos_config = os.environ.get('GEOS_CONFIG', 'geos-config')\n+log.debug('geos_config: %s', geos_config)\n+\n+\n+def get_geos_config(option):\n+    try:\n+        stdout, stderr = subprocess.Popen(\n+            [geos_config, option],\n+            stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()\n+    except OSError as ex:\n+        # e.g., [Errno 2] No such file or directory\n+        raise OSError(\n+            'Could not find geos-config %r: %s' % (geos_config, ex))\n+    if stderr and not stdout:\n+        raise ValueError(stderr.strip())\n+    if sys.version_info[0] >= 3:\n+        result = stdout.decode('ascii').strip()\n+    else:\n+        result = stdout.strip()\n+    log.debug('%s %s: %s', geos_config, option, result)\n+    return result\n+\n+try:\n+    # Get the version from geos-config. Show error if this version tuple is\n+    # different to the GEOS version loaded from the dynamic library.\n+    geos_config_version_string = get_geos_config('--version')\n+    res = re.findall(r'(\\d+)\\.(\\d+)\\.(\\d+)', geos_config_version_string)\n+    geos_config_version = tuple(int(x) for x in res[0])\n+    if geos_config_version != geos_version:\n+        log.error(\"The GEOS dynamic library version is %s %s,\",\n+                  geos_version_string, geos_version)\n+        log.error(\"but the version reported by %s is %s %s.\", geos_config,\n+                  geos_config_version_string, geos_config_version)\n+        sys.exit(1)\n+except OSError as ex:\n+    log.error(ex)\n+    log.error('Cannot find geos-config to get headers and check version.')\n+    log.error('If available, specify a path to geos-config with a '\n+              'GEOS_CONFIG environment variable')\n+    geos_config = None\n+\n+\n+if geos_config:","path":"setup.py","position":239,"original_position":239,"commit_id":"2e58796977672acfd487607981b4fc2f62b23811","original_commit_id":"2e58796977672acfd487607981b4fc2f62b23811","user":{"login":"mwtoews","id":895458,"avatar_url":"https://avatars.githubusercontent.com/u/895458?v=3","gravatar_id":"","url":"https://api.github.com/users/mwtoews","html_url":"https://github.com/mwtoews","followers_url":"https://api.github.com/users/mwtoews/followers","following_url":"https://api.github.com/users/mwtoews/following{/other_user}","gists_url":"https://api.github.com/users/mwtoews/gists{/gist_id}","starred_url":"https://api.github.com/users/mwtoews/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwtoews/subscriptions","organizations_url":"https://api.github.com/users/mwtoews/orgs","repos_url":"https://api.github.com/users/mwtoews/repos","events_url":"https://api.github.com/users/mwtoews/events{/privacy}","received_events_url":"https://api.github.com/users/mwtoews/received_events","type":"User","site_admin":false},"body":"Also, a few lines up `geos_config = None` if the utility does not run / is not found.","created_at":"2015-02-03T23:50:10Z","updated_at":"2015-02-03T23:50:10Z","html_url":"https://github.com/Toblerity/Shapely/pull/239#discussion_r24051782","pull_request_url":"https://api.github.com/repos/Toblerity/Shapely/pulls/239","_links":{"self":{"href":"https://api.github.com/repos/Toblerity/Shapely/pulls/comments/24051782"},"html":{"href":"https://github.com/Toblerity/Shapely/pull/239#discussion_r24051782"},"pull_request":{"href":"https://api.github.com/repos/Toblerity/Shapely/pulls/239"}}},"pull_request":{"url":"https://api.github.com/repos/Toblerity/Shapely/pulls/239","id":28529256,"html_url":"https://github.com/Toblerity/Shapely/pull/239","diff_url":"https://github.com/Toblerity/Shapely/pull/239.diff","patch_url":"https://github.com/Toblerity/Shapely/pull/239.patch","issue_url":"https://api.github.com/repos/Toblerity/Shapely/issues/239","number":239,"state":"closed","locked":false,"title":"Move system-dependant logic to load dynamic library into minimal module, and use geos-config to get development headers","user":{"login":"mwtoews","id":895458,"avatar_url":"https://avatars.githubusercontent.com/u/895458?v=3","gravatar_id":"","url":"https://api.github.com/users/mwtoews","html_url":"https://github.com/mwtoews","followers_url":"https://api.github.com/users/mwtoews/followers","following_url":"https://api.github.com/users/mwtoews/following{/other_user}","gists_url":"https://api.github.com/users/mwtoews/gists{/gist_id}","starred_url":"https://api.github.com/users/mwtoews/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwtoews/subscriptions","organizations_url":"https://api.github.com/users/mwtoews/orgs","repos_url":"https://api.github.com/users/mwtoews/repos","events_url":"https://api.github.com/users/mwtoews/events{/privacy}","received_events_url":"https://api.github.com/users/mwtoews/received_events","type":"User","site_admin":false},"body":"The main thing done here is to move the system-dependant loading of the GEOS dynamic library into a separate module `shapely.libgeos`, which can be used by setup.py for checking versions before install, and by `shapely.geos` for run-time use the GEOS of dynamic library.\r\n\r\nA TODO item is to figure out a different way to specify the dynamic library (#234). Someone else might need to take the lead on this, but at least it will be in one place, rather than repeated in `setup.py` and `shapely/geos.py`. CC @kynan for ideas.\r\n\r\nSecondly, `geos-config`, where available, is used to obtain libraries and headers for developing Cython extensions. This is useful where GEOS is installed on a non-standard prefix. An alternative location for this utility can be proved for setup.py using a `GEOS_CONFIG` environment variable. Note that this is only needed for setup.py, so I don't think it's suitable for setting dynamic library prefix. Also, `geos-config` is a shell script, and is not available for MS Windows.\r\n\r\nOther edits use the logging module for setup.py, and fixing the `requires` metadata. Extra debugging info can be shown e.g. `python -W all setup.py ...`. Also add TODO that `free` is not used anywhere.\r\n\r\nPlease test and comment, as these files are rather sensitive components.\r\n\r\nThis PR supersedes #236 due to GitHub limitations.","created_at":"2015-02-03T06:13:33Z","updated_at":"2015-02-03T23:50:10Z","closed_at":"2015-02-03T06:25:57Z","merged_at":"2015-02-03T06:25:57Z","merge_commit_sha":"ddb766497628d0170a5737a8cb60bc0d8f399a35","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Toblerity/Shapely/pulls/239/commits","review_comments_url":"https://api.github.com/repos/Toblerity/Shapely/pulls/239/comments","review_comment_url":"https://api.github.com/repos/Toblerity/Shapely/pulls/comments/{number}","comments_url":"https://api.github.com/repos/Toblerity/Shapely/issues/239/comments","statuses_url":"https://api.github.com/repos/Toblerity/Shapely/statuses/2e58796977672acfd487607981b4fc2f62b23811","head":{"label":"mwtoews:master-setup","ref":"master-setup","sha":"2e58796977672acfd487607981b4fc2f62b23811","user":{"login":"mwtoews","id":895458,"avatar_url":"https://avatars.githubusercontent.com/u/895458?v=3","gravatar_id":"","url":"https://api.github.com/users/mwtoews","html_url":"https://github.com/mwtoews","followers_url":"https://api.github.com/users/mwtoews/followers","following_url":"https://api.github.com/users/mwtoews/following{/other_user}","gists_url":"https://api.github.com/users/mwtoews/gists{/gist_id}","starred_url":"https://api.github.com/users/mwtoews/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwtoews/subscriptions","organizations_url":"https://api.github.com/users/mwtoews/orgs","repos_url":"https://api.github.com/users/mwtoews/repos","events_url":"https://api.github.com/users/mwtoews/events{/privacy}","received_events_url":"https://api.github.com/users/mwtoews/received_events","type":"User","site_admin":false},"repo":{"id":3175078,"name":"Shapely","full_name":"mwtoews/Shapely","owner":{"login":"mwtoews","id":895458,"avatar_url":"https://avatars.githubusercontent.com/u/895458?v=3","gravatar_id":"","url":"https://api.github.com/users/mwtoews","html_url":"https://github.com/mwtoews","followers_url":"https://api.github.com/users/mwtoews/followers","following_url":"https://api.github.com/users/mwtoews/following{/other_user}","gists_url":"https://api.github.com/users/mwtoews/gists{/gist_id}","starred_url":"https://api.github.com/users/mwtoews/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwtoews/subscriptions","organizations_url":"https://api.github.com/users/mwtoews/orgs","repos_url":"https://api.github.com/users/mwtoews/repos","events_url":"https://api.github.com/users/mwtoews/events{/privacy}","received_events_url":"https://api.github.com/users/mwtoews/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mwtoews/Shapely","description":"Python package for manipulation and analysis of features in the Cartesian plane","fork":true,"url":"https://api.github.com/repos/mwtoews/Shapely","forks_url":"https://api.github.com/repos/mwtoews/Shapely/forks","keys_url":"https://api.github.com/repos/mwtoews/Shapely/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mwtoews/Shapely/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mwtoews/Shapely/teams","hooks_url":"https://api.github.com/repos/mwtoews/Shapely/hooks","issue_events_url":"https://api.github.com/repos/mwtoews/Shapely/issues/events{/number}","events_url":"https://api.github.com/repos/mwtoews/Shapely/events","assignees_url":"https://api.github.com/repos/mwtoews/Shapely/assignees{/user}","branches_url":"https://api.github.com/repos/mwtoews/Shapely/branches{/branch}","tags_url":"https://api.github.com/repos/mwtoews/Shapely/tags","blobs_url":"https://api.github.com/repos/mwtoews/Shapely/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mwtoews/Shapely/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mwtoews/Shapely/git/refs{/sha}","trees_url":"https://api.github.com/repos/mwtoews/Shapely/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mwtoews/Shapely/statuses/{sha}","languages_url":"https://api.github.com/repos/mwtoews/Shapely/languages","stargazers_url":"https://api.github.com/repos/mwtoews/Shapely/stargazers","contributors_url":"https://api.github.com/repos/mwtoews/Shapely/contributors","subscribers_url":"https://api.github.com/repos/mwtoews/Shapely/subscribers","subscription_url":"https://api.github.com/repos/mwtoews/Shapely/subscription","commits_url":"https://api.github.com/repos/mwtoews/Shapely/commits{/sha}","git_commits_url":"https://api.github.com/repos/mwtoews/Shapely/git/commits{/sha}","comments_url":"https://api.github.com/repos/mwtoews/Shapely/comments{/number}","issue_comment_url":"https://api.github.com/repos/mwtoews/Shapely/issues/comments/{number}","contents_url":"https://api.github.com/repos/mwtoews/Shapely/contents/{+path}","compare_url":"https://api.github.com/repos/mwtoews/Shapely/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mwtoews/Shapely/merges","archive_url":"https://api.github.com/repos/mwtoews/Shapely/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mwtoews/Shapely/downloads","issues_url":"https://api.github.com/repos/mwtoews/Shapely/issues{/number}","pulls_url":"https://api.github.com/repos/mwtoews/Shapely/pulls{/number}","milestones_url":"https://api.github.com/repos/mwtoews/Shapely/milestones{/number}","notifications_url":"https://api.github.com/repos/mwtoews/Shapely/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mwtoews/Shapely/labels{/name}","releases_url":"https://api.github.com/repos/mwtoews/Shapely/releases{/id}","created_at":"2012-01-13T22:58:38Z","updated_at":"2015-02-03T05:35:45Z","pushed_at":"2015-02-03T23:07:48Z","git_url":"git://github.com/mwtoews/Shapely.git","ssh_url":"git@github.com:mwtoews/Shapely.git","clone_url":"https://github.com/mwtoews/Shapely.git","svn_url":"https://github.com/mwtoews/Shapely","homepage":"http://toblerity.github.com/shapely/","size":1862,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":0,"forks":3,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Toblerity:master","ref":"master","sha":"c79faf79260762e3bc24b5aa7de3e8aa5b861773","user":{"login":"Toblerity","id":859968,"avatar_url":"https://avatars.githubusercontent.com/u/859968?v=3","gravatar_id":"","url":"https://api.github.com/users/Toblerity","html_url":"https://github.com/Toblerity","followers_url":"https://api.github.com/users/Toblerity/followers","following_url":"https://api.github.com/users/Toblerity/following{/other_user}","gists_url":"https://api.github.com/users/Toblerity/gists{/gist_id}","starred_url":"https://api.github.com/users/Toblerity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toblerity/subscriptions","organizations_url":"https://api.github.com/users/Toblerity/orgs","repos_url":"https://api.github.com/users/Toblerity/repos","events_url":"https://api.github.com/users/Toblerity/events{/privacy}","received_events_url":"https://api.github.com/users/Toblerity/received_events","type":"Organization","site_admin":false},"repo":{"id":3080613,"name":"Shapely","full_name":"Toblerity/Shapely","owner":{"login":"Toblerity","id":859968,"avatar_url":"https://avatars.githubusercontent.com/u/859968?v=3","gravatar_id":"","url":"https://api.github.com/users/Toblerity","html_url":"https://github.com/Toblerity","followers_url":"https://api.github.com/users/Toblerity/followers","following_url":"https://api.github.com/users/Toblerity/following{/other_user}","gists_url":"https://api.github.com/users/Toblerity/gists{/gist_id}","starred_url":"https://api.github.com/users/Toblerity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toblerity/subscriptions","organizations_url":"https://api.github.com/users/Toblerity/orgs","repos_url":"https://api.github.com/users/Toblerity/repos","events_url":"https://api.github.com/users/Toblerity/events{/privacy}","received_events_url":"https://api.github.com/users/Toblerity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Toblerity/Shapely","description":"Python package for manipulation and analysis of geometric objects in the Cartesian plane","fork":false,"url":"https://api.github.com/repos/Toblerity/Shapely","forks_url":"https://api.github.com/repos/Toblerity/Shapely/forks","keys_url":"https://api.github.com/repos/Toblerity/Shapely/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Toblerity/Shapely/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Toblerity/Shapely/teams","hooks_url":"https://api.github.com/repos/Toblerity/Shapely/hooks","issue_events_url":"https://api.github.com/repos/Toblerity/Shapely/issues/events{/number}","events_url":"https://api.github.com/repos/Toblerity/Shapely/events","assignees_url":"https://api.github.com/repos/Toblerity/Shapely/assignees{/user}","branches_url":"https://api.github.com/repos/Toblerity/Shapely/branches{/branch}","tags_url":"https://api.github.com/repos/Toblerity/Shapely/tags","blobs_url":"https://api.github.com/repos/Toblerity/Shapely/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Toblerity/Shapely/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Toblerity/Shapely/git/refs{/sha}","trees_url":"https://api.github.com/repos/Toblerity/Shapely/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Toblerity/Shapely/statuses/{sha}","languages_url":"https://api.github.com/repos/Toblerity/Shapely/languages","stargazers_url":"https://api.github.com/repos/Toblerity/Shapely/stargazers","contributors_url":"https://api.github.com/repos/Toblerity/Shapely/contributors","subscribers_url":"https://api.github.com/repos/Toblerity/Shapely/subscribers","subscription_url":"https://api.github.com/repos/Toblerity/Shapely/subscription","commits_url":"https://api.github.com/repos/Toblerity/Shapely/commits{/sha}","git_commits_url":"https://api.github.com/repos/Toblerity/Shapely/git/commits{/sha}","comments_url":"https://api.github.com/repos/Toblerity/Shapely/comments{/number}","issue_comment_url":"https://api.github.com/repos/Toblerity/Shapely/issues/comments/{number}","contents_url":"https://api.github.com/repos/Toblerity/Shapely/contents/{+path}","compare_url":"https://api.github.com/repos/Toblerity/Shapely/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Toblerity/Shapely/merges","archive_url":"https://api.github.com/repos/Toblerity/Shapely/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Toblerity/Shapely/downloads","issues_url":"https://api.github.com/repos/Toblerity/Shapely/issues{/number}","pulls_url":"https://api.github.com/repos/Toblerity/Shapely/pulls{/number}","milestones_url":"https://api.github.com/repos/Toblerity/Shapely/milestones{/number}","notifications_url":"https://api.github.com/repos/Toblerity/Shapely/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Toblerity/Shapely/labels{/name}","releases_url":"https://api.github.com/repos/Toblerity/Shapely/releases{/id}","created_at":"2011-12-31T19:43:11Z","updated_at":"2015-02-03T10:45:41Z","pushed_at":"2015-02-03T06:25:57Z","git_url":"git://github.com/Toblerity/Shapely.git","ssh_url":"git@github.com:Toblerity/Shapely.git","clone_url":"https://github.com/Toblerity/Shapely.git","svn_url":"https://github.com/Toblerity/Shapely","homepage":"http://toblerity.github.com/shapely/","size":3081,"stargazers_count":226,"watchers_count":226,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":100,"mirror_url":null,"open_issues_count":10,"forks":100,"open_issues":10,"watchers":226,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Toblerity/Shapely/pulls/239"},"html":{"href":"https://github.com/Toblerity/Shapely/pull/239"},"issue":{"href":"https://api.github.com/repos/Toblerity/Shapely/issues/239"},"comments":{"href":"https://api.github.com/repos/Toblerity/Shapely/issues/239/comments"},"review_comments":{"href":"https://api.github.com/repos/Toblerity/Shapely/pulls/239/comments"},"review_comment":{"href":"https://api.github.com/repos/Toblerity/Shapely/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/Toblerity/Shapely/pulls/239/commits"},"statuses":{"href":"https://api.github.com/repos/Toblerity/Shapely/statuses/2e58796977672acfd487607981b4fc2f62b23811"}}}}