#!/usr/bin/env python

from datetime import datetime as DT


def read_html_file(input_file, output_file):
    month_dict = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5,
                  'Jun': 6, 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10,
                  'Nov': 11, 'Dec': 12}
    with open(input_file) as in_fh:
        version_link = {}
        version_list = []
        for entry in in_fh.read().split('<pre>')[1].split('\n'):
            if 'Directory' in entry and not 'lookup_service' \
               in entry and not 'users' in entry and not 'old_releases' in entry:
                date_data = entry.split('Directory')[0].strip().replace(
                    ':', ' ').split(' ')
                year = int(date_data[0])
                month = int(month_dict[date_data[1]])
                date = int(date_data[2])
                try:
                    time = int(date_data[3])
                except IndexError:
                    time = 0
                version = entry.split('/</a>')[0].split('">')[-1]
                version_link[DT(year, month, date, time)] = version
                version_list.append(DT(year, month, date, time))
        latest_version = max(version_list)
        print("Current version: %s" % version_link[latest_version])
        with open(output_file, 'w') as out_fh:
            out_fh.write(version_link[latest_version])

@@ -56,59 +56,72 @@
  DT%0A
-%0A%0Adef read_html_file(input_file, output_file):%0A    
+import sys%0A%0Ainput_file = sys.argv%5B1%5D%0Aoutput_file = sys.argv%5B2%5D%0A%0A
 mont
@@ -192,22 +192,16 @@
         
-      
 'Jun': 6
@@ -255,22 +255,16 @@
         
-   
-   
 'Nov': 1
@@ -277,20 +277,16 @@
 c': 12%7D%0A
-    
 with ope
@@ -309,28 +309,24 @@
  in_fh:%0A    
-   
- 
 version_link
@@ -331,20 +331,16 @@
 nk = %7B%7D%0A
-    
     vers
@@ -353,20 +353,16 @@
 st = %5B%5D%0A
-    
     for 
@@ -422,20 +422,16 @@
         
-  
-  
 if 'Dire
@@ -473,20 +473,16 @@
 vice' %5C%0A
-    
         
@@ -547,28 +547,24 @@
 ' in entry:%0A
-    
             
@@ -636,20 +636,16 @@
         
-    
 ':', ' '
@@ -657,20 +657,16 @@
 it(' ')%0A
-    
         
@@ -706,20 +706,16 @@
         
-  
-  
 month = 
@@ -752,28 +752,24 @@
             
-    
 date = int(d
@@ -781,20 +781,16 @@
 ata%5B2%5D)%0A
-    
         
@@ -810,28 +810,24 @@
             
-    
 time = int(d
@@ -851,20 +851,16 @@
         
-    
 except I
@@ -882,28 +882,24 @@
             
-  
-  
 time = 0%0A   
@@ -895,20 +895,16 @@
 ime = 0%0A
-    
         
@@ -957,20 +957,16 @@
 %3E')%5B-1%5D%0A
-    
         
@@ -1025,36 +1025,32 @@
 ion%0A            
-    
 version_list.app
@@ -1082,20 +1082,16 @@
  time))%0A
-    
     late
@@ -1125,20 +1125,16 @@
 st)%0A    
-  
-  
 print(%22C
@@ -1185,20 +1185,16 @@
 rsion%5D)%0A
-    
     with
@@ -1228,20 +1228,16 @@
 out_fh:%0A
-    
         

Update current_interpro_version.py