@@ -49,29 +49,6 @@ def normalize(name):
4949 return re .sub (r"[-_.]+" , "-" , name ).lower ()
5050
5151
52- def get_official_description (name ):
53- """Extract package Summary description from pypi.org"""
54- from winpython import utils
55-
56- this = normalize (name )
57- this_len = len (this )
58- pip_ask = ["pip" , "search" , this , "--retries" , "0" ]
59- if len (this ) < 2 : # don't ask stupid things
60- return ""
61- try :
62- # .run work when .popen fails when no internet
63- pip_res = (utils .exec_run_cmd (pip_ask ) + "\n " ).splitlines ()
64- pip_filter = [
65- l
66- for l in pip_res
67- if this + " (" == normalize (l [:this_len ]) + l [this_len : this_len + 2 ]
68- ]
69- pip_desc = (pip_filter [0 ][len (this ) + 1 :]).split (" - " , 1 )[1 ]
70- return pip_desc .replace ("://" , " " )
71- except :
72- return ""
73-
74-
7552def get_package_metadata (database , name , gotoWWW = False , update = False ):
7653 """Extract infos (description, url) from the local database"""
7754 # Note: we could use the PyPI database but this has been written on
@@ -104,11 +81,7 @@ def get_package_metadata(database, name, gotoWWW=False, update=False):
10481 ).splitlines ()[0 ]
10582 except :
10683 pass
107- if my_metadata ["description" ] == "" and gotoWWW :
108- # still nothing, try look on pypi
109- the_official = get_official_description (name )
110- if the_official != "" :
111- my_metadata ["description" ] = the_official
84+
11285 if update == True and db_desc == "" and my_metadata ["description" ] != "" :
11386 # we add new findings in our packgages.ini list, if it's required
11487 try :
0 commit comments