# -*- coding: utf-8 -*- #paregu puudub selles programmis igasugune kontroll sisendi ule ### #rakenduse nimi: MakeMyLifeEasyer #autor: itra #rev: 1.0 ### import sys, os.path from string import Template html = Template(""" [ $progenimi ]
[ $autor ]
  1. [ $progenimi REV $rev ] - C++ - *.cpp
  2. Lae alla
  3. [ $progenimi REV $rev ] - Python - *.py
  4. Lae alla
  5. [ $progenimi REV $rev ] - EXE - *.exe
  6. Lae alla
""") running = True fail = sys.argv[1] #fail = "/home/arti/Dropbox/Public/Proged/itra/123.cpp" f = open(fail, 'r') if (os.path.splitext(fail))[1] == ".py": while running: line = f.readline() if line == "###\n": ProgeNimi = ((f.readline()).lstrip('#rakenduse nimi: ')).rstrip('\n') Autor = ((f.readline()).lstrip('#autor: ')).rstrip('\n') Rev = ((f.readline()).lstrip('#rev: ')).rstrip('\n') running = False elif (os.path.splitext(fail))[1] == ".cpp": while running: line = f.readline() if line == "/*## info rev 1.1\n": ProgeNimi = ((f.readline()).lstrip('rakenduse nimi: ')).rstrip('\n') Autor = ((f.readline()).lstrip('autor: ')).rstrip('\n') Rev = ((f.readline()).lstrip('rev: ')).rstrip('\n') Comment = ((f.readline()).lstrip('proge kommentaar: ')).rstrip('\n') WinExeYN = ((f.readline()).lstrip('kas win exe on olemas: ')).rstrip('\n') LinuxExeYN = ((f.readline()).lstrip('kas linux exe on olemas: ')).rstrip('\n') SrcMirrorYN = ((f.readline()).lstrip('kas lähte koodi peegel on olemas: ')).rstrip('\n') SrcMirrorUrl = ((f.readline()).lstrip('kas lähte koodi peegel on olemas: ')).rstrip('\n') WinExeMirrorYN = ((f.readline()).lstrip('kas win exe peegel on olemas: ')).rstrip('\n') WinExeMirrorUrl = ((f.readline()).lstrip('win exe peegli aadress: ')).rstrip('\n') LinuxExeMirrorYN = ((f.readline()).lstrip('kas linux exe peegel on olemas: ')).rstrip('\n') LinuxExeMirrorUrl = ((f.readline()).lstrip('linux exe peegil aadress: ')).rstrip('\n') running = False elif line == "/*##\n": ProgeNimi = ((f.readline()).lstrip('rakenduse nimi: ')).rstrip('\n') Autor = ((f.readline()).lstrip('autor: ')).rstrip('\n') Rev = ((f.readline()).lstrip('rev: ')).rstrip('\n') running = False f.close() SrcCppUrl = "http://dl.dropbox.com/u/18000426/Proged/" + Autor + "/" + ProgeNimi + ".cpp" SrcPyUrl = "http://dl.dropbox.com/u/18000426/Proged/" + Autor + "/" + ProgeNimi + ".py" CompWinExeUrl = "http://dl.dropbox.com/u/18000426/Proged/" + Autor + "/" + ProgeNimi + ".exe" f = open('./'+ProgeNimi+'.html', 'w') f.write(str(html.substitute(progenimi=ProgeNimi, autor=Autor, rev=Rev, srccppurl=SrcCppUrl, srcpyurl=SrcPyUrl, compwinexeurl=CompWinExeUrl))) f.close()