Bluebird’s blog
Black Green Blue Red Gold
RSS
  • Home PageHome
  • About Me

Automating packaging and RedMine

python Add 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

Leave a Reply

  • RSS Thomas's blog

    • Playing with clang and Qt January 10, 2010
    • How to use flex and bison with qmake (my own way) November 22, 2009
    • Wonders from a KDE fan and developer about some KDE design choices November 10, 2009
    • Installing an avr cross compiler in gentoo July 27, 2009
    • tags displayed in hg activity extension June 15, 2009
    • feedback about converting eigen2 to mercurial May 18, 2009
    • mercurial and ipv6 May 7, 2009
    • how to handle translations for an application that is both qt-only and KDE ? May 2, 2009
    • Fixing qmake missing rule for *.ts -> *.qm March 10, 2009
    • updating to KDE 4.2.1 : delete your plasma files (again) March 6, 2009
  • RSS Freehackers labs

    • PyTiCroque - PyTiCroque 0.5 est sorti.
    • Mercurial activity extension - Release 1.2
    • Symia - 0.2 released with misc fixes
    • Emerge activity - Release 1.0 for EmergeActivity
    • PyTiCroque - PyTiCroque 0.43 est sorti.
    • Symia - Announcing symia 0.1
    • Zeta Platform - Pre-compiled kernel for Zeta
    • Zeta Platform - Zeta platform 0.7 released
    • Convex Processing - 1.0 released
    • Opale - Final release for Opale 1.0
  • 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 © 2010 Bluebird’s blog All Rights Reserved XHTML CSS THEME by I SOFTWARE REVIEWS