@@ -178,22 +178,27 @@ def get_github_long_description(
178178 returns = []
179179 for n in points :
180180 ret = None
181- url = 'https://api.github.com/repos/' + user + '/pyradio/' + n
182- if sys .version_info < (3 , 0 ):
183- try :
184- ret = urlopen (url ).read ()
185- except :
186- ret = None
181+ if n == 'tags' :
182+ url = 'https://api.github.com/repos/coderholic/pyradio/tags'
187183 else :
188- try :
184+ url = 'https://api.github.com/repos/' + user + '/pyradio/' + n
185+ if use_sng_repo and not sng_branch :
186+ url += '?sha=devel'
187+ else :
188+ url += '?sha=master'
189+ url += '&per_page=50'
190+ try :
191+ if sys .version_info < (3 , 0 ):
192+ ret = urlopen (url ).read ()
193+ else :
189194 with urlopen (url ) as https_response :
190195 ret = https_response .read ()
191- except :
192- if do_not_exit :
193- ret = None
194- else :
195- print ('Error: Cannot contact GitHub!\n Please make sure your internet connection is up and try again.' )
196- sys .exit (1 )
196+ except :
197+ if do_not_exit :
198+ ret = None
199+ else :
200+ print ('Error: Cannot contact GitHub!\n Please make sure your internet connection is up and try again.' )
201+ sys .exit (1 )
197202
198203 try :
199204 returns .append (json .loads (ret ))
@@ -210,9 +215,9 @@ def get_github_long_description(
210215
211216 if ret is None :
212217 if only_tag_name :
213- return 'PyRadio-git'
218+ return None
214219 else :
215- return 'PyRadio-git' , 'PyRadio-git'
220+ return None , None
216221
217222 if only_tag_name :
218223 return returns [0 ][0 ]['name' ]
@@ -231,35 +236,45 @@ def get_github_long_description(
231236 # print(tag_hash)
232237 # print(revision)
233238
234- this_version = tag_name + '-' + str (revision ) + '-' + returns [0 ][0 ]['sha' ][:7 ] if revision > 0 else None
239+ if revision > 0 :
240+ this_version = tag_name + '-r' + str (revision ) + '-' + returns [0 ][0 ]['sha' ][:7 ]
241+ if use_sng_repo :
242+ this_version += '-sng'
243+ if not sng_branch :
244+ this_version += '-dev'
245+ else :
246+ this_version = None
235247
236- # print('this_version = ' + this_version)
248+ # if this_version:
249+ # print('this_version = ' + this_version)
237250 return tag_name , this_version
238251
239252def get_github_tag (do_not_exit = False ):
240253 ''' get the name of the latest PyRadio tag on GitHub '''
241254 return get_github_long_description (only_tag_name = True , do_not_exit = do_not_exit )
242255
243256def get_next_release ():
257+ ''' not used '''
244258 r = get_github_long_description ()
245- print ('Descriptyion : {}' .format (r ))
259+ print ('Description : {}' .format (r ))
246260
247261 sp = r [1 ].split ('-' )
248262 print ('sp = {}' .format (sp ))
249263 x = int (sp [1 ]) + 1
250- return sp [0 ] + '-r {}' .format (x )
264+ return sp [0 ] + '-{}' .format (x )
251265
252266def get_devel_version ():
253267 long_descpr = get_github_long_description (do_not_exit = True )
254- if long_descpr == ('PyRadio-git' , 'PyRadio-git' ):
255- return 'PyRadio-git'
256- else :
268+ if long_descpr [0 ]:
257269 if long_descpr [1 ]:
258- return 'PyRadio ' + long_descpr [1 ]. replace ( '-' , '-r' , 1 ) + '-git'
270+ return 'PyRadio ' + long_descpr [1 ]
259271 else :
260- return 'PyRadio ' + long_descpr [0 ] + '-0'
272+ return 'PyRadio ' + long_descpr [0 ]
273+ else :
274+ return None
261275
262276def windows_put_devel_version ():
277+ ''' not used '''
263278 long_descr = get_devel_version ()
264279 from shutil import copyfile
265280 cur_dir = os .getcwd ()
@@ -795,10 +810,10 @@ def _do_it(self, mode='update'):
795810
796811
797812if __name__ == '__main__' :
798- # l=get_github_long_description()
799- # print(l)
800- # get_devel_version()
801- # sys.exit()
813+ l = get_github_long_description (use_sng_repo = True )
814+ print (l )
815+ print ( get_devel_version () )
816+ sys .exit ()
802817 print_pyradio_on ()
803818 print_python3 () if PY3 else print_python2 ()
804819 # print(get_devel_version())
@@ -860,15 +875,19 @@ def _do_it(self, mode='update'):
860875 args .force = True
861876 package = 1
862877 VERSION , github_long_description = get_github_long_description (use_sng_repo = True , sng_branch = True )
863- github_long_description += '-sng'
878+ if not github_long_description :
879+ github_long_description = 'PyRadio'
864880 github_long_description = github_long_description .replace ('-' , '-r' , 1 )
881+ # github_long_description += '-sng'
865882 elif args .sng_devel :
866883 '''' sng devel '''
867884 args .force = True
868885 package = 2
869886 VERSION , github_long_description = get_github_long_description (use_sng_repo = True )
870- github_long_description += '-sng-dev'
887+ if not github_long_description :
888+ github_long_description = 'PyRadio'
871889 github_long_description = github_long_description .replace ('-' , '-r' , 1 )
890+ # github_long_description += '-sng-dev'
872891 elif args .devel :
873892 ''' official devel '''
874893 package = 3
0 commit comments