{"action":"created","comment":{"url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/pulls/comments/22460457","id":22460457,"diff_hunk":"@@ -0,0 +1,259 @@\n+#!/usr/bin/env python\n+\n+#\n+# Copyright (c) 2014, SUSE LINUX Products GmbH\n+#\n+# This library is free software; you can redistribute it and/or\n+# modify it under the terms of the GNU Lesser General Public\n+# License as published by the Free Software Foundation; either\n+# version 2.1 of the License, or (at your option) any later version.\n+#\n+# This library is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+# Lesser General Public License for more details.\n+#\n+# You should have received a copy of the GNU Lesser General Public\n+# License along with this library; if not, write to the Free Software\n+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301\n+# USA\n+#\n+# (Licensed under the LGPLv2.1 or later)\n+#\n+#\n+# Authors: Thomas Bechtold <tbechtold@suse.com>\n+#\n+\n+import argparse\n+import functools\n+import os\n+import sys\n+import time\n+from multiprocessing import Pool\n+\n+try:\n+    import xmlrpclib\n+except ImportError:\n+    # Python3 support\n+    import xmlrpc.client as xmlrpclib\n+\n+\n+XMLRPC_SERVER_PROXY = 'https://pypi.python.org/pypi'\n+\n+\n+@functools.total_ordering\n+class PackageInfo(object):\n+    \"\"\"Represents a package info\"\"\"\n+    def __init__(self, type_, name, version, url):\n+        self.type = type_.rstrip()\n+        self.name = name.rstrip()  # the original name from pypi (without python3- or python- prefix)\n+        self.version = version.rstrip()\n+        self.url = url.rstrip()\n+\n+    def __repr__(self):\n+        return \"PackageInfo obj <%s:%s:%s:%s>\" % (self.type, self.name, self.version, self.url)\n+\n+    def __eq__(self, other):\n+        if hasattr(other, 'name'):\n+            return self.name == other.name\n+\n+    def __lt__(self, other):\n+        if hasattr(other, 'name'):\n+            return self.name < other.name\n+\n+\n+def __get_save_file_serial_name(save_file):\n+    \"\"\"filename to use to store the latest used changelog serial from pypi\"\"\"\n+    return save_file + \"-changelog-serial\"\n+\n+\n+def __get_cached_changelog_last_serial(save_file):\n+    \"\"\"try to read the latest changelog serial and return\n+    the number or None if not available\"\"\"\n+    serial_file = __get_save_file_serial_name(save_file)\n+    if os.path.exists(serial_file):\n+        with open(serial_file, 'r') as f:\n+            return int(f.readline())\n+    # no changelog serial available\n+    return None\n+\n+\n+def __write_cached_changelog_last_serial(save_file, changelog_serial=None):\n+    \"\"\"update the cached changelog serial with the current serial from pypi\"\"\"\n+    if not changelog_serial:\n+        client = xmlrpclib.ServerProxy(XMLRPC_SERVER_PROXY)\n+        changelog_serial = str(client.changelog_last_serial())\n+\n+    serial_file = __get_save_file_serial_name(save_file)\n+    with open(serial_file, 'w') as sf:\n+        sf.write(\"%s\\n\" % changelog_serial)\n+\n+\n+def __read_pypi_package_file(save_file):\n+    \"\"\"read the given pypi file into a list of PackageInfo objs\"\"\"\n+    packages = list()\n+    with open(save_file, \"r\") as f:\n+        for line in f.readlines():\n+            if line.startswith('#'):\n+                continue\n+            pack_info = PackageInfo(*line.split(':', 3))\n+            # skip python3-* lines\n+            if pack_info.name.startswith('python3-'):\n+                continue\n+            # remove python- prefix\n+            if pack_info.name.startswith('python-'):\n+                pack_info.name = pack_info.name.replace('python-', '')","path":"server/upstream/download-pypi-versions","position":null,"original_position":105,"commit_id":"2f370e3bf6fce74afc85f5de1f38382d091f9108","original_commit_id":"48e0585327b4fda9c25e07ccbfc3600ad559f2cb","user":{"login":"toabctl","id":276317,"avatar_url":"https://avatars.githubusercontent.com/u/276317?v=3","gravatar_id":"","url":"https://api.github.com/users/toabctl","html_url":"https://github.com/toabctl","followers_url":"https://api.github.com/users/toabctl/followers","following_url":"https://api.github.com/users/toabctl/following{/other_user}","gists_url":"https://api.github.com/users/toabctl/gists{/gist_id}","starred_url":"https://api.github.com/users/toabctl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toabctl/subscriptions","organizations_url":"https://api.github.com/users/toabctl/orgs","repos_url":"https://api.github.com/users/toabctl/repos","events_url":"https://api.github.com/users/toabctl/events{/privacy}","received_events_url":"https://api.github.com/users/toabctl/received_events","type":"User","site_admin":false},"body":"> This will break python modules named \"python-foo\" (and packaged as python-python-foo). You want to remove only the initial prefix.\r\n\r\nDone in https://github.com/toabctl/osc-plugin-collab/commit/2f370e3bf6fce74afc85f5de1f38382d091f9108","created_at":"2015-01-05T13:35:26Z","updated_at":"2015-01-05T13:35:26Z","html_url":"https://github.com/openSUSE/osc-plugin-collab/pull/8#discussion_r22460457","pull_request_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/openSUSE/osc-plugin-collab/pulls/comments/22460457"},"html":{"href":"https://github.com/openSUSE/osc-plugin-collab/pull/8#discussion_r22460457"},"pull_request":{"href":"https://api.github.com/repos/openSUSE/osc-plugin-collab/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/pulls/8","id":23087995,"html_url":"https://github.com/openSUSE/osc-plugin-collab/pull/8","diff_url":"https://github.com/openSUSE/osc-plugin-collab/pull/8.diff","patch_url":"https://github.com/openSUSE/osc-plugin-collab/pull/8.patch","issue_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/issues/8","number":8,"state":"open","locked":false,"title":"Pypi support","user":{"login":"toabctl","id":276317,"avatar_url":"https://avatars.githubusercontent.com/u/276317?v=3","gravatar_id":"","url":"https://api.github.com/users/toabctl","html_url":"https://github.com/toabctl","followers_url":"https://api.github.com/users/toabctl/followers","following_url":"https://api.github.com/users/toabctl/following{/other_user}","gists_url":"https://api.github.com/users/toabctl/gists{/gist_id}","starred_url":"https://api.github.com/users/toabctl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toabctl/subscriptions","organizations_url":"https://api.github.com/users/toabctl/orgs","repos_url":"https://api.github.com/users/toabctl/repos","events_url":"https://api.github.com/users/toabctl/events{/privacy}","received_events_url":"https://api.github.com/users/toabctl/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-10-21T14:08:47Z","updated_at":"2015-01-05T13:35:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e35aa14951123b83f83c59fd5b8e9f3ed4d2e1d9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/pulls/8/commits","review_comments_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/pulls/8/comments","review_comment_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/pulls/comments/{number}","comments_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/issues/8/comments","statuses_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/statuses/2f370e3bf6fce74afc85f5de1f38382d091f9108","head":{"label":"toabctl:pypi-support","ref":"pypi-support","sha":"2f370e3bf6fce74afc85f5de1f38382d091f9108","user":{"login":"toabctl","id":276317,"avatar_url":"https://avatars.githubusercontent.com/u/276317?v=3","gravatar_id":"","url":"https://api.github.com/users/toabctl","html_url":"https://github.com/toabctl","followers_url":"https://api.github.com/users/toabctl/followers","following_url":"https://api.github.com/users/toabctl/following{/other_user}","gists_url":"https://api.github.com/users/toabctl/gists{/gist_id}","starred_url":"https://api.github.com/users/toabctl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toabctl/subscriptions","organizations_url":"https://api.github.com/users/toabctl/orgs","repos_url":"https://api.github.com/users/toabctl/repos","events_url":"https://api.github.com/users/toabctl/events{/privacy}","received_events_url":"https://api.github.com/users/toabctl/received_events","type":"User","site_admin":false},"repo":{"id":23989611,"name":"osc-plugin-collab","full_name":"toabctl/osc-plugin-collab","owner":{"login":"toabctl","id":276317,"avatar_url":"https://avatars.githubusercontent.com/u/276317?v=3","gravatar_id":"","url":"https://api.github.com/users/toabctl","html_url":"https://github.com/toabctl","followers_url":"https://api.github.com/users/toabctl/followers","following_url":"https://api.github.com/users/toabctl/following{/other_user}","gists_url":"https://api.github.com/users/toabctl/gists{/gist_id}","starred_url":"https://api.github.com/users/toabctl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toabctl/subscriptions","organizations_url":"https://api.github.com/users/toabctl/orgs","repos_url":"https://api.github.com/users/toabctl/repos","events_url":"https://api.github.com/users/toabctl/events{/privacy}","received_events_url":"https://api.github.com/users/toabctl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/toabctl/osc-plugin-collab","description":"osc plugin that makes your life easier, especially for the collaboration inside a team","fork":true,"url":"https://api.github.com/repos/toabctl/osc-plugin-collab","forks_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/forks","keys_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/teams","hooks_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/hooks","issue_events_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/issues/events{/number}","events_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/events","assignees_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/assignees{/user}","branches_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/branches{/branch}","tags_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/tags","blobs_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/git/refs{/sha}","trees_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/statuses/{sha}","languages_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/languages","stargazers_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/stargazers","contributors_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/contributors","subscribers_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/subscribers","subscription_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/subscription","commits_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/commits{/sha}","git_commits_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/git/commits{/sha}","comments_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/comments{/number}","issue_comment_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/issues/comments/{number}","contents_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/contents/{+path}","compare_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/merges","archive_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/downloads","issues_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/issues{/number}","pulls_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/pulls{/number}","milestones_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/milestones{/number}","notifications_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/labels{/name}","releases_url":"https://api.github.com/repos/toabctl/osc-plugin-collab/releases{/id}","created_at":"2014-09-13T08:30:30Z","updated_at":"2014-07-28T12:01:34Z","pushed_at":"2015-01-05T13:34:08Z","git_url":"git://github.com/toabctl/osc-plugin-collab.git","ssh_url":"git@github.com:toabctl/osc-plugin-collab.git","clone_url":"https://github.com/toabctl/osc-plugin-collab.git","svn_url":"https://github.com/toabctl/osc-plugin-collab","homepage":null,"size":2597,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openSUSE:master","ref":"master","sha":"d885c2e2839c52e1842cb73319d9695cea61b37c","user":{"login":"openSUSE","id":623819,"avatar_url":"https://avatars.githubusercontent.com/u/623819?v=3","gravatar_id":"","url":"https://api.github.com/users/openSUSE","html_url":"https://github.com/openSUSE","followers_url":"https://api.github.com/users/openSUSE/followers","following_url":"https://api.github.com/users/openSUSE/following{/other_user}","gists_url":"https://api.github.com/users/openSUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/openSUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openSUSE/subscriptions","organizations_url":"https://api.github.com/users/openSUSE/orgs","repos_url":"https://api.github.com/users/openSUSE/repos","events_url":"https://api.github.com/users/openSUSE/events{/privacy}","received_events_url":"https://api.github.com/users/openSUSE/received_events","type":"Organization","site_admin":false},"repo":{"id":14618091,"name":"osc-plugin-collab","full_name":"openSUSE/osc-plugin-collab","owner":{"login":"openSUSE","id":623819,"avatar_url":"https://avatars.githubusercontent.com/u/623819?v=3","gravatar_id":"","url":"https://api.github.com/users/openSUSE","html_url":"https://github.com/openSUSE","followers_url":"https://api.github.com/users/openSUSE/followers","following_url":"https://api.github.com/users/openSUSE/following{/other_user}","gists_url":"https://api.github.com/users/openSUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/openSUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openSUSE/subscriptions","organizations_url":"https://api.github.com/users/openSUSE/orgs","repos_url":"https://api.github.com/users/openSUSE/repos","events_url":"https://api.github.com/users/openSUSE/events{/privacy}","received_events_url":"https://api.github.com/users/openSUSE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openSUSE/osc-plugin-collab","description":"osc plugin that makes your life easier, especially for the collaboration inside a team","fork":false,"url":"https://api.github.com/repos/openSUSE/osc-plugin-collab","forks_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/forks","keys_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/teams","hooks_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/hooks","issue_events_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/issues/events{/number}","events_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/events","assignees_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/assignees{/user}","branches_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/branches{/branch}","tags_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/tags","blobs_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/git/refs{/sha}","trees_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/statuses/{sha}","languages_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/languages","stargazers_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/stargazers","contributors_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/contributors","subscribers_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/subscribers","subscription_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/subscription","commits_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/commits{/sha}","git_commits_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/git/commits{/sha}","comments_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/comments{/number}","issue_comment_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/issues/comments/{number}","contents_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/contents/{+path}","compare_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/merges","archive_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/downloads","issues_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/issues{/number}","pulls_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/pulls{/number}","milestones_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/milestones{/number}","notifications_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/labels{/name}","releases_url":"https://api.github.com/repos/openSUSE/osc-plugin-collab/releases{/id}","created_at":"2013-11-22T13:10:48Z","updated_at":"2014-11-21T19:29:21Z","pushed_at":"2014-11-21T19:29:21Z","git_url":"git://github.com/openSUSE/osc-plugin-collab.git","ssh_url":"git@github.com:openSUSE/osc-plugin-collab.git","clone_url":"https://github.com/openSUSE/osc-plugin-collab.git","svn_url":"https://github.com/openSUSE/osc-plugin-collab","homepage":null,"size":2802,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":3,"forks":3,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openSUSE/osc-plugin-collab/pulls/8"},"html":{"href":"https://github.com/openSUSE/osc-plugin-collab/pull/8"},"issue":{"href":"https://api.github.com/repos/openSUSE/osc-plugin-collab/issues/8"},"comments":{"href":"https://api.github.com/repos/openSUSE/osc-plugin-collab/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/openSUSE/osc-plugin-collab/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/openSUSE/osc-plugin-collab/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/openSUSE/osc-plugin-collab/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/openSUSE/osc-plugin-collab/statuses/2f370e3bf6fce74afc85f5de1f38382d091f9108"}}}}