Bluebird's blog
Black Green Blue Red Gold
RSS
  • Home PageHome
  • About me
  • Free software

python Category

Automating packaging and RedMine

python 5 Comments »

I am developing PyTiCroque which is python + Qt based software. The main platforms are Linux and Windows.

When I am close to final release, getting the release in shape usually goes through several attempts: I generate one release file, test it, find a bug, fix it, generate another release file and here we go again.

Of course, I have automated most of the process. I have a small python script make_exe.py that take care of most of the it: exe building on windows with PyInstaller, then installer building with InnoSetup.

There is one step that I had not automated so far: uploading the release file to RedMine. I used to go through manual upload but for the last release, I had to release the file several times and was annoyed by this last manual step. Surely, there is something I can do to automate this.

It’s been a long time that I wanted to touch web scraping and web automation. After a quick search, I found mechanize and it did the job very well. The doc are a bit strange, with no autogenerated docs, and just example on the website, but the tool is so simple to use that it was not much of a problem.

In 15 minutes, I had my script running:

  1. Login to Redmine
  2. Go to the File Upload page
  3. Enter the information for the new file: filename, mimetype, release attached to the file
  4. upload it

The final script is:


url_fh = 'http://labs.freehackers.org/'
br = mechanize.Browser()
br.set_handle_robots(False)

report( 'Fetching labs.freehackers.org/login page...' )
page = br.open( url_fh + 'login' )

report( 'Logging in...' )
br.select_form( nr=1 )
br["username"]="philippe"
br["password"]="XXXXXX"
br["autologin"]=0
page = br.submit()

report( 'Opening PyTiCroque - New Files page...' )
page = br.open( url_fh + 'projects/pyticroque/files/new' )

report( 'Registering the file' )
br.select_form( nr=1 )
br["version_id"]= [ "44" ]
br.add_file( open( r'd:\work\pyticroque-dev\pyticroque\LISEZMOI.txt' ), "text/plain", "LISEZMOI.txt" )
page = br.submit()
report( 'File sumitted !' )

The process is so simple that I plan to automate more stuff in the future. For example, my users are so not computer savy that doing through a bug reporting software is too much for them. Still, I like good bug reports. I have a log file that gives me accurate information about everything that happened in the software, so if they can attach that file to the bug report, I can probably find the bug. But attaching a file to a bug report is not so simple for non computer savvy people. Instead, what I plan to do is automate the process of bug reporting with a wizard. They will go through the following steps:

  • You want to report a bug ?
  • You want to be notified of updates ? If so, please enter your email address ?
  • Click [Send bug report]

Behind the scene, I will connect to Redmine, identify the right version, prepare the bug report form, attach the log file and enter it in the bug manager. I hope I can get the bug reports then !


May 27th, 2009  
Tags: redmine automation pyticroque



  • Pages

    • About me
    • Free software
      • Old Free Software Interviews
  • RSS Thomas’s blog

    • Compiling firefox-9.0 on linux PPC January 11, 2012
    • DjangoRedmineAdmin 1.0 released January 8, 2012
    • Celery init scripts for Gentoo December 2, 2011
    • New lightweight admin-oriented linux kernel mercurial mirror November 14, 2011
    • EmergeActivity gets a graphical interface: releasing 2.0 November 9, 2011
    • A small step forward for the mercurial activity plugin, releasing version 2.0 September 18, 2011
    • How to detect Altivec availability on linux/ppc at runtime May 13, 2011
    • Mercurial mirror for Django stable branch 1.3 April 7, 2011
    • announcing qxv October 3, 2010
    • New mercurial mirror for Django stable branch 1.2 September 9, 2010
  • RSS Freehackers labs

    • Django Redmine Admin - DjangoRedmineAdmin 1.0 released January 8, 2012
    • Symia - Release 0.4 fixes several important bugs December 11, 2011
    • Emerge activity - Version 2.0 released with (optional) Qt interface November 9, 2011
    • Colibri Mailing List Manager - Release of 1.0-beta1 October 12, 2011
    • Mercurial activity extension - Release 2.0 September 18, 2011
    • Python Mesh Viewer - 2.1 released May 13, 2011
    • Convex Processing - Maintenance release : 1.1 is out April 13, 2011
    • Opale - Maintenance release : 1.1 is out March 28, 2011
    • Mercurial activity extension - Release 1.4 January 26, 2011
    • qxv - 0.2 released January 24, 2011
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
Categories
  • python
  • vi clones
About Me

My name is Philippe, I am doing free software for fun, and propritary software for money and a little bit of fun as well.

Copyright © 2012 Bluebird's blog All Rights Reserved XHTML CSS THEME by I SOFTWARE REVIEWS