Commit d048b502 authored by jlopez's avatar jlopez
Browse files

Fix python getPackages

parent 4799cd19
......@@ -75,6 +75,9 @@ if(strpos($distrib, ':') !== false) {
else if($distrib == "CRAN" || $distrib == "Bioconductor") {
$result = findRPackage($distrib, $version_num, $version_name, $filter, $limit, false);
}
else if($distrib == "Python") {
$result = findPythonPackage($distrib, $version_num, $version_name, $filter, $limit, false);
}
else {
$result = $db->getPackages($distrib, $filter, $patternName, $patternDescription, $limit);
}
......
......@@ -214,7 +214,6 @@ function findUbuntuDebianPackage($os_name, $version_num, $version_name, $keyword
return $results;
}
//TODO finish
function findPythonPackage($os_name, $version_num, $version_name, $keyword, $limit, $onlyname) {
$results = array();
......@@ -231,15 +230,35 @@ function findPythonPackage($os_name, $version_num, $version_name, $keyword, $lim
$index = 0;
for ($i = 0; $i <= $size; $i++) {
for ($i = 0; $i <= $size-1; $i++) {
$vv = $tr[$i]->getElementsByTagName('span');
$name = $vv[1];
if($vv->length != 0) {
}
$name = $vv[0];
$doc = getDocument($url_packages);
$description = $tr[$i]->getElementsByTagName('p');
if($name != null) {
$name = $name->nodeValue;
$version = $vv[1]->nodeValue;
$description = $description[0]->nodeValue;
$link = "https://pypi.org/project/$name";
$other = "python";
$package = new Package($name, $version, $description, $link, $other);
$results[] = $package;
$index++;
}
if($index == $limit) {
break;
}
}
}
return $results;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment