From db8de5b477f47c07a726f9025105dd9f8964e531 Mon Sep 17 00:00:00 2001 From: Jan Lerking Date: Mon, 12 Feb 2018 04:37:45 +0100 Subject: [PATCH] Updated process_files --- __pycache__/h2inc.cpython-35.pyc | Bin 1520 -> 1770 bytes __pycache__/h2inc_gui.cpython-35.pyc | Bin 6608 -> 6608 bytes h2inc.py | 42 ++++++++++++++++----------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/__pycache__/h2inc.cpython-35.pyc b/__pycache__/h2inc.cpython-35.pyc index 516138e287b12278cef6e555e439a5563fb580c7..57272df03dbbc14584bd5642e111b01b498e81e5 100644 GIT binary patch literal 1770 zcmZuxO>f&q5S`_xNK5{xQ!5S7Iyt380z1vc7sCxu9}A;^3m6b;xGcG{rBWibyMh!$ zLJPR}qCca5X|Fw{#~yR)o0aW4L22)3b~rPfeQ#!WI-S&?{L=e9A^M9RJRbBnSo&9p z690lKqTanOs3)A=qspU^Pd%ST0rdhBx85Q3Lb^muM17(>W<75?nQ&yDQt49}&~NZr zqcWs2a(bJ}n97#ZJN)6(EP012=p^%O(&S3ZYA}{|&8be5g758PX!8p+`4xM|n^LsXi@mTAvP($^^9V zxb7|-yO)9v@_-D&{xc#(OkUF2WQWcWc$$SLiVM8<_O9Ns@?Pv`k@aeAgIQkvY{ROa zNo8AdT!~VaIZ)Ow#>S@ox+h)k;tmIzv)^6P=zu-9J-$tC?gdi{Sc11^g zDpIT`o_Yk^2Y3fCIK1aj=97<*{?Q=~797|>Nxh-@V}|Sae3QX99)o{}8TbO|U~b{l zF^nrh)Fv6Q;ZryF9Rq@Hk)LeR8D5=c!O4A5+`L@WDVBZ#fz|`@=g+tmK*$hH;JTr7 z-Jl{i{^8LiLLR{^Wu9swPGKwvUFYq+Qd_)dG*^Q0d7mCKM@2nqj=scR^M@0-+ zkI#2#+2T$yNZ4|&C}E<(cud0<4HF(#WI$D);R5L{6EZ0+61EN3oDQDboD&v)1^eBW z3xz-G#(fmIy5W%0u*08(zu?WPpvg9!p;=C|_{5T%Wh<1U?>gASBv~=b)>R6;Y*06H zY~x1BM%4wVm^PJE466-`s@78Z&>iPCXmTEQ-Bbf3=f?WlC>tZP$_r`zONsfPDZI

+EVwE)Zk9@pJ9?O|a z@?l%s4p%OVB3{KC*emt~4BR$2%3E#Q?wYx9 zceHXCxWn6IWxt#bY|QweMzxD5hoE}Q8aKVWYFt~o)DQaE70e@OTZf~%oL2IP=T+}O Tv_)I&h_=VYx<9YoX>a`t%Wigi literal 1520 zcmZuxO>5*v5UuXk$4J(AJ?q%JIXNMRL}alO6EFm07UE+t0Ur!Q2BS!_J+m51)2+ed z-Ekms$T5(gk-yZ}oc14tJ>^wv;|yk{>6+?NRafb~DsA`s@o?+s;XfhK-?VZ`=r6I% z?+^ukf-0ingDz+&oLy2SX{uBk|tbr=d@mhzaNdGNb}dJ+@?#lQG9#@hBpo7e#*$XQyBJq^71O4HjZ8h)d0C9LRrz&mkVpwv!Z92 za@YzN(1Hiiq3qLagU;Z@2tSm^jmkuyVwo=?&|n~U^eNMgP;k!_x@JW(9kB6FNwWaw z2<9l2x`#L&L7=zf?pLSa@t%xDq3&D z>k}-)RFk(O0QD>kzvw)R#`0)gn01LU9e(KVnrRo!HD zSVsCeDzwV9+J?Gpsw^+9x-47$40Z>!^_mPL7L*InU~F%iz2f0AspsIdVNseEh7NY| z7(Ux?be)&RxPdWW>dBSkGIYOC7U6znZJc4WnbpH8#cTE diff --git a/__pycache__/h2inc_gui.cpython-35.pyc b/__pycache__/h2inc_gui.cpython-35.pyc index cf7859b7c94692428ef1790136d555e718f161e5..2f74536f662831cefa526cdba0b0b68f5e8c7a8c 100644 GIT binary patch delta 15 Wcmca$e8HGajF*>dZP-S(Q<4BEeFWqH delta 15 Wcmca$e8HGajF*?|X5dD)Q<4BFYy}Gd diff --git a/h2inc.py b/h2inc.py index 658bbd8..02d6b2a 100644 --- a/h2inc.py +++ b/h2inc.py @@ -12,7 +12,6 @@ import h2inc_gui tupline = [] preproc = () -outfile = '' filelist = [] folderlist = [] cnt = 0 @@ -25,7 +24,8 @@ def sourcedir_filecnt(sourcedir): for file in files: if file.lower().endswith('.h'): cnt += 1 - filelist += [file] + filelist += [folderName+'/'+file] + print(folderName+'/'+file) #print(filelist) return cnt @@ -40,27 +40,35 @@ def sourcedir_foldercnt(sourcedir): tempf = [file for file in files if file.lower().endswith('.h')] if tempf: cnt = cnt+1 - print(folderName) + #print(folderName) folderlist += [folderName] #print(folderlist) #print(len(folderlist)) return cnt def process_files(sourcedir, destdir): - global folderlist + #global folderlist global filelist + global preproc + outfile = '' cnt = 0 - for f in folderlist: - folderlist[cnt] = str(f).replace(str(sourcedir.get()), str(destdir.get())) - print(folderlist[cnt]) - if not os.path.exists(folderlist[cnt]): - os.makedirs(folderlist[cnt]) + for f in filelist: + inputfile = f + filehandle = open(f, 'r') cnt += 1 - #WorkPath = os.path.dirname(sourcedir) - #print(WorkPath) - #incpath = destdir - #print(incpath) - - #pattern = '.h' - #inputfile = 'gtkaboutdialog.h' - #filehandle = open(WorkPath+'/'+inputfile, 'r') \ No newline at end of file + for lines in filehandle: + preproc = preproc+tuple([parseline(lines)]) + filehandle.close() + for elements in preproc: + outfile = outfile+parseparsed(elements) + outputfile = os.path.splitext(inputfile)[0]+'.inc' + outputfile = str(outputfile).replace(str(sourcedir.get()), str(destdir.get())) + #if not os.path.exists(filelist[cnt]): + #try: + #os.makedirs(output) + #except OSError as exc: # Guard against race condition + #if exc.errno != errno.EEXIST: + #raise + newfile = open(outputfile, "w") + newfile.write(outfile) + newfile.close()