Hi all, I was talking to Alvaro yesterday, and we had a problem to get the latest trunk without having to fetch all the hg repository, so i did this little python script (which depends on BeautifulSoup).
To use it, install beautifulsoup and then run: python get_latest_web2py.py And it will fetch the latest zip from the hg mirror that im maintaining in bitbucket. The resulting file will have this name: web2py-rev_changeset-currentdate.zip, e.g, web2py-794_5e1df34e2052-130509.zip. Hope it is useful for those who have a slow connection and just want to test the latest trunk. Im also thinking in creating a tk interface for it, with support for choice between the latest five revisions, if someone has skills in tk, i would like a hand =) @Massimo: Can we add this to the scripts folder in web2py ? Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---
# coding: utf-8 ################### TODO #################### # # 1. Get the commiter name # 2. Get the human readable revision number # 3. Better document it # 4. Add a progress bar # ############################################# # Modules from BeautifulSoup import BeautifulSoup from datetime import datetime import urllib,shutil,os # Get changeset page contents print "Getting changesets..." page = urllib.urlopen("http://bitbucket.org/douglas/web2py/changesets/").read() # Lets generate a soup tree soup = BeautifulSoup(page) # Now lets get the last revision and build the download url changeset = soup.find('div',id='chg_0').\ find('div','changeset-description').\ a['href'].split('/')[-2] description = soup.find('div',id='chg_0').\ find('div','changeset-description').\ a.string # Configure the local vars to fetch the file print "Defining internal vars..." download_url = 'http://bitbucket.org/douglas/web2py/get/%s.zip' % changeset curdate = datetime.now().strftime("%d%m%y") curpath = os.path.abspath(os.curdir) lastrev = int(soup.find('td').string.split("commit")[1].split(":")[0]) newfile = "%(curpath)s/web2py-%(lastrev)s_%(changeset)s-%(curdate)s.zip" % locals() # Finnaly lets get the file print "Fetching the file: %(download_url)s" % locals() temp_file,metadata = urllib.urlretrieve(download_url) # Move the temp file to the real file print "Moving the temp file to the real file." shutil.move(temp_file, newfile) # Some debug info print "Last commit: %(description)s" % locals() print "File saved to: %(newfile)s" % locals()