|
a/OSSEval/OpenSourceProject/ohloh.py |
|
b/OSSEval/OpenSourceProject/ohloh.py |
1 |
# This Source Code Form is subject to the terms of the Mozilla Public
|
1 |
# This Source Code Form of OSSEval is subject to the terms of the GNU AFFERO
|
2 |
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
2 |
# GENERAL PUBLIC LICENSE, v. 3.0. If a copy of the AGPL was not
|
3 |
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
3 |
# distributed with this file, You can obtain one at http://www.gnu.org/licenses/agpl.txt
|
4 |
#
|
4 |
#
|
|
|
5 |
# OSSeval is powered by the SOS Open Source AGPL edition.
|
|
|
6 |
# The AGPL requires that you do not remove the SOS Open Source attribution and copyright
|
|
|
7 |
# notices from the user interface (see section 5.d below).
|
|
|
8 |
# Commercial licenses are available and do not require any SOS Open Source attributions
|
|
|
9 |
# or visible copyright notices but they are not permitted under this license.
|
|
|
10 |
|
5 |
# Copyright 2014 Bitergium SLL
|
11 |
# OSSEval Copyright 2014 Bitergium SLL
|
|
|
12 |
# SOS Open Source Copyright 2012 Roberto Galoppini
|
|
|
13 |
# Author: Davide Galletti
|
|
|
14 |
|
|
|
15 |
|
6 |
|
16 |
|
7 |
from xml.dom import minidom
|
17 |
from xml.dom import minidom
|
8 |
from utils import Configuration, xmlElements, Forges, UrllibHelper
|
18 |
from utils import Configuration, xmlElements, Forges, UrllibHelper
|
9 |
from OSSEval.utils import TrivialJSONEncoder
|
19 |
from OSSEval.utils import TrivialJSONEncoder
|
10 |
|
20 |
|
|
... |
|
... |
23 |
xmldoc = minidom.parseString(xml)
|
33 |
xmldoc = minidom.parseString(xml)
|
24 |
|
34 |
|
25 |
items_available = xmlElements(xmldoc.getElementsByTagName('items_available')).firstValue()
|
35 |
items_available = xmlElements(xmldoc.getElementsByTagName('items_available')).firstValue()
|
26 |
status = xmlElements(xmldoc.getElementsByTagName('status')).firstValue()
|
36 |
status = xmlElements(xmldoc.getElementsByTagName('status')).firstValue()
|
27 |
project_list = []
|
37 |
project_list = []
|
|
|
38 |
previous_len_project_list = -1
|
28 |
while (status == 'success' and len(project_list) < min(Configuration.max_number_of_records, items_available)):
|
39 |
while (status == 'success' and previous_len_project_list < len(project_list) and len(project_list) < min(Configuration.max_number_of_records, items_available)):
|
|
|
40 |
previous_len_project_list = len(project_list)
|
29 |
print "Ohloh search - " + name + " - page " + str(page) + " len(project_list): " + str(len(project_list))
|
41 |
print "Ohloh search - " + name + " - page " + str(page) + " len(project_list): " + str(len(project_list))
|
30 |
page = page + 1
|
42 |
page = page + 1
|
31 |
item_list = xmldoc.getElementsByTagName('project')
|
43 |
item_list = xmldoc.getElementsByTagName('project')
|
32 |
for s in item_list :
|
44 |
for s in item_list :
|
33 |
try:
|
45 |
try:
|