reinteract-0.5.0/0000777000076400007640000000000011162516460010673 500000000000000reinteract-0.5.0/examples/0000777000076400007640000000000011162516457012517 500000000000000reinteract-0.5.0/examples/imshow.rws0000664000076400007640000000124411060676113014472 00000000000000from replot import imshow from numpy import * import matplotlib # meshgrid is a handy numpy command for creating x and y coordinate # arrays for a 2-D grid xx, yy = meshgrid(linspace(0, 2*pi, 100), linspace(0, 2*pi, 100)) # To get an idea of what these arrays look like, let's look at # their upper left corners xx[0:3,0:3] yy[0:3,0:3] # Now use the coordinate arrays to display a function over the range # [0,2pi] x [0,2pi] imshow(sin(xx) * cos(2 * yy)) # You can use any of the keyword arguments from: # http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes-imshow imshow(sin(xx) * cos(2 * yy), cmap=matplotlib.cm.copper, extent=(0,2*pi,0,2*pi)) reinteract-0.5.0/examples/plot2.rws0000664000076400007640000000061211152364407014224 00000000000000import replot from numpy import * x = linspace(0, 2*pi, 100) # In addition to using plot() to create simple figures, # you can also build up more complex plots using the # matplotlib API # http://matplotlib.sourceforge.net/api/axes_api.html p = replot.Axes() p.plot(x, sin(x), 'bo') p.plot(x, cos(x)) p.set_xlabel("X axis") p.set_ylabel("Y Axis") p p.set_xlim(0, 2*pi) p help(p.set_xlim) reinteract-0.5.0/examples/play.rws0000664000076400007640000000050211060676113014125 00000000000000from numpy import * from replot import * # Plot one cycle of a periodic function x = linspace(0, 2 * pi, 50) plot(x, sin(x) + sin(3*x) / 3 + sin(5*x) / 5) # OK, looks good, let's create a bigger data set # and play it from replay import * x = linspace(0, 440 * 2 * pi, 44100) play(sin(x) + sin(3*x) / 3 + sin(5*x) / 5) reinteract-0.5.0/examples/basics.rws0000664000076400007640000000150311060676113014426 00000000000000# To start using reinteract, type a Python expression, and hit # Return to calculate. (This example is already calculated # when it was loaded, but try modifying the statement below and # then hit Return again to calculate it) 1 + 1 # You can assign and use variables a = 2 a a + 3 # As above, the default action when an expression returns a result # other than N is to display it. You can also use 'print' explicitly print "Hello", "World" # Try modifying the value of a; you'll see that when you hit # control-return, the value of a + 3 is updated as well. # You can define functions def fact(n): result = 1 for i in xrange(0,n): result *= (1 + i) return result fact(3) # And use constructs like for loops and if statements for i in xrange(0,5): print "%d: %d" % (i + 1, fact(i + 1)) reinteract-0.5.0/examples/index.rnb0000664000076400007640000000035711060676113014245 00000000000000[Notebook] last_modified = 1220154386.47 description = Examples of the use of Reinteract. This notebook shows off some of the basic capabilities of Reinteract. Some of the examples here require matplotlib to be installed on your system. reinteract-0.5.0/examples/plot.rws0000664000076400007640000000100411060676113014134 00000000000000from replot import plot from numpy import * x = linspace(0, 2*pi, 100) # Basic plotting of a single data set. (If only # one parameter is given, then [0,1,2,...] is # used for the X values. plot(x, cos(x)) # You can plot multiple sets of data in a single command plot(x, cos(x), x, sin(x)) # You can also specify styles for each data set, see # http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes-plot # for more details plot(x, cos(x), 'r--', # red dashed lines x, sin(x), 'bo') # blue circles reinteract-0.5.0/data/0000777000076400007640000000000011162516460011604 500000000000000reinteract-0.5.0/data/Info.plist0000664000076400007640000000141511070066774013501 00000000000000 CFBundleDevelopmentRegion English CFBundleIconFile Reinteract.icns CFBundleIdentifier com.yourcompany.Reinteract CFBundleInfoDictionaryVersion 6.0 CFBundleName Reinteract CFBundlePackageType APPL CFBundleSignature ???? CFBundleVersion 1.0 NSMainNibFile MainMenu NSPrincipalClass NSApplication reinteract-0.5.0/data/Reinteract.icns0000664000076400007640000015123311161346302014500 00000000000000icnsқis32z v|ry}d>U# 4_wqG UvNWvh|J:?T|{NzesYg dp( r3BDHOrk~u|rUUE:Rylzps8mk3 QڐŒ ṂVlA>8YV&+NekRH pQB:):jH6Q(VH Qa& ܰkB;(D8>i6^gǍ8)Nw**AB-a3/ycG*"  {ګG->H?=2 il32 u{-p{f Z~wk4+sfwxVx}qrXFX s {*5i;g3\nfwuNM|ms^zz[ J yx(c9v|]0a a X]t vrkh,Dl KW8yNN=4ep t=|r#]tDz&}i[p9M~||}eejF$yn~Fpd&qn59+nx t5 }t$.{ (zH Rtn'l8mkf Lx#!ԡlp.`A>eKUS& fRF:zL+/n5%\=*l9!u9V,*_-^i2   M"\S&%zP" @~"F|PSlV0 H"zAȃPSJ0 wXg2דd5%VE5#c`am4 2ER?"T`7  j߅Z) %܉k6Esa: uB[R: x]jT"  ZE0 nbB4m2kB(Q ،XF' EY- LI/mZ& Z[7'k㫬K):E9%i}2 Q" 8ًVB+&CXekk`J. G7 ;avr\B* *6;=<6* [($nL7! 9\*,J%SK%  !IЋfB :Tfmni\D& $2:<7-  it32 y"B}q6wqfn"~/|">\w0Q~tcG`m%p~ik:lMWd-r)}'huO-MJkmls(mMW{~)A~&('{GjnapPy-PeiGrIZ1|q~SuQe1"?HD ~{-|t6ZV{e -q 4{ D"D }}v}'oSYv$s8wv-]<{!J[ts7}xDw'~pXN\Iz.g;2zUr~J :fxDR[}=Qfz~b~{7'bQ:C}UyjWnZOSvH{E c}w }h1Gp$ZJx^~nv~=7.$Z| IzYh{}tc{Z&UI#.}%-%R}y}Svmxu dvO|e9dM|-&MGr =,i` yWu 'HKfp]rso}R26-2]vm}oEH!ms-TwfOv^E}v#nDs7~QqGte?p DzrolyxL'}|n} Wu>{a!]-yryWyv \~An=$2xa8nz$xeynK}{zxwvwxz{~cRz[/ Pv*qz,KKrD}?py~NN-1Ep[ zhb{:}{xteS_zC\:yf3` 4_upY8 X`~]N! @vnn.&B@Yxrp}d}[r?'LQ2K-t,]V}ww2yc _uZ6 ]z~5.tY ;sf%Y{}[@[lyxkS"t8mk@(0 :g D5"#" NǧP (bh Ju ,|<" %K," W辙za⡣|wtH5)  i}J7;@FJҮzvuvzK;, V?6, &=BFNXzcL6#  TKTZ^``^ZVRNLܹrZF8.**+07Au\C-XV`fihe_XQJC>;˶fL7(#-\jO6" iajproi`VLB:2.9vZA,7vZ?( juzzvnbUH<2)"bnR8#  !~bF.r~~reUF7+"ܶfJ1  hK2yiWF5' ʵ{_C+%볡lN4<Њo[G6& uX=& >ܴnP5 xbM8' DﶰnQ6" hɳmO4alU>* }ݶfJ1jM2ܦy`G1 ̵|_C+ ۻfI/JͬnT;&  uX=& D{_C+ įdI2 =𶰡nR7" սsW<&  vZ@* }߶gJ1+꾹jN5  @ާJ ?oR8# ͵}`D,y^C,Y$ |iL2 vY>& ZùkQ9$ 4+$ cF.>򶰡nR7" 'v]C. w8." }_B* ~ථhK2}fM6# 4OB3%z]@( ε~aE,㤦kT>*qZ7XiXF3" ƪz[>'  vZ>' 2nYB/ +5@K^nXB. Ъy[>& ?pS8#  xӉnZF2" ~0;FPYbiP8$ ݪz\?' ~ⶮiM3  Vދn~~mZF3$-5AKT[`fv\B* ꬖ{^A) ѶdH1.uҁXhxxhVD3$ 4AGRZ^```i𪘀dH/ ~`C*  aHVfr~{oaP@1" /rMYadc_YTU㮞jM2 bF-@u?BLXcnvz{xpeXI:-! R^hkibWMELаkN4 dG.zA=CJRZbinqpkdZN@3' xdosri[M?5SjN3 |eI/ROSW\_bfffc^VMB6," mhu{zrcR@1'p߶gJ1Eƽ~bG. gijifc`\WQI@6-# z|nZF4%~bF-ڸv\B,A~|wpg^ULD<4+# }yfP:)!ͱvZ?( ɒ~hQ:& ⽻rcTF;2)" s\E0ᨭlQ7"  vc[u|jVB/ ѽr^J:," jR:&-ퟥz`F/ %:QhzsdTC2# ٜrZC0!  딛yaG1𗚢mS;&  1EXhqsnfZL>0# B򺷮tY@+ f˜qV>)v^F0 &6FRYYTK@5* ޸x\A*gM5"|~zeN8%  )4=A@;3*" ʶՖ~bF.(y^D/jr|iS>*  #)+*&   riM3 ⦦qV?ZhzzjVB.   E涰xeqU:$ ΪiVPbr~wiWC2"   ϵnYєz^B* %}vkM^lw|{sfVC2#}dOl횂fJ1qRL[irwvnbRB2#ⶰtZF?oS9# 򮬡EN[forqj^O?0" XôjQ<1̒x\A*  䱴FQ\fmnldYK<.! 쳲|aG3)뚁eI0>mOV^fklh`TF8*ŲrV>+"VnR8" zg[^bhjje[OB4' ?记gL5$#˒w[@) skhijjhbWK>1$ v[B,ꙀdH0쥊~vrnkf^SG:-! ͨjO7$nQ7" ګ|tme[PB6) E堨v]C-DʑvZ?) CʷzodYL>2& hO7$ ꙀcH/krdVH:." rZA,  mQ7" vdTD6* X<zbJ4" lˑvZ?( zfRB2& mDv~iR;( )뙀cH/¶jUA0# G  g{nWB.  mQ7" ijv\E2"  F 6Ym~p\F2" ΑvZ?) ʯkQ9& "#!O_r~~p^J6%>dH0ծeI1 8%+00,$ FSft{yo_M:(  nR8# 䭙~bE-i*2:><5* AJ[jstm_N;*  ֒w[@* bF-.8AGHD:.  J>CTblnj^N=- HfJ1 ͛eH/M{1=FNQNF:,  P@BQ^gkg^P?/"  oS:$  jN5! "i6AKSVVOD6'  %IxDDR^gki`SD5&  z]B+ rW>) %X;FPWZZSI<.  ū0 @gL3  n|O2'  vZ?)  jޅcgjnnmibWJ=0# B֘~wpg]QD7*  KeJ2  #|{xwwvuqjaUH:."  -?Rds~vk_RC5' ؋qU;& .f⸖~zrj^RE7*  "2FXjx{qeWI:-!  a|`F. &:Pη{rfZN@3'  #3EVfrz{ulbVI;."  !҇lQ8$  -AVlxnbUH:.#  !.>LXbhlnpqrrrrsssssrrqonlie^VMB6+! fx]C, !1DWj{{qeYM@4(  &26.%  #ՄjN6" #2BRboz~vndYNB7,"  #*0479::::::::::::::987642.)# Xv[B+ ".@pV`hnppmic[SJ@6-$   ""###$$$$$$$####"""!   $iN6"  THOTVURNHA:2*"   *e@9." *OeM6$]G:*  1_^F2! [I6& %7dYB.   |ZE1  *=`o?.  8Ӑ}iR:'  .AYǀH'!6g򷝖rZB- !0CXˢv^E/"2DXl˛rZB."2BUgy䳊zfP:("/?Pbrӻ}uxgUB/   ,:JYgu~wrnllnry|pbRA2# '3AN[fqy~~{xvuuvy|~wncVI;."  !+6BMW`gmqsssrrqrrsttsqmf^UJ>2(  #+5>FNTY]_abbbbbbb`]YSMD;2)   !(.5:@DGJKLMMLKJGD@:4-&  !%)-0245665420-)%   !!!!     ic08} jP ftypjp2 jp2 Ojp2hihdrcolr"cdefjp2cOQ2R \ PXX`XX`XX`XXXPPXdKakadu-v5.2.1 | |Z6p|f5]0%BR-z_8] "ש2 GZחQ&$%֨FF%O–<Z|." c*z&@}p4|R K>T8+B ̫Gl%bPʞ"Sz-#eθ}ϙFLc{Iݭv?AvkײvC,3%@uKqOrG/wownD;#dVtȑ*A!9 yOoSyǵۥlPmFd7`v-7aP7D&` '"%_,(3pSp jW*,X;[Vܘ%gwFWG 0BP}N>YORunk 8OI ;R⤄ &&D}CyC[0;S=kQVRh+7m1]tPpKJi: +&]؀M=PsKr?&gXZuǵ\@l.묵 YecZ搞8!PcKta2E[$ȺN~ @_~ [0K^bV q{~m^) q&i!B3ڻ8D 1QOdx9_p|/Mb@0LhEe0"GvJ@ۃ F\oKar73HI2qYd ^ىJ^N:ԇYTCYORs\ )}BE)evJ,%_ SZ;> USSѦAS,^ˌij˜J%C{R\q6 0X39td35x*w4ČDP:PG єS[?&Q1>oh -vs M泈kƘCb;q36 q³]*L0w\Jʐl1/ϿRF(0;mlc ] AU8P W wfl~nŰ<3;ʈTImz: 2 Ѯs]:dUIgu]D/{386M>@ zCuj" Bis&;:-U&T78*DqP%vCϨ~)MI0bִCKEr,^e|ҏ9̔.r+S$r]4TjS 5$cG^b)`I陘E/T-zf޴`}tSqu;w &w@jc`kT j|^=~>^o{*$gj ɋ]&8RejRZ8 ^{ $%1y(y#(֡\r6=I6/J]p 6n5% |b{:tcM5D(*{+Yq'xaZeiV9ΦNt=zPY##{8Ty#Q'P퇓%$ Ǣ: 0'_ dEզ+v$ZQ& B$=gSUf\y(Glk"M ;fTPL@E/+zf]C]RoER5A )Qˤ"Ƀ5@ <1WvlA梔JMge\R尻o2,9:12,(F*e ǣC= 2#ƪdؤmʽU rOѳNᱤ(Aqx}3NTc=wg9c;k{$!fXiV@ƶQ4ǴV($"՛+ fz]T#ÁzVْ>Vkn頺=9>b&Wx@AR*!Y"- ĴxPH8u{S|4zn :ٓ!RҥwL4Otj\yChX= +8+%juО]M?t *H/?U~p)`'Ey;Lyք ɪl&BJŜ!yYeͮ!oXwEU[uHot,P U/iHURa`W'i_.v炞 w9VF< 0Roqj[n'oG|ЗE?u)݉펺7q:]-l85G6`ZgHT.T2~ڼ󀇋PptM}x 4Dom6E`~,![nuЫjW [&C76Hp{nLWPtT;fe(wlI}5(蕵==?HI#dX.Au{Q& \$p5P'j66yC^k©q.4L#"R{ޫ[xsK֭F]z{PܠpI͚a7J P@=}дgjQf8dמ {z}%DSN#6ޮ\qmL? ƶQ4Ǵ7\N^:R4tj.vr6sUL@AD5F$$Zz@9!عXT櫾oǭds5Yd:5f5bϡڼy0,Mnb9`D)NX,sݔfOxuV,^b .~nʼ!u{=VƉ۞k@P3ü[tAhLps.zP(EZ^QUhR6N~9jl3rև8UTR5Y[b9HKVD2 |ػ%dkw%koQ&,N-#H>X]Aȵ-r;&@:P :5Ex;uvna˃Wyx3SG1 1@Ix#F-8j,^pt2GLVԇ?`W'i_.Նo:bIs戕$#zw7uѺЅ2bm].BpYM;a5c1^sSd̗$\ڋ#f9D$n,r`[@Y,G Qp,6aptj9]D_'x:6r_' m"* ww]8ܩkҦL *8%L3*hv.+R,,=zm2A-=Eӟ `v/ڧXɻ=T{JzRy Tery4/[+QuAU6/\hI>ʒc9M*#&%8<Β\+QE Yc 9Ǜ?'3<:MUG 9#!QXTi0>kVVV كa3 vrv:@VJ- .h`ղ4' g/5?}AoCлe`ƫb E#~ njTF1rTm$T^_F/~0O 4HL`tT=P Uqnja|a+^uj[) 1ucDʘwx$Qi,= [o%כUw(8 eSh()&&KLx+8ăBxLzDʈuu  1NId%@x[CNozd4(^῀9em޴C g_gݍz1QZ4 tkB>n骲Jm y`TBO{B)y"ۼk\Ɩ.KϔU{[!5l.tOst˱~DO V~_v0TLFz齇|eh2 rykQ2D zuעCX1q}0II`}PLF\~$G20TTTlUCn`oBf#{Аj%Z [y?pIݤks%@b꒷6p)|S݇z0+>9f{aQPGkl(j^;(Iᓮ!׿CR(_Iƃ +|TP ]fK.QUWy5r?V"m]EI% /UmoZ$Q.-4RkI\s鈲|g6DPf-U0I[kVh01B6 3xV؝Uc=[Xàr)3Wf|"0wQ"J(l rM1؛+́!oQ^PD9{fXFHuJD@R`)QaR\701ߛk4jqK ,9>Zjt =c13$9BYk8Qv%wr_VR=b]>!e=I\-QKhw+Hf$ܘ A~HZU(̽٨y$hl+W}%W Se:7 4Q _yxIN^3*Zm@j.mN T6 ZF3(s|iw>MGc'Co`s{Kp'$Z<߆S8J,?ʧQG MUSuIB; 'Y[kN-9{:/O/qbSb18&r|&yF`6#8Cpw2"OUȊ!% w1z'̻४A/:#́MsN%܅S{ T,$Bδˆ 0~95CU-D_#ȯ썚/dg[D,'"cnZ x] (mcjְ0) <<^Jչ;lDAܰkdE,黝&OG;>(*~ᆕk1 )z[ GnQDZh\ jrlhFO6C zo쎵J, EHN҈oj^3ofP뇤sTٜڨޱcR7X?}:l{B4A GB rciґ}GT>ֆN533j}U ݤ6dͿG0y бEkgJVM :6sY:dRS24yU"R G^/t׀rIrB(牲r<9gw?{uWpT( 0xTtHvglX2>Y[5:(xyڣ[yeE?Hv@DB^5䡷 QG|-W$~H[hwV}NU?2qpl^~y Ԓޜ-ڿ-2)Wd!̞({#@H&&[lOy*oFjD^R#Z9 7TwOY߭h^e5I"% !mlKY[:B?NFҁI2Ԋ o6a^0=~?6bRo{P{`)QaR\701ߛkG%4^JZ֪/FN(yj_[EQkl#7']Qšq+;ax\RQ&\7f ]sxI|0 0}LjQ`s}XKkq>iUa8|7UxAO'S$Q?q *1G)'VEbXYҟbh `ހ3|2R͗oWss!`e|rKZ7h >~3hI6# xZZ$J 'Q)iQ%/T)͒8 u ѥSp^6{K-JF!'/LiҨ+Y1շ)ٳu:d1%U'$~ F#7:og1@ b<ך.RAΗPvXyGf]U8: "p:Pދ"Ht/za(vLUuO)@LŷƧBĸ!s?`6e6KJ$~Ec+1b21yJtƋvZX`mRaTBEF||uhHs{g] HVN5o 0]KxN/ @QzMBlgu}r]UF|'e!~X.z} 1CcoMYK?0~95CU-D_uM_ CƵJ/=fg/JO3m1>X#]a'UQҟK!H-.X'R:ls s_gi(ăղgnz9'ɥ {0W]; B^U /;DfR_`A%VYqCoPt^0F C>~;z W3P>@OV8|Icw o#䀩scz &2Y%ߌD|+'qk 'R)evNҸC6#Lg4Tܲ7<0yhѨ5i6g"y>dzΗwְw\bK0J;[SU<6AP|PzD`;Nc!hJcl}Hh$mD:Ԅ|JԥdГ=pz:)]6\X+sYCR|% ȖI>H]=6 fxs|:>t7XcVG/]iy#Cq{'!6MْU`25&ڊDbRO!~9ԡ+|eݡe$^gHT1jaD{bղ`N-K腦5EA ㋈.W*KyڢR}uiB[CMUa4aOnNLO[A)5##NPk.y>nJdK; U:02'G䱏zW'@FY̰<2\*bD(3ATBMZBBTĚ66g`2jR556:V =a6 ^*~'i~ aψԺWd?ZI:7_Q/&p0ǔ+?EdyHm#.6luىƦXVkB%bd&:_s2g)l0ϗJGSH̻upV^IQ[H=3ݵZ:[x)W4_lH*vCGwI6g{+d2IOKlDW%w}ueA8__ar9Ã<16iX}j23.`ObTsP[H- Jo\܎AOL{>"gSoJz2&wOD ufslGU*Tcas Kd*&Р͋~s@|DkeSig’b7s wz;/1 izo1p J?` eq(2—DeXrnlK1i^[q CA_iZ<*;Ig{ ~E2) 'Wvw#=Ü׮mYN l6Mk$͝pj\.ͩAlBXqcTXh[hRôBx fVIzmv2g =;d~69?bq%e^<5Xۉeެ=@Fp`AcA!p]蝩sDs,ٓ%C?<G9~,?Q̤;-TVγpVK #V4EYPQQaCT@iPo !ڋ&`{xV @٥ t>6^&; 1] &\(eWŋ D]y,J\ ( 21C}1¼u0^@(# , ( u ]s F˛HH+F5/Qc9atҐJS3rNcjfAy@)pfڋ=GC&AB4Ue6]-YXz뭩/9R{_/5^q_Q}CEM2.|w p#NuVI^tIu2BumAĉ@ty8~,jXU =Mߴ cEcSu)QuRA(~ @oa#ІZu tWIyZք 9]4"+E{ H˱a p 9w !hiӢ?_xiRQ{\yIi7GfeeZlh0]]>T~ӿCdk5/m>/ʺ'}oqc>b= G0h+Bc@ݞookWo62ۀŗ \1ۥSq®'{F3!>/ IohxńpiCҼ^ ,<.92П":{9ʞPS.9~d|pz% 2GkE%Lbg]r68H%kR&DBJ\bMg\ͮwbx_lQ13]4_@uSWw9|G=H^6{ kpORgFÛAŗO>*V aQ"/dN(o!;HVɱ+h j#qE_z`$š d\BF/">%CTi%r?׊fZ%_T0ZGЭRuQy9'FLV;p=bX HFD.ucMQɹKLݥIRKMq#'U;_O4A6"S\zo_{ CaJ$ {Hq%B& uJjdPuU-V0o`JgjAc6,umPL8Y]2k- n3*2QFw Jg66ͩ{].#7@:9"?lX~,w`[ v\la[uJ#kmdqJblt]EhT=<[;N7ue4"a+:dh{Ϧ^$ꗘʗtAY0qxUraK %CؤjB g,AXEFX#]酚6 AҲC *(67@{֯6&X1 \kE?)m0YOeD` yBvfxB}Z񷯍-6*q#y+n4> `ߢ{ `y"]ds4!W@|/GS\1jf K!3͎pg:bRk3$)!x}h_vtro%}.ߗ ) E.+f:)Nn:]}gw,1K1\)]lΘ7&nvMyЉF_ Ǜ>XfIbk bKMBQO.}&S!^\A*4L3q V#э Mk8ϧkOȞ"`?5roLwӍG|")6`1V0hF2JG:+33 ԋr$^$>f=# x<1&0-=wi&ˎ2U {c*Y?T'>ȏ62q&9uP4l/;U43[k=GTWHdXD"䍲) ͹JwfUiydt #: yzՃ t?2cs B.N[:tY96Y4|7!G$7u;ޠH%3sOJ<_ "-C fFXjдJwgP*6y8^'=,;MsgIEnt8W/q8 a>j+ۓ/d `:cEOZȚRT4S\>8_7=V^- ,_ok?(Dn1ϔL F@-4cNܶ{+$VJ@$+UBʡɳ_KAf5}h:=y/PG0޵e YF*3;̞YN2~~+f]+s}-0L!7Ou ƻ?bO kG8RS78%0mbyV{_<7|#Cgׇ ,;<2j#g8CqM7gW-zΞ{(ifU;KUлB+"-Ժ5pܑA?1;,A53[ mj`N<au9<9gőPПu1E401EpAm@ûbn 0|cYew2 L*us.5}p uκ!tDEߓڄ87dy oo6t SjuTؙ4'2H2xwq@S)Nt/TBym`Zc)/W$0yMlsҫ'07,!aKj 10ֿSyL5tBaڮ20 4` .irf4.9 ϋArF`*p-вxs;w3_gMPϠr],kuN/cg2Km㗱qA۰ mzV(ƢΝ;U']56#SPQhDʸ69 XV8՝P u#+BfOO,=5Tgܰ |aظ¸@M1LCḢx ea|'5<"(~ #пD)lgn6-XLX,| g}Bf`÷djgO6*1j7 Ҥ4V\%](Gz3O 5@hK}52r-PM|2v{V~AWLn{6H.Oy*{kf_¹O. 1n4 J½[nM{Iѵ{v6kc C`ˇ;ȱu7jqcV7*a5O 1k3b$Qxw|*~j! &ÑXcHH\|Ii5>wyH^%H2YNJ rpqC54_o7,꓏qwZΠTڳpEYK˹#ZqƲ4_ ֖nmkBBQEnHҙ;s"sPnFyD(AC%hy;"l7XM֊,Kx϶6[k(W[/_]M_$h=yiœ+<'PNP3!033.@^ Xo2J E⟶(7f""/tHD1;qƄǖ#K? O"Oe٭/;^b"TlwL_-EN H,2{N/> ws}$4sg`4AbX):It M,J;X/m>.▧C7_A_MӉFK|`Jk:(!Va9+vrGo3,aipTSup@50x JcL/F{=%(=3]F0=]kDU CN,%'f\&ز4Ujy|Aǔ~,^[Uv1+?(qo'"Գ6QybBg՜$SE.ȜgçöBny_꭫$zΧA; $б[ήFYf1!qth<Ϟ/ uID1,aĽ/R0NB0l;RS왼e;*lظ.h a9&, ي3o+@ƒ} ;>O$ &RM'?xp/]}߶WYSSvˆ1GgR"Kڌ̜۰)9 ;?Iy%o,Q}UrP{9g" ,Z4I dk[('3N@!/ !UK,B#,a1 L}jnݣW39\6/%J :*>#gCkCsX2jP=t<#ۓ҄]oʯB_߮84 P%5 >|~ӽLx+t\9]:{GLps/WH3h#΍B/ vMۋ|&~zl.\+$E{r9jw >йE<ֽJaACB/`0^2+A&ᶑ 02dYK>jyGrBA':&^R_E60wŖ#R`x">ƫ׽hpJ v C,dLz/l* ]ǘ#B@U".Ӯl Z:WΨ)xӱz'؋@90d95aJIn#)<:pIإ$H2K/WP)夿&YNcW*mt͐F])x#[v}MѪ6؆{dIoO-J=A 5WCB$uޠOʐ$*|αF!؈v PQh57CpRD⾮I j;v/i]BƓ"S%$4W:+2 }*87%氙J@Z?|邞Y?%uv]>N/T4+2rE$G%SK^ naq|,SSlmYZ>-힀JeѪ<Q3[n#6H]}cq(p ڌcI "fg\Ls9-g4z|tXdCDoqvF۴w ITQC^L^`Sx3y*J"Ŵ"JSPNxhAYBU%7/z3n;\f=JENRW[TI9Q⛡(e2͏uY1bS 'a6\09 D%pibR+ű=->7] pJܪCPIsO":#V_ynQ:@20Gqh8,PuYslFze5ӗ^WxaUk{55hh78s~y%Oe ro&\',-Җӻج]ԨW&ӐIeh>H[SU`&^SAqHPc=\{p<`GPBAޘe`:*݌MF@^1^ҭ ɓ Eo !7)u:T<NW+#.KЌpZD`yL@*qPئJ ˒%Æ V/|E+Y&NeiYw1=0'sۊBɟcGwҪl˓d(PTbtCTG9!W A0iUM\ l/؁f&j40Eٍ|ƆzjQ?ZZwcЕT :G?'zrIF:! h&JLPJtil;aQ$jyY K?.i=Mx'?PQҊbڙڜk/s^ 4 P} \99BF|%jJ>~x JcL)~ySc߅?o鑝Q]Ut& (M2 2b` dF?7VpIg J48 sn/9HhkHq[gF{NGuU`"N&Sw*$`T9'Aظ.h N> VeN hCO_=e94-@4ZW}8mu~qa@2++9 `PWu-[Wo{X`0 Sչ cAd0jrz|Hp-82LX{ Kw=fެdTY?ݔKf^ 1q[~ez75]RFPAjW"77JKM7æ9!{6w@芣uJ40ϠfvԈfd¸B0NQ~k)Hȕ˾YmzUBx б ړI>='lgk)S4y6 0U`9in#%\%S ~siLƳNXEL5.3|t|)D #8g}]Z h-1X20 z?V~+L$-QǛ\v8bC> BfYs_Cn lp^cQ8鯗Y ‰ޛyjvL69 ҳوEwth^$YxNCA&xcB;͡@2^Ր$T UvxF  ZuFUҭώ.='@g6_Ϲ+&,(^TV1-`ϋJf]H/ dCp}aABR;GkSҩQu3rWHz;мE|-c"d `0ahkW|?seTKXI/+j ,3wFO +眿+20ii4 ӯ#Qe K&T"=LXJQ_"oLa*bVFXI"K#ʍʣFRa@% ExkP{#ii\\īϾ}07r72 T8`{d*~R?:"zN&Tnz=rTMyfzw:Ks\zVګ2{̜7fP6O]hj#Jz?}`ާ pw3%;xۦ_Ofu{%M$swA2KSO~o8}'h?=~T![b@'sr{K_b=cax"`` xl+HY"Z(rE:uj< v Xw&;bb3Lմ<:£JnƮS X5oXM*q}qis{u{"X8i[k-bBKv.uwf}(ˣWy֒<3{(o+kS_=,SSĘBdb6 Of#XЈ V:\ 2$}5j$w380KTΌwl]ly:Л9|S[PFPf,u\-byگi/#s[-"xy3 x#(lOSKHoxr 9(nOkxb+ C02tG?Ywؠ^S=W TN'XKJ@lEh̍wec+{ߟѯ)MV5:1:{*_<j[hWQ8:øƟȯJel]Nj>J).v]y3Tq P=Q$DL)HJG#A ~Tm)$JLhWh]L:\ fjCOEf,x\ s/ݯe_Eukjnom0v,bvO0 NKziN^IF+YB>u,ARZHĘWi}ڧ(w3tNQhs`Ka $#&Nhd3y'I)GgU Ŷ?w =rxu/,6JoN$JZkßc*c ˫"Qkb2rCc-ch Ȑ6s({zr{nq:TE"YXBOg %Խvzu\<<*n?r\f=JENWND>[E"٣S) 4,) Og2["jsg=tR1H uf{6J@o NȔ0XS,;ce^s`4@6x#e CI>[FJ*<]1 s}yac =\xL |в3WEfޫd2-&K8=̈y.̀\[ė.d#o>= JI:cp Fp.C둾J9'v/E*jxFFn83vx%tHS*q2Xasizth 6m@blV,]xTUʼOG)LmiJKvMռOVƬd"IoUnЂ)6.ʵ۬t5]1smƒޖB0 ŽP9tAb(gp51E3dw:c:[P*C77P3б장N2hFzS (lA: -\M҃Cv6]QFk!Cc#=F.WA:kQK9ZVKS‘l-J^8Gn^Wc.RzvVfUJsPtjulJ`Iܳ<793ܴ'^6fbQ> _[l51/!j1D)Py9#2O>zcҫD|ㄧ Dh]~ȡo"ّdW,! |+( M-/ŘWBN\Tq6+7pv/[X7,T?b'{,3 TX?aYp(hP+LsGZlNx,__CoM yK4p)"u~,pAP2-ݦJs t`<OBZ3{,&dn{0HM~2K'R/CPv: BVG385mKIxq9ӂ B2~~?F>r ~ȰEmM ^b9e3|(7#xo,c}cj X ϯ՟zc? ־݅(+F2q|J2GFZG[́/aR;x:M.\}:0݃?\ܲ3+T^ߓRç;v2V“J>" #8"wPnV5ѺqF&Gs,,Oe_oU 8+P<$˿2"ymJG p3"BCG!z|OcA@.7B[W2?l 7v#zպВ!F#kxMƌ)<"Z-AΣO+cĶL:؁\hu]s @X,+T 8E֑Mز xdh΄E٭8M.\^]E04Ջ,ٛ73"B\P/MDgi5m]ojk"BBSϙQ[<(+۰xX7Hfu#EڄG] "|9=As>R ":\wS8Fc`" ժc Gȹ %\X>?ݝ8OISVq~i5Fqŋ I}/b꫁ !XpЫ:QzlǎIN'&P )3]HjH6G#%IVNscsvHB`&9&KN>`#0}'r:p]'\G'za-Oj$t8{@bgzv+ 1gv]u`D&ҏO Fd,HNP~~B-m bEyb4D[S izECi]<3btk?QѳkSP hsUreJ8&ӛ $]ie)ݣ.0*}&(Eݡʘۜr=GJ!^wR$X\ eED [n O|'0,j~LRm)u@ q] {p}S`\!H̬}jV?Ʉ6L_TJ?goVxMR,kyhbEk^+YNO͜l,B!FfcbaonX ;%f@ Ok>${%zjJ+KmSVS{64{J)#n$el0E)/2TrjCz@OOq1sy3}>_G{S~JB|5kzp5Q[ L{A[&>FS(OIp,]Es5x^g vp}V|<R Z%< Qqs-hkŇ+G!c26ژg,/K~{E8.Y])f~i4yU Z7'/Cd5zYg?&}E >v;O0ԸBPPS?Jhfl]kur)A Wx$lMl[h+[kA|[8 nZt~`{+c?e8B嘈`, -ߜ##MHkИ(&YMCح2$g6 V'_mq@DB+XqR{ Hv;|1)ZVume {8 2j@lX_IT-6m@oS'PLT R]BsL/?X9X4S=b{ZLb!{Ev 8 :0ɊΣ)l RDfׄ>mJ@rҏ&>$B `Gϣ-Ӆ(2 63zprk,SBa O3fxpJ )H# 4\bHBI;mH4DŽ1>Y߮?KPiack>dQW曾OUȡ׼^_ɋt70NʾVoD{`]5, N+q,#e(TϪ2mfN!cv!; D65LjI(v)<7FEK"Ny*@, )9$;+\kIƥ)ND5u4(oо0./;,I+w굼鎠) "[ b$>ԫ=:Sg1 nn/Vu }%$>e9'~;|C!A? +YYxr D B!dL=Hr#Ӄ-9;@=zTd4&di(N`3#k4dޒG"Wκ-D`Uc)٦Vqӡ@::X]xC Тߓ rܰ]\~ܙ 4YxJU3 s3@kX@L('0~- \ %U<ǷEeɨbD*P nx9ΉDH#Fe D^J@=hdTjG:-tYk,~5:S)tV6d(TWQte &s0w58F+sQ$Ҧ.t*zdǖUXFEt&k]Dw<3aܡ=#\r-t%GS}̙.߷)5d)QcYE5#+.0ѭPHzJ Fg8P /qFH9(C90>R Ft 3Y]^+foT>i烾M0Ғ=rE*kw\dHӡpQJA?g;sI.qôjhdxkS50Q^6*v-WH{* 1L~oMFFr-*^&r6e*gg.L&~}EYRdjܟ̻RiPrNܮdlHZfjz݅"dG> ޿GnA17J(>R]3SqEE?$VtyhJ>X]RG%rX;,F5}JmЂ4o3``"[g"!b**Fze~¦pb$u Gu'N&Q[t}3(9 x{JNE`M!)@Iy-EeC}drF2 +>Rمh.fyV\B#`n3ix,%fZ:1_!ͰT<.P ޺ō鮉Ag2.4qRl/E삅<}#wo( Hcsl#-jo¦g幫~Z1A#$vMմfVm-1;tJ`'bKM`EU&~%љG|ƌ*o\GJMkHcغċ!S)lG_HOتMa,. d: )θ QM6#l9b`#rƘ~Qw(Cs& hW_=@S\ٜeI"2a𱨈GhQ,Rjb? rUhp~JKD6pj:N$[pܘЩv8G˿?>m4#}AV5`+,:df75@l@ !Ӂ)GreGE8T`]aE'[X='tc "[`ҳMr<02ki7,~2j#m/9t4ZcB`[OET#R/J")8 9K lO7]KD0l]ES1ߦ; Đ( #W]p;{(2_C_ :;P%FA?E'x&ОU& B,\GBICa.&vRDK'H/MW9X䨫{Ej>K|=Q.tRH`,. ̩C2t`OE1KS;Mi"ÿBJ9_!оC;%yVeJc5c;3ME_"GdPR&ј8p l:M1*SP[8!M^©}9%ou֣eqbݮm# /dev/null 2>&1 # # uninstall-hook: # -update-mime-database $(DESTDIR)$(datadir)/mime > /dev/null 2>&1 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: reinteract-0.5.0/data/Reinteract.ico0000664000076400007640000012450611063356475014336 00000000000000 hf   V00 %@@ (BD x"Ά(  K=J4oK93LL<m N~yVv qL B$5 W j2^Iyy2Jy.(0 w: .(5 %[14|!W\#ACRH E|<E%e_u+j2@~Mlat?zjf $'BXS ?Ǐ=?/os{y9( @ d(Q  +*bA7b'$nII4`Tr^=D)`k?mW{52M< ro ,:VXA0Tz~F4_} ?IMM}ZTU o9$z?{ZX>|?xqs##ccǞ??N?(0` 1[(WL: AMq,OU-60UC3[ft|.I4<T~00000u$H[t"4vl[eqE^Pd*]D. bErhW:IW@l H#;v}s& 'wF[u ,)_k&|48 [1Kzu\E #L*|7#lR0-Q @y'k/aF_ B`)1V YJ9.?????ǏLJx|?~???~?~>?(@ TRvd'OP%4$N3]?<gI+uf<PXM\J EKF EF yF|COB3;-Y/=sX^hW CNk7v tn(B"QF6[ m +#w Shd"* Eg4R 6-MtFl0 O7[$I;2)3 {W\*]* E5wIA*M;Ia{gOM)1 Z; {m#e@l; l1{ +%-????x?????~~???????????~?PNG  IHDR\rf IDATxy]Eǿ˨, 8D!dDS*08,ɾ/aA1 dOS M[yHկ_[u0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.<]8`02T=},\_ـbFxX8X?/}@F1P<|p>"ei T`xRdt*úw2^rW]90Ŝޝ`8Ux7G&~O{E |!^[^y= <^SY`FC106x8Y<L ;LvHFJ(I%?h0 `~11IxvVtPx8ߪ9ɾ2>2E&+V U(9x=x#Ǚg;[`臇e͐ R#j{XyLQH ?Z%P2שx81BȮAfE WpK%;u2'kDP+Z'(YF*ٹ'aB^REId׈Jm ?Jm[CTF;/_0{+)Da  M ԐR@4g"}1ΊQ@p:oBOD)_ՠhF+レ5\34(l=%JvbhSo_M`6 \|TL*:G#"H6Qs-GoUa #&f[eүİ :Պr9\i#NdzgwaeW:5V,Pңd6$c摶@`_E[SwEL"^QwGm$u澲_(D6>R-WQsRDmGN[}7AwW7M^z"z/|KSo1 i 3"%"ݫ=dKYf6'9`˧ `4u$_fhŀk=`?`<5+7Dk@Lhp+k<^+@2a00pSXUDN`f1RUJ񰘗ķÐ| m?r*K#=+#<9.B'Ovu9ҬGNF(Ycjj"U 2A On>쥩j%X/4HL!,@u%;UNv4uop":*WEY PT+T`DvУdIXF@2M ~V5{+lQs4у/7RʹWN.\,i^`d7gyI~Bc ,rȮQJ^UKo~RJ<|eH˪UT D]6N()}%}v3#k&`Rs|I$$h8p$p:i(U}jZщ%;_KQ`wץ}B`mst3 V@[EV=sx/t>l 2] l `DvBk?ՕP[FR%xyHuouY;4*1 sZD(B5Q_CE'+6.!O鬓<' (IbC[> =Jv(y X5T\:v"[`K\;RSmƹa)'b ɩ?|i08zz;5 ktd /r3ѕg)8MkJ,D7FJLw,hf6j23=QE.J$XJv- !{BgO[qCJCBzI^"ѣd [P(Rp: NY*)+rQ* 6Hd](;×qEdy?q>1ALc@%8NDˑҘLR./WK8M×'<Ց 6奈0V!<<Dy(oQl*0-^6nN|%;/G{IbZ-4[pxk]`P7a aNh(QtKJ?nKP齒;7= 60H;>%mnDΟ_z M#Y."z}Y9׀^*&s#՜dDkliJ^.s"~A$IPBk0IZYKZp|, /'t.Qĵ3=¤ :`-'efx,A1t.w񯎗-xOB=AaR:_:ع}|{MWjBu_V%D=a;)ť^~;T㤲*ϸw&^k [-cBhhTq!^@@Te=l`'?ӑ/ NqE8Es } 1] ^~uAr pgώ$T"=JvCH/%`ۀ_N?6ŲBcr08+}=%OKVVon6 0lЃ \SHŧ}*hҡZ>H2l/3IR'L?{:9 GD/uIBZ(ٹkE`ۀA3;%"07i& GjMPHM oyvۇN6rdĵ^#E uDV'p&WۀJYTeoWٛ7D@S?A>bۀrſ۷9SQËLJ9/=?Y;(jߋfCQaVa1&0e]'/ޡGN0,ᾂi5fGQnHגuL,q 9TsȐ}׋mkFKF-6e/:^c Y0 h#?[sTr8>}!e #%;yRG5>^P Eܱh;\×.f@d'O+dbK~mʎ'xlWzX94h=p^4Kص"LDyIqOvgM^e-L; H|tmٛ@^Jxygf`'-+ldHX|MmckS@G͌ARwp>rTg/Ȧ ĎxT<|6j-Y{n\,g]ˎwWfmS7;I4: ajiAdvaC$u߄,k5"QMwyB@s4V4NE HCl`Ǽ+v4˫ĵJ *_/#dxEj hͮ9 htu Nq^cK{W*d@ĸJ(K-'Ly#?ˇ64bСmM@%ˠk:O?8/LGGa,}ZԐ{~͋ϝdo>ifs^1 6XةKV>i]=,NaT`CY ]a^EOSՖ\uW1ljO^*Er]Bv̓ͲHuۀ)7 Scݻ۶rĩƜD1%QT#QWVBwl࿐~s(s_.xsH hjls61,͉pǷߗq^c,{QRlvI`J4tw](/;loXi!utE4cmۀ5lWE3:؜Ucv }JI [ 'm=ڌA,HVM<:X<>%[{I;/5KV9/f G~C : HU-0 tFZa<g$KVf$ۆ`JZ!"Kn@@ ^u Lfd⊶*KJ$Eo@Y?qP a^/^+(jt/E/q{!BxX8:۟qF!%nE/H'N,_M*.ٞ0? NH`z fmURqCm^V{tV7/4M5(_ (d i2R9t;H϶IGU袎h.3'Te4)'LvxOoO[M%M nܗk&zXȋ\-RCa`<%peskR'Pb""DPRT$/;c:u 2_{8b9!iqS"{&ͳU׎Зp2;X?v"VV8?~qpZ Cv$ꛙ !Jz8 IoyV~pd:?,a,8'iA?bhgi֦JHҚ8:Վ+ThJSV nJk$z}#:3\2LfBO;lO~b11]ޢHCJҒn8vwJÇc;BO^ށpfJ:`So9˜Ys8?Tz %U mpV97\ScV^ly_sKe';*T x>Q))$<~H/DH#KHRO")x,CkgIzQcI;q.T݄%0=HDV?/\3N MϹŁ|CG!?XQ=}Ј_GH2"f(>;F^42cgcq[Kt ` <50ʱ@wq "^"UAKvnPaX!s]Dh/W.i<>+K+be$$H*KȘ԰@2^#D >j <]=^wR|k:0gdž/')vt"QV ^jG|щ*ph'L`z!L!w9!yls])Rzn% {c}S`1q0qI"…]KJ&h*5IkN3IDAT6^l_FttңQ4eʳ%3Qjk0`plv=L;:Q`/rXth XaB`q64-P0Kn1889Ƶpi+O97Za["k6}y; x H|Y l,WJ49H5buK'!Azt|p502㥖gfUEi@5mgx81 x6:a(Dp,­i9ds7L՘0 dž QOT< 9uSjUHT;" فW9xsF2<|q ÐT< dWG:WVAwC:)Y4D 7 YӀ DvhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaEieIENDB`reinteract-0.5.0/data/reinteract.svg0000664000076400007640000001114011047727070014403 00000000000000 image/svg+xml reinteract-0.5.0/data/MainMenu.nib/0000777000076400007640000000000011162516460014064 500000000000000reinteract-0.5.0/data/MainMenu.nib/info.nib0000664000076400007640000000072711070066774015443 00000000000000 IBFramework Version 629 IBOldestOS 5 IBOpenObjects 57 IBSystem Version 9E17 targetFramework IBCocoaFramework reinteract-0.5.0/data/MainMenu.nib/classes.nib0000664000076400007640000000332611070066774016143 00000000000000 IBClasses ACTIONS preferences id CLASS NSApplication LANGUAGE ObjC SUPERCLASS NSResponder ACTIONS about id break id calculate id calculateAll id close id copy id copyAsDoctests id cut id delete id newLibrary id newNotebook id newWorksheet id notebookProperties id open id openNotebook id paste id preferences id quit id redo id rename id save id undo id CLASS NSObject LANGUAGE ObjC IBVersion 1 reinteract-0.5.0/data/MainMenu.nib/keyedobjects.nib0000664000076400007640000003037611070066774017166 00000000000000bplist00 X$versionT$topY$archiverX$objects]IB.objectdata_NSKeyedArchiverl 156;<@Ddl| #()*/89=@AFMNOPU\]^cjklqxyz{ ")*+/6:;<=BIJKLQXYZ[_  $-6?HQRV_hiw GHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~56789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~U$null  !"#$%&'()*+,-./0VNSRootV$class]NSObjectsKeys_NSClassesValues_NSAccessibilityOidsValues]NSConnections[NSNamesKeys[NSFramework]NSClassesKeysZNSOidsKeys]NSNamesValues_NSAccessibilityConnectors]NSFontManager_NSVisibleWindows_NSObjectsValues_NSAccessibilityOidsKeysYNSNextOid\NSOidsValueskjՀցhԁi234[NSClassNameXNSObject789:X$classesZ$classname:5^NSCustomObject_IBCocoaFramework=>?ZNS.objects78ABBC5\NSMutableSetUNSSet=EFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc %*/49>CINRV[_dinsw|efghjk]NSDestinationXNSSourceWNSLabel mnopqrstuvwxyz{WNSTitle_NSKeyEquivModMaskZNSKeyEquiv]NSMnemonicLocYNSOnImage\NSMixedImageVNSMenu   m}~[NSMenuItems^NSNoAutoenable TRedoQZ2^NSResourceNameWNSImage_NSMenuCheckmark785_NSCustomResource2_NSMenuMixedState785ZNSMenuItemUredo:785_NSNibControlConnector^NSNibConnectorefghmnopqrstxyzm}VNSNameʀ̀_Hide ReinteractQh23]NSApplicationUhide:efgh $mnopqrstxyz"#!m}~ UCloseQwVclose:efgh΀&)mnopqrstxyz'(![New LibraryP[newLibrary:efgh݀+.mnopqrstxyz,-_Quit ReinteractQqUquit:efgh03mnopqrstxyz{12 YCalculateQ Zcalculate:efgh58mnopqrstxyz6 7!_New Notebook...QN\newNotebook:efgh  :=mnopqrstxyz;<!]New WorksheetQn]newWorksheet:efgh?Bmnopqrstxyz"A(@m}~%&Ā _Notebook Properties_notebookProperties:efgh-.DHmnopqrs0t2xyz{7_NSAttributedTitleE( FVDelete:;XNSStringG(78>??5_NSAttributedStringWdelete:efghDEJMmnopqrstHIxyzKL!TSaveQsUsave:efghSTOQmopqrstWxyzP(!VRenameWrename:efghabSUmnopqrstexyzT(!WOpen...Uopen:efghopWZmnopqrststxyzXY!nOpen Notebook &QO]openNotebook:fgh}~\^mnopqrstxyz](XShow All_unhideAllApplications:efgh`cmnopqrstxyz{ab UPasteQvVpaste:efghehmnopqrstxyz{fg TUndoQzUundo:efghjmmnopqrstxyz{kl _Copy as DoctestsQC_copyAsDoctests:efghormnopqrstxyz{pq SCutQxTcut:efghȀtvmopqrstxyzu(_About ReinteractVabout:fghՀx{mnopqrstxyz܀z(ym}ဨTZoom\performZoom:fgh}mnopqrstxyz܀~(y_Bring All to Front_arrangeInFront:efghmnopqrstxyz{ UBreakQ.Vbreak:efghmnopqrstxyz[Hide Others_hideOtherApplications:fghmnopqrstxyz܀yXMinimizeQm_performMiniaturize:efgh !mnopqrst$xyz{2 ]Calculate All]calculateAll:fgh-.mnopqrst12xyz5m}89_Reinteract HelpQ?YshowHelp:efgh@AmnopqrstDExyzlPreferences &Q,\preferences:efghOPmnopqrstSTxyz{ TCopyQcUcopy:78\]]^5^NSMutableArrayWNSArray=`aӯ7 @5jlmn-q{atuwyS|}O-oDj "}0!yjo S5tÀO ǀ+ȀDW&΀J`e?} :x@\̀TFile=Eo| awDS5W:&S JOmnopqrstxyz]NSIsSeparator\NSIsDisabled( ( !mnopqrstxyz( ( !78ss5THelp=E-VWindow=Eŀ怊x}mnopqrstxyz܀( ( y^_NSWindowsMenumnopqrstxyz( ( m}ဨXServices=E倢__NSServicesMenumnopqrstxyzYNSSubmenuXNSActiony(m}ЀҀ^submenuAction:mnopqrstlxyz(mnopqrstxyz( ( TEdit=E jO- e oj`D0mnopqrstxyz{( (  mnopqrstxyz{( (  mnopqrstxyz{( (  mnopqrst58xyz>(mnopqrstxyzG!(mnopqrst"%xyzP@Ā(XNotebook=ET?mnopqrstxyz( ( mnopqrst{xyzg (ZReinteract=Ekj@nq}}܀t̀\ǀ+mnopqrstxyz( ( \_NSAppleMenumnopqrstxyzʀ(YAMainMenu=Euymt΀ȀÀ[_NSMainMenu78^^5=`ӯ7{{utm{n5{{{{{"{{{y{{   Ȁ!!!!!! y΀ !!y! @ y !yÀ  =`Ӏӯ8 @5jlmn-q{atuwyS|}O-oDj "}뀼!yjo S5tÀO ǀ+ȀDW&΀J`e?} :x@\̀0=`ӯ8 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF׀؀ـڀۀ܀݀ހ߀     [Separator-5_Menu Item (Hide Reinteract)_Menu Item (Calculate All)oMenu Item (Preferences &)[Menu (Help)[Menu (File)]Menu (Window)_Menu Item (Copy as Doctests)_Menu Item (Hide Others)[Separator-6_Menu (Services)_Menu Item (Window)_Menu Item (Services)_Menu Item (Reinteract Help)_Menu Item (Cut)[Separator-7[Menu (Edit)_Menu Item (Open...)_Menu Item (Help)_Menu Item (File)_Menu Item (New Notebook...)[Separator-1_Menu Item (About Reinteract)_Menu Item (Notebook)_Menu Item (Rename)_Menu Item (Close)[Separator-2[Separator-8_Menu Item (Quit Reinteract)_Menu Item (Edit)_Menu Item (Copy)YSeparator_Menu (Reinteract)_Menu Item (Delete)oMenu Item (Open Notebook &)_Menu Item (New Library)_Menu Item (Reinteract)_Menu Item (Minimize)_Menu Item (Save)_Menu Item (Paste)_Menu Item (Undo)_Menu Item (Notebook Properties)[Separator-3_Menu Item (Bring All to Front)\File's Owner[Application_Menu Item (Redo)_Menu Item (Break)_Menu Item (New Worksheet)_Menu Item (Zoom)_Menu (Notebook)_Menu Item (Show All)[Separator-4[Separator-9XMainMenu_Menu Item (Calculate)=`Ӡ=`Ӡ=`ӯU S@Ua5j_lmn-q{[aHQ^LIZtuWJXwPySbcG]M|}OKN-oDR\`jYT V"}O0R[!yjo wSI/s5d%itCÀO 4ǀ+Ȁ*9DW&΀J`eN?|} nV:_x@\>̀=`߀ӯU      !"#$%&'()*+,-./01234 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgrhQjw%o{gSRs:tPIO\9Hy8Kv'xu=E=`Ӡ=`Ӡ785^NSIBObjectData"'1:?DRTfBH*FTgy *=FQST]dqw !)+-/1RZny1:?R_acex  *13579KMVXZhn       ! - . : K M O Q S t v x z | ~     6 8 : ? A C E G Y [ h y { }       # % ' ) * @ V g i k m o      8 : < > @ B D I K Q b d f h j   0 2 4 6 8 : < Y [ i v x z |     13579Z\^`bdfkms "$&*,1BDFHJgikmoqs  ,.02468M_prtvx $1357XZ\^`bdmo!#%'468:LNXikmoq  ")8@IK   "$&(*/8:OQSUWY[]_ac  !*,.02[]_`bcegix"+-/13579;LNPRTc  ACEFHIKMOxz|}!#%')+-/XZ\^`bdfhqz| "$&(*,.024]_abdegikxuwy{}acegikmoqsuwy{}OQSUWY[]_acegikmoqsuwy{}GS_m ,8Nat 3FYcw 4 G i u !!!.!:!F!O!g!p!r!s!|!~!!!"7"9";"="?"A"C"E"G"I"K"M"O"Q"S"U"W"Y"["]"_"a"c"e"g"i"k"m"o"q"s"u"w"y"{"}""""""""""""""""""""""""""""""""""""""""""""""""""""###################################$$$$ $$$$$$$ $#$&$)$,$/$2$5$8$;$>$A$D$G$J$M$P$S$V$Y$\$_$b$e$h$k$n$q$t$w$z$}$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%% % %%%%%%%%% %"%$%'%)%+%-%/%1%4%7%:%<%>%A%D%M%O%R%U%X%[%^%`%c%e%h%k%m%o%q%z%|%}%%%%%%%%%reinteract-0.5.0/data/reinteract.desktop0000664000076400007640000000040711076005753015260 00000000000000[Desktop Entry] Name=Reinteract Comment=Interactive Python shell Exec=reinteract %U Terminal=false Type=Application StartupNotify=true MimeType=text/x-reinteract-worksheet;application/x-reinteract-notebook; Icon=reinteract Categories=GNOME;GTK;Education;Science; reinteract-0.5.0/data/Makefile.am0000664000076400007640000000213311161346363013557 00000000000000icondir = $(datadir)/icons/hicolor/scalable/apps icon_DATA = reinteract.svg desktopdir = $(datadir)/applications desktop_DATA = reinteract.desktop mimedir = $(datadir)/mime/packages mime_DATA = reinteract.xml # Install the ICO to use in the About dialog pkgdata_DATA= \ Reinteract.ico EXTRA_DIST= \ $(desktop_DATA) \ $(icon_DATA) \ $(mime_DATA) \ Info.plist \ MainMenu.nib/classes.nib \ MainMenu.nib/info.nib \ MainMenu.nib/keyedobjects.nib \ Reinteract.ico \ Reinteract.icns # Calling update-mime-database is necessary to get the associations # in reinteract.xml to work properly on a XDG-compliant system; however # it makes things hard on packagers since there are a bunch of stray # files in the install root (and it complicates 'make uninstall') # # We could have --disable-update-mime or something in configure.ac, # but just skip it. Most people will be using packaged versions anyways. # # install-data-hook: # -update-mime-database $(DESTDIR)$(datadir)/mime > /dev/null 2>&1 # # uninstall-hook: # -update-mime-database $(DESTDIR)$(datadir)/mime > /dev/null 2>&1 reinteract-0.5.0/data/reinteract.xml0000644000076400007640000000055111076003137014377 00000000000000 reinteract-0.5.0/AUTHORS0000664000076400007640000000004411110023155011642 00000000000000Owen Taylor reinteract-0.5.0/ChangeLog0000664000076400007640000000000011075764504012360 00000000000000reinteract-0.5.0/configure.ac0000664000076400007640000000625711162516344013112 00000000000000AC_INIT(reinteract, 0.5.0) AC_CONFIG_AUX_DIR(config) AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip]) AM_MAINTAINER_MODE AM_PATH_PYTHON(2.4) AC_CONFIG_HEADERS(config.h) AC_PROG_CC AC_PROG_OBJC changequote(,)dnl if test "x$GCC" = "xyes"; then case " $CFLAGS " in *[\ \ ]-Wall[\ \ ]*) ;; *) CFLAGS="$CFLAGS -Wall" ;; esac case " $OBJCFLAGS " in *[\ \ ]-Wall[\ \ ]*) ;; *) OBJCFLAGS="$OBJCFLAGS -Wall" ;; esac fi changequote([,])dnl APPDIR= AC_ARG_WITH(appdir, [AC_HELP_STRING([--with-appdir=APPDIR], [On OS X, install Reinteract.app into APPDIR])], [if test x$withval = xyes ; then AC_MSG_ERROR([Directory must be specified as argument to --with-appdir]) elif test x$withval = xno ; then : else APPDIR=$withval fi]) AM_CONDITIONAL(INSTALL_APP, test "x$APPDIR" != x) AC_SUBST(APPDIR) use_python_thunks=false AC_ARG_ENABLE(python-thunks, [AC_HELP_STRING([--enable-python-thunks], [On OS X, lazily locate Python at run-time (default is no)])], [if test "x$enableval" != xno ; then use_python_thunks=true ; fi]) if $use_python_thunks ; then AC_DEFINE(USE_PYTHON_THUNKS, 1, [Define to locate Python lazily at runtime]) fi AM_CONDITIONAL(USE_PYTHON_THUNKS, $use_python_thunks) dnl A macro to get a variable from distutils.sysconfig dnl reinteract_GET_CONFIG_VAR(SHELL_NAME, SYSCONFIG_NAME) dnl AC_DEFUN([reinteract_GET_CONFIG_VAR], [$1=`$PYTHON -c "import sys; import distutils.sysconfig; sys.stdout.write(distutils.sysconfig.get_config_var('$2'))"`]) AC_CANONICAL_HOST platform_osx=false case $host in *-*-darwin*) # This will break if someone wants to build the X11 version of reinteract # on OS X. They can just use bin/uninst.py, or they can figure out how # to fix this :-) platform_osx=true PKG_CHECK_MODULES(WRAPPER, [pygobject-2.0 >= 2.12 gtk+-2.0 >= 2.12]) JD_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) if $use_python_thunks ; then : ; else # Need to figure out how to link against Python at compile time AC_MSG_CHECKING([how to link against Python]) reinteract_GET_CONFIG_VAR(python_framework_prefix, PYTHONFRAMEWORKPREFIX) if test x$python_framework_prefix = x ; then reinteract_GET_CONFIG_VAR(python_libdir, LIBDIR) PYTHON_LIBS="-L$python_libdir -lpython$PYTHON_VERSION" else PYTHON_LIBS="-F$python_framework_prefix -framework Python" fi AC_MSG_RESULT($PYTHON_LIBS) AC_SUBST(PYTHON_LIBS) # Test to see if what we found actually works save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PYTHON_INCLUDES" save_LIBS="$LIBS" LIBS="$LIBS $PYTHON_LIBS" AC_LINK_IFELSE(AC_LANG_PROGRAM([#include ], [Py_Initialize();]), :, AC_MSG_ERROR([Linking against Python didn't work; see config.log for details])) CFLAGS="$save_CFLAGS" LIBS="$save_LIBS" fi ;; esac AM_CONDITIONAL(PLATFORM_OSX, $platform_osx) REINTERACT_PACKAGE_DIR=${pythondir}/$PACKAGE_NAME AC_SUBST(REINTERACT_PACKAGE_DIR) AC_OUTPUT([ Makefile dialogs/Makefile data/Makefile bin/reinteract ]) reinteract-0.5.0/bin/0000777000076400007640000000000011162516457011451 500000000000000reinteract-0.5.0/bin/reinteract.in0000664000076400007640000000146511161346302014052 00000000000000#!/usr/bin/env python # # Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import os import reinteract from reinteract.global_settings import global_settings prefix="@prefix@" datarootdir="@datarootdir@".replace("${prefix}", prefix) global_settings.dialogs_dir = os.path.join(datarootdir, "reinteract", "dialogs") global_settings.examples_dir = os.path.join(datarootdir, "reinteract", "examples") global_settings.icon_file = os.path.join(datarootdir, "reinteract", "Reinteract.ico") global_settings.version = "@VERSION@" if __name__ == "__main__": import reinteract.main reinteract.main.main() reinteract-0.5.0/bin/Reinteract.pyw0000664000076400007640000000173111162516344014225 00000000000000#!/usr/bin/env python # # Copyright 2007-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import os import sys script_path = os.path.realpath(os.path.abspath(sys.argv[0])) topdir = os.path.dirname(os.path.dirname(script_path)) libdir = os.path.join(topdir, 'python') externaldir = os.path.join(topdir, 'external') builderdir = os.path.join(topdir, 'dialogs') examplesdir = os.path.join(topdir, 'examples') icon_file = os.path.join(topdir, 'Reinteract.ico') sys.path[0:0] = [libdir, externaldir] import reinteract from reinteract.global_settings import global_settings global_settings.dialogs_dir = builderdir global_settings.examples_dir = examplesdir global_settings.icon_file = icon_file global_settings.version = "@VERSION@" import reinteract.main reinteract.main.main() reinteract-0.5.0/bin/uninst.py0000775000076400007640000000261211161073573013261 00000000000000#!/usr/bin/env python # # Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import os import re import subprocess import sys script_path = os.path.realpath(os.path.abspath(sys.argv[0])) topdir = os.path.dirname(os.path.dirname(script_path)) libdir = os.path.join(topdir, 'lib') builderdir = os.path.join(topdir, 'dialogs') examplesdir = os.path.join(topdir, 'examples') icon_file = os.path.join(topdir, 'data', 'Reinteract.ico') try: # Get the git description of the current commit, e.g. # REINTERACT_0_4_8-3-gac3e15d version = subprocess.Popen(["git", "describe"], env={'GIT_DIR': os.path.join(topdir, ".git")}, stdout=subprocess.PIPE).communicate()[0] # Transform REINTERACT_0_4_8 into 0.4.8 version = re.sub("^REINTERACT_", "", version) version = re.sub("_", ".", version) except OSError: version = None sys.path[0:0] = [libdir] import reinteract from reinteract.global_settings import global_settings global_settings.dialogs_dir = builderdir global_settings.examples_dir = examplesdir global_settings.icon_file = icon_file global_settings.version = version import reinteract.main reinteract.main.main() reinteract-0.5.0/dialogs/0000777000076400007640000000000011162516460012315 500000000000000reinteract-0.5.0/dialogs/open-notebook.xml0000664000076400007640000000755511161245654015553 00000000000000 5 Open Notebook... True 500 400 GDK_WINDOW_TYPE_HINT_NORMAL False True 6 True True 6 GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_IN True True True 1 True GTK_BUTTONBOX_END True True True _Browse... True True True True True gtk-cancel True 1 True True True gtk-open True 2 False GTK_PACK_END 1 button1 button2 open_button reinteract-0.5.0/dialogs/save-file.glade0000664000076400007640000001020711162516460015104 00000000000000 6 Save As... False True 320 260 GDK_WINDOW_TYPE_HINT_NORMAL False True 12 True 6 12 True gtk-dialog-question 6 True 0 Please enter a name for 'Unsaved Worksheet' 1 1 True 6 6 True True True 2 True True GTK_BUTTONBOX_END True True True gtk-cancel True -6 True True True True gtk-save True -5 1 False GTK_PACK_END reinteract-0.5.0/dialogs/open-notebook.glade0000664000076400007640000000757111162516460016022 00000000000000 5 Open Notebook... True 500 400 GDK_WINDOW_TYPE_HINT_NORMAL False True 6 True True 6 GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_IN True True True 1 True GTK_BUTTONBOX_END True True True _Browse... True 1 True True True True gtk-cancel True -6 1 True True True gtk-open True -5 2 False GTK_PACK_END 1 reinteract-0.5.0/dialogs/new-notebook.xml0000664000076400007640000002400411161245654015367 00000000000000 5 New Notebook... True 400 400 GDK_WINDOW_TYPE_HINT_NORMAL False True 6 True 6 12 True 4 True Name: False False True True 1 False False True 6 True 0 0 <b>Description</b> True False False True 12 True True GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_IN True True GTK_WRAP_WORD 1 1 True 4 True 0 0 <b>Create In</b> True True 12 True True True Default Folder True True True True Other Folder True True 1 True 24 True GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER Choose Parent Folder 2 1 False False 2 1 True GTK_BUTTONBOX_END True True True True gtk-cancel True True True True True True C_reate True 1 False GTK_PACK_END default_folder_radio_button other_folder_radio_button button1 create_button reinteract-0.5.0/dialogs/preferences.glade0000664000076400007640000002455011162516460015540 00000000000000 6 Reinteract Preferences 400 normal False True 2 True 12 True 6 True 0 <b>Editor Font</b> True False False 0 True 12 True 12 Custom True True False True False False 0 True True True False False 1 1 False False 0 True 6 True 0 <b>Doc Tootip Font</b> True False False 0 True 12 True 12 Custom True True False True False False 0 True True True False False 1 1 False False 1 True Enable autocompletion True True False True 0 True 12 True 0 <small><i>Complete manually with Ctrl+Space</i></small> True 1 False False 2 1 True end gtk-close -7 True True True True 1 False end 0 reinteract-0.5.0/dialogs/preferences.xml0000664000076400007640000002461511161245655015272 00000000000000 6 Reinteract Preferences 400 normal False True 2 True 12 True 6 True 0 <b>Editor Font</b> True False False 0 True 12 True 12 Custom True True False True False False 0 True True True False False 1 1 False False 0 True 6 True 0 <b>Doc Tootip Font</b> True False False 0 True 12 True 12 Custom True True False True False False 0 True True True False False 1 1 False False 1 True Enable autocompletion True True False True 0 True 12 True 0 <small><i>Complete manually with Ctrl+Space</i></small> True 1 False False 2 1 True end gtk-close True True True True 1 False end 0 close_button reinteract-0.5.0/dialogs/notebook-properties.xml0000664000076400007640000001430611161245654016776 00000000000000 5 Notebook Properties True 400 300 GDK_WINDOW_TYPE_HINT_NORMAL False True 6 True 6 12 True 4 True Name: False False True True 1 False False True 6 True 0 0 <b>Description</b> True False False True 12 True True GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_IN True True GTK_WRAP_WORD 1 1 1 True GTK_BUTTONBOX_END True True True True gtk-cancel True True True True True True gtk-ok True 1 False GTK_PACK_END button1 button2 reinteract-0.5.0/dialogs/Makefile.in0000664000076400007640000002477511162516443014320 00000000000000# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = dialogs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(dialogsdir)" dialogsDATA_INSTALL = $(INSTALL_DATA) DATA = $(dialogs_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ APPDIR = @APPDIR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EXEEXT = @EXEEXT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJC = @OBJC@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PYTHON = @PYTHON@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ REINTERACT_PACKAGE_DIR = @REINTERACT_PACKAGE_DIR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ WRAPPER_CFLAGS = @WRAPPER_CFLAGS@ WRAPPER_LIBS = @WRAPPER_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_OBJC = @ac_ct_OBJC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DIALOGS = \ open-notebook.xml \ new-notebook.xml \ notebook-properties.xml \ preferences.xml \ save-file.xml dialogsdir = $(pkgdatadir)/dialogs dialogs_DATA = $(DIALOGS) EXTRA_DIST = $(dialogs_DATA) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dialogs/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu dialogs/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-dialogsDATA: $(dialogs_DATA) @$(NORMAL_INSTALL) test -z "$(dialogsdir)" || $(MKDIR_P) "$(DESTDIR)$(dialogsdir)" @list='$(dialogs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(dialogsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(dialogsdir)/$$f'"; \ $(dialogsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(dialogsdir)/$$f"; \ done uninstall-dialogsDATA: @$(NORMAL_UNINSTALL) @list='$(dialogs_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(dialogsdir)/$$f'"; \ rm -f "$(DESTDIR)$(dialogsdir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(dialogsdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-dialogsDATA install-dvi: install-dvi-am install-exec-am: install-html: install-html-am install-info: install-info-am install-man: install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dialogsDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic dist-hook \ distclean distclean-generic distdir dvi dvi-am html html-am \ info info-am install install-am install-data install-data-am \ install-dialogsDATA install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-dialogsDATA update-dialogs: for f in $(DIALOGS) ; do \ glade=$${f%.xml}.glade ; \ gtk-builder-convert $(srcdir)/$$glade - | grep -v ' $(srcdir)/$$f ; \ done dist-hook: for f in $(DIALOGS) ; do \ glade=$${f%.xml}.glade ; \ cp $(srcdir)/$$glade $(distdir) ; \ done distclean-hook: rm -f $(DIALOGS) .PHONY: update-dialogs # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: reinteract-0.5.0/dialogs/new-notebook.glade0000664000076400007640000002400011162516460015634 00000000000000 5 New Notebook... True 400 400 GDK_WINDOW_TYPE_HINT_NORMAL False True 6 True 6 12 True 4 True Name: False False True True 1 False False True 6 True 0 0 <b>Description</b> True False False True 12 True True GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_IN True True GTK_WRAP_WORD 1 1 True 4 True 0 0 <b>Create In</b> True True 12 True True True Default Folder 0 True True True True Other Folder 0 True True 1 True 24 True GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER Choose Parent Folder 2 1 False False 2 1 True GTK_BUTTONBOX_END True True True True gtk-cancel True -6 True True True True True C_reate True -5 1 False GTK_PACK_END reinteract-0.5.0/dialogs/notebook-properties.glade0000664000076400007640000001432611162516460017251 00000000000000 5 Notebook Properties True 400 300 GDK_WINDOW_TYPE_HINT_NORMAL False True 6 True 6 12 True 4 True Name: False False True True 1 False False True 6 True 0 0 <b>Description</b> True False False True 12 True True GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_IN True True GTK_WRAP_WORD 1 1 1 True GTK_BUTTONBOX_END True True True True gtk-cancel True -6 True True True True True gtk-ok True -5 1 False GTK_PACK_END reinteract-0.5.0/dialogs/save-file.xml0000664000076400007640000001017311161245655014636 00000000000000 6 Save As... False True 320 260 GDK_WINDOW_TYPE_HINT_NORMAL False True 12 True 6 12 True gtk-dialog-question 6 True 0 Please enter a name for 'Unsaved Worksheet' 1 1 True 6 6 True True True 2 True True GTK_BUTTONBOX_END True True True gtk-cancel True True True True True gtk-save True 1 False GTK_PACK_END button1 save_button reinteract-0.5.0/dialogs/Makefile.am0000664000076400007640000000115711153136001014260 00000000000000DIALOGS = \ open-notebook.xml \ new-notebook.xml \ notebook-properties.xml \ preferences.xml \ save-file.xml dialogsdir=$(pkgdatadir)/dialogs dialogs_DATA=$(DIALOGS) EXTRA_DIST=$(dialogs_DATA) update-dialogs: for f in $(DIALOGS) ; do \ glade=$${f%.xml}.glade ; \ gtk-builder-convert $(srcdir)/$$glade - | grep -v ' $(srcdir)/$$f ; \ done dist-hook: for f in $(DIALOGS) ; do \ glade=$${f%.xml}.glade ; \ cp $(srcdir)/$$glade $(distdir) ; \ done distclean-hook: rm -f $(DIALOGS) .PHONY: update-dialogs reinteract-0.5.0/autogen.sh0000775000076400007640000000024010717052602012604 00000000000000#!/bin/sh (cd $(dirname $0); touch ChangeLog NEWS && autoreconf --install --symlink && autoreconf && ./configure --enable-maintainer-mode $@ ) reinteract-0.5.0/tools/0000777000076400007640000000000011162516460012033 500000000000000reinteract-0.5.0/tools/build_deps_osx/0000777000076400007640000000000011162516460015036 500000000000000reinteract-0.5.0/tools/build_deps_osx/pycairo-unknown-surface-types.patch0000664000076400007640000000211111070066774023731 00000000000000Index: cairo/pycairo-pattern.c =================================================================== RCS file: /cvs/cairo/pycairo/cairo/pycairo-pattern.c,v retrieving revision 1.39 diff -u -r1.39 pycairo-pattern.c --- cairo/pycairo-pattern.c 11 Dec 2007 02:56:48 -0000 1.39 +++ cairo/pycairo-pattern.c 29 Aug 2008 00:59:20 -0000 @@ -77,8 +77,8 @@ type = &PycairoRadialGradient_Type; break; default: - PyErr_SetString(CairoError, "Unsupported Pattern type"); - return NULL; + type = &PycairoPattern_Type; + break; } o = type->tp_alloc(type, 0); Index: cairo/pycairo-surface.c =================================================================== RCS file: /cvs/cairo/pycairo/cairo/pycairo-surface.c,v retrieving revision 1.87 diff -u -r1.87 pycairo-surface.c --- cairo/pycairo-surface.c 11 Dec 2007 02:56:48 -0000 1.87 +++ cairo/pycairo-surface.c 29 Aug 2008 00:59:21 -0000 @@ -99,8 +99,8 @@ break; #endif default: - PyErr_SetString(CairoError, "Unsupported Surface type"); - return NULL; + type = &PycairoSurface_Type; + break; } o = type->tp_alloc (type, 0); reinteract-0.5.0/tools/build_deps_osx/reinteract-bootstrap.modules0000664000076400007640000000173511070066774022535 00000000000000 reinteract-0.5.0/tools/build_deps_osx/i386.cache0000664000076400007640000000002511070066774016435 00000000000000ac_cv_c_bigendian=no reinteract-0.5.0/tools/build_deps_osx/gdk-window-process-updates-hook.patch0000664000076400007640000001055711070066774024142 00000000000000Index: gdk/directfb/gdkwindow-directfb.c =================================================================== --- gdk/directfb/gdkwindow-directfb.c (revision 21214) +++ gdk/directfb/gdkwindow-directfb.c (working copy) @@ -80,8 +80,8 @@ static GSList *update_windows = NULL; static guint update_idle = 0; -static void -gdk_window_directfb_process_all_updates (void) +void +_gdk_windowing_window_process_all_updates (void) { GSList *tmp_list; GSList *old_update_windows = update_windows; @@ -158,7 +158,7 @@ static gboolean gdk_window_update_idle (gpointer data) { - gdk_window_directfb_process_all_updates (); + _gdk_windowing_window_process_all_updates (); return FALSE; } Index: gdk/quartz/gdkwindow-quartz.c =================================================================== --- gdk/quartz/gdkwindow-quartz.c (revision 21214) +++ gdk/quartz/gdkwindow-quartz.c (working copy) @@ -395,8 +395,8 @@ } } -static void -gdk_window_quartz_process_all_updates (void) +void +_gdk_windowing_window_process_all_updates (void) { GSList *old_update_windows = update_windows; GSList *tmp_list = update_windows; @@ -460,7 +460,7 @@ static gboolean gdk_window_quartz_update_idle (gpointer data) { - gdk_window_quartz_process_all_updates (); + _gdk_windowing_window_process_all_updates (); return FALSE; } Index: gdk/gdkinternals.h =================================================================== --- gdk/gdkinternals.h (revision 21214) +++ gdk/gdkinternals.h (working copy) @@ -247,6 +247,8 @@ gboolean foreign_destroy); void _gdk_window_clear_update_area (GdkWindow *window); +void _gdk_window_process_all_updates_generic (void); + void _gdk_screen_close (GdkScreen *screen); const char *_gdk_get_sm_client_id (void); @@ -312,6 +314,12 @@ #define GDK_WINDOW_IS_MAPPED(window) ((((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0) +/* Hook to allow backend implementations of gdk_window_process_all_updates; a + * backend that doesn't implement GdkPaintable for its windows should just + * call _gdk_window_process_all_updates_generic() + */ +void _gdk_windowing_window_process_all_updates (void); + /* Called before processing updates for a window. This gives the windowing * layer a chance to save the region for later use in avoiding duplicate * exposes. The return value indicates whether the function has a saved Index: gdk/gdkwindow.c =================================================================== --- gdk/gdkwindow.c (revision 21214) +++ gdk/gdkwindow.c (working copy) @@ -2620,16 +2620,6 @@ g_slist_free (displays); } -/* Currently it is not possible to override - * gdk_window_process_all_updates in the same manner as - * gdk_window_process_updates and gdk_window_invalidate_maybe_recurse - * by implementing the GdkPaintable interface. If in the future a - * backend would need this, the right solution would be to add a - * method to GdkDisplay that can be optionally - * NULL. gdk_window_process_all_updates can then walk the list of open - * displays and call the mehod. - */ - /** * gdk_window_process_all_updates: * @@ -2640,6 +2630,18 @@ void gdk_window_process_all_updates (void) { + /* Let the backend hook it */ + _gdk_windowing_window_process_all_updates(); +} + +/** + * The generic implementation of gdk_window_process_all_updates(); + * a backend should use this if it hasn't implemented GdkPaintable + * for its windows. + */ +void +_gdk_window_process_all_updates_generic (void) +{ GSList *old_update_windows = update_windows; GSList *tmp_list = update_windows; Index: gdk/win32/gdkwindow-win32.c =================================================================== --- gdk/win32/gdkwindow-win32.c (revision 21214) +++ gdk/win32/gdkwindow-win32.c (working copy) @@ -3772,6 +3772,12 @@ { } +void +_gdk_windowing_window_process_all_updates (void) +{ + _gdk_window_process_all_updates_generic (); +} + static void gdk_window_impl_iface_init (GdkWindowImplIface *iface) { Index: gdk/x11/gdkwindow-x11.c =================================================================== --- gdk/x11/gdkwindow-x11.c (revision 21214) +++ gdk/x11/gdkwindow-x11.c (working copy) @@ -6159,6 +6159,12 @@ #endif } +void +_gdk_windowing_window_process_all_updates (void) +{ + _gdk_window_process_all_updates_generic (); +} + static void gdk_window_impl_iface_init (GdkWindowImplIface *iface) { reinteract-0.5.0/tools/build_deps_osx/Python-2.5.2-framework-arch-only.patch0000664000076400007640000000144711070066774023621 00000000000000Passing -arch_only to libtool breaks building a PPC-only framework --- Makefile.pre.arch_only 2008-09-28 21:45:54.000000000 -0400 +++ Makefile.pre 2008-09-28 21:47:07.000000000 -0400 @@ -395,7 +395,7 @@ -current_version $(VERSION); \ else \ /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \ - -lSystem -lSystemStubs -arch_only i386 -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) -compatibility_version $(VERSION) -current_version $(VERSION) ;\ + -lSystem -lSystemStubs -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) -compatibility_version $(VERSION) -current_version $(VERSION) ;\ fi $(INSTALL) -d -m $(DIRMODE) \ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj reinteract-0.5.0/tools/build_deps_osx/jhbuildrc-reinteract0000664000076400007640000000656511070066774021025 00000000000000# -*- mode: python -*- # # Build setup for Reinteract dependencies. This depends on the the # wrapper .jhbuildrc from gtk-osx-build. # # Copyright (C) 2008 Owen Taylor # # Portions adopted from .jhbuildrc-cfw-10.4 # Copyright (C) 2006 - 2008 Imendio AB # try: _variant = os.environ['JHB_VARIANT'] except: _f = os.popen("uname -p") if _f.read().startswith("i386"): _variant = "devel-i386" else: _variant = "devel-ppc" _f.close() checkoutroot = "/opt/reinteract/" + _variant + "/source" prefix = "/opt/reinteract/" + _variant + "/install" modules = [ 'meta-reinteract-deps' ] if "ppc" in _variant: os.environ['CC'] = 'gcc -arch ppc' os.environ['CXX'] = 'g++ -arch ppc' os.environ['LDFLAGS'] = '-arch ppc' _cflags = '-std=gnu89' if "devel" in _variant: _optimize = '-gstabs+3 -O1' else: _optimize = '-O2' # Python splits CFLAGS up this way os.environ['BASECFLAGS'] = _cflags os.environ['OPT'] = _optimize # For autoconf, they are unified os.environ['CFLAGS'] = _cflags + ' ' + _optimize os.environ['OBJCFLAGS'] = _cflags + ' ' + _optimize os.environ['CXXFLAGS'] = _optimize # Always build against the 10.4 SDK even in devel mode; this will help # keep us introducing problems that show up at release time _sdkdir = setup_sdk_10_4() environ_append("BASECFLAGS", "-isysroot " + _sdkdir) environ_append("OBJCFLAGS", "-isysroot " + _sdkdir) # Needed to get the various sublibraries to find and use the same symbols. # (Copied from jhbuildrc-cfw-10.4, not 100% sure it's needed here) environ_append('LDFLAGS', '-Wl,-flat_namespace') # Need to point some modules to the right place so we don't pick up # things from /usr/lib. append_autogenargs("gettext", "--with-libiconv-prefix=" + _sdkdir + "/usr") # We we need to do a framework build to get a shared libpython; # if we didn't specify a directory, it would be installed in the system # /Library/Frameworks, which we don't want append_autogenargs("python", "--enable-framework=" + prefix + "/Library/Frameworks") # A workaround: if --enable-universalsdk isn't passed, the Python # Framework creation does -arch_only i386, and things break. So, for # ppc we build the framework universal, even though we don't need that #if "ppc" in _variant: # append_autogenargs("python", "--enable-universalsdk") # This is used by the Reinteract native app to locate the Python framework to use os.environ['PYTHON_FRAMEWORK_DIR'] = prefix + "/Library/Frameworks/Python.framework" # For unknown reasons, iconv is not picked up correctly without this # (possibly due to using -flat_namespace....). append_autogenargs('glib', ' --with-libiconv=gnu') _reinteract_basedir = os.path.expanduser("~/Source/reinteract/tools/build_deps_osx") # We need to explicitly force the endianness to GLib's configure, which gets # confused by a universal setup if "i386" in _variant: _cache_file = "i386.cache" else: _cache_file = "ppc.cache" append_autogenargs('glib', ' --cache-file=' + os.path.join(_reinteract_basedir, _cache_file)) # The standard gtk-osx-build .jhbuildrc adds a --build for glib, fix it up # if necessary if "ppc" in _variant: module_autogenargs['glib'] = module_autogenargs['glib'].replace("--build=i486-apple-darwin", "powerpc-apple-darwin") moduleset = _reinteract_basedir + "/reinteract.modules" # Not quite true ... we want to JHBuild Python, but we JHBuild our own # version of it. _gtk_osx_use_jhbuild_python = True reinteract-0.5.0/tools/build_deps_osx/gdk-quartz-eventloop-rework-20080905.patch0000664000076400007640000011225311070066774024325 00000000000000diff --git a/gdk/gdk.c b/gdk/gdk.c index 4bb73c2..d0ed996 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -80,7 +80,8 @@ static const GDebugKey gdk_debug_keys[] = { {"cursor", GDK_DEBUG_CURSOR}, {"multihead", GDK_DEBUG_MULTIHEAD}, {"xinerama", GDK_DEBUG_XINERAMA}, - {"draw", GDK_DEBUG_DRAW} + {"draw", GDK_DEBUG_DRAW}, + {"eventloop", GDK_DEBUG_EVENTLOOP} }; static const int gdk_ndebug_keys = G_N_ELEMENTS (gdk_debug_keys); diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index cd383a9..97e0860 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -85,7 +85,8 @@ typedef enum { GDK_DEBUG_CURSOR = 1 <<11, GDK_DEBUG_MULTIHEAD = 1 <<12, GDK_DEBUG_XINERAMA = 1 <<13, - GDK_DEBUG_DRAW = 1 <<14 + GDK_DEBUG_DRAW = 1 <<14, + GDK_DEBUG_EVENTLOOP = 1 <<15 } GdkDebugFlag; #ifndef GDK_DISABLE_DEPRECATED diff --git a/gdk/quartz/gdkeventloop-quartz.c b/gdk/quartz/gdkeventloop-quartz.c index 50b2c7e..9f87371 100644 --- a/gdk/quartz/gdkeventloop-quartz.c +++ b/gdk/quartz/gdkeventloop-quartz.c @@ -8,22 +8,582 @@ #include "gdkprivate-quartz.h" +/* + * This file implementations integration between the GLib main loop and + * the native system of the Core Foundation run loop and Cocoa event + * handling. There are basically two different cases that we need to + * handle: either the GLib main loop is in control (the application + * has called gtk_main(), or is otherwise iterating the main loop), or + * CFRunLoop is in control (we are in a modal operation such as window + * resizing or drag-and-drop.) + * + * When the GLib main loop is in control we integrate in native event + * handling in two ways: first we add a GSource that handles checking + * whether there are native events available, translating native events + * to GDK events, and dispatching GDK events. Second we replace the + * "poll function" of the GLib main loop with our own version that knows + * how to wait for both the file descriptors and timeouts that GLib is + * interested in and also for incoming native events. + * + * When CFRunLoop is in control, we integrate in GLib main loop handling + * by adding a "run loop observer" that gives us notification at various + * points in the run loop cycle. We map these points onto the corresponding + * stages of the GLib main loop (prepare, check, dispatch), and make the + * appropriate calls into GLib. + * + * Both cases share a single problem: the OS X API's don't allow us to + * wait simultaneously for file descriptors and for events. So when we + * need to do a blocking wait that includes file descriptor activity, we + * push the actual work of calling select() to a helper thread (the + * "select thread") and wait for native events in the main thread. + * + * The main known limitation of this code is that if a callback is triggered + * via the OS X run loop while we are "polling" (in either case described + * above), iteration of the GLib main loop is not possible from within + * that callback. If the programmer tries to do so explicitly, then they + * will get a warning from GLib "main loop already active in another thread". + */ + +/******* State for run loop iteration *******/ + +/* Count of number of times we've gotten an "Entry" notification for + * our run loop observer. + */ +static int current_loop_level = 0; + +/* Run loop level at which we acquired ownership of the GLib main + * loop. See note in run_loop_entry(). -1 means that we don't have + * ownership + */ +static int acquired_loop_level = -1; + +/* Between run_loop_before_waiting() and run_loop_after_waiting(); + * whether we we need to call select_thread_collect_poll() + */ +static gboolean run_loop_polling_async = FALSE; + +/* Between run_loop_before_waiting() and run_loop_after_waiting(); + * max_prioritiy to pass to g_main_loop_check() + */ +static gint run_loop_max_priority; + +/* Timer that we've added to wake up the run loop when a GLib timeout + */ +static CFRunLoopTimerRef run_loop_timer = NULL; + +/* These are the file descriptors that are we are polling out of + * the run loop. (We keep the array around and reuse it to avoid + * constant allocations.) + */ +#define RUN_LOOP_POLLFDS_INITIAL_SIZE 16 +static GPollFD *run_loop_pollfds; +static guint run_loop_pollfds_size; /* Allocated size of the array */ +static guint run_loop_n_pollfds; /* Number of file descriptors in the array */ + +/******* Other global variables *******/ + +/* Since we count on replacing the GLib main loop poll function as our + * method of integrating Cocoa event handling into the GLib main loop + * we need to make sure that the poll function is always called even + * when there are no file descriptors that need to be polled. To do + * this, we add a dummy GPollFD to our event source with a file + * descriptor of '-1'. Then any time that GLib is polling the event + * source, it will call our poll function. + */ static GPollFD event_poll_fd; + +/* Current NSEvents that we've gotten from Cocoa but haven't yet converted + * to GdkEvents. We wait until our dispatch() function to do the conversion + * since the conversion can conceivably cause signals to be emmitted + * or other things that shouldn't happen inside a poll function. + */ static GQueue *current_events; +/* The default poll function for GLib; we replace this with our own + * Cocoa-aware version and then call the old version to do actual + * file descriptor polling. There's no actual need to chain to the + * old one; we could reimplement the same functionality from scratch, + * but since the default implementation does the right thing, why + * bother. + */ static GPollFunc old_poll_func; -static gboolean select_fd_waiting = FALSE, ready_for_poll = FALSE; -static pthread_t select_thread = 0; -static int wakeup_pipe[2]; -static pthread_mutex_t pollfd_mutex = PTHREAD_MUTEX_INITIALIZER; -static pthread_cond_t ready_cond = PTHREAD_COND_INITIALIZER; -static GPollFD *pollfds; -static guint n_pollfds; -static CFRunLoopSourceRef select_main_thread_source; +/* Reference to the run loop of the main thread. (There is a unique + * CFRunLoop per thread.) + */ static CFRunLoopRef main_thread_run_loop; + +/* Normally the Cocoa main loop maintains an NSAutoReleasePool and frees + * it on every iteration. Since we are replacing the main loop we have + * to provide this functionality ourself. We free and replace the + * auto-release pool in our sources prepare() function. + */ static NSAutoreleasePool *autorelease_pool; +/* Flag when we've called nextEventMatchingMask ourself; this triggers + * a run loop iteration, so we need to detect that and avoid triggering + * our "run the GLib main looop while the run loop is active machinery. + */ +static gboolean getting_events; + +/************************************************************ + ********* Select Thread ********* + ************************************************************/ + +/* The states in our state machine, see comments in select_thread_func() + * for descriptiions of each state + */ +typedef enum { + BEFORE_START, + WAITING, + POLLING_QUEUED, + POLLING_RESTART, + POLLING_DESCRIPTORS, +} SelectThreadState; + +#ifdef G_ENABLE_DEBUG +static const char *const state_names[] = { + "BEFORE_START", + "WAITING", + "POLLING_QUEUED", + "POLLING_RESTART", + "POLLING_DESCRIPTORS" +}; +#endif + +static SelectThreadState select_thread_state = BEFORE_START; + +static pthread_t select_thread; +static pthread_mutex_t select_thread_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t select_thread_cond = PTHREAD_COND_INITIALIZER; + +#define SELECT_THREAD_LOCK() pthread_mutex_lock (&select_thread_mutex) +#define SELECT_THREAD_UNLOCK() pthread_mutex_unlock (&select_thread_mutex) +#define SELECT_THREAD_SIGNAL() pthread_cond_signal (&select_thread_cond) +#define SELECT_THREAD_WAIT() pthread_cond_wait (&select_thread_cond, &select_thread_mutex) + +/* These are the file descriptors that the select thread is currently + * polling. + */ +static GPollFD *current_pollfds; +static guint current_n_pollfds; + +/* These are the file descriptors that the select thread should pick + * up and start polling when it has a chance. + */ +static GPollFD *next_pollfds; +static guint next_n_pollfds; + +/* Pipe used to wake up the select thread */ +static gint select_thread_wakeup_pipe[2]; + +/* Run loop source used to wake up the main thread */ +static CFRunLoopSourceRef select_main_thread_source; + +static void +select_thread_set_state (SelectThreadState new_state) +{ + gboolean old_state; + + if (select_thread_state == new_state) + return; + + GDK_NOTE (EVENTLOOP, g_print ("EventLoop: Select thread state: %s => %s\n", state_names[select_thread_state], state_names[new_state])); + + old_state = select_thread_state; + select_thread_state = new_state; + if (old_state == WAITING && new_state != WAITING) + SELECT_THREAD_SIGNAL (); +} + +static void +signal_main_thread (void) +{ + GDK_NOTE (EVENTLOOP, g_print ("EventLoop: Waking up main thread\n")); + + /* If we are in nextEventMatchingMask, then we need to make sure an + * event gets queued, otherwise it's enough to simply wake up the + * main thread run loop + */ + if (!run_loop_polling_async) + CFRunLoopSourceSignal (select_main_thread_source); + + if (CFRunLoopIsWaiting (main_thread_run_loop)) + CFRunLoopWakeUp (main_thread_run_loop); +} + +static void * +select_thread_func (void *arg) +{ + char c; + + SELECT_THREAD_LOCK (); + + while (TRUE) + { + switch (select_thread_state) + { + case BEFORE_START: + /* The select thread has not been started yet + */ + g_assert_not_reached (); + + case WAITING: + /* Waiting for a set of file descriptors to be submitted by the main thread + * + * => POLLING_QUEUED: main thread thread submits a set of file descriptors + */ + SELECT_THREAD_WAIT (); + break; + + case POLLING_QUEUED: + /* Waiting for a set of file descriptors to be submitted by the main thread + * + * => POLLING_DESCRIPTORS: select thread picks up the file descriptors to begin polling + */ + if (current_pollfds) + g_free (current_pollfds); + + current_pollfds = next_pollfds; + current_n_pollfds = next_n_pollfds; + + next_pollfds = NULL; + next_n_pollfds = 0; + + select_thread_set_state (POLLING_DESCRIPTORS); + break; + + case POLLING_RESTART: + /* Select thread is currently polling a set of file descriptors, main thread has + * began a new iteration with the same set of file descriptors. We don't want to + * wake the select thread up and wait for it to restart immediately, but to avoid + * a race (described below in select_thread_start_polling()) we need to recheck after + * polling completes. + * + * => POLLING_DESCRIPTORS: select completes, main thread rechecks by polling again + * => POLLING_QUEUED: main thread submits a new set of file descriptors to be polled + */ + select_thread_set_state (POLLING_DESCRIPTORS); + break; + + case POLLING_DESCRIPTORS: + /* In the process of polling the file descriptors + * + * => WAITING: polling completes when a file descriptor becomes active + * => POLLING_QUEUED: main thread submits a new set of file descriptors to be polled + * => POLLING_RESTART: main thread begins a new iteration with the same set file descriptors + */ + SELECT_THREAD_UNLOCK (); + old_poll_func (current_pollfds, current_n_pollfds, -1); + SELECT_THREAD_LOCK (); + + read (select_thread_wakeup_pipe[0], &c, 1); + + if (select_thread_state == POLLING_DESCRIPTORS) + { + signal_main_thread (); + select_thread_set_state (WAITING); + } + break; + } + } +} + +static void +got_fd_activity (void *info) +{ + NSEvent *event; + + /* Post a message so we'll break out of the message loop */ + event = [NSEvent otherEventWithType: NSApplicationDefined + location: NSZeroPoint + modifierFlags: 0 + timestamp: 0 + windowNumber: 0 + context: nil + subtype: GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP + data1: 0 + data2: 0]; + + [NSApp postEvent:event atStart:YES]; +} + +static void +select_thread_start (void) +{ + g_return_if_fail (select_thread_state == BEFORE_START); + + pipe (select_thread_wakeup_pipe); + fcntl (select_thread_wakeup_pipe[0], F_SETFL, O_NONBLOCK); + + CFRunLoopSourceContext source_context = {0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, got_fd_activity }; + select_main_thread_source = CFRunLoopSourceCreate (NULL, 0, &source_context); + + CFRunLoopAddSource (main_thread_run_loop, select_main_thread_source, kCFRunLoopCommonModes); + + select_thread_state = WAITING; + + while (TRUE) + { + if (pthread_create (&select_thread, NULL, select_thread_func, NULL) == 0) + break; + + g_warning ("Failed to create select thread, sleeping and trying again"); + sleep (1); + } +} + +#ifdef G_ENABLE_DEBUG +static void +dump_poll_result (GPollFD *ufds, + guint nfds) +{ + gint i; + + for (i = 0; i < nfds; i++) + { + if (ufds[i].fd >= 0 && ufds[i].revents) + { + g_print (" %d:", ufds[i].fd); + if (ufds[i].revents & G_IO_IN) + g_print (" in"); + if (ufds[i].revents & G_IO_OUT) + g_print (" out"); + if (ufds[i].revents & G_IO_PRI) + g_print (" pri"); + g_print ("\n"); + } + } +} +#endif + +gboolean +pollfds_equal (GPollFD *old_pollfds, + guint old_n_pollfds, + GPollFD *new_pollfds, + guint new_n_pollfds) +{ + gint i; + + if (old_n_pollfds != new_n_pollfds) + return FALSE; + + for (i = 0; i < old_n_pollfds; i++) + { + if (old_pollfds[i].fd != new_pollfds[i].fd || + old_pollfds[i].events != new_pollfds[i].events) + return FALSE; + } + + return TRUE; +} + +/* Begins a polling operation with the specified GPollFD array; the + * timeout is used only to tell if the polling operation is blocking + * or non-blocking. + * + * Return value: + * -1: No file descriptors ready, began asynchronous poll + * 0: No file descriptors ready, asynchronous poll not needed + * > 0: Number of file descriptors ready + */ +static gint +select_thread_start_poll (GPollFD *ufds, + guint nfds, gint timeout) +{ + gint n_ready; + gboolean have_new_pollfds = FALSE; + gint poll_fd_index = -1; + gint i; + + for (i = 0; i < nfds; i++) + if (ufds[i].fd == -1) + { + poll_fd_index = i; + break; + } + + if (nfds == 0 || + (nfds == 1 && poll_fd_index >= 0)) + { + GDK_NOTE (EVENTLOOP, g_print ("EventLoop: Nothing to poll\n")); + return 0; + } + + /* If we went immediately to an async poll, then we might decide to + * dispatch idle functions when higher priority file descriptor sources + * are ready to be dispatched. So we always need to first check + * check synchronously with a timeout of zero, and only when no + * sources are immediately ready, go to the asynchronous poll. + * + * Of course, if the timeout passed in is 0, then the synchronous + * check is sufficient and we never need to do the asynchronous poll. + */ + n_ready = old_poll_func (ufds, nfds, 0); + if (n_ready > 0 || timeout == 0) + { +#ifdef G_ENABLE_DEBUG + if ((_gdk_debug_flags & GDK_DEBUG_EVENTLOOP) && n_ready > 0) + { + g_print ("EventLoop: Found ready file descriptors before waiting\n"); + dump_poll_result (ufds, nfds); + } +#endif + + return n_ready; + } + + SELECT_THREAD_LOCK (); + + if (select_thread_state == BEFORE_START) + { + select_thread_start (); + } + + if (select_thread_state == POLLING_QUEUED) + { + /* If the select thread hasn't picked up the set of file descriptors yet + * then we can simply replace an old stale set with a new set. + */ + if (!pollfds_equal (ufds, nfds, next_pollfds, next_n_pollfds - 1)) + { + g_free (next_pollfds); + next_pollfds = NULL; + next_n_pollfds = 0; + + have_new_pollfds = TRUE; + } + } + else if (select_thread_state == POLLING_RESTART || select_thread_state == POLLING_DESCRIPTORS) + { + /* If we are already in the process of polling the right set of file descriptors, + * there's no need for us to immediately force the select thread to stop polling + * and then restart again. And avoiding doing so increases the efficiency considerably + * in the common case where we have a set of basically inactive file descriptors that + * stay unchanged present as we process many events. + * + * However, we have to be careful that we don't hit the following race condition + * Select Thread Main Thread + * ----------------- --------------- + * Polling Completes + * Reads data or otherwise changes file descriptor state + * Checks if polling is current + * Does nothing (*) + * Releases lock + * Acquires lock + * Marks polling as complete + * Wakes main thread + * Receives old stale file descriptor state + * + * To avoid this, when the new set of poll descriptors is the same as the current + * one, we transition to the POLLING_RESTART stage at the point marked (*). When + * the select thread wakes up from the poll because a file descriptor is active, if + * the state is POLLING_RESTART it immediately begins polling same the file descriptor + * set again. This normally will just return the same set of active file descriptors + * as the first time, but in sequence described above will properly update the + * file descriptor state. + * + * Special case: this RESTART logic is not needed if the only FD is the internal GLib + * "wakeup pipe" that is presented when threads are initialized. + * + * P.S.: The harm in the above sequence is mostly that sources can be signalled + * as ready when they are no longer ready. This may prompt a blocking read + * from a file descriptor that hangs. + */ + if (!pollfds_equal (ufds, nfds, current_pollfds, current_n_pollfds - 1)) + have_new_pollfds = TRUE; + else + { + if (!((nfds == 1 && poll_fd_index < 0 && g_thread_supported ()) || + (nfds == 2 && poll_fd_index >= 0 && g_thread_supported ()))) + select_thread_set_state (POLLING_RESTART); + } + } + else + have_new_pollfds = TRUE; + + if (have_new_pollfds) + { + GDK_NOTE (EVENTLOOP, g_print ("EventLoop: Submitting a new set of file descriptor to the select thread\n")); + + g_assert (next_pollfds == NULL); + + next_n_pollfds = nfds + 1; + next_pollfds = g_new (GPollFD, nfds + 1); + memcpy (next_pollfds, ufds, nfds * sizeof (GPollFD)); + + next_pollfds[nfds].fd = select_thread_wakeup_pipe[0]; + next_pollfds[nfds].events = G_IO_IN; + + if (select_thread_state != POLLING_QUEUED && select_thread_state != WAITING) + { + if (select_thread_wakeup_pipe[1]) + { + char c = 'A'; + write (select_thread_wakeup_pipe[1], &c, 1); + } + } + + select_thread_set_state (POLLING_QUEUED); + } + + SELECT_THREAD_UNLOCK (); + + return -1; +} + +/* End an asynchronous polling operation started with + * select_thread_collect_poll(). This must be called if and only if + * select_thread_start_poll() return -1. The GPollFD array passed + * in must be identical to the one passed to select_thread_start_poll(). + * + * The results of the poll are written into the GPollFD array passed in. + * + * Return Value: number of file descriptors ready + */ +static int +select_thread_collect_poll (GPollFD *ufds, guint nfds) +{ + gint i; + gint n_ready = 0; + + SELECT_THREAD_LOCK (); + + if (select_thread_state == WAITING) /* The poll completed */ + { + for (i = 0; i < nfds; i++) + { + if (ufds[i].fd == -1) + continue; + + g_assert (ufds[i].fd == current_pollfds[i].fd); + g_assert (ufds[i].events == current_pollfds[i].events); + + if (current_pollfds[i].revents) + { + ufds[i].revents = current_pollfds[i].revents; + n_ready++; + } + } + +#ifdef G_ENABLE_DEBUG + if (_gdk_debug_flags & GDK_DEBUG_EVENTLOOP) + { + g_print ("EventLoop: Found ready file descriptors after waiting\n"); + dump_poll_result (ufds, nfds); + } +#endif + } + + SELECT_THREAD_UNLOCK (); + + return n_ready; +} + +/************************************************************ + ********* Main Loop Source ********* + ************************************************************/ + gboolean _gdk_quartz_event_loop_check_pending (void) { @@ -51,21 +611,14 @@ static gboolean gdk_event_prepare (GSource *source, gint *timeout) { - NSEvent *event; gboolean retval; GDK_THREADS_ENTER (); *timeout = -1; - event = [NSApp nextEventMatchingMask: NSAnyEventMask - untilDate: [NSDate distantPast] - inMode: NSDefaultRunLoopMode - dequeue: NO]; - retval = (_gdk_event_queue_find_first (_gdk_display) != NULL || - (current_events && current_events->head) || - event != NULL); + _gdk_quartz_event_loop_check_pending ()); GDK_THREADS_LEAVE (); @@ -79,15 +632,23 @@ gdk_event_check (GSource *source) GDK_THREADS_ENTER (); - if (autorelease_pool) - [autorelease_pool release]; - autorelease_pool = [[NSAutoreleasePool alloc] init]; - - if (_gdk_event_queue_find_first (_gdk_display) != NULL || - _gdk_quartz_event_loop_check_pending ()) - retval = TRUE; - else - retval = FALSE; + /* XXX: This check isn't right it won't handle a recursive GLib main + * loop run within an outer CFRunLoop run. Such loops will pile up + * memory. Fixing this requires setting a flag *only* when we call + * g_main_context_check() from within the run loop iteraton code, + * and also maintaining our own stack of run loops... allocating and + * releasing NSAutoReleasePools not properly nested with CFRunLoop + * runs seems to cause problems. + */ + if (current_loop_level == 0) + { + if (autorelease_pool) + [autorelease_pool release]; + autorelease_pool = [[NSAutoreleasePool alloc] init]; + } + + retval = (_gdk_event_queue_find_first (_gdk_display) != NULL || + _gdk_quartz_event_loop_check_pending ()); GDK_THREADS_LEAVE (); @@ -127,212 +688,300 @@ static GSourceFuncs event_funcs = { NULL }; -static void -got_fd_activity (void *info) +/************************************************************ + ********* Our Poll Function ********* + ************************************************************/ + +static gint +poll_func (GPollFD *ufds, + guint nfds, + gint timeout_) { NSEvent *event; + NSDate *limit_date; + gint n_ready; - /* Post a message so we'll break out of the message loop */ - event = [NSEvent otherEventWithType: NSApplicationDefined - location: NSZeroPoint - modifierFlags: 0 - timestamp: 0 - windowNumber: 0 - context: nil - subtype: GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP - data1: 0 - data2: 0]; + n_ready = select_thread_start_poll (ufds, nfds, timeout_); + if (n_ready > 0) + timeout_ = 0; - [NSApp postEvent:event atStart:YES]; + if (timeout_ == -1) + limit_date = [NSDate distantFuture]; + else if (timeout_ == 0) + limit_date = [NSDate distantPast]; + else + limit_date = [NSDate dateWithTimeIntervalSinceNow:timeout_/1000.0]; + + getting_events = TRUE; + event = [NSApp nextEventMatchingMask: NSAnyEventMask + untilDate: limit_date + inMode: NSDefaultRunLoopMode + dequeue: YES]; + getting_events = FALSE; + + if (n_ready < 0) + n_ready = select_thread_collect_poll (ufds, nfds); + + if (event && + [event type] == NSApplicationDefined && + [event subtype] == GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP) + { + /* Just used to wake us up; if an event and a FD arrived at the same + * time; could have come from a previous iteration in some cases, + * but the spurious wake up is harmless if a little inefficient. + */ + event = NULL; + } + + if (event) + { + if (!current_events) + current_events = g_queue_new (); + g_queue_push_head (current_events, [event retain]); + } + + return n_ready; } -static void * -select_thread_func (void *arg) +/************************************************************ + ********* Running the main loop out of CFRunLoop ********* + ************************************************************/ + +/* Wrapper around g_main_context_query() that handles reallocating + * run_loop_pollfds up to the proper size + */ +static gint +query_main_context (GMainContext *context, + int max_priority, + int *timeout) { - int n_active_fds; + gint nfds; + + if (!run_loop_pollfds) + { + run_loop_pollfds_size = RUN_LOOP_POLLFDS_INITIAL_SIZE; + run_loop_pollfds = g_new (GPollFD, run_loop_pollfds_size); + } - pthread_mutex_lock (&pollfd_mutex); + while ((nfds = g_main_context_query (context, max_priority, timeout, + run_loop_pollfds, + run_loop_pollfds_size)) > run_loop_pollfds_size) + { + g_free (run_loop_pollfds); + run_loop_pollfds_size = nfds; + run_loop_pollfds = g_new (GPollFD, nfds); + } + + return nfds; +} - while (1) +static void +run_loop_entry (void) +{ + current_loop_level++; + + if (acquired_loop_level == -1) { - char c; - int n; - - ready_for_poll = TRUE; - pthread_cond_signal (&ready_cond); - pthread_cond_wait (&ready_cond, &pollfd_mutex); - ready_for_poll = FALSE; - - select_fd_waiting = TRUE; - pthread_cond_signal (&ready_cond); - pthread_mutex_unlock (&pollfd_mutex); - n_active_fds = old_poll_func (pollfds, n_pollfds, -1); - pthread_mutex_lock (&pollfd_mutex); - select_fd_waiting = FALSE; - n = read (wakeup_pipe[0], &c, 1); - if (n == 1) - { - g_assert (c == 'A'); - - n_active_fds --; + if (g_main_context_acquire (NULL)) + { + GDK_NOTE (EVENTLOOP, g_print ("EventLoop: Beginning tracking run loop activity\n")); + acquired_loop_level = current_loop_level; } - pthread_mutex_unlock (&pollfd_mutex); - - if (n_active_fds) + else { - /* We have active fds, signal the main thread */ - CFRunLoopSourceSignal (select_main_thread_source); - if (CFRunLoopIsWaiting (main_thread_run_loop)) - CFRunLoopWakeUp (main_thread_run_loop); + /* If we fail to acquire the main context, that means someone is iterating + * the main context in a different thread; we simply wait until this loop + * exits and then try again at next entry. In general, iterating the loop + * from a different thread is rare: it is only possible when GDK threading + * is initialized and is not frequently used even then. So, we hope that + * having GLib main loop iteration blocked in the combination of that and + * a native modal operation is a minimal problem. We could imagine using a + * thread that does g_main_context_wait() and then wakes us back up, but + * the gain doesn't seem worth the complexity. + */ + GDK_NOTE (EVENTLOOP, g_print ("EventLoop: Can't acquire main loop; skipping tracking run loop activity\n")); } - - pthread_mutex_lock (&pollfd_mutex); } } -static gint -poll_func (GPollFD *ufds, guint nfds, gint timeout_) +static void +run_loop_before_timers (void) { - NSEvent *event; - NSDate *limit_date; - gboolean poll_event_fd = FALSE; - int n_active = 0; - int i; +} - if (nfds > 1 || ufds[0].fd != -1) - { - if (!select_thread) { - /* Create source used for signalling the main thread */ - main_thread_run_loop = CFRunLoopGetCurrent (); - CFRunLoopSourceContext source_context = {0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, got_fd_activity }; - select_main_thread_source = CFRunLoopSourceCreate (NULL, 0, &source_context); - CFRunLoopAddSource (main_thread_run_loop, select_main_thread_source, kCFRunLoopDefaultMode); +static void +run_loop_before_sources (void) +{ + GMainContext *context = g_main_context_default (); + gint max_priority; + gint nfds; + + /* Before we let the CFRunLoop process sources, we want to check if there + * are any pending GLib main loop sources more urgent than + * G_PRIORITY_DEFAULT that need to be dispatched. (We consider all activity + * from the CFRunLoop to have a priority of G_PRIORITY_DEFAULT.) If no + * sources are processed by the CFRunLoop, then processing will continue + * on to the BeforeWaiting stage where we check for lower priority sources. + */ + + g_main_context_prepare (context, &max_priority); + max_priority = MIN (max_priority, G_PRIORITY_DEFAULT); - pipe (wakeup_pipe); - fcntl(wakeup_pipe[0], F_SETFL, O_NONBLOCK); + /* We ignore the timeout that query_main_context () returns since we'll + * always query again before waiting. + */ + nfds = query_main_context (context, max_priority, NULL); - pthread_mutex_lock (&pollfd_mutex); - pthread_create (&select_thread, NULL, select_thread_func, NULL); - } else - pthread_mutex_lock (&pollfd_mutex); + if (nfds) + old_poll_func (run_loop_pollfds, nfds, 0); + + if (g_main_context_check (context, max_priority, run_loop_pollfds, nfds)) + { + GDK_NOTE (EVENTLOOP, g_print ("EventLoop: Dispatching high priority sources\n")); + g_main_context_dispatch (context); + } +} - while (!ready_for_poll) - pthread_cond_wait (&ready_cond, &pollfd_mutex); +static void +dummy_timer_callback (CFRunLoopTimerRef timer, + void *info) +{ + /* Nothing; won't normally even be called */ +} - /* We cheat and use the fake fd (if it's polled) for our pipe */ +static void +run_loop_before_waiting (void) +{ + GMainContext *context = g_main_context_default (); + gint timeout; + gint n_ready; + + /* At this point, the CFRunLoop is ready to wait. We start a GMain loop + * iteration by calling the check() and query() stages. We start a + * poll, and if it doesn't complete immediately we let the run loop + * go ahead and sleep. Before doing that, if there was a timeout from + * GLib, we set up a CFRunLoopTimer to wake us up. + */ + + g_main_context_prepare (context, &run_loop_max_priority); + + run_loop_n_pollfds = query_main_context (context, run_loop_max_priority, &timeout); - for (i = 0; i < nfds; i++) - if (ufds[i].fd == -1) - { - poll_event_fd = TRUE; - break; - } - - g_free (pollfds); - - if (i == nfds) - { - n_pollfds = nfds + 1; - pollfds = g_new (GPollFD, nfds + 1); - memcpy (pollfds, ufds, nfds * sizeof (GPollFD)); - } - else - { - pollfds = g_memdup (ufds, nfds * sizeof (GPollFD)); - n_pollfds = nfds; - } - - pollfds[i].fd = wakeup_pipe[0]; - pollfds[i].events = G_IO_IN; - - /* Start our thread */ - pthread_cond_signal (&ready_cond); - pthread_cond_wait (&ready_cond, &pollfd_mutex); - pthread_mutex_unlock (&pollfd_mutex); + n_ready = select_thread_start_poll (run_loop_pollfds, run_loop_n_pollfds, timeout); + + if (n_ready > 0 || timeout == 0) + { + /* We have stuff to do, no sleeping allowed! */ + CFRunLoopWakeUp (main_thread_run_loop); + } + else if (timeout > 0) + { + /* We need to get the run loop to break out of it's wait when our timeout + * expires. We do this by adding a dummy timer that we'll remove immediately + * after the wait wakes up. + */ + GDK_NOTE (EVENTLOOP, g_print ("EventLoop: Adding timer to wake us up in %d milliseconds\n", timeout)); + + run_loop_timer = CFRunLoopTimerCreate (NULL, /* allocator */ + CFAbsoluteTimeGetCurrent () + timeout / 1000., + 0, /* interval (0=does not repeat) */ + 0, /* flags */ + 0, /* order (priority) */ + dummy_timer_callback, + NULL); + + CFRunLoopAddTimer (main_thread_run_loop, run_loop_timer, kCFRunLoopCommonModes); } + + run_loop_polling_async = n_ready < 0; +} - if (timeout_ == -1) - limit_date = [NSDate distantFuture]; - else if (timeout_ == 0) - limit_date = [NSDate distantPast]; - else - limit_date = [NSDate dateWithTimeIntervalSinceNow:timeout_/1000.0]; +static void +run_loop_after_waiting (void) +{ + GMainContext *context = g_main_context_default (); - event = [NSApp nextEventMatchingMask: NSAnyEventMask - untilDate: limit_date - inMode: NSDefaultRunLoopMode - dequeue: YES]; - - if (event) + /* After sleeping, we finish of the GMain loop iteratin started in before_waiting() + * by doing the check() and dispatch() stages. + */ + + if (run_loop_timer) { - if ([event type] == NSApplicationDefined && - [event subtype] == GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP) - { - pthread_mutex_lock (&pollfd_mutex); - - for (i = 0; i < nfds; i++) - { - if (ufds[i].fd == -1) - continue; - - g_assert (ufds[i].fd == pollfds[i].fd); - g_assert (ufds[i].events == pollfds[i].events); - - if (pollfds[i].revents) - { - ufds[i].revents = pollfds[i].revents; - n_active ++; - } - } - - pthread_mutex_unlock (&pollfd_mutex); - - /* Try to get a Cocoa event too, if requested */ - if (poll_event_fd) - event = [NSApp nextEventMatchingMask: NSAnyEventMask - untilDate: [NSDate distantPast] - inMode: NSDefaultRunLoopMode - dequeue: YES]; - else - event = NULL; - } + CFRunLoopRemoveTimer (main_thread_run_loop, run_loop_timer, kCFRunLoopCommonModes); + CFRelease (run_loop_timer); + run_loop_timer = NULL; } - - /* There were no active fds, break out of the other thread's poll() */ - pthread_mutex_lock (&pollfd_mutex); - if (select_fd_waiting && wakeup_pipe[1]) + + if (run_loop_polling_async) { - char c = 'A'; - - write (wakeup_pipe[1], &c, 1); + select_thread_collect_poll (run_loop_pollfds, run_loop_n_pollfds); + run_loop_polling_async = FALSE; } - pthread_mutex_unlock (&pollfd_mutex); - - if (event) + + if (g_main_context_check (context, run_loop_max_priority, run_loop_pollfds, run_loop_n_pollfds)) { - for (i = 0; i < nfds; i++) - { - if (ufds[i].fd == -1) - { - ufds[i].revents = G_IO_IN; - break; - } - } + GDK_NOTE (EVENTLOOP, g_print ("EventLoop: Dispatching after waiting\n")); + g_main_context_dispatch (context); + } +} - if (!current_events) - current_events = g_queue_new (); - g_queue_push_head (current_events, [event retain]); +static void +run_loop_exit (void) +{ + g_return_if_fail (current_loop_level > 0); - n_active ++; + if (current_loop_level == acquired_loop_level) + { + g_main_context_release (NULL); + acquired_loop_level = -1; + GDK_NOTE (EVENTLOOP, g_print ("EventLoop: Ended tracking run loop activity\n")); } + + current_loop_level--; +} - return n_active; +static void +run_loop_observer_callback (CFRunLoopObserverRef observer, + CFRunLoopActivity activity, + void *info) +{ + if (getting_events) /* Activity we triggered */ + return; + + switch (activity) + { + case kCFRunLoopEntry: + run_loop_entry (); + break; + case kCFRunLoopBeforeTimers: + run_loop_before_timers (); + break; + case kCFRunLoopBeforeSources: + run_loop_before_sources (); + break; + case kCFRunLoopBeforeWaiting: + run_loop_before_waiting (); + break; + case kCFRunLoopAfterWaiting: + run_loop_after_waiting (); + break; + case kCFRunLoopExit: + run_loop_exit (); + break; + default: + break; + } } +/************************************************************/ + void _gdk_quartz_event_loop_init (void) { GSource *source; + CFRunLoopObserverRef observer; + + /* Hook into the GLib main loop */ event_poll_fd.events = G_IO_IN; event_poll_fd.fd = -1; @@ -344,8 +993,22 @@ _gdk_quartz_event_loop_init (void) g_source_attach (source, NULL); old_poll_func = g_main_context_get_poll_func (NULL); - g_main_context_set_poll_func (NULL, poll_func); + g_main_context_set_poll_func (NULL, poll_func); + + /* Hook into the the CFRunLoop for the main thread */ + + main_thread_run_loop = CFRunLoopGetCurrent (); + + observer = CFRunLoopObserverCreate (NULL, /* default allocator */ + kCFRunLoopAllActivities, + true, /* repeats: not one-shot */ + 0, /* order (priority) */ + run_loop_observer_callback, + NULL); + + CFRunLoopAddObserver (main_thread_run_loop, observer, kCFRunLoopCommonModes); + + /* Initialize our autorelease pool */ autorelease_pool = [[NSAutoreleasePool alloc] init]; } - reinteract-0.5.0/tools/build_deps_osx/pango-relocate.patch0000664000076400007640000000304011070567375020703 00000000000000Add support for PANGO_SYSCONFDIR/PANGO_LIBDIR variables to Pango. http://bugzilla.gnome.org/show_bug.cgi?id=554524 --- pango/pango-utils.c.relocate 2008-09-30 10:23:42.000000000 -0400 +++ pango/pango-utils.c 2008-09-30 10:26:35.000000000 -0400 @@ -692,19 +692,23 @@ G_CONST_RETURN char * pango_get_sysconf_subdirectory (void) { -#ifdef G_OS_WIN32 - static gchar *result = NULL; + static const gchar *result = NULL; if (result == NULL) { +#ifdef G_OS_WIN32 gchar *root = g_win32_get_package_installation_directory_of_module (pango_dll); result = g_build_filename (root, "etc\\pango", NULL); g_free (root); - } - return result; #else - return SYSCONFDIR "/pango"; + const char *sysconfdir = g_getenv("PANGO_SYSCONFDIR"); + if (sysconfdir != NULL) + result = g_build_filename(sysconfdir, "pango", NULL); + else + result = SYSCONFDIR "/pango"; #endif + } + return result; } /** @@ -721,19 +725,23 @@ G_CONST_RETURN char * pango_get_lib_subdirectory (void) { -#ifdef G_OS_WIN32 static gchar *result = NULL; if (result == NULL) { +#ifdef G_OS_WIN32 gchar *root = g_win32_get_package_installation_directory_of_module (pango_dll); result = g_build_filename (root, "lib\\pango", NULL); g_free (root); - } - return result; #else - return LIBDIR "/pango"; + const char *libdir = g_getenv("PANGO_LIBDIR"); + if (libdir != NULL) + result = g_build_filename(libdir, "pango", NULL); + else + result = LIBDIR "/pango"; #endif + } + return result; } reinteract-0.5.0/tools/build_deps_osx/Python-2.5.2-framework-arch.patch0000664000076400007640000000713111070066774022636 00000000000000--- configure.in.detect_arch 2008-09-28 21:55:37.000000000 -0400 +++ configure.in 2008-09-28 22:02:07.000000000 -0400 @@ -1346,6 +1346,23 @@ ;; esac +# This handles the case when someone specifies CC="gcc -arch ppc" +# to do a cross-arch build. It's probably better to use the autoconf +# build-system variables, but this is easier to figure out for +# a quick hack. +# +case "$CC" in + *ppc*) + darwin_arch=ppc + ;; + *i386*) + darwin_arch=i386 + ;; + *) + darwin_arch=`arch` + ;; +esac + AC_SUBST(LIBTOOL_CRUFT) case $ac_sys_system/$ac_sys_release in Darwin/@<:@01567@:>@\..*) @@ -1353,7 +1370,7 @@ if test "${enable_universalsdk}"; then : else - LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`" + LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only $darwin_arch" fi LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; @@ -1365,7 +1382,7 @@ else LIBTOOL_CRUFT="" fi - LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`" + LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only $darwin_arch" LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; esac --- configure.detect_arch 2008-09-28 22:03:32.000000000 -0400 +++ configure 2008-09-28 22:11:32.000000000 -0400 @@ -11359,6 +11359,22 @@ ;; esac +# This handles the case when someone specifies CC="gcc -arch ppc" +# to do a cross-arch build. It's probably better to use the autoconf +# build-system variables, but this is easier to figure out for +# a quick hack. +# +case "$CC" in + *ppc*) + darwin_arch=ppc + ;; + *i386*) + darwin_arch=i386 + ;; + *) + darwin_arch=`arch` + ;; +esac case $ac_sys_system/$ac_sys_release in Darwin/[01567]\..*) @@ -11366,7 +11382,7 @@ if test "${enable_universalsdk}"; then : else - LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`" + LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only $darwin_arch" fi LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; @@ -11378,7 +11394,7 @@ else LIBTOOL_CRUFT="" fi - LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`" + LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only $darwin_arch" LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; esac --- Makefile.pre.in.arch_framework 2008-09-28 22:50:44.000000000 -0400 +++ Makefile.pre.in 2008-09-28 22:51:44.000000000 -0400 @@ -394,8 +394,11 @@ -compatibility_version $(VERSION) \ -current_version $(VERSION); \ else \ - /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \ - @LIBTOOL_CRUFT@ ;\ + $(CC) -o $(LDLIBRARY) -dynamiclib \ + -all_load $(LIBRARY) -Wl,-single_module \ + -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \ + -compatibility_version $(VERSION) \ + -current_version $(VERSION); \ fi $(INSTALL) -d -m $(DIRMODE) \ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj reinteract-0.5.0/tools/build_deps_osx/gtk-dont-steal-update-region.patch0000664000076400007640000000201711153136000023357 00000000000000http://bugzilla.gnome.org/show_bug.cgi?id=573688 Index: gtk/gtktextview.c =================================================================== --- gtk/gtktextview.c (revision 22435) +++ gtk/gtktextview.c (working copy) @@ -4531,7 +4531,6 @@ GtkTextView *text_view; GList *child_exposes; GList *tmp_list; - GdkRegion *updates; text_view = GTK_TEXT_VIEW (widget); @@ -4546,19 +4545,6 @@ gtk_text_view_flush_first_validate (text_view); } - /* More regions could have become invalid in the above loop */ - updates = gdk_window_get_update_area (text_view->text_window->bin_window); - if (updates) - { - GdkRectangle rect; - - gdk_region_get_clipbox (updates, &rect); - - gdk_rectangle_union (area, &rect, area); - - gdk_region_destroy (updates); - } - if (!text_view->onscreen_validated) { g_warning (G_STRLOC ": somehow some text lines were modified or scrolling occurred since the last validation of lines on the screen - may be a text widget bug."); reinteract-0.5.0/tools/build_deps_osx/README0000664000076400007640000000310211070066774015636 00000000000000This directory contains scripts and other files used to build the dependencies required for Reinteract on OS X. It builds on top of the excellent gtk-osx-build work done by Imendio. http://developer.imendio.com/projects/gtk-macosx/build-instructions Differences here: - All modules are changed to build from tarballs; this allows creating an installer and putting up the corresponding source for download. - Select patches not yet in version control (or not yet in tarballs) are added. - Python is upgraded from 2.4 to 2.5 - Extra modules (numpy and matplotlib) are added. - Provision is made for cross-building ppc versions of the dependencies on i386; the the idea is that the ppc and i386 versions of everything can be lipo-ed together to create a universal bundle for release. Usage ===== - Run gtk-osx-build-setup.sh as described in the first step on: http://developer.imendio.com/projects/gtk-macosx/build-instructions You *don't* need to do anything else on that page. - Install git if you don't already have it. (http://code.google.com/p/git-osx-installer/ works) - Checkout the Reinteract sources into ~/Source/reinteract cd ~/Source git clone git://git.fishsoup.net/reinteract - Run build.sh ~/Source/reinteract/tools/build_deps_osx/build.sh This builds everything and installs it into /opt/reinteract - Shell into the built environment JHB=reinteract jhbuild shell - Configure and build reinteract cd ~/Source/reinteract ./autogen.sh make - Run reinteract Reinteract.app/Contents/MacOS/Reinteract reinteract-0.5.0/tools/build_deps_osx/build.sh0000775000076400007640000000221611070066774016421 00000000000000#!/bin/bash basedir=$(cd $(dirname $0) && pwd) # Compute the JHB_VARIANT directory so we can create the root # directory if test "x$JHB_VARIANT" = x ; then platform=$(uname -p) case $platform in i386*) JHB_VARIANT="devel-i386" ;; *) JHB_VARIANT="devel-ppc" ;; esac fi # Sanity check to make sure that something standard was specified case $JHB_VARIANT in devel-i386) ;; devel-ppc) ;; release-i386) ;; release-ppc) ;; *) echo 2>&1 "Unknown JHB_VARIANT $JHB_VARIANT" exit 1 ;; esac export JHB=reinteract if test -e $HOME/.jhbuildrc-reinteract ; then : ; else ln -s $basedir/jhbuildrc-reinteract $HOME/.jhbuildrc-reinteract fi if test -d /opt/reinteract/packages ; then : ; else mkdir -p /opt/reinteract/packages fi if test -d /opt/reinteract/$JHB_VARIANT/source ; then : ; else mkdir -p /opt/reinteract/$JHB_VARIANT/source fi if test -e /opt/reinteract/$JHB_VARIANT/source/pkgs ; then : ; else ln -s /opt/reinteract/packages /opt/reinteract/$JHB_VARIANT/source/pkgs fi jhbuild -m $basedir/reinteract-bootstrap.modules build meta-bootstrap jhbuild build meta-gtk-osx-bootstrap jhbuild build reinteract-0.5.0/tools/build_deps_osx/ppc.cache0000664000076400007640000000002611070066774016527 00000000000000ac_cv_c_bigendian=yes reinteract-0.5.0/tools/build_deps_osx/reinteract.modules0000664000076400007640000001216211160437530020506 00000000000000 reinteract-0.5.0/tools/compiledir.py0000664000076400007640000000040511070567375014462 00000000000000#!/usr/bin/env python import compileall import sys # Because we don't pass force=True, byte-compiled existing in the directories # we build from will be used unmodified; perhaps it would be better to recompile? compileall.compile_dir(sys.argv[1], quiet=True) reinteract-0.5.0/tools/build_msi/0000777000076400007640000000000011162516460014002 500000000000000reinteract-0.5.0/tools/build_msi/ProgressPage.wxs0000664000076400007640000000460211066054514017066 00000000000000 {\dialogTitleStyle}[TITLE] - Version [ProductVersion] Cancel reinteract-0.5.0/tools/build_msi/FatalErrorPage.wxs0000664000076400007640000000240611066054514017323 00000000000000 {\dialogTitleStyle}[TITLE] - Version [ProductVersion] Installation of Reinteract failed; your system was not modified. Close reinteract-0.5.0/tools/build_msi/Overrides.wxl0000664000076400007640000000117211066054514016417 00000000000000 [TITLE] bannerBmp [TITLE] bannerBmp [TITLE] reinteractIcon reinteract-0.5.0/tools/build_msi/ReinteractUI.wxs0000664000076400007640000001452511066054514017030 00000000000000 Installed PREVIOUSVERSIONS Installed (Installed AND NOT !gtk=3) OR (PREVIOUSVERSIONS AND NOT &gtk=3) (Installed AND NOT !pygtk=3) OR (PREVIOUSVERSIONS AND NOT &pygtk=3) (Installed AND NOT !scipy=3) OR (PREVIOUSVERSIONS AND NOT &scipy=3) NOT Installed Installed INSTALLSTARTED="1" reinteract-0.5.0/tools/build_msi/README0000664000076400007640000000316311162516344014604 00000000000000This directory includes a Python script and WiX scripts for building a MSI installer for Reinteract. To make this work, you'll need: * All the (binary) components that go into building the installer. The components in each installer build are listed at: http://www.reinteract.org/download/Reinteract-.msi.components with their original URLs. (The components are also mirrored in the components/binary directory.) The non-Python components need to be installed with the bin/ directory in your PATH environment variable. * WiX version 3 installed and added to your PATH. Get it from: http://wix.sourceforge.net/ * To build against Python-2.5, MinGW installed and added to your PATH. (This is used to compile the Reinteract.exe wrapper script.) Get it from: http://www.mingw.org/ * To build against Python-2.6, Visual Studio 2008 or Visual C++ 20008 Express Edition (a free download) installed. Then simply run 'python build_msi.py' from this directory, and: Reinteract--python2.N.msi file will be generated. The file Reinteract--python2.N.msi.manifest is a listing of all the files in the installer. This is meant for comparing with the previous version to make sure that files haven't gone missing. Some portions of the installer user interface are derived from an installer I created for the Mugshot Windows client. Those portions are Copyright Red Hat, Inc, 2006. The rest of the user interface files and build_msi.py are Copyright Owen Taylor, 2008-2009. All of the code and data in this directory may be used under the same licensing terms as the rest of Reinteract. reinteract-0.5.0/tools/build_msi/BrowsePage.wxs0000664000076400007640000000431111066054514016520 00000000000000 {\dialogTitleStyle}[TITLE] - Version [ProductVersion] Install Reinteract to: Change... Back Continue Cancel reinteract-0.5.0/tools/build_msi/build_msi.py0000664000076400007640000005036411162516344016252 00000000000000#!/usr/bin/env python # # Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import ctypes.util import logging from optparse import OptionParser import os import re import shutil import StringIO import sys import uuid script = os.path.abspath(sys.argv[0]) scriptdir = os.path.dirname(script) toolsdir = os.path.dirname(scriptdir) topdir = os.path.dirname(toolsdir) sys.path[0:0] = (toolsdir,) from common.builder import Builder from common.utils import check_call # The upgrade code must never change UPGRADE_CODE = uuid.UUID('636776fc-e72d-4fe4-af41-d6273b177683') # The role of the product code is slightly unclear; it doesn't have to # be changed on every change, but should be changed on 'significant' # changes. We build it out of a fixed namespace and the version nuber # # (There is also a "package code" which is supposed to be different # for every .msi that is not byte-per-byte identical.) # # A different product namespace should be used for a 64-bit installer # PRODUCT_NAMESPACE = uuid.UUID('7aff852e-dd4e-4fa0-aa01-13ea8d4b6510') # Component ID's must be unique to the component, version, and language # # We first build a version specific component_namespace from this constant # value, and then we base component ID's from that. # COMPONENT_NAMESPACE = uuid.UUID('6579e040-85ff-4a20-a709-c9335c70296c') # A set of patterns defining what files we should extract from the filesystem # for the 'gtk' libraries that we bundle into the installer. These patterns # are relative to the root of the GTK+ install tree GTK_FILES = [ 'bin/intl.dll', 'bin/jpeg62.dll', 'bin/libatk-1.0-0.dll', 'bin/libcairo-2.dll', 'bin/freetype6.dll', 'bin/libgdk-win32-2.0-0.dll', 'bin/libgdk_pixbuf-2.0-0.dll', 'bin/libgio-2.0-0.dll', 'bin/libglib-2.0-0.dll', 'bin/libgmodule-2.0-0.dll', 'bin/libgobject-2.0-0.dll', 'bin/libgthread-2.0-0.dll', 'bin/libgtk-win32-2.0-0.dll', 'bin/libpango-1.0-0.dll', 'bin/libpangocairo-1.0-0.dll', 'bin/libpangowin32-1.0-0.dll', 'bin/libpng12-0.dll', 'bin/libtiff3.dll', 'bin/zlib1.dll', 'etc/gtk-2.0/gdk-pixbuf.loaders', 'etc/gtk-2.0/gtk.immodules', 'etc/pango/pango.modules', 'lib/gtk-2.0/2.10.0', # engines, immodules, and pixbuf loaders 'share/themes', 'share/doc/cairo-1*', 'share/doc/glib-2*', 'share/doc/gtk+-2*', 'share/doc/pango-1*' ] TEMPLATE = \ """ %(generated)s """.strip() # We need unique keys for various things like components, files. # Generate them sequentially id_count = 0 def generate_id(): global id_count id_count += 1 return "Id%04d" % id_count class MsiBuilder(Builder): def __init__(self, output, topdir): Builder.__init__(self, topdir) self.output = output self.feature_components = {} self.directory_ids = {} self.generated = None self.manifest = [] def find_gtk_directory(self): glib_dll = ctypes.util.find_library('libglib-2.0-0.dll') assert glib_dll bindir = os.path.dirname(glib_dll) assert os.path.basename(bindir) == 'bin' return os.path.dirname(bindir) def add_gtk_files(self): gtkdir = self.find_gtk_directory() self.add_matching_files(gtkdir, GTK_FILES, '', feature='gtk') gtkrcfile = os.path.join(self.tempdir, "gtkrc") f = open(gtkrcfile, "w") f.write('gtk-theme-name = "MS-Windows"') # doesn't seem to work # f.write('gtk-im-module = "ime"') f.close() self.add_file(gtkrcfile, 'etc/gtk-2.0', feature='gtk') # To redistribute FreeType, you must include an advertising # notice for FreeType" in your documentation". I believe adding # file with the rest of our licenses in the share/doc subdirectory # should be compliant, though a little more obscure than might # be considered polite. # # long-term: first evaluate whether FreeType is necessary to # the functioning of matplotlib we care about?. If so, maybe # special-case the About dialog on Windows to include a notice # about FreeType? # readme_freetype = os.path.join(self.tempdir, "README.FreeType") f = open(readme_freetype, "w") f.write("""The Reinteract distribution contains contains FreeType. FreeType is copyright 2008 The FreeType Project (www.freetype.org) All rights reserved. """) f.close() self.add_file(readme_freetype, 'share/doc/freetype', feature='gtk') def generate(self, s): if self.generated == None: self.generated = StringIO.StringIO() self.generated.write(s) else: self.generated.write('\n') self.generated.write(s) def add_feature_component(self, feature, component_id): if feature in self.feature_components: self.feature_components[feature].add(component_id) else: self.feature_components[feature] = set([component_id]) def get_file_feature(self, relative): return self.get_file_attributes(relative)['feature'] # Extra is something unique to the component def generate_component_guid(self, extra): return uuid.uuid5(self.component_namespace, extra) def walk_component_directory(self, directory, indent): if directory != '': id = generate_id() self.generate("%s" % (indent, id, os.path.basename(directory))) self.directory_ids[directory] = id absdir = os.path.join(self.treedir, directory) features = {} for f in os.listdir(absdir): absf = os.path.join(absdir, f) relf = os.path.join(directory, f) if os.path.isdir(absf): continue feature = self.get_file_feature(relf) if feature in features: features[feature].add(relf) else: features[feature] = set([relf]) for feature, files in sorted(features.iteritems()): id = generate_id() guid = self.generate_component_guid("[%s]%s" % (feature, directory)) self.generate("%s " % (indent, id, guid)) for file in files: # Special case so we can launch out of a custom action later if os.path.basename(file) == "Reinteract.exe": file_id = "ReinteractExe" else: file_id = generate_id() self.manifest.append(file) # The problem here is that matplotlib has TTF files that shouldn't be installed # on the system and that confuses things because fonts are unique in having a # version but no LanguageId embedded in the font. Using DefaultLanguage='0' # generates a warning from WiX but avoids the validation warning ICE60. I'm # not sure if it actually fixes the problem that ICE60 is warning about. if file.endswith(".ttf"): default_language = " DefaultLanguage='0'" else: default_language = "" self.generate("%s " % (indent, file_id, os.path.basename(file), file, default_language)) self.generate("%s " % (indent,)) self.add_feature_component(feature, id) for f in os.listdir(absdir): absf = os.path.join(absdir, f) relf = os.path.join(directory, f) features = {} absf = os.path.join(absdir, f) if not os.path.isdir(absf): continue self.walk_component_directory(relf, indent + ' ') if directory != '': self.generate("%s" % (indent,)) def generate_components(self): self.generate("") self.generate(" ") self.generate(" ") self.walk_component_directory('', ' ') self.generate(" ") self.generate(" ") self.generate(" ") self.generate("") def generate_feature(self, id, allow_absent, title, description): self.generate("" % ( id, 'allow' if allow_absent else 'disallow', title, description)) if id in self.feature_components: for component_id in sorted(self.feature_components[id]): self.generate(" " % (component_id,)) self.generate("") def substitute_pyw(self, version): origfile = os.path.join(self.topdir, "bin", "Reinteract.pyw") f = open(origfile, "r") contents = f.read() f.close() contents = contents.replace("@VERSION@", version) destfile = os.path.join(self.tempdir, "Reinteract.pyw") f = open(destfile, "w") f.write(contents) f.close() self.add_file(destfile, 'bin', feature='core') def compile_wrapper_python25(self): # On Python-2.5 we build with MingW32; this avoids creating # a dependency on the Visual Studio runtime. # python_topdir = os.path.dirname(os.path.dirname(shutil.__file__)) python_include = os.path.join(python_topdir, "include") python_lib = os.path.join(python_topdir, "libs") wrapper_c = os.path.join(self.topdir, "tools", "build_msi", "wrapper.c") wrapper_o = os.path.join(self.tempdir, "wrapper.o") check_call(['gcc', '-o', wrapper_o, '-c', '-O2', '-Wall', '-I', python_include, wrapper_c]) wrapper_rc = os.path.join(self.tempdir, "wrapper.rc") wrapper_res_o = os.path.join(self.tempdir, "wrapper.res.o") f = open(wrapper_rc, "w") f.write("""LANGUAGE 0, 0 100 ICON %s """ % os.path.join(self.treedir, "Reinteract.ico")) f.close() check_call(['windres', '-O', 'COFF', '-o', wrapper_res_o, wrapper_rc]) wrapper = os.path.join(self.tempdir, "Reinteract.exe") lpython = "-lpython%d%d" % (sys.version_info[0], sys.version_info[1]) check_call(['gcc', '-mwindows', '-o', wrapper, '-L', python_lib, wrapper_o, wrapper_res_o, lpython]) self.add_file(wrapper, 'bin', feature='core') def compile_wrapper_python26(self): # For Python-2.6 we build with Visual Studio; trying to get a # MingW32-built .exe to load the extensions we bundle for Python-2.6 # seems very difficult. We hope that our version of Visual Studio # was close enough to the version that Python is built with so # that if Python runs, we run. # # We use some distutils internals to locate the Visual Studio # command line tools # from distutils.msvc9compiler import MSVCCompiler compiler = MSVCCompiler() # This looks for the tools and then adds them to os.environ['Path'] compiler.initialize() python_topdir = os.path.dirname(os.path.dirname(shutil.__file__)) python_include = os.path.join(python_topdir, "include") python_lib = os.path.join(python_topdir, "libs") wrapper_c = os.path.join(self.topdir, "tools", "build_msi", "wrapper.c") wrapper_rc = os.path.join(self.tempdir, "wrapper.rc") f = open(wrapper_rc, "w") f.write("""LANGUAGE 0, 0 100 ICON %s """ % os.path.join(self.treedir, "Reinteract.ico")) f.close() # We can use distutils to do the basic compilation objects = compiler.compile([wrapper_c, wrapper_rc], output_dir=self.tempdir, include_dirs=[python_include]) # But have to do the linking a bit more manually since distutils # doesn't know how to handle creating .exe files wrapper = os.path.join(self.tempdir, "Reinteract.exe") manifest = os.path.join(self.tempdir, "Reinteract.exe.manifest") extra_libs = [ 'user32.lib', # For MessageBox ] check_call([compiler.linker, "/MANIFEST", "/MANIFESTFILE:" + manifest, "/LIBPATH:" + python_lib, "/OUT:" + wrapper] + objects + extra_libs) # Embed the manifest into the executable check_call(['mt.exe', '-manifest', manifest, '-outputresource:' + wrapper + ';1']) self.add_file(wrapper, 'bin', feature='core') def build(self): version = self.get_version() python_version = "python%d.%d" % (sys.version_info[0], sys.version_info[1]) full_version = version + "-" + python_version output = self.output % { 'version' : full_version } _logger.info("Will write output to %s", output) self.component_namespace = uuid.uuid5(COMPONENT_NAMESPACE, full_version) self.add_files_from_am('', '', feature='core') self.substitute_pyw(full_version) # This is a XDG icon-specification organized directory with a SVG in it, not useful shutil.rmtree(os.path.join(self.treedir, 'icons')) self.add_file('data/Reinteract.ico', '', feature='core') self.add_feature_component('core', 'ReinteractShortcut') if python_version == 'python2.5': self.compile_wrapper_python25() else: self.compile_wrapper_python26() self.add_external_module('cairo', 'external', feature='pygtk') self.add_external_module('gobject', 'external', feature='pygtk') self.add_external_module('atk', 'external', feature='pygtk') self.add_external_module('pango', 'external', feature='pygtk') self.add_external_module('pangocairo', 'external', feature='pygtk') self.add_external_module('gtk', 'external', feature='pygtk') self.add_external_module('numpy', 'external', feature='scipy') self.add_external_module('matplotlib', 'external', feature='scipy') # More matlab stuff self.add_external_module('mpl_toolkits', 'external', feature='scipy') # Some external deps installed with matplotlib self.add_external_module('dateutil', 'external', feature='scipy') self.add_external_module('pytz', 'external', feature='scipy') # matlab-like toplevel module installed with matplotlib self.add_external_module('pylab', 'external', feature='scipy') self.add_gtk_files() self.compile_python() self.generate_components() self.generate_feature('core', allow_absent='no', title='Reinteract', description='The Reinteract Application') self.generate_feature('gtk', allow_absent='yes', title='GTK+', description='Private copies of GTK+, GLib, Pango, ATK, and Cairo') self.generate_feature('pygtk', allow_absent='yes', title='PyGTK ', description='Private copies of the PyGTK and Pycairo language bindings') self.generate_feature('scipy', allow_absent='yes', title='SciPy', description='Private copies of the numpy and matplotlib modules') wxs = TEMPLATE % { 'product_guid' : uuid.uuid5(PRODUCT_NAMESPACE, full_version), 'version' : version, 'upgrade_code' : UPGRADE_CODE, 'shortcut_component_guid' : self.generate_component_guid("{shortcut}"), 'bindir_id' : self.directory_ids['bin'], 'generated' : self.generated.getvalue(), } wxsfile = os.path.join(self.tempdir, 'Reinteract.wxs') f = open(wxsfile, "w") f.write(wxs) f.close() wxsfiles = [wxsfile] localization_file = None for w in self.main_am['WIX_FILES'].split(): absw = os.path.join(self.topdir, w) if w.endswith(".wxs"): wxsfiles.append(absw) elif w.endswith(".wxl"): localization_file = absw else: shutil.copy(absw, self.treedir) wixobjfiles = [] for w in wxsfiles: wixobjfile = os.path.join(self.tempdir, os.path.basename(w)) wixobjfile = re.sub(".wxs$", ".wixobj", wixobjfile) check_call(['candle', '-o', wixobjfile, w]) wixobjfiles.append(wixobjfile) # WixUtilExtension is used for WixShellExec # WixUIExtension is used for the ErrorDlg, FilesInUse, MsiRMFilesInUse dialogs light_cmd = ['light', '-ext', 'WixUtilExtension', '-ext', 'WixUIExtension'] # Where to look for source files light_cmd.extend(['-b', self.treedir]) # File holding localization strings that we used to override some strings in # the WixUI dialogs if localization_file != None: light_cmd.extend(['-loc', localization_file]) # Where to write the output light_cmd.extend(['-o', output]) # Object files to build into the result light_cmd.extend(wixobjfiles) check_call(light_cmd) manifestfile = output + ".manifest" f = open(manifestfile, "w") for x in sorted(self.manifest): print >>f, x f.close() ############################################################ parser = OptionParser() parser.add_option("-o", "--output", help="Filename of MSI to create") parser.add_option("-d", "--debug", action="store_true", help="Enable debugging messages") parser.add_option("-v", "--verbose", action="store_true", help="Enable verbose messages") options, args = parser.parse_args() if args: parser.print_usage(sys.stderr) sys.exit(1) if options.debug: logging.basicConfig(level=logging.DEBUG) elif options.verbose: logging.basicConfig(level=logging.INFO) _logger = logging.getLogger("build_msi") output = options.output if output == None: output = os.path.join(os.getcwd(), "Reinteract-%(version)s.msi") script = os.path.abspath(sys.argv[0]) scriptdir = os.path.dirname(script) toolsdir = os.path.dirname(scriptdir) topdir = os.path.dirname(toolsdir) builder = MsiBuilder(output=output, topdir=topdir) try: builder.build() finally: builder.cleanup() reinteract-0.5.0/tools/build_msi/WelcomePage.wxs0000664000076400007640000000640511066054514016660 00000000000000 {\dialogTitleStyle}[TITLE] - Version [ProductVersion] Please choose how you would like to install Reinteract: Reinteract will be installed in the standard location with all dependencies. Choose the install location and which dependencies to install. Install INSTALLTYPE="standard" INSTALLTYPE="standard" NOT INSTALLTYPE="standard" Continue INSTALLTYPE="custom" INSTALLTYPE="custom" NOT INSTALLTYPE="custom" Cancel reinteract-0.5.0/tools/build_msi/CancelPage.wxs0000664000076400007640000000250411066054514016446 00000000000000 {\dialogTitleStyle}[TITLE] - Version [ProductVersion] Installation of Reinteract was cancelled; your system was not modified. Close reinteract-0.5.0/tools/build_msi/wrapper.c0000664000076400007640000000225611066054514015551 00000000000000#define WIN32_LEAN_AND_MEAN #include #include #include "Python.h" #include static void fail(void) { MessageBoxA(NULL, "Cannot determine location of Reinteract.pyw from EXE name", NULL, MB_OK); exit(1); } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { #define BUF_SIZE 1024 char buf[BUF_SIZE]; char *argv[2] = { "Reinteract.exe", "Reinteract.pyw" }; char *dirend; int count = GetModuleFileNameA(NULL, buf, BUF_SIZE); if (count == 0 || count == BUF_SIZE) fail(); /* This will fail in some exotic cases like C:Reinteract.exe */ dirend = buf + count; while (dirend > buf && *(dirend - 1) != '/' && *(dirend - 1) != '\\') dirend--; /* Change to the the EXE directory so that we find our DLL's despite Python * using LOAD_WITH_ALTERED_SEARCH_PATH. Modifying %PATH% would be another * option. Doing it this way also simplifies passing in Reinteract.pyw * as the first argument. */ if (dirend > buf) { *dirend = '\0'; SetCurrentDirectory(buf); } return Py_Main(2, argv); } reinteract-0.5.0/tools/build_msi/BrowsePage2.wxs0000664000076400007640000000534211066054514016607 00000000000000 Reintrct|Reinteract {\dialogTitleStyle}[TITLE] - Version [ProductVersion] Look in: New Folder.. Folder name: Back Continue Cancel reinteract-0.5.0/tools/build_msi/reinteractBanner.bmp0000664000076400007640000055150211066054514017716 00000000000000BMB6(iK   ccccddddddddeeeeeeeeeeffffffffffgggggggggghhhhuuuuuuvvvvvvvvwwwwwwwwwwxxxxxxxxxxyyyyyyyyyyzzzzzzzz{{{{{{{{{{||||}}kkddddddeeeeeeeeeeffffffffffgggggggghhhhhhhhhhuuvvvvvvvvwwwwwwwwwwxxxxxxxxxxyyyyyyyyyyzzzzzzzz{{{{{{{{{{||||||||ddeeeeeeeeeeffffffffffgggggggghhhhhhhhhhiiiivvvvvvwwwwwwwwwwxxxxxxxxxxyyyyyyyyzzzzzzzzzz{{{{{{{{{{||||||||||}}eeeeeeeeffffffffffgggggggghhhhhhhhhhiiiiiiiizzvvwwwwwwwwwwxxxxxxxxxxyyyyyyyyzzzzzzzzzz{{{{{{{{{{||||||||||}}}}}}eeffffffffffgggggggghhhhhhhhhhiiiiiiiiiijjwwwwwwwwwwxxxxxxxxxxyyyyyyyyzzzzzzzzzz{{{{{{{{{{||||||||||}}}}}}}}ffffffffgggggggghhhhhhhhhhiiiiiiiiiijjjjjjwwwwwwxxxxxxxxxxyyyyyyyyzzzzzzzzzz{{{{{{{{{{||||||||||}}}}}}}}~~~~kkffgggggggghhhhhhhhhhiiiiiiiiiijjjjjjjjkkwwxxxxxxxxxxyyyyyyyyzzzzzzzzzz{{{{{{{{{{||||||||}}}}}}}}}}~~~~~~~~gggggghhhhhhhhhhiiiiiiiiiijjjjjjjjkkkkkkxxxxxxxxxxyyyyyyyyzzzzzzzzzz{{{{{{{{{{||||||||}}}}}}}}}}~~~~~~~~~~gghhhhhhhhhhiiiiiiiiiijjjjjjjjkkkkkkkkkkxxxxyyyyyyyyyyzzzzzzzzzz{{{{{{{{{{||||||||}}}}}}}}}}~~~~~~~~~~hhhhhhiiiiiiiiiijjjjjjjjkkkkkkkkkkllllyyyyyyyyyyzzzzzzzzzz{{{{{{{{{{||||||||}}}}}}}}}}~~~~~~~~~~hhiiiiiiiiiijjjjjjjjkkkkkkkkkkllllllll{{~~yyyyyyzzzzzzzzzz{{{{{{{{{{||||||||}}}}}}}}}}~~~~~~~~~~wwiiiijjjjjjjjjjkkkkkkkkkkllllllllllmmnnyyyyzzzzzzzzzz{{{{{{{{{{||||||||}}}}}}}}}}~~~~~~~~~~jjjjjjjjjjkkkkkkkkkkllllllllllmmmmmmmmzzzzzzzzzz{{{{{{{{||||||||||}}}}}}}}}}~~~~~~~~~~xxjjjjkkkkkkkkkkllllllllllmmmmmmmmnnnnzzzzzz{{{{{{{{||||||||||}}}}}}}}}}~~~~~~~~~~kkkkkkkkkkllllllllllmmmmmmmmnnnnnnnnzzzz{{{{{{{{||||||||||}}}}}}}}}}~~~~~~~~~~yykkkkllllllllmmmmmmmmmmnnnnnnnnnnoo{{{{{{{{||||||||||}}}}}}}}}}~~~~~~~~~~llllllllmmmmmmmmmmnnnnnnnnnnoooooopp{{{{||||||||||}}}}}}}}}}~~~~~~~~~~zzllmmmmmmmmmmnnnnnnnnnnoooooooooopp||||||||||}}}}}}}}}}~~~~~~~~mmmmmmmmnnnnnnnnnnoooooooooopppppp||||||||}}}}}}}}}}~~~~~~~~{{mmnnnnnnnnnnooooooooppppppppppqq||||}}}}}}}}}}~~~~~~~~nnnnnnnnooooooooppppppppppqqqqqqrr}}}}}}}}}}~~~~~~~~nnooooooooppppppppppqqqqqqqqqqrr}}}}}}}}~~~~~~~~rrooooppppppppppqqqqqqqqqqrrrrrr}}}}~~~~~~~~ppppppppppqqqqqqqqqqrrrrrrrrssss~~~~~~~~ppppqqqqqqqqqqrrrrrrrrssssssss~~~~qqqqqqqqqqrrrrrrrrsssssssssstt~~qqqqrrrrrrrrssssssssssttttttttvvrrrrrrssssssssssttttttttttuurrssssssssssttttttttttuuuuuuuussssssttttttttttuuuuuuuuvvvvwwttttttttttuuuuuuuuvvvvvvvvvvttttttuuuuuuuuvvvvvvvvvvwwwwuuuuuuuuvvvvvvvvvvwwwwwwwwxxuuvvvvvvvvvvwwwwwwwwwwxxxxvvvvvvvvwwwwwwwwwwxxxxxxxxyyvvwwwwwwwwwwxxxxxxxxyyyyyywwwwwwxxxxxxxxyyyyyyyyyyzz||xxxxxxxxyyyyyyyyyyzzzzzz{{xxxxyyyyyyyyyyzzzzzzzzzz{{yyyyyyyyzzzzzzzzzz{{{{{{{{yyzzzzzzzzzz{{{{{{{{||||||zzzz{{{{{{{{{{||||||||||{{{{{{{{||||||||||}}}}}}{{{{||||||||||}}}}}}}}}}~~||||||||}}}}}}}}}}~~~~~~~~||}}}}}}}}}}~~~~~~~~}}}}~~~~~~~~~~~~~~~~~~~~reinteract-0.5.0/tools/build_msi/FeaturesPage.wxs0000664000076400007640000000645311066054514017046 00000000000000 {\dialogTitleStyle}[TITLE] - Version [ProductVersion] By default, Reinteract will be installed with various libraries and modules that it depends upon. You can choose to not install these dependencies if you already have existing copies on your system that you would rather use instead. Install private copies of GTK+, GLib, Pango, ATK, and Cairo INSTALLGTK NOT INSTALLGTK Install private copies of the PyGTK and Pycairo language bindings INSTALLPYGTK NOT INSTALLPYGTK Install private copies of the numpy and matplotlib modules INSTALLSCIPY NOT INSTALLSCIPY Back Installed Install Cancel reinteract-0.5.0/tools/build_msi/SuccessPage.wxs0000664000076400007640000000573511066054514016702 00000000000000 {\dialogTitleStyle}[TITLE] - Version [ProductVersion] Start Reinteract now Installed Finish 1 STARTREINTERACT=1 reinteract-0.5.0/tools/run_tests.sh0000775000076400007640000000041711076405670014344 00000000000000#!/bin/sh cd $srcdir/lib/reinteract status=0 for f in *.py ; do if grep '^if __name__' $f | grep -v INTERACTIVE &> /dev/null ; then echo -n "$f .. " python $f if [ $? = 0 ] ; then echo "OK" else echo "FAIL" status=1 fi fi done exit $status reinteract-0.5.0/tools/build_bundle/0000777000076400007640000000000011162516460014463 500000000000000reinteract-0.5.0/tools/build_bundle/reinteract-dmg-background.png0000664000076400007640000003713211070567375022150 00000000000000PNG  IHDRXsRGBbKGD pHYs B(xtIME :/~ IDATxw\7Qq@EW#r}S)5ӲijLŕ"j"Ⱦ~|=i^u~:`14G@:: tt@@:  t@@@@: t@@:: to4p֭[͛7dɒݻJ,IG8c ߈#GY_D oZ*@ǿ۩S/}upJ.-___iӦ*]?vRppMyݵl2V4;KfeeeF쬮]jСjٲ?۶m[￳#;VZr劶nݪF٭S@3F+WիW/988X>ҥKժU+;Y"En7.&`ܹӪ_~Q߾}u9f_xQ:U;C7|ikjzw$9RVݺuip *dS^bE֭[o;{N{칣^X1YF<$EÆ kvW1FƍS.]tR6;ĉjܸM} q)XFhl׮zeS 6yoР;ӧO+!!A'O?ަ zG[o pwƺu qrwwW{nyHH? ˗W W f6;dҥi {]w9s(""ƌC#3t V*ggЋ/*==:p/HOOWffMyŊںunݪx5jHM4Qpp4dh֭rvvS/hm߾]!!!z#X> իuUXQzG\g*..泴49r(/w+'!!A!!!ڶmܬgʕZtT^xAŋ233yf-_\SZԥK|¹^DDvڥ}),,LŋW5ԣGKlOիWs\׶J*A*T0zcݻwԗdz|M7,,ԭ[$VZřիW^{4jȸX{Gmꧦ3qDӫW/S|yiM8cLllӧqpp+;wڝ,Ӿ}߶mn[8q̛7j=j9`M>xzzZ>oԨ4a5ŋ7.\p!A2eIKK3YYYf޽g1;vҞ߶j8 Av[HgϞ>>VWٻ*ѻw599TRR\|9;v0={4!!!w:l w(\Rs՘1cԪU+o^:|pEDD~y믿(7onE*6ϗOHHaSrZ%Jͦm۶vۧO9q-o>*U W>vܩɓ'Ӛ1cNWWW-[֦==7j[}3 4ŋհaCgk@~orE#FWw}Ve9ַ … k+==]iiiJOOWLLΞ=k74;2;>mڴQ,_\IIIիW_?.ZD_ tWL"I7ogS?׈#TD~);p8㙴|||ThQ5iDmڴp"d2]D͜9S}bcc5Eٔ Ё;o߾ZtV^}gǏ):tVEH"y~ ڿ>!!!5k-Z$IRu\/:pM0Ak֬,tcݳ~X;v^h7j:t营C;v5jI&i<.\GUvG/wգGÇӰ@|'ԩUZ~5jqzӣG!@ѣG۽zϧ}FW_}ꀣ[nznj|*U:pթSG]v{>t_oڵJHHal:tpsvvVժUmʷmf>@ɘ1c/[LsW`]pAo}n7u7ϩStԩ6e)))y.rzٳ4?S6}Q``q?vʕ+ׯz)=yj0ܸx=)vXVr\{s|[WNo͊ޟi޼4hi֬KC^{5edd}Ȱ;۷o;ح{nc۬Y0Æ ˵Moudeeټ\E Ӷhyڵ37o6fر9w޽͖-[ڵk믿 *zʼ⋦Yf׷zzz~f^6mjNK޶43tw*)))w;88c}{w_Ϟ=mƕa-[+@텺ׁfo[2'Ṉ~N׎1;udh̫z'++lܸ1a6lؐm7<)R$===͕+WK/k9nw>_~eÔ,Y 2t-ZM6;Z3????ӽ{wsEĘƍ8l׮]tʕvpp0Çy]W_}e/~-j&Ol1O>& `c_TR]\\SO=Q^/wg]3g中$''Zj:C 1 e˖v+V|&%%fs5y ۷8ϟbalݺt{|> eJJ1ci֬=}v;yi߾}; M66?gv7斧o'/+T`wL޽m;;;޽{}콏={:/W\ ?[9rĔ-[wߵ{PwÇ֭[ =`ٳvagUTL< G$&&ٳҹsݻLk׮]:vʔ)-[iӽhΝڳgΞ=h"O/ QDDywMLLҥKu% <8ϯ^ְ0ڵK'OTj԰aCUV-|6nܨcǎI͛7Wpp}^t: tt@@:  t@@@@: t@@:: t[4/##CϷIKVŊU\98d-[L/^#Ӌҏ?G*UVJ*q?sZdO6TX񶍿Csv? EڵkhEGGZbhҥӢE?Μ9sWӨQgjر֯_8?STD effjSzThQKdI,m"Ek322tEyyyC.]Rhh|}}UvmIRzz:Hf͚VsL?~\T:uc9`KOOWFF:.VonWǏرcR:ul!84թSGŋ} hѢJOO׮]zi?uUIZ>oooÇ+66VPB5&&Frttd.wVrrׯ… 8X߿_ު]6 .ӥ8c0adFa)o$b Ӷm[%>c̋/hܬ.7.\|W6OJJ2=U6mژ IuTbvpٗ܏9bʕ+g2׊7 yMFFF/v/mJ2O*_z)U4Çox6Ŋ3{1%J nKI&m:{}8;;^zԯ_~=TB~֧O#L:ժ|޼yF-eف7oٴi駟̸q㌿qrr2SLjJ*:uXvfϞm$ӧ0%o֪>3F={|gٯ U+WoooluUZ5mrI&jժS\ffR19waׯosE{фٜao޼٪#$aÆkMN>֭k ,h.\`UI+U ̱S$?Z5H2k֬Fٱc;4lؐ+pvpvVtezp.]ի5m4ZjJ(Kݻw+##ϊrٳ[l)I:}짟~:wd%%%)11Q/_VnSNiz3gTVԶm[3F֊+ /X8qBNRݕd]rEj۶\]]k׮NQ=zf[n;TmذA3g|)S|:vUG[̙3:q})99Y 0`eeei۶mV%JP:'99YS׮]UX1y[V۶myTvm$++K=ݫLvt|7nlYvM6M#GTRR\]]Ureʕ+xʕ+w˖ѦeرcJMM5\N<*UpCU>}۷kĉzUn]˲eرc5vw#:[̲ׯ_(66VT *(K'>WWW?~\TZ;-uzۥd]{`rm{uy)Z<==mfu;r6@cIR͚5m>sqq);x  ͝;WUTD:z+Yןe]^^^ڰaCujԨq/_^5׃;#ך5k,ӓ#Gk׮vǓ^y][+WOU{U5,Oj… ہy^vo.׭\cRSSmvGj׮3gX'0 qoaEHH4fU^R'NbŊUJBCCզMy,9: ???mڴIKg]t_kݺuԩ$3_`zۖJHHЄ Tn]8` v;?o4ʕ+K߯ݻ]y&ŵW~a9<˭h$44TW('7zҺu4qDꡇR"EtmڴInnnv@6srrR-$*'''SNX}Q_ZhawVD mܸQ#FUxqkzwhUyڹsk~z-gyײeK[NK.ٳgeyi͚5-x-h궀$j޼>͙3G*YG,E9omڴI]tQ֢EkVWF-Kڵ>-E-Z~AӦMSxx=ju>^`YWk 6_~QPP6nܨ_UnnnVkK.hԨQ_pBy{{+00PZ{'u)**JJIIu]4lPIIIVeʕojTH[mNѣGkƌ'M8Qڵ9wPBjѢʖ-{&88X?.\HEGG[++Vԁ4rHZ򤸩SjСy?3Џ?Hedd(--Mh=>t=tGƍ%'Nŋ5p@n3.8q:w,777,YRJOOWN,~qKc~ŋ*YհaCtC@: pM4 nפItjqqq4ivޝk׮E%Kogow}gU6|-XWc֭B J*&..OڴiFٹslʔ)Fٵkm={ٳMRRgӧO7̎;uح[7SBz>l$?0O{a+vGyf&##㶌Yfrʷ}9̙cl`֭kUVvmS~}vr ~͚5KgΜ1F}]Cy;լYSWѢEotVXǫM66^diy}UfΜ9/,:vK.8p|I5k֌>we-]T=zݻ5{"۴ic*;ujݺ=.]\\Kw4t;-Zd 0@~~~7n8:uX۳gfΜ^xAΝӂ ujذa?rH-[VO>&Nm۶S>|~7qZJ+WTXX﯁ZEŋk:}<<}֮]+鯗d?Gj׮l٢N߳4}t/Tխ[7j>ׯ_+Wjܸq ŋu1kѪTUcǎO>ѡCRJ)00P?|}}o:_v-Zp)SF͚5K/d0̝;W˗/W\\6m_~9Ǻiii:umۦHo߾6k}\QFiҤIںuΞ=ݻw}aʇ~hy؋/h9C߿7n,N4IUfM=رcO>Q||Əo)7n\]]/O?զM6mhȑrqqV>}Z*WZn!Cܹs7nc=szҴi$˗kϞ=U2eԸqc >\`NqJ%JPԯ_?Iٳm|dc)1cd-[f7l3QFلQRLlz͟;w899z*߁^zukw7&--J*\rV>qpp0O>Mϟ?ߪ yllFI/;P9b5lffR5ПyhVpVa$#GƍmƝO2ަVZV{n#ɼ 7 9`ό$|rk׶V[ۓl|||%Tzz͛ڵk^z\ge+UH"Ve*SMЉ'ԨQ;7|-[|*P*##CgΜ6ӧlsbŊ\k׶bTBX'WWW5jH;vԬY.慛RRRlC8qB>>>^}7GG5lPJLLqǎʕ+gU^P!Y9rD#G^ӫÇk͚5rppPxx0E/q3ƍW]r6 $u:x`>^*VX'jժx լYSEѲe4|˽JHHPFFFe^rl\\\,eԩS2efϞ_V>}p{矹λ$]pAv\xg(ݾ}{sKm޼:88o=()jU``>S}7/TJ1B> sjJO#<ݻZjruu+r1t|rtt˗~zSffΝ#GZ}e3sIٕ?bŊS L"???OrtP7n[m㣂 ٳv?u@~.]Z&L]ӧO׌3_|oriӦM2؜FEEZ*T:,V}<׭TlY988]O:'֬Y35kLIIIZr&LCGUɒ%svwƍl6W .߇bbb?u?*Uno+Vؔ^Z[U'tA]pA|7h@[l5ϟ?4i*?>)WNmݺժ$mڴI7\"6moFZr-YzM;$$$Vڵmn%\^zt6olU~q www-X ߗ*uW@UZU6l鹿j*eeeݒ T޽5~xedd￷Z{_vY|_9s(##g6ٜԫW/=z￯Lc4g-ZH?Tb}Y 9sF>+{?ceddk׮V? %uXbZp/鯟0 0f5kJfΜ*&&&ןo7Nݻ5d,XP#Fu'hڵJOO$hJLL+pz,wE[6g6l ,!Cĉ~|U?X͙3j޳իW+**~߯~Znnn`~ի\c# 4ȪԩSMMBd7nl^:t0/qpp0xxx%KXϳWZeJ(a$///S`A#ɪ… dJ(aM۶mرc$sauHeYSL1F)Re:6lsڟ2eZOuf$'''SlYj$ 9~WSL˼;88GIrdY>֭222;cibŊ I@fӦMVܫV8%%Ŵnj͞=۪e[-Wٶm[ƟS/ G\\\$ais'''oX i&SdI28;;[>{ꩧ$h'Nh?aܮa+k۶me͛7@jР.]={WӦMm6=zTjժ\]]U@@~ٳG;vPB,=ϯu9EDD(00!+**JǎSPP *dUҥKھ}.???5o,ԩS駟+88X111:q4h`s166VOVrrTrٝlھ}IqM4u\r@:0@ s@@ t9as:0@ ́%cץKTH ?K@:  t@@@@: t@@:: tt@@:  t@@@:: tt@@:  t@@@@: t@@:: tt@@@: t@@:: tt@@:  t@@@@:G?wǩq~IENDB`reinteract-0.5.0/tools/build_bundle/reinteract-dmg-background.svg0000664000076400007640000001170311070567375022157 00000000000000 image/svg+xml Reinteract Drag the Reinteract Icon to theApplications Folder to install reinteract-0.5.0/tools/build_bundle/build_bundle.sh0000775000076400007640000000276611162516344017404 00000000000000#!/bin/bash # # Copyright 2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## # Script to build a universal binary of Reinteract to use in the bundle # and then build the binary if [ -n "$JHBUILD_PREFIX" ] ; then echo 1>&2 "JHBuild is already running" exit 1 fi scriptdir=$(cd $(dirname $0) && pwd) toolsdir=$(dirname $scriptdir) topdir=$(dirname $toolsdir) libdir=/opt/reinteract/release-i386/install/lib # These names cause the system frameworks to try and link against # the single-arch versions of these libraries instead of of the # system versions. The real fix is probably to get GTK+ to use # the system libraries. echo "Moving image libraries away" for i in png jpeg tiff ; do mv $libdir/lib$i.dylib $libdir/lib$i.dylib.save done export JHB=reinteract JHB_VARIANT=release-i386 jhbuild run env \ OBJC='gcc -arch i386 -arch ppc' \ CC='gcc -arch i386 -arch ppc' \ CFLAGS='-O2' \ CPP='gcc -E' \ sh -c "cd $topdir && ./autogen.sh --enable-python-thunks && make clean && make" status=$? echo "Restoring image libraries" for i in png jpeg tiff ; do mv $libdir/lib$i.dylib.save $libdir/lib$i.dylib done [ $status = 0 ] || exit 1 jhbuild run python \ $scriptdir/build_bundle.py --add-arch=/opt/reinteract/release-ppc/install reinteract-0.5.0/tools/build_bundle/README0000664000076400007640000000303611161346302015256 00000000000000This directory contains a script for creating an application bundle of Reinteract and it's dependencies. The script also knows how to take that application bundle and package it into a Disk Image (dmg) file to use as an installer. The disk image file is set up with an explanatory background image and symlink to the Applications folder. Usage ===== This describes how to create an dmg installer with universal binaries (ppc and i386), without debug symbols. The script can also be used (with fairly obvious modifications) to build only for one architecture, to build using devel instead of release configurations, or to just build an app bundle and not a dmg. * First you need to have a build set up configured according to tools/build_deps_osx/README. * You also need the pkg-dmg script from: http://mxr.mozilla.org/seamonkey/source/build/package/mac_osx/ somewhere in your path. (Copy it into your ~/bin), say * Build PPC and i386 release versions of the dependencies: JHB_VARIANT=release-i386 tools/build_deps_osx/build.sh JHB_VARIANT=release-ppc tools/build_deps_osx/build.sh * Now build a universal binary of ReinteractWrapper and create the .dmg from it and the dependencies tools/build_bundle/build_bundle.sh That will write a file Reinteract-.dmg into the current directory. It will also write a file Reinteract-.dmg.manifest, which is just a list of all the files in the app bundle. This is meant for version-to-version comparisons to avoid accidental inclusion or removal of files. reinteract-0.5.0/tools/build_bundle/build_bundle.py0000664000076400007640000003035611160437530017410 00000000000000#!/usr/bin/env python # # Copyright 2008 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import ctypes.util import logging from optparse import OptionParser import os import re import shutil import StringIO import subprocess import sys import uuid # Useful abbreviations join = os.path.join dirname = os.path.dirname basename = os.path.basename script = os.path.abspath(sys.argv[0]) scriptdir = dirname(script) toolsdir = dirname(scriptdir) topdir = dirname(toolsdir) sys.path[0:0] = (toolsdir,) from common.builder import Builder from common.utils import check_call # A set of patterns defining what files we should extract from the filesystem # for the dependencies libraries that we bundle into the installer. These patterns # are relative to the root of the install tree. This list is manually maintained # to keep extra files from accidentally creaping into the installer DEP_LIBRARY_FILES = [ 'lib/libatk-1.0.*.dylib', 'lib/libcairo.*.dylib', 'lib/libgdk-quartz-2.0.*.dylib', 'lib/libgdk_pixbuf-2.0.*.dylib', 'lib/libgio-2.0.*.dylib', 'lib/libglib-2.0.*.dylib', 'lib/libgmodule-2.0.*.dylib', 'lib/libgobject-2.0.*.dylib', 'lib/libgthread-2.0.*.dylib', 'lib/libgtk-quartz-2.0.*.dylib', 'lib/libintl.*.dylib', 'lib/libjpeg.*.dylib', 'lib/libpango-1.0.*.dylib', 'lib/libpangocairo-1.0.*.dylib', 'lib/libpixman-1.*.dylib', 'lib/libpng12.*.dylib', 'lib/libpyglib-2.0.*.dylib', 'lib/libtiff.3.dylib', 'lib/pango/1.6.0/modules/pango-*.so', 'lib/gtk-2.0/2.10.0/*/*.so', # engines, immodules, and pixbuf loaders 'share/themes' ] # We include readme files and license information for all the dependencies # we bundle. DEP_LIBRARY_SOURCE_FILES = [ 'atk*/README', 'atk*/COPYING', 'cairo*/README', 'cairo*/COPYING*', 'gettext*/README', 'gettext*/COPYING', 'glib*/README', 'glib*/COPYING', 'gtk+*/README', 'gtk+*/COPYING', 'gtk-quartz-engine-*/README', 'gtk-quartz-engine-*/COPYING', 'jpeg*/README', 'libpng*/README', 'libpng*/LICENSE', 'matplotlib*/README.txt', 'matplotlib*/license/*', 'numpy*/README.txt', 'numpy*/LICENSE.txt' 'pango*/README', 'pango*/COPYING', 'pixman*/README', 'pixman*/COPYING', 'pycairo*/README', 'pycairo*/COPYING', 'pygobject*/README', 'pygobject*/COPYING', 'pygtk*/README', 'pygtk*/COPYING', 'tiff*/README' ] class BundleBuilder(Builder): def __init__(self, output, topdir, output_type, arches): Builder.__init__(self, topdir, treesubdir='Reinteract.app') self.output = output self.output_type = output_type self.manifest = [] self.arches = arches self.jhbuild_source_dir = os.path.normpath(os.environ['JHBUILD_SOURCE']) self.jhbuild_install_dir = os.path.normpath(os.environ['JHBUILD_PREFIX']) def repoint_libraries(self, binary, install_dir): # Rewrite paths to shared libaries inside binary to be relative to # the executable instead of pointing to absolute paths in install_dir otool = subprocess.Popen(args=['otool', '-L', binary], stdout=subprocess.PIPE) first = True for line in otool.stdout: # First line is the identification name of the library, subsequent lines are indented if not line.startswith('\t'): continue path = line.strip().split()[0] if not path.startswith(install_dir): continue relative_path = path[len(install_dir) + 1:] check_call(['install_name_tool', '-change', path, '@executable_path/../Resources/' + relative_path, binary]) otool.wait() def add_file(self, source, directory, **attributes): # We override to add special handling for binary files if ((source.endswith(".so") or source.endswith(".dylib")) and source.startswith(self.jhbuild_install_dir)): relative_path = source[len(self.jhbuild_install_dir) + 1:] # We find a correspoding binary for each arch and join them # together with the lipo command fat_tmp = join(self.tempdir, basename(source)) lipo_command = ['lipo', '-create', '-output', fat_tmp] for arch, install_dir in self.arches.iteritems(): arch_source = join(install_dir, relative_path) arch_tmp = join(self.tempdir, arch + '-' + basename(source)) shutil.copy(arch_source, arch_tmp) # Before running lipo on the library, rewrite dependency # paths in it to be relative to the executable self.repoint_libraries(arch_tmp, install_dir) lipo_command.extend(('-arch', arch, arch_tmp)) check_call(lipo_command) Builder.add_file(self, fat_tmp, directory, **attributes) else: Builder.add_file(self, source, directory, **attributes) def rewrite_modules_file(self, file): # Rewrite paths in a module list file to by executable relative # (these files are used for different types of dynamically loaded # modules within GTK+ to avoid having to load and query a list of # shared objects on startup) source = join(self.jhbuild_install_dir, file) tmp = join(self.tempdir, basename(file)) infile = open(source, "r") outfile = open(tmp, "w") for line in infile: line = line.replace(self.jhbuild_install_dir, '@executable_path/../Resources') outfile.write(line) infile.close() outfile.close() self.add_file(tmp, join('Contents/Resources', dirname(file))) def add_dep_library_files(self): self.add_matching_files(self.jhbuild_install_dir, DEP_LIBRARY_FILES, 'Contents/Resources') self.add_matching_files(self.jhbuild_source_dir, DEP_LIBRARY_SOURCE_FILES, 'Contents/Resources/doc') gtkrcfile = join(self.tempdir, "gtkrc") f = open(gtkrcfile, "w") self.rewrite_modules_file('etc/gtk-2.0/gdk-pixbuf.loaders') self.rewrite_modules_file('etc/gtk-2.0/gtk.immodules') self.rewrite_modules_file('etc/pango/pango.modules') f.write('gtk-theme-name = "Quartz"') f.close() self.add_file(gtkrcfile, 'Contents/Resources/etc/gtk-2.0') def add_external_modules(self): externaldir = 'Contents/Resources/external' self.add_external_module('cairo', externaldir) self.add_external_module('glib', externaldir) self.add_external_module('gio', externaldir) self.add_external_module('gobject', externaldir) self.add_external_module('atk', externaldir) self.add_external_module('pango', externaldir) self.add_external_module('pangocairo', externaldir) self.add_external_module('gtk', externaldir) self.add_external_module('numpy', externaldir) self.add_external_module('matplotlib', externaldir) # More matlab stuff self.add_external_module('mpl_toolkits', externaldir) # Some external deps installed with matplotlib self.add_external_module('dateutil', externaldir) self.add_external_module('pytz', externaldir) # matlab-like toplevel module installed with matplotlib self.add_external_module('pylab', externaldir) def build_manifest(self, dir): absdir = join(self.treedir, dir) for f in os.listdir(absdir): absf = join(absdir, f) relative = join(dir, f) if os.path.isdir(absf): self.build_manifest(relative) else: self.manifest.append(relative) def write_app(self, output): shutil.rmtree(output) shutil.move(self.treedir, output) def write_dmg(self, output): # pkg-dmg expects a folder corresponding to the top of the image, so # we need to move our Reinteract.app folder down a level sourcefolder = join(self.tempdir, "Reinteract-tmp") os.makedirs(sourcefolder) shutil.move(self.treedir, join(sourcefolder, "Reinteract.app")) command = ['pkg-dmg'] command.extend(('--source', sourcefolder)) command.extend(('--target', output)) # This exact Volume Name is important, since the .DS_Store file contains # a reference to /Volumes/Reinteract/.background/reinteract-background.png # I don't know if a relative path is possible. command.extend(('--volname', 'Reinteract')) command.extend(('--mkdir', '.background')) command.extend(('--copy', join(self.topdir, 'tools/build_bundle/reinteract-dmg-background.png') + ':' + ".background/reinteract-background.png")) command.extend(('--copy', join(self.topdir, 'tools/build_bundle/reinteract.dsstore') + ':' + ".DS_Store")) command.extend(('--symlink', '/Applications:Applications')) check_call(command) def build(self): version = self.get_version() output = self.output % { 'version' : version } _logger.info("Will write output to %s", output) self.add_files_from_am('', 'Contents/Resources') # This is a XDG icon-specification organized directory with a SVG in it, not useful shutil.rmtree(join(self.treedir, 'Contents/Resources/icons')) # Desktop files for the Linux desktop shutil.rmtree(join(self.treedir, 'Contents/Resources/applications')) self.add_dep_library_files() self.add_external_modules() self.add_file('data/Info.plist', 'Contents') self.add_file('data/Reinteract.icns', 'Contents/Resources') self.add_files_from_directory('data/MainMenu.nib', 'Contents/Resources/MainMenu.nib') shutil.copy(join(self.topdir, 'ReinteractWrapper'), join(self.tempdir, 'Reinteract')) self.add_file(join(self.tempdir, 'Reinteract'), 'Contents/MacOS') self.compile_python() self.build_manifest('') manifestfile = output + ".manifest" f = open(manifestfile, "w") for x in sorted(self.manifest): print >>f, x f.close() if self.output_type == "app": self.write_app(output) else: self.write_dmg(output) ############################################################ parser = OptionParser() parser.add_option("-o", "--output", help="Filename of output to create") parser.add_option("-d", "--debug", action="store_true", help="Enable debugging messages") parser.add_option("-v", "--verbose", action="store_true", help="Enable verbose messages") parser.add_option("", "--add-arch", action="append", help="Specify a path to an alternate architecture jhbuild install tree") parser.add_option("", "--dmg", action="store_true", help="Create a .dmg file (default)") parser.add_option("", "--app", action="store_true", help="Create a .app directory") options, args = parser.parse_args() if args: parser.print_usage(sys.stderr) sys.exit(1) if options.debug: logging.basicConfig(level=logging.DEBUG) elif options.verbose: logging.basicConfig(level=logging.INFO) if options.dmg and options.app: print >>sys.stderr, "Only one of --dmg and --app can be specified" sys.exit(1) output_type = "app" if options.app else "dmg" _logger = logging.getLogger("build_bundle") output = options.output if output == None: if output_type == "app": output = join(os.getcwd(), "Reinteract.app") else: output = join(os.getcwd(), "Reinteract-%(version)s.dmg") install_dirs = [os.environ['JHBUILD_PREFIX']] if options.add_arch: install_dirs.extend(options.add_arch) arches = {} for install_dir in install_dirs: m = re.match('.*/(devel|release)-([^/]*)/.*', install_dir) if not m: print >>sys.stderr, "Can't extract architecture from --add-arch option" sys.exit(1) arches[m.group(2)] = os.path.normpath(install_dir) builder = BundleBuilder(output=output, topdir=topdir, output_type=output_type, arches=arches) try: builder.build() finally: builder.cleanup() reinteract-0.5.0/tools/build_bundle/reinteract.dsstore0000664000076400007640000003600411070567375020162 00000000000000Bud1   ob PctB  @ @ @ @.BKGDblob PctB.ICVObool.Ilocblob!.fwi0blobicnv.fwswlong.fwvhshor.icgoblob.icvoblob icv4`nonebotmd.icvtshor.pictblob ReinteractAH+reinteract-background.pngB=  .backgroundz>z}0Reinteract:.background:reinteract-background.png4reinteract-background.png Reinteract&/.background/reinteract-background.png/Volumes/Reinteractxx Macintosh HDn#0Disk Image:.background:reinteract-background.png4reinteract-background.png Disk Image&/.background/reinteract-background.png/Volumes/Disk Image\\ Macintosh HDn#0Disk Image:.background:reinteract-background.png4reinteract-background.png Disk Image&/.background/reinteract-background.png/Volumes/Disk Image\\ Macintosh HD= 0: for ff in glob.iglob(absf): relative = ff[len(sourcedir) + 1:] if os.path.isdir(ff): self.add_files_from_directory(ff, os.path.join(directory, relative), **attributes) else: destdir = os.path.join(directory, os.path.dirname(relative)) self.add_file(ff, destdir, **attributes) elif os.path.isdir(absf): self.add_files_from_directory(absf, os.path.join(directory, f), **attributes) else: destdir = os.path.join(directory, os.path.dirname(f)) self.add_file(absf, destdir, **attributes) def add_external_module(self, module_name, directory, **attributes): """ Add files from a Python module in the current Python path into the temporary tree If the python module is a package, all files in the package directory are added; as well as Python files, byte-code compiled python files, and shared libraries, this might include data files, examples, and so forth. @param module_name: name of the module to import @param directory: directory to copy module into (relative to treedir) @param attributes: attributes passed to add_file() for each file """ mod = __import__(module_name) f = mod.__file__ if f.endswith('__init__.pyc') or f.endswith('__init__.pyo') or f.endswith('__init__.py'): dir = os.path.dirname(f) self.add_files_from_directory(dir, os.path.join(directory, os.path.basename(dir)), **attributes) else: if f.endswith('.pyc') or f.endswith('.pyo'): # Don't worry about getting the compiled files, we'll recompile anyways f = f[:-3] + "py" self.add_file(f, directory, **attributes) def add_files_from_am(self, relative, directory, **attributes): """ Add files listed in a Makefile.am into the temporary tree The files that are added are files that are listed as _DATA or _PYTHON. Recursion is done via SUBDIRS. automake conditionals are ignored. @param relative: path relative to the Reinteract source topdir of the directory where the Makefile.am lives @param directory: directory to copy files into (relative to tempory tree) @param attributes: attributes passed to add_file() for each file """ am_file = os.path.join(self.topdir, relative, 'Makefile.am') am_parser = AMParser(am_file, { 'bindir' : 'bin', 'docdir' : 'doc', 'examplesdir' : 'examples', 'pkgdatadir' : '.', 'datadir' : '.', 'pythondir' : 'python', 'REINTERACT_PACKAGE_DIR' : 'python/reinteract', # Some config variables irrelevant for our purposes 'PYTHON_INCLUDES' : '', 'PYTHON_LIBS' : '', 'WRAPPER_CFLAGS' : '' }) if relative == '': self.main_am = am_parser for k, v in am_parser.iteritems(): if k.endswith("_DATA"): base = k[:-5] dir = am_parser[base + 'dir'] for x in v.split(): self.add_file(os.path.join(relative, x), os.path.join(directory, dir), **attributes) elif k.endswith("_PYTHON"): base = k[:-7] dir = am_parser[base + 'dir'] for x in v.split(): self.add_file(os.path.join(relative, x), os.path.join(directory, dir), **attributes) if 'SUBDIRS' in am_parser: for subdir in am_parser['SUBDIRS'].split(): if subdir == '.': continue self.add_files_from_am(os.path.join(relative, subdir), directory, **attributes) def compile_python(self): """ Byte-compile all Python files in the tree to .pyc and .pyo """ # I'm not really sure that there is a point in having the .pyc files distributed # but it matches what distutils and Fedora RPM packaging do. check_call(['python', os.path.join(self.topdir, 'tools', 'compiledir.py'), self.treedir]) check_call(['python', "-O", os.path.join(self.topdir, 'tools', 'compiledir.py'), self.treedir]) def get_file_attributes(self, relative): """ Get the attributes dictionary for a file @param relative: location of the file in the temporary tree """ # .pyc/.pyo are added when we byte-compile the .py files, so they # may not be in file_attributes[], so look for the base .py instead # to figure out the right feature if relative.endswith(".pyc") or relative.endswith(".pyo"): relative = relative[:-3] + "py" # Handle byte compiled .pyw, though they don't seem to be # generated in practice if not relative in self.file_attributes: relative += "w" return self.file_attributes[relative] def get_version(self): """ Get the Reinteract version from configure.ac """ ac_file = os.path.join(self.topdir, 'configure.ac') f = open(ac_file, "r") contents = f.read() f.close() m = re.search(r'^\s*AC_INIT\s*\(\s*[A-Za-z0-9_.-]+\s*,\s*([0-9.]+)\s*\)\s*$', contents, re.MULTILINE) assert m return m.group(1) reinteract-0.5.0/tools/common/__init__.py0000664000076400007640000000000011070567375015351 00000000000000reinteract-0.5.0/tools/common/am_parser.py0000664000076400007640000000326611072036060015564 00000000000000# Copyright 2008 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import logging import re _logger = logging.getLogger("AMParser") # Simple class to suck in a AM file and get variables from it with substitution class AMParser(object): # We ignore possibility of \\\n - a literal backslash at the end of a line VARIABLE_RE = re.compile( r'^([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*=[ \t]*((?:.*\\\n)*.*)', re.MULTILINE); REFERENCE_RE = re.compile(r'\$\(([a-zA-Z_][a-zA-Z0-9_]*)\)') def __init__(self, filename, overrides={}): _logger.debug('Scanning %s', filename) f = open(filename, "r") contents = f.read() f.close() self.d = {} for m in AMParser.VARIABLE_RE.finditer(contents): name = m.group(1) value = m.group(2).replace('\\\n', '') # Canonicalize whitespace for clean debugg output, would break # quoted strings but we don't have any value = re.sub(r'\s+', ' ', value.strip()) self.d[name] = value # _logger.debug(' %s = %s', name, value) self.d.update(overrides) def __getitem__(self, key): return AMParser.REFERENCE_RE.sub(lambda m: self[m.group(1)], self.d[key]) def __iter__(self): return self.d.iterkeys() def __contains__(self, item): return item in self.d def iterkeys(self): return self.d.iterkeys() def iteritems(self): return ((x, self[x]) for x in self.d.iterkeys()) reinteract-0.5.0/tools/common/utils.py0000664000076400007640000000107711072036322014752 00000000000000# Copyright 2008 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import logging import subprocess # Intentionally don't use "utils" here to get meaningful messages _logger = logging.getLogger("builder") def check_call(args): """Log the command then call subprocess.check_call()""" _logger.info("%s", subprocess.list2cmdline(args)) subprocess.check_call(args) reinteract-0.5.0/configure0000775000076400007640000055232111162516444012532 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.63 for reinteract 0.5.0. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell bug-autoconf@gnu.org about your system, echo including any error possibly output before this message. echo This can help us improve future autoconf versions. echo Configuration will now proceed without shell functions. } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='reinteract' PACKAGE_TARNAME='reinteract' PACKAGE_VERSION='0.5.0' PACKAGE_STRING='reinteract 0.5.0' PACKAGE_BUGREPORT='' ac_subst_vars='LTLIBOBJS LIBOBJS REINTERACT_PACKAGE_DIR PLATFORM_OSX_FALSE PLATFORM_OSX_TRUE PYTHON_LIBS CPP PYTHON_INCLUDES WRAPPER_LIBS WRAPPER_CFLAGS PKG_CONFIG host_os host_vendor host_cpu host build_os build_vendor build_cpu build USE_PYTHON_THUNKS_FALSE USE_PYTHON_THUNKS_TRUE APPDIR INSTALL_APP_FALSE INSTALL_APP_TRUE am__fastdepOBJC_FALSE am__fastdepOBJC_TRUE OBJCDEPMODE ac_ct_OBJC OBJCFLAGS OBJC am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC pkgpyexecdir pyexecdir pkgpythondir pythondir PYTHON_PLATFORM PYTHON_EXEC_PREFIX PYTHON_PREFIX PYTHON_VERSION PYTHON MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_maintainer_mode enable_dependency_tracking with_appdir enable_python_thunks ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS OBJC OBJCFLAGS PKG_CONFIG WRAPPER_CFLAGS WRAPPER_LIBS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { $as_echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { $as_echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 { (exit 1); exit 1; }; } ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { $as_echo "$as_me: error: working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures reinteract 0.5.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/reinteract] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of reinteract 0.5.0:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-python-thunks On OS X, lazily locate Python at run-time (default is no) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-appdir=APPDIR On OS X, install Reinteract.app into APPDIR Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory OBJC Objective C compiler command OBJCFLAGS Objective C compiler flags PKG_CONFIG path to pkg-config utility WRAPPER_CFLAGS C compiler flags for WRAPPER, overriding pkg-config WRAPPER_LIBS linker flags for WRAPPER, overriding pkg-config CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF reinteract configure 0.5.0 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by reinteract $as_me 0.5.0, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 $as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in config "$srcdir"/config; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&5 $as_echo "$as_me: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.10' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 $as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 $as_echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi { $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:$LINENO: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 $as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='reinteract' VERSION='0.5.0' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' { $as_echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE if test -n "$PYTHON"; then # If the user set $PYTHON, use it and don't search something else. { $as_echo "$as_me:$LINENO: checking whether $PYTHON version >= 2.4" >&5 $as_echo_n "checking whether $PYTHON version >= 2.4... " >&6; } prog="import sys, string # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. minver = map(int, string.split('2.4', '.')) + [0, 0, 0] minverhex = 0 for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[i] sys.exit(sys.hexversion < minverhex)" if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5 ($PYTHON -c "$prog") >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else { { $as_echo "$as_me:$LINENO: error: too old" >&5 $as_echo "$as_me: error: too old" >&2;} { (exit 1); exit 1; }; } fi am_display_PYTHON=$PYTHON else # Otherwise, try each interpreter until we find one that satisfies # VERSION. { $as_echo "$as_me:$LINENO: checking for a Python interpreter with version >= 2.4" >&5 $as_echo_n "checking for a Python interpreter with version >= 2.4... " >&6; } if test "${am_cv_pathless_PYTHON+set}" = set; then $as_echo_n "(cached) " >&6 else for am_cv_pathless_PYTHON in python python2 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 none; do test "$am_cv_pathless_PYTHON" = none && break prog="import sys, string # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. minver = map(int, string.split('2.4', '.')) + [0, 0, 0] minverhex = 0 for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[i] sys.exit(sys.hexversion < minverhex)" if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5 ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then break fi done fi { $as_echo "$as_me:$LINENO: result: $am_cv_pathless_PYTHON" >&5 $as_echo "$am_cv_pathless_PYTHON" >&6; } # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. if test "$am_cv_pathless_PYTHON" = none; then PYTHON=: else # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args. set dummy $am_cv_pathless_PYTHON; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PYTHON+set}" = set; then $as_echo_n "(cached) " >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:$LINENO: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi am_display_PYTHON=$am_cv_pathless_PYTHON fi if test "$PYTHON" = :; then { { $as_echo "$as_me:$LINENO: error: no suitable Python interpreter found" >&5 $as_echo "$as_me: error: no suitable Python interpreter found" >&2;} { (exit 1); exit 1; }; } else { $as_echo "$as_me:$LINENO: checking for $am_display_PYTHON version" >&5 $as_echo_n "checking for $am_display_PYTHON version... " >&6; } if test "${am_cv_python_version+set}" = set; then $as_echo_n "(cached) " >&6 else am_cv_python_version=`$PYTHON -c "import sys; print sys.version[:3]"` fi { $as_echo "$as_me:$LINENO: result: $am_cv_python_version" >&5 $as_echo "$am_cv_python_version" >&6; } PYTHON_VERSION=$am_cv_python_version PYTHON_PREFIX='${prefix}' PYTHON_EXEC_PREFIX='${exec_prefix}' { $as_echo "$as_me:$LINENO: checking for $am_display_PYTHON platform" >&5 $as_echo_n "checking for $am_display_PYTHON platform... " >&6; } if test "${am_cv_python_platform+set}" = set; then $as_echo_n "(cached) " >&6 else am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"` fi { $as_echo "$as_me:$LINENO: result: $am_cv_python_platform" >&5 $as_echo "$am_cv_python_platform" >&6; } PYTHON_PLATFORM=$am_cv_python_platform { $as_echo "$as_me:$LINENO: checking for $am_display_PYTHON script directory" >&5 $as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } if test "${am_cv_python_pythondir+set}" = set; then $as_echo_n "(cached) " >&6 else am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null || echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` fi { $as_echo "$as_me:$LINENO: result: $am_cv_python_pythondir" >&5 $as_echo "$am_cv_python_pythondir" >&6; } pythondir=$am_cv_python_pythondir pkgpythondir=\${pythondir}/$PACKAGE { $as_echo "$as_me:$LINENO: checking for $am_display_PYTHON extension module directory" >&5 $as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } if test "${am_cv_python_pyexecdir+set}" = set; then $as_echo_n "(cached) " >&6 else am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null || echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"` fi { $as_echo "$as_me:$LINENO: result: $am_cv_python_pyexecdir" >&5 $as_echo "$am_cv_python_pyexecdir" >&6; } pyexecdir=$am_cv_python_pyexecdir pkgpyexecdir=\${pyexecdir}/$PACKAGE fi ac_config_headers="$ac_config_headers config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 $as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { $as_echo "$as_me:$LINENO: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } if test -z "$ac_file"; then $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 $as_echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi fi fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } { $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } { $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest$ac_cv_exeext { $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi { $as_echo "$as_me:$LINENO: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=m ac_cpp='$OBJCPP $CPPFLAGS' ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_objc_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in gcc objcc objc cc CC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OBJC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$OBJC"; then ac_cv_prog_OBJC="$OBJC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJC=$ac_cv_prog_OBJC if test -n "$OBJC"; then { $as_echo "$as_me:$LINENO: result: $OBJC" >&5 $as_echo "$OBJC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$OBJC" && break done fi if test -z "$OBJC"; then ac_ct_OBJC=$OBJC for ac_prog in gcc objcc objc cc CC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OBJC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJC"; then ac_cv_prog_ac_ct_OBJC="$ac_ct_OBJC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJC=$ac_cv_prog_ac_ct_OBJC if test -n "$ac_ct_OBJC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_OBJC" >&5 $as_echo "$ac_ct_OBJC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_OBJC" && break done if test "x$ac_ct_OBJC" = x; then OBJC="gcc" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJC=$ac_ct_OBJC fi fi # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for Objective C compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { $as_echo "$as_me:$LINENO: checking whether we are using the GNU Objective C compiler" >&5 $as_echo_n "checking whether we are using the GNU Objective C compiler... " >&6; } if test "${ac_cv_objc_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_objc_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_objc_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $ac_cv_objc_compiler_gnu" >&5 $as_echo "$ac_cv_objc_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GOBJC=yes else GOBJC= fi ac_test_OBJCFLAGS=${OBJCFLAGS+set} ac_save_OBJCFLAGS=$OBJCFLAGS { $as_echo "$as_me:$LINENO: checking whether $OBJC accepts -g" >&5 $as_echo_n "checking whether $OBJC accepts -g... " >&6; } if test "${ac_cv_prog_objc_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_objc_werror_flag=$ac_objc_werror_flag ac_objc_werror_flag=yes ac_cv_prog_objc_g=no OBJCFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_objc_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_objc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 OBJCFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_objc_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_objc_werror_flag=$ac_save_objc_werror_flag OBJCFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_objc_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_objc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_objc_werror_flag=$ac_save_objc_werror_flag fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_objc_g" >&5 $as_echo "$ac_cv_prog_objc_g" >&6; } if test "$ac_test_OBJCFLAGS" = set; then OBJCFLAGS=$ac_save_OBJCFLAGS elif test $ac_cv_prog_objc_g = yes; then if test "$GOBJC" = yes; then OBJCFLAGS="-g -O2" else OBJCFLAGS="-g" fi else if test "$GOBJC" = yes; then OBJCFLAGS="-O2" else OBJCFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$OBJC" am_compiler_list='gcc3 gcc' { $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_OBJC_dependencies_compiler_type+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_OBJC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_OBJC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_OBJC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:$LINENO: result: $am_cv_OBJC_dependencies_compiler_type" >&5 $as_echo "$am_cv_OBJC_dependencies_compiler_type" >&6; } OBJCDEPMODE=depmode=$am_cv_OBJC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_OBJC_dependencies_compiler_type" = gcc3; then am__fastdepOBJC_TRUE= am__fastdepOBJC_FALSE='#' else am__fastdepOBJC_TRUE='#' am__fastdepOBJC_FALSE= fi if test "x$GCC" = "xyes"; then case " $CFLAGS " in *[\ \ ]-Wall[\ \ ]*) ;; *) CFLAGS="$CFLAGS -Wall" ;; esac case " $OBJCFLAGS " in *[\ \ ]-Wall[\ \ ]*) ;; *) OBJCFLAGS="$OBJCFLAGS -Wall" ;; esac fi APPDIR= # Check whether --with-appdir was given. if test "${with_appdir+set}" = set; then withval=$with_appdir; if test x$withval = xyes ; then { { $as_echo "$as_me:$LINENO: error: Directory must be specified as argument to --with-appdir" >&5 $as_echo "$as_me: error: Directory must be specified as argument to --with-appdir" >&2;} { (exit 1); exit 1; }; } elif test x$withval = xno ; then : else APPDIR=$withval fi fi if test "x$APPDIR" != x; then INSTALL_APP_TRUE= INSTALL_APP_FALSE='#' else INSTALL_APP_TRUE='#' INSTALL_APP_FALSE= fi use_python_thunks=false # Check whether --enable-python-thunks was given. if test "${enable_python_thunks+set}" = set; then enableval=$enable_python_thunks; if test "x$enableval" != xno ; then use_python_thunks=true ; fi fi if $use_python_thunks ; then cat >>confdefs.h <<\_ACEOF #define USE_PYTHON_THUNKS 1 _ACEOF fi if $use_python_thunks; then USE_PYTHON_THUNKS_TRUE= USE_PYTHON_THUNKS_FALSE='#' else USE_PYTHON_THUNKS_TRUE='#' USE_PYTHON_THUNKS_FALSE= fi # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 $as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { $as_echo "$as_me:$LINENO: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if test "${ac_cv_build+set}" = set; then $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 $as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 $as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 $as_echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:$LINENO: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if test "${ac_cv_host+set}" = set; then $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 $as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 $as_echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac platform_osx=false case $host in *-*-darwin*) # This will break if someone wants to build the X11 version of reinteract # on OS X. They can just use bin/uninst.py, or they can figure out how # to fix this :-) platform_osx=true if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PKG_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:$LINENO: checking for WRAPPER" >&5 $as_echo_n "checking for WRAPPER... " >&6; } if test -n "$WRAPPER_CFLAGS"; then pkg_cv_WRAPPER_CFLAGS="$WRAPPER_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"pygobject-2.0 >= 2.12 gtk+-2.0 >= 2.12\"") >&5 ($PKG_CONFIG --exists --print-errors "pygobject-2.0 >= 2.12 gtk+-2.0 >= 2.12") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then pkg_cv_WRAPPER_CFLAGS=`$PKG_CONFIG --cflags "pygobject-2.0 >= 2.12 gtk+-2.0 >= 2.12" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$WRAPPER_LIBS"; then pkg_cv_WRAPPER_LIBS="$WRAPPER_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"pygobject-2.0 >= 2.12 gtk+-2.0 >= 2.12\"") >&5 ($PKG_CONFIG --exists --print-errors "pygobject-2.0 >= 2.12 gtk+-2.0 >= 2.12") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then pkg_cv_WRAPPER_LIBS=`$PKG_CONFIG --libs "pygobject-2.0 >= 2.12 gtk+-2.0 >= 2.12" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then WRAPPER_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "pygobject-2.0 >= 2.12 gtk+-2.0 >= 2.12" 2>&1` else WRAPPER_PKG_ERRORS=`$PKG_CONFIG --print-errors "pygobject-2.0 >= 2.12 gtk+-2.0 >= 2.12" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$WRAPPER_PKG_ERRORS" >&5 { { $as_echo "$as_me:$LINENO: error: Package requirements (pygobject-2.0 >= 2.12 gtk+-2.0 >= 2.12) were not met: $WRAPPER_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables WRAPPER_CFLAGS and WRAPPER_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&5 $as_echo "$as_me: error: Package requirements (pygobject-2.0 >= 2.12 gtk+-2.0 >= 2.12) were not met: $WRAPPER_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables WRAPPER_CFLAGS and WRAPPER_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&2;} { (exit 1); exit 1; }; } elif test $pkg_failed = untried; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables WRAPPER_CFLAGS and WRAPPER_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details." >&5 $as_echo "$as_me: error: The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables WRAPPER_CFLAGS and WRAPPER_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } else WRAPPER_CFLAGS=$pkg_cv_WRAPPER_CFLAGS WRAPPER_LIBS=$pkg_cv_WRAPPER_LIBS { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:$LINENO: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 $as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$LINENO: checking for headers required to compile python extensions" >&5 $as_echo_n "checking for headers required to compile python extensions... " >&6; } py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"` py_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"` if test -x "$PYTHON-config"; then PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null` else PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" if test "$py_prefix" != "$py_exec_prefix"; then PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" fi fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then { $as_echo "$as_me:$LINENO: result: found" >&5 $as_echo "found" >&6; } else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { $as_echo "$as_me:$LINENO: result: not found" >&5 $as_echo "not found" >&6; } { { $as_echo "$as_me:$LINENO: error: could not find Python headers" >&5 $as_echo "$as_me: error: could not find Python headers" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_ext CPPFLAGS="$save_CPPFLAGS" if $use_python_thunks ; then : ; else # Need to figure out how to link against Python at compile time { $as_echo "$as_me:$LINENO: checking how to link against Python" >&5 $as_echo_n "checking how to link against Python... " >&6; } python_framework_prefix=`$PYTHON -c "import sys; import distutils.sysconfig; sys.stdout.write(distutils.sysconfig.get_config_var('PYTHONFRAMEWORKPREFIX'))"` if test x$python_framework_prefix = x ; then python_libdir=`$PYTHON -c "import sys; import distutils.sysconfig; sys.stdout.write(distutils.sysconfig.get_config_var('LIBDIR'))"` PYTHON_LIBS="-L$python_libdir -lpython$PYTHON_VERSION" else PYTHON_LIBS="-F$python_framework_prefix -framework Python" fi { $as_echo "$as_me:$LINENO: result: $PYTHON_LIBS" >&5 $as_echo "$PYTHON_LIBS" >&6; } # Test to see if what we found actually works save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PYTHON_INCLUDES" save_LIBS="$LIBS" LIBS="$LIBS $PYTHON_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { Py_Initialize(); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: Linking against Python didn't work; see config.log for details" >&5 $as_echo "$as_me: error: Linking against Python didn't work; see config.log for details" >&2;} { (exit 1); exit 1; }; } fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$save_CFLAGS" LIBS="$save_LIBS" fi ;; esac if $platform_osx; then PLATFORM_OSX_TRUE= PLATFORM_OSX_FALSE='#' else PLATFORM_OSX_TRUE='#' PLATFORM_OSX_FALSE= fi REINTERACT_PACKAGE_DIR=${pythondir}/$PACKAGE_NAME ac_config_files="$ac_config_files Makefile dialogs/Makefile data/Makefile bin/reinteract" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepOBJC_TRUE}" && test -z "${am__fastdepOBJC_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepOBJC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"am__fastdepOBJC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${INSTALL_APP_TRUE}" && test -z "${INSTALL_APP_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"INSTALL_APP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"INSTALL_APP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${USE_PYTHON_THUNKS_TRUE}" && test -z "${USE_PYTHON_THUNKS_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"USE_PYTHON_THUNKS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"USE_PYTHON_THUNKS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${PLATFORM_OSX_TRUE}" && test -z "${PLATFORM_OSX_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"PLATFORM_OSX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"PLATFORM_OSX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by reinteract $as_me 0.5.0, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ reinteract config.status 0.5.0 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2008 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { $as_echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { $as_echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "dialogs/Makefile") CONFIG_FILES="$CONFIG_FILES dialogs/Makefile" ;; "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; "bin/reinteract") CONFIG_FILES="$CONFIG_FILES bin/reinteract" ;; *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { $as_echo "$as_me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=' ' ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 $as_echo "$as_me: error: could not setup config files machinery" >&2;} { (exit 1); exit 1; }; } _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 $as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 $as_echo "$as_me: error: could not setup config headers machinery" >&2;} { (exit 1); exit 1; }; } fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac ac_file_inputs="$ac_file_inputs '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 $as_echo "$as_me: error: could not create -" >&2;} { (exit 1); exit 1; }; } fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 $as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi reinteract-0.5.0/aclocal.m40000664000076400007640000013215311162516442012456 00000000000000# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(AC_AUTOCONF_VERSION, [2.63],, [m4_warning([this file was generated for autoconf 2.63. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # # Similar to PKG_CHECK_MODULES, make sure that the first instance of # this or PKG_CHECK_MODULES is called, or make sure to call # PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_ifval([$2], [$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD ifelse([$4], , [AC_MSG_ERROR(dnl [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT ])], [AC_MSG_RESULT([no]) $4]) elif test $pkg_failed = untried; then ifelse([$4], , [AC_MSG_FAILURE(dnl [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) ifelse([$3], , :, [$3]) fi[]dnl ])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.10.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 13 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.60])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, [ --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer], USE_MAINTAINER_MODE=$enableval, USE_MAINTAINER_MODE=no) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST(MAINT)dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # --------------------------------------------------------------------------- # Adds support for distributing Python modules and packages. To # install modules, copy them to $(pythondir), using the python_PYTHON # automake variable. To install a package with the same name as the # automake package, install to $(pkgpythondir), or use the # pkgpython_PYTHON automake variable. # # The variables $(pyexecdir) and $(pkgpyexecdir) are provided as # locations to install python extension modules (shared libraries). # Another macro is required to find the appropriate flags to compile # extension modules. # # If your package is configured with a different prefix to python, # users will have to add the install directory to the PYTHONPATH # environment variable, or create a .pth file (see the python # documentation for details). # # If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will # cause an error if the version of python installed on the system # doesn't meet the requirement. MINIMUM-VERSION should consist of # numbers and dots only. AC_DEFUN([AM_PATH_PYTHON], [ dnl Find a Python interpreter. Python versions prior to 1.5 are not dnl supported because the default installation locations changed from dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages dnl in 1.5. m4_define_default([_AM_PYTHON_INTERPRETER_LIST], [python python2 python2.5 python2.4 python2.3 python2.2 dnl python2.1 python2.0 python1.6 python1.5]) m4_if([$1],[],[ dnl No version check is needed. # Find any Python interpreter. if test -z "$PYTHON"; then AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) fi am_display_PYTHON=python ], [ dnl A version check is needed. if test -n "$PYTHON"; then # If the user set $PYTHON, use it and don't search something else. AC_MSG_CHECKING([whether $PYTHON version >= $1]) AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], [AC_MSG_RESULT(yes)], [AC_MSG_ERROR(too old)]) am_display_PYTHON=$PYTHON else # Otherwise, try each interpreter until we find one that satisfies # VERSION. AC_CACHE_CHECK([for a Python interpreter with version >= $1], [am_cv_pathless_PYTHON],[ for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do test "$am_cv_pathless_PYTHON" = none && break AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) done]) # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. if test "$am_cv_pathless_PYTHON" = none; then PYTHON=: else AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) fi am_display_PYTHON=$am_cv_pathless_PYTHON fi ]) if test "$PYTHON" = :; then dnl Run any user-specified action, or abort. m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) else dnl Query Python for its version number. Getting [:3] seems to be dnl the best way to do this; it's what "site.py" does in the standard dnl library. AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], [am_cv_python_version=`$PYTHON -c "import sys; print sys.version[[:3]]"`]) AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) dnl Use the values of $prefix and $exec_prefix for the corresponding dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made dnl distinct variables so they can be overridden if need be. However, dnl general consensus is that you shouldn't need this ability. AC_SUBST([PYTHON_PREFIX], ['${prefix}']) AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) dnl At times (like when building shared libraries) you may want dnl to know which OS platform Python thinks this is. AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], [am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`]) AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) dnl Set up 4 directories: dnl pythondir -- where to install python scripts. This is the dnl site-packages directory, not the python standard library dnl directory like in previous automake betas. This behavior dnl is more consistent with lispdir.m4 for example. dnl Query distutils for this directory. distutils does not exist in dnl Python 1.5, so we fall back to the hardcoded directory if it dnl doesn't work. AC_CACHE_CHECK([for $am_display_PYTHON script directory], [am_cv_python_pythondir], [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null || echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`]) AC_SUBST([pythondir], [$am_cv_python_pythondir]) dnl pkgpythondir -- $PACKAGE directory under pythondir. Was dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is dnl more consistent with the rest of automake. AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) dnl pyexecdir -- directory for installing python extension modules dnl (shared libraries) dnl Query distutils for this directory. distutils does not exist in dnl Python 1.5, so we fall back to the hardcoded directory if it dnl doesn't work. AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], [am_cv_python_pyexecdir], [am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null || echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`]) AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) dnl Run any user-specified action. $2 fi ]) # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) # --------------------------------------------------------------------------- # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. # Run ACTION-IF-FALSE otherwise. # This test uses sys.hexversion instead of the string equivalent (first # word of sys.version), in order to cope with versions such as 2.2c1. # hexversion has been introduced in Python 1.5.2; it's probably not # worth to support older versions (1.5.1 was released on October 31, 1998). AC_DEFUN([AM_PYTHON_CHECK_VERSION], [prog="import sys, string # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. minver = map(int, string.split('$2', '.')) + [[0, 0, 0]] minverhex = 0 for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]] sys.exit(sys.hexversion < minverhex)" AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4]) reinteract-0.5.0/config.h.in0000664000076400007640000000116711162516457012647 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to locate Python lazily at runtime */ #undef USE_PYTHON_THUNKS /* Version number of package */ #undef VERSION reinteract-0.5.0/config/0000777000076400007640000000000011162516457012146 500000000000000reinteract-0.5.0/config/config.sub0000755000076400007640000010115310751614361014042 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2008-01-16' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: reinteract-0.5.0/config/install-sh0000755000076400007640000003246410751614361014073 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2006-12-25.00 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: reinteract-0.5.0/config/config.guess0000755000076400007640000012751610751614361014412 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2008-01-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: reinteract-0.5.0/config/py-compile0000755000076400007640000001005610751614361014064 00000000000000#!/bin/sh # py-compile - Compile a Python program scriptversion=2005-05-14.22 # Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . if [ -z "$PYTHON" ]; then PYTHON=python fi basedir= destdir= files= while test $# -ne 0; do case "$1" in --basedir) basedir=$2 if test -z "$basedir"; then echo "$0: Missing argument to --basedir." 1>&2 exit 1 fi shift ;; --destdir) destdir=$2 if test -z "$destdir"; then echo "$0: Missing argument to --destdir." 1>&2 exit 1 fi shift ;; -h|--h*) cat <<\EOF Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..." Byte compile some python scripts FILES. Use --destdir to specify any leading directory path to the FILES that you don't want to include in the byte compiled file. Specify --basedir for any additional path information you do want to be shown in the byte compiled file. Example: py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py Report bugs to . EOF exit $? ;; -v|--v*) echo "py-compile $scriptversion" exit $? ;; *) files="$files $1" ;; esac shift done if test -z "$files"; then echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 exit 1 fi # if basedir was given, then it should be prepended to filenames before # byte compilation. if [ -z "$basedir" ]; then pathtrans="path = file" else pathtrans="path = os.path.join('$basedir', file)" fi # if destdir was given, then it needs to be prepended to the filename to # byte compile but not go into the compiled file. if [ -z "$destdir" ]; then filetrans="filepath = path" else filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)" fi $PYTHON -c " import sys, os, string, py_compile files = '''$files''' print 'Byte-compiling python modules...' for file in string.split(files): $pathtrans $filetrans if not os.path.exists(filepath) or not (len(filepath) >= 3 and filepath[-3:] == '.py'): continue print file, sys.stdout.flush() py_compile.compile(filepath, filepath + 'c', path) print" || exit $? # this will fail for python < 1.5, but that doesn't matter ... $PYTHON -O -c " import sys, os, string, py_compile files = '''$files''' print 'Byte-compiling python modules (optimized versions) ...' for file in string.split(files): $pathtrans $filetrans if not os.path.exists(filepath) or not (len(filepath) >= 3 and filepath[-3:] == '.py'): continue print file, sys.stdout.flush() py_compile.compile(filepath, filepath + 'o', path) print" 2>/dev/null || : # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: reinteract-0.5.0/config/depcomp0000755000076400007640000004271310751614361013442 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2007-03-29.01 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software # Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: reinteract-0.5.0/config/missing0000755000076400007640000002557710751614361013475 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2006-05-10.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case $1 in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $1 in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: reinteract-0.5.0/Makefile.in0000664000076400007640000014332211162516443012664 00000000000000# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = $(am__EXEEXT_1) @PLATFORM_OSX_TRUE@am__append_1 = ReinteractWrapper @USE_PYTHON_THUNKS_TRUE@am__append_2 = \ @USE_PYTHON_THUNKS_TRUE@ src/reinteract_wrapper_osx/ThunkPython.c \ @USE_PYTHON_THUNKS_TRUE@ src/reinteract_wrapper_osx/ThunkPython.h subdir = . DIST_COMMON = README $(am__configure_deps) $(dist_noinst_SCRIPTS) \ $(reinteractpkg_PYTHON) $(replay_PYTHON) $(replot_PYTHON) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/config.h.in $(top_srcdir)/bin/reinteract.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ config/config.guess config/config.sub config/depcomp \ config/install-sh config/missing config/py-compile ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = bin/reinteract @PLATFORM_OSX_TRUE@am__EXEEXT_1 = ReinteractWrapper$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) am__ReinteractWrapper_SOURCES_DIST = \ src/reinteract_wrapper_osx/main.m \ src/reinteract_wrapper_osx/MenuController.m \ src/reinteract_wrapper_osx/MenuController.h \ src/reinteract_wrapper_osx/pyNativeMainMenu.m \ src/reinteract_wrapper_osx/pyNativeMainMenu.h \ src/reinteract_wrapper_osx/ThunkPython.c \ src/reinteract_wrapper_osx/ThunkPython.h @USE_PYTHON_THUNKS_TRUE@am__objects_1 = ThunkPython.$(OBJEXT) am_ReinteractWrapper_OBJECTS = main.$(OBJEXT) MenuController.$(OBJEXT) \ pyNativeMainMenu.$(OBJEXT) $(am__objects_1) ReinteractWrapper_OBJECTS = $(am_ReinteractWrapper_OBJECTS) ReinteractWrapper_LDADD = $(LDADD) ReinteractWrapper_LINK = $(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) \ $(ReinteractWrapper_LDFLAGS) $(LDFLAGS) -o $@ am__installdirs = "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(reinteractpkgdir)" "$(DESTDIR)$(replaydir)" \ "$(DESTDIR)$(replotdir)" "$(DESTDIR)$(examplesdir)" binSCRIPT_INSTALL = $(INSTALL_SCRIPT) SCRIPTS = $(bin_SCRIPTS) $(dist_noinst_SCRIPTS) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ OBJCCOMPILE = $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) OBJCLD = $(OBJC) OBJCLINK = $(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(ReinteractWrapper_SOURCES) DIST_SOURCES = $(am__ReinteractWrapper_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; reinteractpkgPYTHON_INSTALL = $(INSTALL_DATA) replayPYTHON_INSTALL = $(INSTALL_DATA) replotPYTHON_INSTALL = $(INSTALL_DATA) py_compile = $(top_srcdir)/config/py-compile examplesDATA_INSTALL = $(INSTALL_DATA) DATA = $(examples_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } GZIP_ENV = --best DIST_ARCHIVES = $(distdir).tar.bz2 distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ APPDIR = @APPDIR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EXEEXT = @EXEEXT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJC = @OBJC@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PYTHON = @PYTHON@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ REINTERACT_PACKAGE_DIR = @REINTERACT_PACKAGE_DIR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ WRAPPER_CFLAGS = @WRAPPER_CFLAGS@ WRAPPER_LIBS = @WRAPPER_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_OBJC = @ac_ct_OBJC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIST_END = SUBDIRS = data dialogs bin_SCRIPTS = bin/reinteract dist_noinst_SCRIPTS = \ bin/uninst.py \ bin/Reinteract.pyw reinteractpkgdir = $(REINTERACT_PACKAGE_DIR) reinteractpkg_PYTHON = \ lib/reinteract/__init__.py \ lib/reinteract/about_dialog.py \ lib/reinteract/application.py \ lib/reinteract/application_state.py \ lib/reinteract/base_window.py \ lib/reinteract/base_notebook_window.py \ lib/reinteract/change_range.py \ lib/reinteract/chunks.py \ lib/reinteract/completion_popup.py \ lib/reinteract/config_file.py \ lib/reinteract/custom_result.py \ lib/reinteract/data_format.py \ lib/reinteract/doc_format.py \ lib/reinteract/doc_popup.py \ lib/reinteract/editor.py \ lib/reinteract/editor_window.py \ lib/reinteract/file_list.py \ lib/reinteract/format_escaped.py \ lib/reinteract/global_settings.py \ lib/reinteract/iter_copy_from.py \ lib/reinteract/library_editor.py \ lib/reinteract/main.py \ lib/reinteract/main_menu.py \ lib/reinteract/mini_window.py \ lib/reinteract/new_notebook.py \ lib/reinteract/notebook.py \ lib/reinteract/notebook_info.py \ lib/reinteract/notebook_window.py \ lib/reinteract/open_notebook.py \ lib/reinteract/popup.py \ lib/reinteract/preferences_dialog.py \ lib/reinteract/recorded_object.py \ lib/reinteract/retokenize.py \ lib/reinteract/rewrite.py \ lib/reinteract/sanitize_textview_ipc.py \ lib/reinteract/save_file.py \ lib/reinteract/shell_buffer.py \ lib/reinteract/shell_view.py \ lib/reinteract/statement.py \ lib/reinteract/stdout_capture.py \ lib/reinteract/test_utils.py \ lib/reinteract/thread_executor.py \ lib/reinteract/tokenized_statement.py \ lib/reinteract/undo_stack.py \ lib/reinteract/window_builder.py \ lib/reinteract/worksheet.py \ lib/reinteract/worksheet_editor.py \ $(LIST_END) replaydir = $(pythondir) replay_PYTHON = lib/replay.py replotdir = $(pythondir) replot_PYTHON = lib/replot.py examplesdir = $(pkgdatadir)/examples examples_DATA = \ examples/basics.rws \ examples/imshow.rws \ examples/index.rnb \ examples/play.rws \ examples/plot.rws \ examples/plot2.rws \ $(LIST_END) TOOLS_EXTRA = \ tools/common/__init__.py \ tools/common/am_parser.py \ tools/common/builder.py \ tools/common/utils.py # Input files for the WiX-based Windows installer WIX_FILES = \ tools/build_msi/BrowsePage.wxs \ tools/build_msi/BrowsePage2.wxs \ tools/build_msi/CancelPage.wxs \ tools/build_msi/FatalErrorPage.wxs \ tools/build_msi/FeaturesPage.wxs \ tools/build_msi/ProgressPage.wxs \ tools/build_msi/ReinteractUI.wxs \ tools/build_msi/SuccessPage.wxs \ tools/build_msi/WelcomePage.wxs \ tools/build_msi/Overrides.wxl \ tools/build_msi/reinteractBanner.bmp # Scripts and other files used for Windows installer WIX_EXTRA = \ tools/build_msi/README \ tools/build_msi/build_msi.py \ tools/build_msi/wrapper.c \ tools/compiledir.py # Scripts and other files used for OS X installer BUNDLE_EXTRA = \ tools/build_bundle/README \ tools/build_bundle/build_bundle.py \ tools/build_bundle/build_bundle.sh \ tools/build_bundle/reinteract-dmg-background.png \ tools/build_bundle/reinteract-dmg-background.svg \ tools/build_bundle/reinteract.dsstore BUILD_DEPS_OSX_EXTRA = \ tools/build_deps_osx/Python-2.5.2-framework-arch-only.patch \ tools/build_deps_osx/Python-2.5.2-framework-arch.patch \ tools/build_deps_osx/README \ tools/build_deps_osx/build.sh \ tools/build_deps_osx/gdk-quartz-eventloop-rework-20080905.patch \ tools/build_deps_osx/gdk-window-process-updates-hook.patch \ tools/build_deps_osx/gtk-dont-steal-update-region.patch \ tools/build_deps_osx/i386.cache \ tools/build_deps_osx/jhbuildrc-reinteract \ tools/build_deps_osx/pango-relocate.patch \ tools/build_deps_osx/ppc.cache \ tools/build_deps_osx/pycairo-unknown-surface-types.patch \ tools/build_deps_osx/reinteract-bootstrap.modules \ tools/build_deps_osx/reinteract.modules ReinteractWrapper_SOURCES = src/reinteract_wrapper_osx/main.m \ src/reinteract_wrapper_osx/MenuController.m \ src/reinteract_wrapper_osx/MenuController.h \ src/reinteract_wrapper_osx/pyNativeMainMenu.m \ src/reinteract_wrapper_osx/pyNativeMainMenu.h $(am__append_2) INCLUDES = \ $(PYTHON_INCLUDES) \ $(WRAPPER_CFLAGS) \ -DEXAMPLESDIR=\"$(examplesdir)\" \ -DDIALOGSDIR=\"$(pkgdatadir)/dialogs\" \ -DICONDIR=\"$(pkgdatadir)\" ReinteractWrapper_LDFLAGS = -framework Cocoa $(PYTHON_LIBS) TESTS = tools/run_tests.sh EXTRA_DIST = \ ChangeLog \ autogen.sh \ epydoc.conf \ bin/reinteract.in \ $(examples_DATA) \ README \ $(TOOLS_EXTRA) \ $(WIX_FILES) \ $(WIX_EXTRA) \ $(BUNDLE_EXTRA) \ $(BUILD_DEPS_OSX_EXTRA) \ src/reinteract_wrapper_osx/README \ tools/run_tests.sh \ $(LIST_END) DISTCLEANFILES = \ $(LIST_END) MAINTAINERCLEANFILES = \ aclocal.m4 \ ChangeLog \ config/install-sh \ config/missing \ config/py-compile \ configure \ Makefile.in \ NEWS \ $(LIST_END) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .m .o .obj am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ cd $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 bin/reinteract: $(top_builddir)/config.status $(top_srcdir)/bin/reinteract.in cd $(top_builddir) && $(SHELL) ./config.status $@ clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) ReinteractWrapper$(EXEEXT): $(ReinteractWrapper_OBJECTS) $(ReinteractWrapper_DEPENDENCIES) @rm -f ReinteractWrapper$(EXEEXT) $(ReinteractWrapper_LINK) $(ReinteractWrapper_OBJECTS) $(ReinteractWrapper_LDADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_SCRIPTS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f $$d$$p; then \ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ else :; fi; \ done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; for p in $$list; do \ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MenuController.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ThunkPython.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pyNativeMainMenu.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` ThunkPython.o: src/reinteract_wrapper_osx/ThunkPython.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ThunkPython.o -MD -MP -MF $(DEPDIR)/ThunkPython.Tpo -c -o ThunkPython.o `test -f 'src/reinteract_wrapper_osx/ThunkPython.c' || echo '$(srcdir)/'`src/reinteract_wrapper_osx/ThunkPython.c @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ThunkPython.Tpo $(DEPDIR)/ThunkPython.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/reinteract_wrapper_osx/ThunkPython.c' object='ThunkPython.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ThunkPython.o `test -f 'src/reinteract_wrapper_osx/ThunkPython.c' || echo '$(srcdir)/'`src/reinteract_wrapper_osx/ThunkPython.c ThunkPython.obj: src/reinteract_wrapper_osx/ThunkPython.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ThunkPython.obj -MD -MP -MF $(DEPDIR)/ThunkPython.Tpo -c -o ThunkPython.obj `if test -f 'src/reinteract_wrapper_osx/ThunkPython.c'; then $(CYGPATH_W) 'src/reinteract_wrapper_osx/ThunkPython.c'; else $(CYGPATH_W) '$(srcdir)/src/reinteract_wrapper_osx/ThunkPython.c'; fi` @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ThunkPython.Tpo $(DEPDIR)/ThunkPython.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/reinteract_wrapper_osx/ThunkPython.c' object='ThunkPython.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ThunkPython.obj `if test -f 'src/reinteract_wrapper_osx/ThunkPython.c'; then $(CYGPATH_W) 'src/reinteract_wrapper_osx/ThunkPython.c'; else $(CYGPATH_W) '$(srcdir)/src/reinteract_wrapper_osx/ThunkPython.c'; fi` .m.o: @am__fastdepOBJC_TRUE@ $(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ $< .m.obj: @am__fastdepOBJC_TRUE@ $(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` main.o: src/reinteract_wrapper_osx/main.m @am__fastdepOBJC_TRUE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT main.o -MD -MP -MF $(DEPDIR)/main.Tpo -c -o main.o `test -f 'src/reinteract_wrapper_osx/main.m' || echo '$(srcdir)/'`src/reinteract_wrapper_osx/main.m @am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/main.Tpo $(DEPDIR)/main.Po @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='src/reinteract_wrapper_osx/main.m' object='main.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o main.o `test -f 'src/reinteract_wrapper_osx/main.m' || echo '$(srcdir)/'`src/reinteract_wrapper_osx/main.m main.obj: src/reinteract_wrapper_osx/main.m @am__fastdepOBJC_TRUE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT main.obj -MD -MP -MF $(DEPDIR)/main.Tpo -c -o main.obj `if test -f 'src/reinteract_wrapper_osx/main.m'; then $(CYGPATH_W) 'src/reinteract_wrapper_osx/main.m'; else $(CYGPATH_W) '$(srcdir)/src/reinteract_wrapper_osx/main.m'; fi` @am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/main.Tpo $(DEPDIR)/main.Po @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='src/reinteract_wrapper_osx/main.m' object='main.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o main.obj `if test -f 'src/reinteract_wrapper_osx/main.m'; then $(CYGPATH_W) 'src/reinteract_wrapper_osx/main.m'; else $(CYGPATH_W) '$(srcdir)/src/reinteract_wrapper_osx/main.m'; fi` MenuController.o: src/reinteract_wrapper_osx/MenuController.m @am__fastdepOBJC_TRUE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT MenuController.o -MD -MP -MF $(DEPDIR)/MenuController.Tpo -c -o MenuController.o `test -f 'src/reinteract_wrapper_osx/MenuController.m' || echo '$(srcdir)/'`src/reinteract_wrapper_osx/MenuController.m @am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/MenuController.Tpo $(DEPDIR)/MenuController.Po @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='src/reinteract_wrapper_osx/MenuController.m' object='MenuController.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o MenuController.o `test -f 'src/reinteract_wrapper_osx/MenuController.m' || echo '$(srcdir)/'`src/reinteract_wrapper_osx/MenuController.m MenuController.obj: src/reinteract_wrapper_osx/MenuController.m @am__fastdepOBJC_TRUE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT MenuController.obj -MD -MP -MF $(DEPDIR)/MenuController.Tpo -c -o MenuController.obj `if test -f 'src/reinteract_wrapper_osx/MenuController.m'; then $(CYGPATH_W) 'src/reinteract_wrapper_osx/MenuController.m'; else $(CYGPATH_W) '$(srcdir)/src/reinteract_wrapper_osx/MenuController.m'; fi` @am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/MenuController.Tpo $(DEPDIR)/MenuController.Po @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='src/reinteract_wrapper_osx/MenuController.m' object='MenuController.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o MenuController.obj `if test -f 'src/reinteract_wrapper_osx/MenuController.m'; then $(CYGPATH_W) 'src/reinteract_wrapper_osx/MenuController.m'; else $(CYGPATH_W) '$(srcdir)/src/reinteract_wrapper_osx/MenuController.m'; fi` pyNativeMainMenu.o: src/reinteract_wrapper_osx/pyNativeMainMenu.m @am__fastdepOBJC_TRUE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT pyNativeMainMenu.o -MD -MP -MF $(DEPDIR)/pyNativeMainMenu.Tpo -c -o pyNativeMainMenu.o `test -f 'src/reinteract_wrapper_osx/pyNativeMainMenu.m' || echo '$(srcdir)/'`src/reinteract_wrapper_osx/pyNativeMainMenu.m @am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/pyNativeMainMenu.Tpo $(DEPDIR)/pyNativeMainMenu.Po @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='src/reinteract_wrapper_osx/pyNativeMainMenu.m' object='pyNativeMainMenu.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o pyNativeMainMenu.o `test -f 'src/reinteract_wrapper_osx/pyNativeMainMenu.m' || echo '$(srcdir)/'`src/reinteract_wrapper_osx/pyNativeMainMenu.m pyNativeMainMenu.obj: src/reinteract_wrapper_osx/pyNativeMainMenu.m @am__fastdepOBJC_TRUE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT pyNativeMainMenu.obj -MD -MP -MF $(DEPDIR)/pyNativeMainMenu.Tpo -c -o pyNativeMainMenu.obj `if test -f 'src/reinteract_wrapper_osx/pyNativeMainMenu.m'; then $(CYGPATH_W) 'src/reinteract_wrapper_osx/pyNativeMainMenu.m'; else $(CYGPATH_W) '$(srcdir)/src/reinteract_wrapper_osx/pyNativeMainMenu.m'; fi` @am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/pyNativeMainMenu.Tpo $(DEPDIR)/pyNativeMainMenu.Po @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='src/reinteract_wrapper_osx/pyNativeMainMenu.m' object='pyNativeMainMenu.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o pyNativeMainMenu.obj `if test -f 'src/reinteract_wrapper_osx/pyNativeMainMenu.m'; then $(CYGPATH_W) 'src/reinteract_wrapper_osx/pyNativeMainMenu.m'; else $(CYGPATH_W) '$(srcdir)/src/reinteract_wrapper_osx/pyNativeMainMenu.m'; fi` install-reinteractpkgPYTHON: $(reinteractpkg_PYTHON) @$(NORMAL_INSTALL) test -z "$(reinteractpkgdir)" || $(MKDIR_P) "$(DESTDIR)$(reinteractpkgdir)" @list='$(reinteractpkg_PYTHON)'; dlist=''; for p in $$list; do\ if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ if test -f $$b$$p; then \ f=$(am__strip_dir) \ dlist="$$dlist $$f"; \ echo " $(reinteractpkgPYTHON_INSTALL) '$$b$$p' '$(DESTDIR)$(reinteractpkgdir)/$$f'"; \ $(reinteractpkgPYTHON_INSTALL) "$$b$$p" "$(DESTDIR)$(reinteractpkgdir)/$$f"; \ else :; fi; \ done; \ if test -n "$$dlist"; then \ if test -z "$(DESTDIR)"; then \ PYTHON=$(PYTHON) $(py_compile) --basedir "$(reinteractpkgdir)" $$dlist; \ else \ PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(reinteractpkgdir)" $$dlist; \ fi; \ else :; fi uninstall-reinteractpkgPYTHON: @$(NORMAL_UNINSTALL) @list='$(reinteractpkg_PYTHON)'; dlist=''; for p in $$list; do\ f=$(am__strip_dir) \ rm -f "$(DESTDIR)$(reinteractpkgdir)/$$f"; \ rm -f "$(DESTDIR)$(reinteractpkgdir)/$${f}c"; \ rm -f "$(DESTDIR)$(reinteractpkgdir)/$${f}o"; \ done install-replayPYTHON: $(replay_PYTHON) @$(NORMAL_INSTALL) test -z "$(replaydir)" || $(MKDIR_P) "$(DESTDIR)$(replaydir)" @list='$(replay_PYTHON)'; dlist=''; for p in $$list; do\ if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ if test -f $$b$$p; then \ f=$(am__strip_dir) \ dlist="$$dlist $$f"; \ echo " $(replayPYTHON_INSTALL) '$$b$$p' '$(DESTDIR)$(replaydir)/$$f'"; \ $(replayPYTHON_INSTALL) "$$b$$p" "$(DESTDIR)$(replaydir)/$$f"; \ else :; fi; \ done; \ if test -n "$$dlist"; then \ if test -z "$(DESTDIR)"; then \ PYTHON=$(PYTHON) $(py_compile) --basedir "$(replaydir)" $$dlist; \ else \ PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(replaydir)" $$dlist; \ fi; \ else :; fi uninstall-replayPYTHON: @$(NORMAL_UNINSTALL) @list='$(replay_PYTHON)'; dlist=''; for p in $$list; do\ f=$(am__strip_dir) \ rm -f "$(DESTDIR)$(replaydir)/$$f"; \ rm -f "$(DESTDIR)$(replaydir)/$${f}c"; \ rm -f "$(DESTDIR)$(replaydir)/$${f}o"; \ done install-replotPYTHON: $(replot_PYTHON) @$(NORMAL_INSTALL) test -z "$(replotdir)" || $(MKDIR_P) "$(DESTDIR)$(replotdir)" @list='$(replot_PYTHON)'; dlist=''; for p in $$list; do\ if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ if test -f $$b$$p; then \ f=$(am__strip_dir) \ dlist="$$dlist $$f"; \ echo " $(replotPYTHON_INSTALL) '$$b$$p' '$(DESTDIR)$(replotdir)/$$f'"; \ $(replotPYTHON_INSTALL) "$$b$$p" "$(DESTDIR)$(replotdir)/$$f"; \ else :; fi; \ done; \ if test -n "$$dlist"; then \ if test -z "$(DESTDIR)"; then \ PYTHON=$(PYTHON) $(py_compile) --basedir "$(replotdir)" $$dlist; \ else \ PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(replotdir)" $$dlist; \ fi; \ else :; fi uninstall-replotPYTHON: @$(NORMAL_UNINSTALL) @list='$(replot_PYTHON)'; dlist=''; for p in $$list; do\ f=$(am__strip_dir) \ rm -f "$(DESTDIR)$(replotdir)/$$f"; \ rm -f "$(DESTDIR)$(replotdir)/$${f}c"; \ rm -f "$(DESTDIR)$(replotdir)/$${f}o"; \ done install-examplesDATA: $(examples_DATA) @$(NORMAL_INSTALL) test -z "$(examplesdir)" || $(MKDIR_P) "$(DESTDIR)$(examplesdir)" @list='$(examples_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(examplesDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(examplesdir)/$$f'"; \ $(examplesDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(examplesdir)/$$f"; \ done uninstall-examplesDATA: @$(NORMAL_UNINSTALL) @list='$(examples_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(examplesdir)/$$f'"; \ rm -f "$(DESTDIR)$(examplesdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *$$ws$$tst$$ws*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ echo "XPASS: $$tst"; \ ;; \ *) \ echo "PASS: $$tst"; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *$$ws$$tst$$ws*) \ xfail=`expr $$xfail + 1`; \ echo "XFAIL: $$tst"; \ ;; \ *) \ failed=`expr $$failed + 1`; \ echo "FAIL: $$tst"; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ echo "SKIP: $$tst"; \ fi; \ done; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="All $$all tests passed"; \ else \ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all tests failed"; \ else \ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ skipped="($$skip tests were not run)"; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) $(am__remove_distdir) test -d $(distdir) || mkdir $(distdir) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ am__remove_distdir=: \ am__skip_length_check=: \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-recursive @PLATFORM_OSX_FALSE@all-local: all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA) config.h all-local installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(reinteractpkgdir)" "$(DESTDIR)$(replaydir)" "$(DESTDIR)$(replotdir)" "$(DESTDIR)$(examplesdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) @INSTALL_APP_FALSE@install-exec-hook: @PLATFORM_OSX_FALSE@install-exec-hook: clean: clean-recursive clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-examplesDATA install-reinteractpkgPYTHON \ install-replayPYTHON install-replotPYTHON install-dvi: install-dvi-recursive install-exec-am: install-binSCRIPTS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-recursive install-info: install-info-recursive install-man: install-pdf: install-pdf-recursive install-ps: install-ps-recursive installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binSCRIPTS uninstall-examplesDATA \ uninstall-reinteractpkgPYTHON uninstall-replayPYTHON \ uninstall-replotPYTHON .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ install-exec-am install-strip .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am all-local am--refresh check check-TESTS check-am \ clean clean-generic clean-noinstPROGRAMS ctags ctags-recursive \ dist dist-all dist-bzip2 dist-gzip dist-lzma dist-shar \ dist-tarZ dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-tags distcleancheck \ distdir distuninstallcheck dvi dvi-am html html-am info \ info-am install install-am install-binSCRIPTS install-data \ install-data-am install-dvi install-dvi-am \ install-examplesDATA install-exec install-exec-am \ install-exec-hook install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-reinteractpkgPYTHON \ install-replayPYTHON install-replotPYTHON install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am \ uninstall-binSCRIPTS uninstall-examplesDATA \ uninstall-reinteractpkgPYTHON uninstall-replayPYTHON \ uninstall-replotPYTHON @PLATFORM_OSX_TRUE@build-local-app: ReinteractWrapper @PLATFORM_OSX_TRUE@ rm -rf Reinteract.app @PLATFORM_OSX_TRUE@ mkdir -p Reinteract.app/Contents/MacOS @PLATFORM_OSX_TRUE@ cp -p ReinteractWrapper Reinteract.app/Contents/MacOS/Reinteract @PLATFORM_OSX_TRUE@ mkdir -p Reinteract.app/Contents/Resources @PLATFORM_OSX_TRUE@ cp -p $(top_srcdir)/data/Info.plist Reinteract.app/Contents @PLATFORM_OSX_TRUE@ cp -pr $(top_srcdir)/data/MainMenu.nib Reinteract.app/Contents/Resources @PLATFORM_OSX_TRUE@ cp -p $(top_srcdir)/data/Reinteract.icns Reinteract.app/Contents/Resources @PLATFORM_OSX_TRUE@ touch Reinteract.app/Contents/Resources/UNINSTALLED @PLATFORM_OSX_TRUE@all-local: build-local-app @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@install-exec-hook: build-local-app @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@ for f in `find Reinteract.app -type f` ; do \ @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@ b=`basename $$f` ; \ @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@ d=`dirname $$f` ; \ @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@ if test $$b = Reinteract ; then \ @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@ $(MKDIR_P) $(DESTDIR)$(APPDIR)/$$d ; \ @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@ $(INSTALL_PROGRAM) $$f $(DESTDIR)$(APPDIR)/$$f ;\ @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@ elif test $$b = UNINSTALLED ; then \ @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@ : ; \ @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@ else \ @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@ $(MKDIR_P) $(DESTDIR)$(APPDIR)/$$d ; \ @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@ $(INSTALL_DATA) $$f $(DESTDIR)$(APPDIR)/$$f ; \ @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@ fi \ @INSTALL_APP_TRUE@@PLATFORM_OSX_TRUE@ done api-docs: @conf=`cd $(top_srcdir) && pwd`/epydoc.conf ; \ out=`pwd`/api-docs ; \ modules="" ; \ for pkg in $(reinteractpkg_PYTHON) ; do \ modules="$$modules `echo $$pkg | sed s@^lib/@@`" ; \ done; \ cd $(top_srcdir)/lib && PYTHONPATH="$PYTHONPATH:reinteract" epydoc -v --config=$$conf --output=$$out $$modules distcheck-hook: @echo "Checking against files in git" @failed=false; \ for f in `cd $(srcdir) && git-ls-files -x .gitignore` ; do \ if test -e $(distdir)/$$f ; then : ; else \ echo File missing from distribution: $$f ; \ failed=true ; \ fi \ done ; \ if $$failed ; then \ exit 1 ; \ fi .PHONY: api-docs build-local-app # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: reinteract-0.5.0/src/0000777000076400007640000000000011162516457011470 500000000000000reinteract-0.5.0/src/reinteract_wrapper_osx/0000777000076400007640000000000011162516460016253 500000000000000reinteract-0.5.0/src/reinteract_wrapper_osx/pyNativeMainMenu.h0000664000076400007640000000064011072036560021571 00000000000000/* -*- mode: ObjC; c-basic-offset: 4; indent-tabs-mode: nil; -*- * * Copyright 2008 Owen Taylor * * This file is part of Reinteract and distributed under the terms * of the BSD license. See the file COPYING in the Reinteract * distribution for full details. * ************************************************************************/ #include "ThunkPython.h" PyMODINIT_FUNC init_py_native_main_menu(void); reinteract-0.5.0/src/reinteract_wrapper_osx/main.m0000664000076400007640000001556211162516344017305 00000000000000/* -*- mode: ObjC; c-basic-offset: 4; indent-tabs-mode: nil; -*- * * Copyright 2008-2009 Owen Taylor * * This file is part of Reinteract and distributed under the terms * of the BSD license. See the file COPYING in the Reinteract * distribution for full details. * ************************************************************************/ #include #include "ThunkPython.h" #include #include #include #include #import "MenuController.h" #import "pyNativeMainMenu.h" static void die(const char *format, ...) { if (PyErr_Occurred()) PyErr_Print(); va_list vap; va_start(vap, format); vfprintf(stderr, format, vap); va_end(vap); fprintf(stderr, "\n"); exit(1); } static PyObject * getModuleAttribute(const char *moduleName, const char *attributeName) { PyObject *module = PyImport_ImportModule(moduleName); if (module == NULL) die("Cannot import %s module", moduleName); PyObject *attribute = PyObject_GetAttrString(module, attributeName); if (attribute == NULL) die("Cannot get %s.%s", moduleName, attributeName); Py_DECREF(module); return attribute; } static BOOL dirExists(NSString *path) { struct stat s; if (stat([path UTF8String], &s) != 0) return FALSE; return S_ISDIR(s.st_mode); } static BOOL fileExists(NSString *path) { struct stat s; if (stat([path UTF8String], &s) != 0) return FALSE; return TRUE; } int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSBundle *mainBundle = [NSBundle mainBundle]; NSString *resourcePath = [mainBundle resourcePath]; /* This allocates the shared NSApplication object and stores it in the * NSApp global variable */ [NSApplication sharedApplication]; #ifdef USE_PYTHON_THUNKS /* Find the right version of Python and fill the vtable of "thunks" * to that library */ if (!init_thunk_python()) exit(1); #endif /* Normal Python initialization */ Py_Initialize(); PySys_SetArgv(argc, (char **)argv); /* Set up sys.path and locate special directories. We do this in Python * on other platforms; conceptually program this replaces Reinteract.py * and so has that responsibility */ PyObject *sysPath = getModuleAttribute("sys", "path"); NSString *dialogsDir; NSString *examplesDir; NSString *iconFile; /* If we are being run from the full bundle, then our Python files, etc. * are inside the Resources directory of the bundle. If we running from * the shell bundle we create uninstalled, then there is a special marker * file indicating that, and we we expect to find stuff up one directory * from the top of the bundle. Otherwise, the location of files is based * on the installation directory that is configured. */ NSString *pythonDir = [resourcePath stringByAppendingPathComponent:@"python"]; if (dirExists(pythonDir)) { dialogsDir = [resourcePath stringByAppendingPathComponent:@"dialogs"]; examplesDir = [resourcePath stringByAppendingPathComponent:@"examples"]; iconFile = [resourcePath stringByAppendingPathComponent:@"Reinteract.icns"]; NSString *externalDir = [resourcePath stringByAppendingPathComponent:@"external"]; PyObject *toInsert = Py_BuildValue("(ss)", [pythonDir UTF8String], [externalDir UTF8String]); PySequence_SetSlice(sysPath, 0, 0, toInsert); Py_DECREF(toInsert); /* Set environment variables used by dependencies */ NSString *libdir = [resourcePath stringByAppendingPathComponent:@"lib"]; NSString *sysconfdir = [resourcePath stringByAppendingPathComponent:@"etc"]; NSString *pixbufModuleFile = [sysconfdir stringByAppendingPathComponent:@"gtk-2.0/gdk-pixbuf.loaders"]; setenv("GDK_PIXBUF_MODULE_FILE", [pixbufModuleFile UTF8String], 1); setenv("GTK_EXE_PREFIX", [resourcePath UTF8String], 1); setenv("GTK_DATA_PREFIX", [resourcePath UTF8String], 1); NSString *systemGtkrcFile = [sysconfdir stringByAppendingPathComponent:@"gtk-2.0/gtkrc"]; NSString *userGtkrcFile = [NSHomeDirectory() stringByAppendingPathComponent:@".gtkrc-2.0"]; NSString *gtkrcFiles = [NSString stringWithFormat:@"%@:%@", systemGtkrcFile, userGtkrcFile]; setenv("GTK2_RC_FILES", [gtkrcFiles UTF8String], 1); NSString *imModuleFile = [sysconfdir stringByAppendingPathComponent:@"gtk-2.0/gtk.immodules"]; setenv("GTK_IM_MODULE_FILE", [imModuleFile UTF8String], 1); setenv("PANGO_LIBDIR", [libdir UTF8String], 1); setenv("PANGO_SYSCONFDIR", [sysconfdir UTF8String], 1); } else if (fileExists([resourcePath stringByAppendingPathComponent:@"UNINSTALLED"])) { NSString *baseDir = [[mainBundle bundlePath] stringByDeletingLastPathComponent]; dialogsDir = [baseDir stringByAppendingPathComponent:@"dialogs"]; examplesDir = [baseDir stringByAppendingPathComponent:@"examples"]; NSString *dataDir = [baseDir stringByAppendingPathComponent:@"data"]; iconFile = [dataDir stringByAppendingPathComponent:@"Reinteract.icns"]; pythonDir = [baseDir stringByAppendingPathComponent:@"lib"]; PyObject *toInsert = Py_BuildValue("(s)", [pythonDir UTF8String]); PySequence_SetSlice(sysPath, 0, 0, toInsert); Py_DECREF(toInsert); } else { dialogsDir = @DIALOGSDIR; examplesDir = @EXAMPLESDIR; iconFile = @ICONDIR "/Reinteract.ico"; } /* Set attributes in the global_settings objects */ PyObject *globalSettings = getModuleAttribute("reinteract.global_settings", "global_settings"); PyObject *pyDialogsDir = PyString_FromString([dialogsDir UTF8String]); PyObject_SetAttrString(globalSettings, "dialogs_dir", pyDialogsDir); Py_DECREF(pyDialogsDir); PyObject *pyExamplesDir = PyString_FromString([examplesDir UTF8String]); PyObject_SetAttrString(globalSettings, "examples_dir", pyExamplesDir); Py_DECREF(pyExamplesDir); PyObject *pyIconFile = PyString_FromString([iconFile UTF8String]); PyObject_SetAttrString(globalSettings, "icon_file", pyIconFile); Py_DECREF(pyIconFile); PyObject *pyVersion = PyString_FromString(VERSION); PyObject_SetAttrString(globalSettings, "version", pyVersion); Py_DECREF(pyVersion); PyObject_SetAttrString(globalSettings, "main_menu_mode", Py_True); /* Initialize reinteract.NativeMainMenu module; this provides two-way * communication between Python and the menu */ init_py_native_main_menu(); /* We're all set, now run run reinteract.main.main() */ PyObject *main_module = getModuleAttribute("reinteract.main", "main"); PyObject *result = PyObject_CallFunction(main_module, ""); if (result == NULL) die("Error calling main() function"); Py_DECREF(result); Py_Finalize(); [pool drain]; return 0; } reinteract-0.5.0/src/reinteract_wrapper_osx/ThunkPython.h0000664000076400007640000001165611075354546020656 00000000000000/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- * * Copyright 2008 Owen Taylor * * This file is part of Reinteract and distributed under the terms * of the BSD license. See the file COPYING in the Reinteract * distribution for full details. * ************************************************************************/ /* * This header file is used to redirect the parts of the Python API that we * we use to a VTable of symbols dynamically looked up via dlopen/dlsym * and avoid statically linking to the Python framework. This allows us to * create a single executable that works both with the python.org installer * for OS X 10.4 and the system version of Python shipped with OS X 10.5. * * The downside is that we are bypassing the standard system linker facilities * so could be more easily tripped up by ABI changes. And this is a pain * to maintain. Note that anything added below also needs to be added in * ThunkPython.c. */ #ifndef __THUNK_PYTHON_H__ #define __THUNK_PYTHON_H__ #include #ifndef PACKAGE_NAME #error "config.h must be included before ThunkPython.h" #endif #ifdef USE_PYTHON_THUNKS struct { int (*thunk_PyArg_ParseTuple)(PyObject *, const char *, ...); PyObject * (*thunk_PyErr_Occurred)(void); void (*thunk_PyErr_Print)(void); void (*thunk_PyErr_SetString)(PyObject *, const char *); PyGILState_STATE (*thunk_PyGILState_Ensure)(void); void (*thunk_PyGILState_Release)(PyGILState_STATE); PyObject * (*thunk_PyImport_ImportModule)(const char *name); PyObject * (*thunk_PyList_New)(Py_ssize_t); int (*thunk_PyList_SetItem)(PyObject *, Py_ssize_t, PyObject *); int (*thunk_PyModule_AddObject)(PyObject *, const char *, PyObject *); PyObject * (*thunk_PyObject_CallFunction)(PyObject *callable_object, char *format, ...); PyObject * (*thunk_PyObject_CallMethod)(PyObject *o, char *m, char *format, ...); PyObject * (*thunk_PyObject_GetAttrString)(PyObject *o, const char *attr_name); int (*thunk_PyObject_SetAttrString)(PyObject *o, char *attr_name, PyObject *v); int (*thunk_PySequence_SetSlice)(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, PyObject *v); PyObject * (*thunk_PyString_FromString)(const char *); void (*thunk_PySys_SetArgv)(int, char **); PyObject * (*thunk_PyType_GenericNew)(PyTypeObject *, PyObject *, PyObject *); int (*thunk_PyType_IsSubtype)(PyTypeObject *, PyTypeObject *); int (*thunk_PyType_Ready)(PyTypeObject *); PyObject * (*thunk_Py_BuildValue)(const char *, ...); PyObject * (*thunk_Py_InitModule4)(const char *name, PyMethodDef *methods, const char *doc, PyObject *self, int apiver); void (*thunk_Py_Initialize)(void); void (*thunk_Py_Finalize)(void); PyObject *thunk__Py_NoneStruct; PyIntObject *thunk__Py_TrueStruct; PyIntObject *thunk__Py_ZeroStruct; PyObject ** thunk_PyExc_RuntimeError; PyObject ** thunk_PyExc_TypeError; } python_thunks; #define PyArg_ParseTuple (python_thunks.thunk_PyArg_ParseTuple) #define PyErr_Occurred (python_thunks.thunk_PyErr_Occurred) #define PyErr_Occurred (python_thunks.thunk_PyErr_Occurred) #define PyErr_Print (python_thunks.thunk_PyErr_Print) #define PyErr_SetString (python_thunks.thunk_PyErr_SetString) #define PyGILState_Ensure (python_thunks.thunk_PyGILState_Ensure) #define PyGILState_Release (python_thunks.thunk_PyGILState_Release) #define PyImport_ImportModule (python_thunks.thunk_PyImport_ImportModule) #define PyList_New (python_thunks.thunk_PyList_New) #define PyList_SetItem (python_thunks.thunk_PyList_SetItem) #define PyModule_AddObject (python_thunks.thunk_PyModule_AddObject) #define PyObject_CallFunction (python_thunks.thunk_PyObject_CallFunction) #define PyObject_CallMethod (python_thunks.thunk_PyObject_CallMethod) #define PyObject_GetAttrString (python_thunks.thunk_PyObject_GetAttrString) #define PyObject_SetAttrString (python_thunks.thunk_PyObject_SetAttrString) #define PySequence_SetSlice (python_thunks.thunk_PySequence_SetSlice) #define PyString_FromString (python_thunks.thunk_PyString_FromString) #define PySys_SetArgv (python_thunks.thunk_PySys_SetArgv) #define PyType_GenericNew (python_thunks.thunk_PyType_GenericNew) #define PyType_IsSubtype (python_thunks.thunk_PyType_IsSubtype) #define PyType_Ready (python_thunks.thunk_PyType_Ready) #define Py_BuildValue (python_thunks.thunk_Py_BuildValue) #define Py_InitModule4 (python_thunks.thunk_Py_InitModule4) #define Py_Initialize (python_thunks.thunk_Py_Initialize) #define Py_Finalize (python_thunks.thunk_Py_Finalize) #define _Py_NoneStruct (*python_thunks.thunk__Py_NoneStruct) #define _Py_TrueStruct (*python_thunks.thunk__Py_TrueStruct) #define _Py_ZeroStruct (*python_thunks.thunk__Py_ZeroStruct) #define PyExc_RuntimeError (*python_thunks.thunk_PyExc_RuntimeError) #define PyExc_TypeError (*python_thunks.thunk_PyExc_TypeError) int init_thunk_python(); #endif USE_PYTHON_THUNKS #endif /* __THUNK_PYTHON_H__ */ reinteract-0.5.0/src/reinteract_wrapper_osx/README0000664000076400007640000000236411070066774017064 00000000000000The "wrapper" program in this directory is used on OS X instead of the Python main programs we use on other platforms (we use a native wrapper on Windows to for a system install, but it's much simpler and just invokes the Python main program directly.) The wrapper has several functions: * It locates the correct copy of Python (the native Python 2.5 on 10.5 or the python.org version for 10.4), and loads it via dlopen * It sets up sys.path and the global_settings path options * It loads the "NIB" file holding the main menu definition * It contains a glue module (reinterate.NativeMainMenu) that allows our PyGTK to enable/disable menu items Note that this program uses *header* files from Python and from GTK+ but is statically linked only to the Cocoa frameworks. References to Python and GTK+ symbols are done dynamically with dlopen/dlsym. Not linking to Python is essential to allow the run-time selection of a Python framework in different locations. Not linking to GTK+ is not so vital, but our use of GTK+ is very small and doing that via dlopen() makes it easier to create a universal bundle for the application in the release process (we don't need relink the wrapper once we've lipo'd together universal versions of the GTK+ libraries.) reinteract-0.5.0/src/reinteract_wrapper_osx/ThunkPython.c0000664000076400007640000000737611075354546020655 00000000000000/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- * * Copyright 2008 Owen Taylor * * This file is part of Reinteract and distributed under the terms * of the BSD license. See the file COPYING in the Reinteract * distribution for full details. * ************************************************************************/ /* See comment in ThunkPython.h for what this is about */ #include #include #include #include "ThunkPython.h" #define concat(x,y) x#y #define LOOKUP_SYMBOL(s) \ do { \ python_thunks.thunk_##s = dlsym(handle, #s); \ if (python_thunks.thunk_##s == NULL) { \ fprintf(stderr, "Cannot find symbol %s\n", #s); \ return 0; \ } \ } \ while (0) static int file_exists(const char *path) { struct stat s; if (stat(path, &s) != 0) return 0; return 1; } static void * dlopen_framework_version(const char *framework_dir, const char *version) { char *buf = malloc(strlen(framework_dir) + 1 + strlen("Versions") + 1 + strlen(version) + 1 + strlen("Python") + 1); if (!buf) return NULL; strcpy(buf, framework_dir); strcat(buf, "/"); strcat(buf, "Versions"); strcat(buf, "/"); strcat(buf, version); strcat(buf, "/"); strcat(buf, "Python"); /* This is to prevent some magic behavior in dlopen where dlopening a * non-existing version inside a framework will open a system-installed * copy of that version instead: not what we want with PYTHON_FRAMEWORK_DIR */ if (!file_exists(buf)) return NULL; void *handle = dlopen(buf, RTLD_GLOBAL | RTLD_LAZY); free(buf); return handle; } static void * dlopen_framework(const char *framework_dir) { void *handle = dlopen_framework_version(framework_dir, "2.6"); if (!handle) handle = dlopen_framework_version(framework_dir, "2.5"); return handle; } int init_thunk_python() { const char *framework_dir = getenv("PYTHON_FRAMEWORK_DIR"); void *handle = NULL; if (framework_dir) handle = dlopen_framework(framework_dir); if (!handle) handle = dlopen_framework("/Library/Frameworks/Python.framework"); if (!handle) handle = dlopen_framework("/System/Library/Frameworks/Python.framework"); if (!handle) { fprintf(stderr, "Cannot find path to Python framework\n"); return 0; } LOOKUP_SYMBOL(PyArg_ParseTuple); LOOKUP_SYMBOL(PyErr_Occurred); LOOKUP_SYMBOL(PyErr_Occurred); LOOKUP_SYMBOL(PyErr_Print); LOOKUP_SYMBOL(PyErr_SetString); LOOKUP_SYMBOL(PyGILState_Ensure); LOOKUP_SYMBOL(PyGILState_Release); LOOKUP_SYMBOL(PyImport_ImportModule); LOOKUP_SYMBOL(PyList_New); LOOKUP_SYMBOL(PyList_SetItem); LOOKUP_SYMBOL(PyModule_AddObject); LOOKUP_SYMBOL(PyObject_CallFunction); LOOKUP_SYMBOL(PyObject_CallMethod); LOOKUP_SYMBOL(PyObject_GetAttrString); LOOKUP_SYMBOL(PyObject_SetAttrString); LOOKUP_SYMBOL(PySequence_SetSlice); LOOKUP_SYMBOL(PyString_FromString); LOOKUP_SYMBOL(PySys_SetArgv); LOOKUP_SYMBOL(PyType_GenericNew); LOOKUP_SYMBOL(PyType_IsSubtype); LOOKUP_SYMBOL(PyType_Ready); LOOKUP_SYMBOL(Py_BuildValue); LOOKUP_SYMBOL(Py_InitModule4); LOOKUP_SYMBOL(Py_Initialize); LOOKUP_SYMBOL(Py_Finalize); LOOKUP_SYMBOL(_Py_NoneStruct); LOOKUP_SYMBOL(_Py_TrueStruct); LOOKUP_SYMBOL(_Py_ZeroStruct); LOOKUP_SYMBOL(PyExc_RuntimeError); LOOKUP_SYMBOL(PyExc_TypeError); return 1; } reinteract-0.5.0/src/reinteract_wrapper_osx/MenuController.m0000664000076400007640000001141211075354546021326 00000000000000/* -*- mode: ObjC; c-basic-offset: 4; indent-tabs-mode: nil; -*- * * Copyright 2008 Owen Taylor * * This file is part of Reinteract and distributed under the terms * of the BSD license. See the file COPYING in the Reinteract * distribution for full details. * ************************************************************************/ #include #import "MenuController.h" /* The MenuController object is a delegate that receives messages when * most of our menu items in the menu are selected. (A few of them are * wired directly to standard Cocoa functionality.) * * Each menu item has as its action a selector (method reference) * with the name corresponding to the action name used within our * PyGTK code. (newWorksheet for the 'new-worksheet' action, etc.) * * When we get a message, we convert the selector into the action name * and call into Python (by way of the actionCallback function.) We * also support enabling and disabling menu items by action name. */ @implementation MenuController -(id)init { actionToMenuItem = [[NSMutableDictionary alloc] init]; return self; } -(void)setActionCallback:(MenuActionCallback)callback callbackData:(void *)callbackData { actionCallback = callback; actionCallbackData = callbackData; } // Convert a selector name (newWorksheet:) to the action name // (new-worksheet). The function here is the same as: // // result = re.sub('([A-Z])', lambda m: "-" + m.group(1).lower(), selector[:-1]) // static NSString * selectorToActionName(SEL selector) { NSString *str = NSStringFromSelector(selector); NSMutableString *result = [NSMutableString stringWithCapacity:[str length]]; int length = [str length] - 1; // Remove trailing : int i = 0; int last = 0; for (i = 0; i < length; i++) { unichar c = [str characterAtIndex:i]; if (c >= 'A' && c <= 'Z') { [result appendString:[str substringWithRange:NSMakeRange(last, i - last)]]; unichar c2[2]; c2[0] = '-'; c2[1] = c + ('a' - 'A'); NSString *tmp = [NSString stringWithCharacters:c2 length:2]; [result appendString:tmp]; last = i + 1; } } [result appendString:[str substringWithRange:NSMakeRange(last, i - last)]]; return result; } -(void)addActionsFromMenu:(NSMenu *)menu { NSArray *items = [menu itemArray]; int i; for (i = 0; i < [items count]; i++) { NSMenuItem *item = [items objectAtIndex:i]; if ([item hasSubmenu]) [self addActionsFromMenu:[item submenu]]; else if ([item target] == self) { [actionToMenuItem setObject:item forKey:selectorToActionName([item action])]; } } } -(void)activateAction:(id)sender { if (actionCallback) actionCallback(selectorToActionName([sender action]), actionCallbackData); } // The delegate methods for individual menu items just call the generic // activateAction method and we figure out what action was selected from // the sender (that is, the menu item.) -(void)about:(id)sender { [self activateAction:sender]; } -(void)break:(id)sender { [self activateAction:sender]; } -(void)calculate:(id)sender { [self activateAction:sender]; } -(void)calculateAll:(id)sender { [self activateAction:sender]; } -(void)close:(id)sender { [self activateAction:sender]; } -(void)cut:(id)sender { [self activateAction:sender]; } -(void)copy:(id)sender { [self activateAction:sender]; } -(void)copyAsDoctests:(id)sender { [self activateAction:sender]; } -(void)delete:(id)sender { [self activateAction:sender]; } -(void)newLibrary:(id)sender { [self activateAction:sender]; } -(void)newNotebook:(id)sender { [self activateAction:sender]; } -(void)newWorksheet:(id)sender { [self activateAction:sender]; } -(void)notebookProperties:(id)sender { [self activateAction:sender]; } -(void)openNotebook:(id)sender { [self activateAction:sender]; } -(void)open:(id)sender { [self activateAction:sender]; } -(void)paste:(id)sender { [self activateAction:sender]; } -(void)preferences:(id)sender { [self activateAction:sender]; } -(void)redo:(id)sender { [self activateAction:sender]; } -(void)rename:(id)sender { [self activateAction:sender]; } -(void)quit:(id)sender { [self activateAction:sender]; } -(void)save:(id)sender { [self activateAction:sender]; } -(void)undo:(id)sender { [self activateAction:sender]; } -(void)enableAction:(NSString *)actionName { NSMenuItem *item = [actionToMenuItem objectForKey:actionName]; [item setEnabled:YES]; } -(void)disableAction:(NSString *)actionName { NSMenuItem *item = [actionToMenuItem objectForKey:actionName]; [item setEnabled:NO]; } -(NSArray *)actionNames { return [actionToMenuItem allKeys]; } @end reinteract-0.5.0/src/reinteract_wrapper_osx/pyNativeMainMenu.m0000664000076400007640000002343011075354546021612 00000000000000/* -*- mode: ObjC; c-basic-offset: 4; indent-tabs-mode: nil; -*- * * Copyright 2008 Owen Taylor * * This file is part of Reinteract and distributed under the terms * of the BSD license. See the file COPYING in the Reinteract * distribution for full details. * ************************************************************************/ #include #include "ThunkPython.h" #include #include #include #include #import "MenuController.h" /* This file implements the reinteract.native_main_menu object, which is * glue between the menu and the PyGTK code. The interface here is: * * class NativeMainMenu: * def do_action(self, action_name): * """An Action was selected""" * pass # Override in subclass * * def enable_action(self, action_name): * """Enable the action with the specified name""" * [...] * * def disable_action(self, action_name): * """Disable the action with the specified name""" * [...] * * def get_action_names(self): * """Return a list of all action names in the menu""" * [...] * * def handle_key_press(self, event): * """Check key equivalents and activate a menu item if appropriate * * @returns: True if a menu item was activated * """ * [...] * * You use this class by deriving from it and instantiating a singleton * copy. Instantiating more than one copy of a derived class will produce * undefined and probably bad results. */ typedef struct { PyObject_HEAD MenuController *controller; } pyNativeMainMenu; static void pyNativeMenu_actionCallback(NSString *actionName, void *data) { pyNativeMainMenu *slf = data; PyGILState_STATE gstate; gstate = PyGILState_Ensure(); PyObject *result = PyObject_CallMethod((PyObject *)slf, "do_action", "s", [actionName UTF8String]); if (result == NULL) PyErr_Print(); else Py_DECREF(result); PyGILState_Release(gstate); } static int pyNativeMainMenu_init(pyNativeMainMenu *slf, PyObject *args, PyObject *kwds) { if (!PyArg_ParseTuple(args, "")) return -1; slf->controller = [[MenuController alloc] init]; [slf->controller setActionCallback:pyNativeMenu_actionCallback callbackData:slf]; // Create the MainMenu object from the NIB file and set our controller // object as the delegate NSNib *nib = [[NSNib alloc] initWithNibNamed: @"MainMenu" bundle:nil]; if (![nib instantiateNibWithOwner:slf->controller topLevelObjects:nil]){ PyErr_SetString(PyExc_RuntimeError, "Can't instantiate MainMenu.nib"); return -1; } // Once the nib has been loaded and the objects created (the menu // is automatically added to the global NSApp), we don't need the data // of the NIB any more [nib release]; [slf->controller addActionsFromMenu:[NSApp mainMenu]]; // finishLaunching actually shows the menu. There might be some // justification for splitting calling this out into a separate menu [NSApp finishLaunching]; return 0; } static PyObject * pyNativeMainMenu_enable_action(pyNativeMainMenu *slf, PyObject *args) { const char *action_name; if (!PyArg_ParseTuple(args, "s", &action_name)) return NULL; [slf->controller enableAction:[NSString stringWithUTF8String:action_name]]; Py_RETURN_NONE; } static PyObject * pyNativeMainMenu_disable_action(pyNativeMainMenu *slf, PyObject *args) { const char *action_name; if (!PyArg_ParseTuple(args, "s", &action_name)) return NULL; [slf->controller disableAction:[NSString stringWithUTF8String:action_name]]; Py_RETURN_NONE; } static PyObject * pyNativeMainMenu_get_action_names(pyNativeMainMenu *slf) { NSArray *names = [slf->controller actionNames]; PyObject *result = PyList_New([names count]); int i; if (!result) return NULL; for (i = 0; i < [names count]; i++) { const char *name = [[names objectAtIndex:i] UTF8String]; PyObject *py_name = PyString_FromString(name); if (!py_name) { Py_DECREF(result); return NULL; } PyList_SetItem(result, i, py_name); // Steals reference to py_name } return result; } static NSEvent * event_get_nsevent(GdkEvent *event) { static NSEvent *(*ptr_gdk_quartz_event_get_nsevent) (GdkEvent*); if (!ptr_gdk_quartz_event_get_nsevent) { ptr_gdk_quartz_event_get_nsevent = dlsym(RTLD_DEFAULT, "gdk_quartz_event_get_nsevent"); if (!ptr_gdk_quartz_event_get_nsevent) { fprintf(stderr, "Can't get pointer to gdk_quartz_event_get_nsevent()"); return NULL; } } return (*ptr_gdk_quartz_event_get_nsevent) (event); } /* All key events get intercepted by the gtk-quartz event loop before * normal processing by NSApplication can deliver them to the menu bar. * For this reason, we have to pass key events received on our toplevel * windows to the menu bar ourselves. * * Luckily the original NSEvent can be retrieved from the GdkEvent so * we don't have to synthesize a new event ourselves. */ static PyObject * pyNativeMainMenu_handle_key_press(pyNativeMainMenu *slf, PyObject *args) { PyObject *py_event; if (!PyArg_ParseTuple(args, "O", &py_event)) return NULL; #if 0 /* Doing it this way would require us to call pygobject_init() first * which is possible but requires us to thunk more Python API to make * that (inline) functin happy. pyg_boxed_get() is just casting * and structure access, so doesn't require pygobject_init() */ if (!pyg_boxed_check(py_event, GDK_TYPE_EVENT)) { PyErr_SetString(PyExc_TypeError, "Argument must be a GdkEvent"); return NULL; } #else PyObject *module = PyImport_ImportModule("gtk.gdk"); PyObject *attribute = PyObject_GetAttrString(module, "Event"); if (!PyObject_TypeCheck(py_event, (PyTypeObject *)attribute)) { PyErr_SetString(PyExc_TypeError, "Argument must be a GdkEvent"); return NULL; } #endif NSEvent *event = event_get_nsevent(pyg_boxed_get(py_event, GdkEvent)); if ([[NSApp mainMenu] performKeyEquivalent:event]) Py_RETURN_TRUE; else Py_RETURN_FALSE; } static PyMethodDef pyNativeMainMenu_methods[] = { {"enable_action", (PyCFunction)pyNativeMainMenu_enable_action, METH_VARARGS, "Enable the menu item with the specified action name" }, {"disable_action", (PyCFunction)pyNativeMainMenu_disable_action, METH_VARARGS, "Disable the menu item with the specified action name" }, {"get_action_names", (PyCFunction)pyNativeMainMenu_get_action_names, METH_NOARGS, "Return a list of all action names" }, {"handle_key_press", (PyCFunction)pyNativeMainMenu_handle_key_press, METH_VARARGS, "Perform any key equivalents for the given key event" }, {NULL} /* Sentinel */ }; static PyTypeObject pyNativeMainMenuType = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "reinteract.native_main_menu.NativeMainMenu", /*tp_name*/ sizeof(pyNativeMainMenu), /*tp_basicsize*/ 0, /*tp_itemsize*/ 0, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash */ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ "Native Interface to the main menu", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ pyNativeMainMenu_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)pyNativeMainMenu_init, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ }; static PyMethodDef native_main_menu_methods[] = { { NULL } /* No module level methods */ }; PyMODINIT_FUNC init_py_native_main_menu(void) { PyObject *m; if (PyType_Ready(&pyNativeMainMenuType) < 0) return; // We need to load the reinteract package so we have the namespace // for reinteract.native_main_menu. We don't actually need anything // from reinteract.__init__.py, which is empty. PyObject *tmp = PyImport_ImportModule("reinteract"); if (tmp) Py_DECREF(tmp); else { PyErr_Print(); return; } m = Py_InitModule("reinteract.native_main_menu", native_main_menu_methods); pyNativeMainMenuType.tp_new = PyType_GenericNew; Py_INCREF(&pyNativeMainMenuType); PyModule_AddObject(m, "NativeMainMenu", (PyObject *)&pyNativeMainMenuType); } reinteract-0.5.0/src/reinteract_wrapper_osx/MenuController.h0000664000076400007640000000230011072036527021306 00000000000000/* -*- mode: ObjC; c-basic-offset: 4; indent-tabs-mode: nil; -*- * * Copyright 2008 Owen Taylor * * This file is part of Reinteract and distributed under the terms * of the BSD license. See the file COPYING in the Reinteract * distribution for full details. * ************************************************************************/ #import typedef void (*MenuActionCallback) (NSString *actionName, void *data); // Delegate for menu items. See MenuController.m for a description @interface MenuController : NSObject { // Mapping from action name to the menu item object NSMutableDictionary *actionToMenuItem; // Callback when a menu item is activated MenuActionCallback actionCallback; void *actionCallbackData; } // Sets the callback when menu items are activated -(void)setActionCallback:(MenuActionCallback) callback callbackData:(void *)callbackData; // Initializes the action name to menu item mapping with the menu items // in the menu and in submenus -(void)addActionsFromMenu:(NSMenu *)menu; // Enable/disable actions by menu item name -(void)enableAction:(NSString *)actionName; -(void)disableAction:(NSString *)actionName; -(NSArray *)actionNames; @end reinteract-0.5.0/README0000664000076400007640000000211211162516344011466 00000000000000Reinteract ========== Reinteract is a interactive shell for Python that allows changing history, not just repeating it. You can go back to early statements, edit them, and the changes flow through the rest of the subsequent code. You might think of it as a Python 'worksheet'. See: http://www.reinteract.org For more information. Copyright 2007-2009 Owen Taylor, Red Hat, Inc., and others Reinteract is licensed under the simplified BSD license. See the file COPYING for full details. Running ======= To run Reinteract from this directory, just type: bin/uninst.py At the command line. There's no need to run the configure script first. Installing ========== The standard autotools setup here is meant for the people packaging Reinteract for system install on Linux and Unix systems. If you aren't doing that, just run Reinteract from this directory or create a symlink from bin/uninst to $HOME/bin/uninst. Latest Sources ============== You can get the latest sources using git: git clone git://git.fishsoup.net/reinteract.git Owen Taylor 11 November 2007 reinteract-0.5.0/lib/0000777000076400007640000000000011162516457011447 500000000000000reinteract-0.5.0/lib/replot.py0000664000076400007640000001666511162516344013255 00000000000000# Copyright 2007, 2008 Owen Taylor # Copyright 2008 Kai Willadsen # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import cairo import gtk import matplotlib from matplotlib.figure import Figure from matplotlib.backends.backend_cairo import RendererCairo, FigureCanvasCairo import numpy from reinteract.recorded_object import RecordedObject, default_filter import reinteract.custom_result as custom_result class _PlotResultCanvas(FigureCanvasCairo): def draw_event(*args): # Since we never change anything about the figure, the only time we # need to redraw is in response to an expose event, which we handle # ourselves pass class PlotWidget(gtk.DrawingArea): __gsignals__ = { 'button-press-event': 'override', 'button-release-event': 'override', 'expose-event': 'override', 'size-allocate': 'override', 'unrealize': 'override' } def __init__(self, result): gtk.DrawingArea.__init__(self) self.figure = Figure(facecolor='white', figsize=(6,4.5)) self.canvas = _PlotResultCanvas(self.figure) self.axes = self.figure.add_subplot(111) self.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE) self.cached_contents = None def do_expose_event(self, event): cr = self.window.cairo_create() if not self.cached_contents: self.cached_contents = cr.get_target().create_similar(cairo.CONTENT_COLOR, self.allocation.width, self.allocation.height) renderer = RendererCairo(self.figure.dpi) renderer.set_width_height(self.allocation.width, self.allocation.height) renderer.set_ctx_from_surface(self.cached_contents) self.figure.draw(renderer) # event.region is not bound: http://bugzilla.gnome.org/show_bug.cgi?id=487158 # gdk_context = gtk.gdk.CairoContext(renderer.ctx) # gdk_context.region(event.region) # gdk_context.clip() cr.set_source_surface(self.cached_contents, 0, 0) cr.paint() def do_size_allocate(self, allocation): if allocation.width != self.allocation.width or allocation.height != self.allocation.height: self.cached_contents = None gtk.DrawingArea.do_size_allocate(self, allocation) def do_unrealize(self): gtk.DrawingArea.do_unrealize(self) self.cached_contents = None def do_button_press_event(self, event): if event.button == 3: custom_result.show_menu(self, event, save_callback=self.__save) return True else: return True def do_button_release_event(self, event): return True def do_realize(self): gtk.DrawingArea.do_realize(self) cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR) self.window.set_cursor(cursor) def do_size_request(self, requisition): try: # matplotlib < 0.98 requisition.width = self.figure.bbox.width() requisition.height = self.figure.bbox.height() except TypeError: # matplotlib >= 0.98 requisition.width = self.figure.bbox.width requisition.height = self.figure.bbox.height def __save(self, filename): # The save/restore here was added to matplotlib's after 0.90. We duplicate # it for compatibility with older versions. (The code would need modification # for 0.98 and newer, which is the reason for the particular version in the # check) version = [int(x) for x in matplotlib.__version__.split('.')] need_save = version[:2] < [0, 98] if need_save: orig_dpi = self.figure.dpi.get() orig_facecolor = self.figure.get_facecolor() orig_edgecolor = self.figure.get_edgecolor() try: self.canvas.print_figure(filename) finally: if need_save: self.figure.dpi.set(orig_dpi) self.figure.set_facecolor(orig_facecolor) self.figure.set_edgecolor(orig_edgecolor) self.figure.set_canvas(self.canvas) # def do_size_allocate(self, allocation): # gtk.DrawingArea.do_size_allocate(self, allocation) # # dpi = self.figure.dpi.get() # self.figure.set_size_inches (allocation.width / dpi, allocation.height / dpi) def _validate_args(args): # # The matplotlib argument parsing is a little wonky # # plot(x, y, 'fmt', y2) # plot(x1, y2, x2, y2, 'fmt', y3) # # Are valid, but # # plot(x, y, y2) # # is not. We just duplicate the algorithm here # l = len(args) i = 0 while True: xi = None yi = None formati = None remaining = l - i if remaining == 0: break elif remaining == 1: yi = i i += 1 # The 'remaining != 3 and' encapsulates the wonkyness referred to above elif remaining == 2 or (remaining != 3 and not isinstance(args[i + 2], basestring)): # plot(...., x, y [, ....]) xi = i yi = i + 1 i += 2 else: # plot(....., x, y, format [, ...]) xi = i yi = i + 1 formati = i + 2 i += 3 if xi != None: arg = args[xi] if isinstance(arg, numpy.ndarray): xshape = arg.shape elif isinstance(arg, list): # Not supporting nested python lists here xshape = (len(arg),) else: raise TypeError("Expected numpy array or list for argument %d" % (xi + 1)) else: xshape = None # y isn't optional, pretend it is to preserve code symmetry if yi != None: arg = args[yi] if isinstance(arg, numpy.ndarray): yshape = arg.shape elif isinstance(arg, list): # Not supporting nested python lists here yshape = (len(arg),) else: raise TypeError("Expected numpy array or list for argument %d" % (yi + 1)) else: yshape = None if xshape != None and yshape != None and xshape != yshape: raise TypeError("Shapes of arguments %d and %d aren't compatible" % ((xi + 1), (yi + 1))) if formati != None and not isinstance(args[formati], basestring): raise TypeError("Expected format string for argument %d" % (formati + 1)) class Axes(RecordedObject, custom_result.CustomResult): def _check_plot(self, name, args, kwargs, spec): _validate_args(args) def create_widget(self): widget = PlotWidget(self) self._replay(widget.axes) return widget def filter_method(baseclass, name): if not default_filter(baseclass, name): return False if name.startswith('get_'): return False if name == 'create_widget': return False return True Axes._set_target_class(matplotlib.axes.Axes, filter_method) def plot(*args, **kwargs): axes = Axes() axes.plot(*args, **kwargs) return axes def imshow(*args, **kwargs): axes = Axes() axes.imshow(*args, **kwargs) return axes reinteract-0.5.0/lib/replay.py0000664000076400007640000000433211072036033013220 00000000000000# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk import os from numpy import float32, float64 import reinteract.custom_result as custom_result class PlayResult(custom_result.CustomResult): def __init__(self, data): self.__data = data def create_widget(self): widget = gtk.Button("Play") widget.connect('clicked', self.play) widget.connect('button_press_event', self.on_button_press) widget.connect('realize', self.on_realize) return widget def play(self, *args): if self.__data.dtype == float32: command = "play -t raw -r 44100 -f -4 -L -q -" else: command = "play -t raw -r 44100 -f -8 -L -q -" f = os.popen(command, 'w') self.__data.tofile(f) f.close() def __save(self, filename): escaped = filename.replace("'", r"'\''") if self.__data.dtype == float32: command = "sox -t raw -r 44100 -f -4 -L -q - '%s'" % escaped else: command = "sox -t raw -r 44100 -f -8 -L -q - '%s'" % escaped f = os.popen(command, 'w') self.__data.tofile(f) f.close() def on_button_press(self, button, event): if event.button == 3: custom_result.show_menu(button, event, save_callback=self.__save) return True return False def on_realize(self, button): # Hack to get the right cursor over the button, since the button # doesn't set a cursor itself. button.window is the text view's # window, we have to search to find button.event_window, since # its not bound for c in button.window.get_children(): if c.get_user_data() == button: cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR) c.set_cursor(cursor) def play(data): if data.dtype != float32 and data.dtype != float64: raise TypeError("Data must be float32 or float64, not %s", data.dtype) return PlayResult(data) reinteract-0.5.0/lib/reinteract/0000777000076400007640000000000011162516457013607 500000000000000reinteract-0.5.0/lib/reinteract/global_settings.py0000664000076400007640000000472211162516344017257 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## # # This module holds preferences and options that are global to the entire program. import gobject import os import sys from config_file import ConfigFile def _bool_property(name, default): def getter(self): return self.config.get_bool('Reinteract', name, default) def setter(self, value): self.config.set_bool('Reinteract', name, value) return gobject.property(getter=getter, setter=setter, type=bool, default=default) def _string_property(name, default=None): def getter(self): return self.config.get_string('Reinteract', name, default) def setter(self, value): self.config.set_string('Reinteract', name, value) return gobject.property(getter=getter, setter=setter, type=str, default=default) class GlobalSettings(gobject.GObject): dialogs_dir = gobject.property(type=str) examples_dir = gobject.property(type=str) config_dir = gobject.property(type=str) icon_file = gobject.property(type=str) notebooks_dir = gobject.property(type=str) mini_mode = gobject.property(type=bool, default=False) main_menu_mode = gobject.property(type=bool, default=False) version = gobject.property(type=str) editor_font_is_custom = _bool_property('editor_font_is_custom', default=False) editor_font_name = _string_property('editor_font_name', default="Monospace 12") doc_tooltip_font_is_custom = _bool_property('doc_tooltip_font_is_custom', default=False) doc_tooltip_font_name = _string_property('doc_tooltip_font_name', default="Sans 11") autocomplete = _bool_property('autocomplete', default=True) def __init__(self): gobject.GObject.__init__(self) if sys.platform == 'win32': self.config_dir = os.path.join(os.getenv('APPDATA'), 'Reinteract') else: self.config_dir = os.path.expanduser("~/.reinteract") # In a shocking example of cross-platform convergence, ~/Documents # is the documents directory on OS X, Windows, and Linux self.notebooks_dir = os.path.expanduser("~/Documents/Reinteract") config_location = os.path.join(self.config_dir, 'reinteract.conf') self.config = ConfigFile(config_location) global_settings = GlobalSettings() reinteract-0.5.0/lib/reinteract/data_format.py0000664000076400007640000002403411125213321016342 00000000000000# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import re import inspect import pydoc import gtk from cStringIO import StringIO # # For most objects, we simply call their repr() function, but we handle # tuples, lists, and dicts specially. We handle them in one of two ways: # # - As a list of items, one per line. # # Dictionaries are always formatted this way. Lists and Tuples are # formatted this way if them items in the sequence have long # or multi-line representations. # # - As a list of items, wrapped into multiple lines # # Lists and Tuples are formatted this way if them items in the sequence # have short, single-line representations. # # total maximum number of lines _MAX_LINES = 17 # if a sequence has items longer than this, force separate-lines mode _MAX_WRAPPED_ITEM_LEN = 20 # maximum number of lines for a wrapped sequence _MAX_WRAPPED_ITEM_LINES = 5 # max line width when line-wrapping _MAX_WIDTH = 80 # Common parameters to the functions below: # # open: opening delimeter # close: closing delimeter # nl: "what to use for break lines". The idea is that if you are at an # indentation level of 3, and use "\n " to break lines, the # broken lines stay at indentation level 3. # object_stack: stack of objects currently being formatted. This is # used to catch recursive data structures. def __format_separate(sequence, open, close, nl): # Used to format dictionaries, lists, and tuples as a list of items # 1-per-line. buf = StringIO() buf.write(open) lines = 1 last_str, last_lines = None, 0 for str, item_lines in sequence: if last_str != None: # Process the last item, we'll have one more after it new_lines = lines + last_lines # The new line takes us over the maximum item count, so we # won't have room for the next item if new_lines > _MAX_LINES: buf.write("...") last_str = None break buf.write(last_str) buf.write(",") buf.write(nl) lines = new_lines last_str = str last_lines = item_lines if last_str != None: buf.write(last_str) buf.write(close) return buf.getvalue(), lines def __format_wrapped(sequence, open, close, nl): # Used to format lists, and tuples as a line-wrapped list of items lines = 1 buf = StringIO() buf.write(open) available_width = _MAX_WIDTH - (len(nl) - 1) last_str, last_lines = None, 0 count = 0 count_on_line = 0 for str, item_lines in sequence: if item_lines > 1: return None if len(str) > _MAX_WRAPPED_ITEM_LEN: return None if last_str != None: # Process the last item, we'll have one more after it new_available_width = available_width - (len(last_str) + 1) # len(last_str) + len(",") if count_on_line > 0: new_available_width -= 1 # len(" ") if lines == _MAX_WRAPPED_ITEM_LINES: # An ellipsis won't fit after this item, and most likely the item after either if new_available_width < 4 + len(close): # len(" ...") + len(close) if count_on_line > 0: buf.write(" ") buf.write("...") last_str = None break else: if new_available_width < 0: buf.write(nl) count_on_line = 0 lines += 1 available_width = _MAX_WIDTH - (len(nl) - 1) if count_on_line > 0: buf.write(" ") available_width -= 1 buf.write(last_str) buf.write(",") available_width -= (len(last_str) + 1) count_on_line += 1 last_str = str last_lines = item_lines if last_str != None: new_available_width = available_width - (len(last_str) + len(close)) if count_on_line > 0: new_available_width -= 1 if new_available_width < 0: buf.write(nl) elif count_on_line > 0: buf.write(" ") buf.write(last_str) buf.write(close) return buf.getvalue(), lines def __format_dict(obj, nl, object_stack): nl = nl + " " def iter(): for key, value in sorted(obj.items()): key_str, key_lines = __format(key, nl, object_stack) value_str, value_lines = __format(value, nl, object_stack) yield key_str + ": " + value_str, key_lines + value_lines - 1 return __format_separate(iter(), "{", "}", nl) def __format_sequence(obj, open, close, nl, object_stack): nl = nl + " " seq = (__format(x, nl, object_stack) for x in obj) result = __format_wrapped(seq, open, close, nl) if result == None: seq = (__format(x, nl, object_stack) for x in obj) result = __format_separate(seq, open, close, nl) return result def __format(obj, nl, object_stack): for o in object_stack: if obj is o: return "", 1 object_stack += (obj,) t = type(obj) repr_attr = getattr(t, '__repr__', None) if issubclass(t, dict) and repr_attr is dict.__repr__: return __format_dict(obj, nl, object_stack) elif issubclass(t, list) and repr_attr is list.__repr__: return __format_sequence(obj, '[', ']', nl, object_stack) elif issubclass(t, tuple) and repr_attr is tuple.__repr__: return __format_sequence(obj, '(', ')', nl, object_stack) else: s = repr(obj) return s.replace("\n", nl), 1 + s.count("\n") def format(obj): """Format obj as text This in spirit similar to pprint.format(), but differs in the details of how the formatting done. Sequences and dictionaries are trunctated as necessary to keep the entire display compact. """ return __format(obj, "\n", ())[0] def insert_formatted(buf, iter, obj, heading_type_tag, inline_type_tag, value_tag): """Insert a nicely-formatted display of obj into a gtk.TextBuffer @param buf: the buffer to insert the formatted display into @param iter: the location to insert the formatted display @param obj: the object to display in the buffer @param heading_type_tag: tag to use for the object type if we are outputting a block @param inline_type_tag: tag to use for the object type if we are outputting a single line @param value_tag: the tag to use for the objects value """ text = format(obj) if text.find("\n") >= 0: insert_with_tag(buf, iter, pydoc.describe(obj), heading_type_tag) buf.insert(iter, "\n") else: insert_with_tag(buf, iter, pydoc.describe(obj), inline_type_tag) buf.insert(iter, ": ") insert_with_tag(buf, iter, text, value_tag) def is_data_object(obj): """Return True of obj holds data This routine is used to distinguish objects we should show help for (like modules, classes, methods, and so forth) from other types of object. """ # Test borrowed from pydoc.py return not (inspect.ismodule(obj) or inspect.isclass(obj) or inspect.isroutine(obj) or inspect.isgetsetdescriptor(obj) or inspect.ismemberdescriptor(obj) or isinstance(obj, property)) def insert_with_tag(buf, iter, text, tag): """Insert text into a gtk.TextBuffer, then tag it with the given tag""" mark = buf.create_mark(None, iter, True) buf.insert(iter, text) start = buf.get_iter_at_mark(mark) buf.apply_tag(tag, start, iter) buf.delete_mark(mark) #################################################################################### if __name__ == "__main__": CHOMP_RE = re.compile(r"^\s*\|", re.MULTILINE) def do_test(obj, expected): # Trim off initial and trailing blank lines, and use the amount of white # space on the first remaining line as an overall indent to remove expected = re.sub("^\s*\n","", expected) expected = re.sub("\n\s*$","", expected) initial_white = len(re.match(r"^\s*", expected).group(0)) expected = "\n".join([s[initial_white:] for s in expected.split("\n")]) expected = CHOMP_RE.sub("", expected) result = format(obj) if result != expected: print "For %s,\nGot:\n%s\nExpected:\n%s" % (obj, repr(result), repr(expected)) # We whack down the maximums to reduce the size of our test cases _MAX_LINES = 5 _MAX_WRAPPED_ITEM_LINES = 3 _MAX_WIDTH = 40 do_test(1, "1") do_test({'a': 1, 'b': 2}, """ {'a': 1, 'b': 2} """) do_test(dict(((x, x) for x in range(5))), """ {0: 0, 1: 1, 2: 2, 3: 3, 4: 4} """) do_test(dict(((x, x) for x in range(6))), """ {0: 0, 1: 1, 2: 2, 3: 3, ...} """) # ---------------------------------------- do_test(range(100), """ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, ...] """) do_test(["a" * 9] * 4, """ ['aaaaaaaaa', 'aaaaaaaaa', 'aaaaaaaaa', 'aaaaaaaaa'] """) try: import numpy do_test([numpy.float64(1.0)], """ [1.0] """) do_test([numpy.float64(1.0), numpy.float64(1.0)], """ [1.0, 1.0] """) except ImportError: pass a = [1] a.append(a) do_test(a, "[1, ]") reinteract-0.5.0/lib/reinteract/chunks.py0000664000076400007640000001546611162516344015401 00000000000000# Copyright 2007-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import traceback from change_range import ChangeRange from statement import Statement, WarningResult from tokenized_statement import TokenizedStatement; class Chunk(object): """ A chunk is a series of consecutive lines in a Worksheet treated as a unit. The Chunk class is a base class for different types of chunks. It contains basic functionality for tracking a [start,end) range, and tracking what lines withinthe chunk have changed. """ def __init__(self, start=-1, end=-1): self.start = start self.end = end self.changes = ChangeRange() self.newly_inserted = True def set_range(self, start, end): if start < self.start: self.changes.insert(0, self.start - start) self.start = start if end > self.end: self.changes.insert(self.end -self.start, self.start - start) self.end = end if start > self.start: self.changes.delete_range(0, start - self.start) self.start = start if end < self.end: self.changes.delete_range(end - self.start, self.end - self.start) self.end = end def change_line(self, line): self.changes.change(line - self.start, line + 1 - self.start) def change_lines(self, start, end): self.changes.change(start - self.start, end - self.start) def insert_lines(self, pos, count): self.changes.insert(pos - self.start, count) self.end += count def delete_lines(self, start, end): self.changes.delete_range(start - self.start, end - self.start) # Note: deleting everything gives [end,end], which is legitimate # but maybe a little surprising. Doesn't matter for us. if start == self.start: self.start = end else: self.end -= (end - start) class StatementChunk(Chunk): """ StatementChunk represents a series of lines making up a single unit of Python code. (Roughly, but perhaps not exactly corresponding to a statement in the Python grammar. A StatementChunk might contain text that isn't compilable at all.) In addition to the basic range-tracking capabilities of the base class, the StatementChunk class holds a tokenized representation of the code, information about the status of the chunk (needs_compile, needs_execute), and after compilation and/or execution, the resulting results or errors. """ def __init__(self, start=-1, end=-1): Chunk.__init__(self, start, end) self.tokenized = TokenizedStatement() self.status_changed = False self.results_changed = False self.executing = False self.needs_compile = False self.needs_execute = False self.statement = None self.results = None self.error_message = None self.error_line = None self.error_offset = None def __repr__(self): return "StatementChunk(%d,%d,%r,%r,%r)" % (self.start, self.end, self.needs_compile, self.needs_execute, self.tokenized.get_text()) def set_lines(self, lines): range = self.tokenized.set_lines(lines) if range == None: return False if range[0] != range[1]: # non-empty range ... empty=truncation self.change_lines(self.start + range[0], self.start + range[1]) if not self.needs_compile: self.needs_compile = True self.status_changed = True self.needs_execute = False self.statement = None return True def mark_for_execute(self): if self.statement != None and not self.needs_execute: self.statement.mark_for_execute() self.needs_execute = True self.status_changed = True return True else: return False def get_statement(self, worksheet): if not self.statement: self.statement = Statement(self.tokenized.get_text(), worksheet) self.statement.chunk = self return self.statement def update_statement(self): self.status_changed = True if self.statement.state == Statement.COMPILE_SUCCESS: self.needs_compile = False self.needs_execute = True elif self.statement.state == Statement.EXECUTING: self.executing = True elif self.statement.state == Statement.EXECUTE_SUCCESS: self.executing = False self.needs_compile = False self.needs_execute = False if self.results != self.statement.results: self.results_changed = True self.results = self.statement.results self.error_message = None self.error_line = None self.error_offset = None elif self.statement.state == Statement.COMPILE_ERROR: self.needs_compile = True self.needs_execute = True self.error_message = self.statement.error_message self.error_line = self.statement.error_line self.error_offset = self.statement.error_offset self.results = None self.results_changed = True elif self.statement.state == Statement.EXECUTE_ERROR: self.executing = False self.needs_compile = False self.needs_execute = True self.error_message = self.statement.error_message self.error_line = self.statement.error_line self.error_offset = self.statement.error_offset self.results = None self.results_changed = True elif self.statement.state == Statement.INTERRUPTED: self.executing = False self.needs_compile = False self.needs_execute = True self.error_message = "Interrupted" self.error_line = None self.error_offset = None self.results = None self.results_changed = True else: # NEW/EXECUTING should not be hit here raise AssertionError("Unexpected state in Chunk.update_statement()") class BlankChunk(Chunk): """ BlankChunk represents a series of consecutive blank lines. """ def __init__(self, start=-1, end=-1): Chunk.__init__(self, start, end) def __repr__(self): return "BlankChunk(%d,%d)" % (self.start, self.end) class CommentChunk(Chunk): """ CommentChunk represents a series of consecutive comment lines. """ def __init__(self, start=-1, end=-1): Chunk.__init__(self, start, end) def __repr__(self): return "CommentChunk(%d,%d)" % (self.start, self.end) reinteract-0.5.0/lib/reinteract/file_list.py0000664000076400007640000006033211162516344016050 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gobject import gtk import logging import os import pango from notebook import Notebook, NotebookFile, WorksheetFile, MiscFile, LibraryFile _HEADER_COLOR = gtk.gdk.Color(0xffff,0xdddd,0xbbbb) _debug = logging.getLogger("FileList").debug ###################################################################### # Basic sorting primitives: paths and classes of files ###################################################################### def _split_path(path): # Break a relative filesystem path into components result = [] while True: dirname, basename = os.path.split(path) result.append(basename) if dirname == '': break path = dirname result.reverse() return result def _collate(a, b): # Crappy 'collation' ... ignore case unless the two names match in case c = cmp(a.lower(), b.lower()) if c != 0: return c return cmp(a, b) def _compare_paths(a, b): # Compare two relative paths lexicographically by component for f_a,f_b in zip(_split_path(a), _split_path(b)): c = _collate(f_a, f_b) if c != 0: return c return cmp(len(a), len(b)) _file_class_order = {} _file_class_order[WorksheetFile] = 0 _file_class_order[LibraryFile] = 1 _file_class_order[MiscFile] = 2 def _compare_files(file_a, file_b): c = cmp(_file_class_order[file_a.__class__], _file_class_order[file_b.__class__]) if c != 0: return c return _compare_paths(file_a.path, file_b.path) ###################################################################### # Classes for the items in the list ###################################################################### class _Item: def get_text(self): return os.path.basename(self.path) def __cmp__(self, other): c = cmp(_file_class_order[self.klass], _file_class_order[other.klass]) if c != 0: return c c = _compare_paths(self.path, other.path) if c != 0: return c # This is to keep a file and folder with the same path from looking identical # ordering is arbitrary return cmp(self.__class__.__name__, other.__class__.__name__) class _FileItem(_Item): def __init__(self, file): self.file = file self.path = file.path self.klass = file.__class__ def get_text(self): name = _Item.get_text(self) if self.file.modified: return "*" + name else: return name class _FolderItem(_Item): def __init__(self, path, klass): self.path = path self.klass = klass class _HeaderItem(_Item): def __init__(self, klass): # Using a path of '' means it will sort before all the other items of the same class self.path = '' self.klass = klass def get_text(self): if self.klass == WorksheetFile: return "Worksheets" elif self.klass == LibraryFile: return "Libraries" else: return "Other Files" ###################################################################### # Tree view utility ###################################################################### def _next_row_depthfirst(model, iter): # Return the next row after a row in depth-first order if model.iter_has_child(iter): return model.iter_children(iter) while iter != None: next = model.iter_next(iter) if next != None: return next iter = model.iter_parent(iter) return None def _remove_row_depthfirst(model, iter): # Remove a row and returns an iterator to the next row in depth-first order. # (This implementation depends on the TreeStore being "iters_persist") parent = model.iter_parent(iter) if model.remove(iter): return iter while parent != None: next = model.iter_next(parent) if next != None: return next parent = model.iter_parent(parent) return None # Enhance gtk.CellRendererPixbuf to support a background color (use for header rows) class _BgPixbufRenderer(gtk.CellRendererPixbuf): # To simplify, use background_gdk = None, rather than background-set = False background_gdk = gobject.property(type=gobject.TYPE_PYOBJECT) def do_render(self, window, widget, background_area, cell_area, expose_area, flags): if self.background_gdk: cr = window.cairo_create() cr.set_source_color(self.background_gdk) cr.rectangle(background_area) cr.fill() gtk.CellRendererPixbuf.do_render(self, window, widget, background_area, cell_area, expose_area, flags) ###################################################################### class FileList(gtk.TreeView): __gsignals__ = { 'open-file': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)), 'close-file': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)), 'rename-file': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)), 'delete-file': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)), 'row-activated': 'override', 'destroy': 'override' } def __init__(self, notebook): self.__model = gtk.TreeStore(gobject.TYPE_PYOBJECT) gtk.TreeView.__init__(self, self.__model) self.notebook = notebook self.__files_changed_handler = self.notebook.connect('files-changed', self.on_files_changed) column = gtk.TreeViewColumn() self.append_column(column) column.set_resizable(gtk.TREE_VIEW_COLUMN_AUTOSIZE) cell_renderer = _BgPixbufRenderer() cell_renderer.props.stock_size = gtk.ICON_SIZE_MENU width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU) cell_renderer.props.width = width cell_renderer.props.height = height column.pack_start(cell_renderer, False) column.set_cell_data_func(cell_renderer, self.__state_cell_data_func) cell_renderer = gtk.CellRendererText() column.pack_start(cell_renderer, True) column.set_cell_data_func(cell_renderer, self.__filename_cell_data_func) self.set_headers_visible(False) self.get_selection().set_select_function(self.__select_function) self.__rescan() def do_button_press_event(self, event): # We hard-code support for the Mac-style control-click here because the # rename/delete functionality is only available in the popup menu, so # there needs to be a way for everybody to get to ti. if (event.window == self.get_bin_window() and event.button == 3 or (event.button == 1 and event.state == gtk.gdk.CONTROL_MASK)): info = self.get_path_at_pos(int(event.x), int(event.y)) if info == None: return False path, column, cell_x, cell_y = info self.set_cursor(path, column) self.grab_focus() iter = self.__model.get_iter(path) self.__popup_menu(iter, event) return True else: return gtk.TreeView.do_button_press_event(self, event) def do_destroy(self): iter = self.__model.get_iter_first() while iter: item = self.__model.get_value(iter, 0) self.__disconnect_item(item) iter = _next_row_depthfirst(self.__model, iter) self.notebook.disconnect(self.__files_changed_handler) def do_row_activated(self, path, column): iter = self.__model.get_iter(path) item = self.__model.get_value(iter, 0) if isinstance(item, _FileItem): self.emit('open-file', item.file) def do_popup_menu(self): _, iter = self.get_selection().get_selected() self.__popup_menu(iter) def __filename_cell_data_func(self, column, cell, model, iter): item = model.get_value(iter, 0) cell.props.text = item.get_text() if isinstance(item, _HeaderItem): cell.props.background_gdk = _HEADER_COLOR else: cell.props.background_set = False if isinstance(item, _FileItem) and item.file.active: cell.props.weight = pango.WEIGHT_BOLD else: cell.props.weight_set = False def __state_cell_data_func(self, column, cell, model, iter): item = model.get_value(iter, 0) if isinstance(item, _HeaderItem): cell.props.background_gdk = gtk.gdk.Color(0xffff,0xdddd,0xbbbb) else: cell.props.background_gdk = None if isinstance(item, _FileItem): cell.props.stock_id = NotebookFile.stock_id_for_state(item.file.state) else: cell.props.stock_id = None def __select_function(self, path): obj = self.__model.get_value(self.__model.get_iter(path), 0) return isinstance(obj, _FileItem) ############################################################ def __iter_for_item(self, item): iter = self.__model.get_iter_first() while iter: row_item = self.__model.get_value(iter, 0) if row_item == item: return iter iter = _next_row_depthfirst(self.__model, iter) return None def __iter_for_file(self, file): iter = self.__model.get_iter_first() while iter: row_item = self.__model.get_value(iter, 0) if isinstance(row_item, _FileItem) and row_item.file == file: return iter iter = _next_row_depthfirst(self.__model, iter) return None def __refresh_item(self, item): iter = self.__iter_for_item(item) path = self.__model.get_path(iter) self.__model.row_changed(path, iter) def __connect_item(self, item): if isinstance(item, _FileItem): item.notify_active_handler = item.file.connect('notify::active', lambda *args: self.__refresh_item(item)) item.notify_modified_handler = item.file.connect('notify::modified', lambda *args: self.__refresh_item(item)) item.notify_state_handler = item.file.connect('notify::state', lambda *args: self.__refresh_item(item)) item.worksheet = None item.notify_code_modified_handler = 0 def __disconnect_item(self, item): if isinstance(item, _FileItem): item.file.disconnect(item.notify_active_handler) item.notify_active_handler = None item.file.disconnect(item.notify_modified_handler) item.notify_modified_handler = None item.file.disconnect(item.notify_state_handler) item.notify_state_handler = None def __popup_menu(self, iter, event=None): item = self.__model.get_value(iter, 0) if not isinstance(item, _FileItem): return menu = gtk.Menu() menu_item = gtk.ImageMenuItem(stock_id="gtk-open") menu_item.set_sensitive(not item.file.active) menu_item.connect('activate', lambda m: self.emit('open-file', item.file)) menu.add(menu_item) menu_item = gtk.ImageMenuItem(stock_id="gtk-close") menu_item.set_sensitive(item.file.active) menu_item.connect('activate', lambda m: self.emit('close-file', item.file)) menu.add(menu_item) menu_item = gtk.SeparatorMenuItem() menu.add(menu_item) menu_item = gtk.MenuItem("Rename...") menu_item.connect('activate', lambda m: self.emit('rename-file', item.file)) menu.add(menu_item) menu_item = gtk.ImageMenuItem(stock_id="gtk-delete") menu_item.set_sensitive(not item.file.modified) menu_item.connect('activate', lambda m: self.emit('delete-file', item.file)) menu.add(menu_item) menu.show_all() if event: button = event.button time = event.time position_func = None else: # Triggered from the keyboard button = -1 time = gtk.get_current_event_time() # Position the popup with respect to the row in the TreeView that # we are popping it up for, not wherever the mouse happens to be def position_func(menu): # Reference point is the middle of the cell cell_rect = self.get_cell_area(self.__model.get_path(iter), self.get_column(0)) window_x, window_y = self.get_bin_window().get_origin() x = window_x + cell_rect.x + cell_rect.width / 2 y = window_y + cell_rect.y + cell_rect.height / 2 # Make sure we fit within the monitor monitor_n = self.get_screen().get_monitor_at_point(x, y) monitor_rect = self.get_screen().get_monitor_geometry(monitor_n) width, height = menu.size_request() if x < monitor_rect.x: x = monitor_rect.x elif x + width >= monitor_rect.x + monitor_rect.width: x = monitor_rect.x + monitor_rect.width - width if y < monitor_rect.y: y = monitor_rect.y elif y + height >= monitor_rect.y + monitor_rect.height: # At the bottom we position above the reference point rather # then just forcing onto the screen by the minimum amount y = window_y + cell_rect.y + cell_rect.height / 2 - height return (x, y, False) menu.popup(None, None, position_func, button, time) ############################################################ def __iter_items(self): # Generator yielding all the items to display in the list in order klass = None path = [] for file in sorted(self.notebook.files.values(), _compare_files): if file.__class__ != klass: klass = file.__class__ path = [] yield (_HeaderItem(file.__class__), len(path)) new_path = _split_path(file.path)[0:-1] while len(path) > len(new_path) or (len(path) > 0 and path[len(path) - 1] != new_path[len(path) - 1]): path.pop() while len(new_path) > len(path): folder_name = new_path[len(path)] path.append(folder_name) yield (_FolderItem(os.path.join(*new_path[0:len(path)]), klass), len(path) - 1) yield (_FileItem(file), len(path)) def __rescan(self): # # Compare the items that should be in the list (from __iter_items) with the items that are # currently in the list, insert missing items, and remove items that no longer in the list. # We go through quite a bit of trouble here to make the minimal set of inserts and removals # rather than just starting over from scratch to avoid problems with scroll position, # selection, and expanded state that will occur if we delete everything and add them again. # Efficiency is not the main concern. # depth = 0 parent = None next_old = self.__model.get_iter_first() seen_folders = False for (item, new_depth) in self.__iter_items(): # Delete old items that are logically before the next item found_item = False while next_old != None: old_item = self.__model.get_value(next_old, 0) c = cmp(item, old_item) if c < 0: break elif c == 0: found_item = True iter = next_old next_old = _next_row_depthfirst(self.__model, next_old) break else: next_parent = self.__model.iter_parent(next_old) _debug("Removing %s", old_item.get_text()) next_old = _remove_row_depthfirst(self.__model, next_old) self.__disconnect_item(next_old) while new_depth < depth: parent = self.__model.iter_parent(parent) depth -= 1 if not found_item: if next_old: _debug("Inserting %s before %s", item.get_text(), self.__model.get_value(next_old, 0).get_text()) else: _debug("Appending %s", item.get_text()) next = None if next_old: if parent: parent_path = self.__model.get_path(parent) else: parent_path = () if self.__model.get_path(next_old)[0:-1] == parent_path: next = next_old iter = self.__model.insert_before(parent, next) self.__model.set_value(iter, 0, item) self.__connect_item(item) next_old = _next_row_depthfirst(self.__model, iter) if isinstance(item, _FolderItem): seen_folders = True parent = iter depth += 1 while next_old != None: next_old = _remove_row_depthfirst(self.__model, next_old) self.set_show_expanders(seen_folders) def on_files_changed(self, notebook): self.__rescan() ############################################################ def select_file(self, file): """Select the row corresponding to the given file. The row will be scrolled into the visible area if necesary. @param file the file to select """ iter = self.__iter_for_file(file) if iter == None: return self.set_cursor(self.__model.get_path(iter), self.get_column(0)) ###################################################################### if __name__ == '__main__': #pragma: no cover import sys if "-d" in sys.argv: logging.basicConfig(level=logging.DEBUG, format="DEBUG: %(message)s") def expect_split_path(p, expected): if _split_path(p) != expected: raise AssertionError("For %r got %s expected %s" % (p, _split_path(p), expected)) expect_split_path("", [""]) expect_split_path("a", ["a"]) expect_split_path("a/b", ["a", "b"]) def expect_compare_paths(a, b, expected): if _compare_paths(a, b) != expected: raise AssertionError("For %r <=> %r got %s expected %s" % (a, b, _compare_paths(a, b), expected)) if _compare_paths(b, a) != - expected: raise AssertionError("For %r <=> %r got %s expected %s" % (a, b, _compare_paths(b, a), - expected)) expect_compare_paths("a", "a", 0) expect_compare_paths("a", "b", -1) expect_compare_paths("a", "a/b", -1) expect_compare_paths("a/a", "a/b", -1) expect_compare_paths("a/b", "a/b", 0) import tempfile notebook_folder = tempfile.mkdtemp("", "reinteract_notebook.") def make_folder(relative): absolute = os.path.join(notebook_folder, relative) os.mkdir(absolute) def make_file(relative): absolute = os.path.join(notebook_folder, relative) open(absolute, 'w').close() def remove(relative=None): if relative: absolute = os.path.join(notebook_folder, relative) else: absolute = notebook_folder if os.path.isdir(absolute): for root, dirs, files in os.walk(absolute, topdown=False): for name in files: os.remove(os.path.join(root, name)) for name in dirs: os.rmdir(os.path.join(root, name)) os.rmdir(absolute) else: os.remove(absolute) try: make_folder("subdir") make_file("worksheet_a.rws") make_file("subdir/worksheet_c.rws") make_file("library_a.py") make_file("subdir/library_b.py") notebook = Notebook(notebook_folder) file_list = FileList(notebook) def expect(*expected_items): items = [] model = file_list.get_model() iter = model.get_iter_first() while iter: depth = len(model.get_path(iter)) - 1 items.append((">" * depth) + model.get_value(iter, 0).get_text()) iter = _next_row_depthfirst(model, iter) if items != list(expected_items): raise AssertionError("Got %s expected %s" % (items, expected_items)) expect("Worksheets", "subdir", ">worksheet_c.rws", "worksheet_a.rws", "Libraries", "library_a.py", "subdir", ">library_b.py") remove("subdir/worksheet_c.rws") notebook.refresh() expect("Worksheets", "worksheet_a.rws", "Libraries", "library_a.py", "subdir", ">library_b.py") make_folder("subdir/subsubdir") make_file("subdir/subsubdir/misc.txt") notebook.refresh() expect("Worksheets", "worksheet_a.rws", "Libraries", "library_a.py", "subdir", ">library_b.py", "Other Files", "subdir", ">subsubdir", ">>misc.txt") # Test insertion where the next item is at the toplevel make_file("worksheet_b.rws") notebook.refresh() expect("Worksheets", "worksheet_a.rws", "worksheet_b.rws", "Libraries", "library_a.py", "subdir", ">library_b.py", "Other Files", "subdir", ">subsubdir", ">>misc.txt") # Test insertion where the next item is at the same sublevel make_file("subdir/library_0.py") notebook.refresh() expect("Worksheets", "worksheet_a.rws", "worksheet_b.rws", "Libraries", "library_a.py", "subdir", ">library_0.py", ">library_b.py", "Other Files", "subdir", ">subsubdir", ">>misc.txt") # Test insertion where the next item is at a lower level make_file("subdir/library_c.py") notebook.refresh() expect("Worksheets", "worksheet_a.rws", "worksheet_b.rws", "Libraries", "library_a.py", "subdir", ">library_0.py", ">library_b.py", ">library_c.py", "Other Files", "subdir", ">subsubdir", ">>misc.txt") # Test a removal where the next row is at a lower level remove("subdir/library_c.py") notebook.refresh() expect("Worksheets", "worksheet_a.rws", "worksheet_b.rws", "Libraries", "library_a.py", "subdir", ">library_0.py", ">library_b.py", "Other Files", "subdir", ">subsubdir", ">>misc.txt") # Test a removal of trailing items make_file("subdir/aaa.txt") remove("subdir/subsubdir/misc.txt") notebook.refresh() expect("Worksheets", "worksheet_a.rws", "worksheet_b.rws", "Libraries", "library_a.py", "subdir", ">library_0.py", ">library_b.py", "Other Files", "subdir", ">aaa.txt") remove("library_a.py") remove("subdir/library_0.py") remove("subdir/library_b.py") notebook.refresh() expect("Worksheets", "worksheet_a.rws", "worksheet_b.rws", "Other Files", "subdir", ">aaa.txt") finally: remove() file_list.destroy() reinteract-0.5.0/lib/reinteract/test_utils.py0000664000076400007640000000062411072035647016275 00000000000000# Copyright 2008 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## def assert_equals(result, expected): if result != expected: raise AssertionError("Got %r, expected %r" % (result, expected)) reinteract-0.5.0/lib/reinteract/doc_format.py0000664000076400007640000000330011072035051016172 00000000000000# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import re import pydoc import gtk from data_format import insert_with_tag, is_data_object BOLD_RE = re.compile("(?:(.)\b(.))+") STRIP_BOLD_RE = re.compile("(.)\b(.)") def insert_docs(buf, iter, obj, bold_tag): """Insert documentation about obj into a gtk.TextBuffer @param buf: the buffer to insert the documentation into @param iter: the location to insert the documentation @param obj: the object to get documentation about @param bold_tag: the tag to use for bold text, such as headings """ # If the routine is an instance, we get help on the type instead if is_data_object(obj): obj = type(obj) name = getattr(obj, '__name__', None) document = pydoc.text.document(obj, name) # pydoc.text.document represents boldface with overstrikes, we need to # reverse engineer this and find the spans of bold text pos = 0 while True: m = BOLD_RE.search(document, pos) if m == None: # Strip the trailing newline; this isn't very justifiable in general terms, # but matches what we need in Reinteract if document.endswith("\n"): buf.insert(iter, document[pos:-1]) else: buf.insert(iter, document[pos:]) break buf.insert(iter, document[pos:m.start()]) insert_with_tag(buf, iter, STRIP_BOLD_RE.sub(lambda m: m.group(1), m.group()), bold_tag) pos = m.end() reinteract-0.5.0/lib/reinteract/change_range.py0000664000076400007640000001042311072034666016475 00000000000000# Copyright 2008 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## class ChangeRange(object): """ The ChangeRange class is used to track what lines have changed, both for an overall WorkSheet and within individual chunks. The represention is a [start,end) range of lines within the range that have changed and a delta of how many lines have been inserted or deleted. (That it tracks changed lines is purely conventional, the same object could be used to track any other list of items.) """ def __init__(self, start=-1, end=-1): self.start = start self.end = end self.delta = end - start def empty(self): """Return True if no lines have been inserted, deleted or changed""" return self.delta == 0 and self.start == self.end def change(self, start, end): """Mark a range of lines as having changed""" if self.empty(): self.start = start self.end = end else: self.start = min(self.start, start) self.end = max(self.end, end) def insert(self, position, count): """Adjust the change range for an insertion""" if self.empty(): self.start = position self.end = position + count else: if position < self.start: self.start = position self.end += count elif position < self.end: self.end += count else: self.end = position + count self.delta += count def delete_range(self, start, end): """Adjust the change range for a deletion""" if self.empty(): self.start = self.end = start else: if self.start >= end: self.start -= end - start elif self.start >= start: self.start = start if self.end >= end: self.end -= end - start elif self.end >= start: self.end = start self.delta -= (end - start) def clear(self): """Clear the change range and reset to initial values""" self.start = self.end = -1 self.delta = 0 def __repr__(self): return "ChangeRange(%d,%d,%d)" % (self.start, self.end, self.delta) ###################################################################### if __name__ == '__main__': #pragma: no cover changes = ChangeRange() def expect(start, end, delta): if (changes.start, changes.end, delta) != (start, end, delta): raise AssertionError("Got %r, Expected %r" % ((changes.start, changes.end, delta), (start, end, delta))) # change() changes.change(1, 2) expect(1, 2, 0) changes.change(0, 3) expect(0, 3, 0) changes.clear() changes.change(0, 1) changes.change(2, 3) expect(0, 3, 0) # insert_lines() changes.clear() changes.insert(1,1) expect(1, 2, 1) changes.clear() changes.change(3,5) changes.insert(0,1) expect(0, 6, 1) changes.clear() changes.change(3,5) changes.insert(4,1) expect(3, 6, 1) changes.clear() changes.change(3,4) changes.insert(5,1) expect(3, 6, 1) # delete_range() changes.clear() changes.delete_range(0, 1) expect(0, 0, -1) changes.clear() changes.change(3, 6) changes.delete_range(0, 1) expect(2, 5, -1) changes.clear() changes.change(3, 6) changes.delete_range(2, 4) expect(2, 4, -2) changes.clear() changes.change(3, 6) changes.delete_range(4, 5) expect(3, 5, -1) changes.clear() changes.change(3, 6) changes.delete_range(5, 7) expect(3, 5, -2) changes.clear() changes.change(3, 6) changes.delete_range(7, 8) expect(3, 6, -1) changes.clear() changes.change(3, 6) changes.delete_range(2, 7) expect(2, 2, -5) # Combinations of insertions and deletions changes.clear() changes.insert(2, 2) changes.delete_range(2, 4) expect(2, 2, 0) # since the changes above were a no-op, we start from scratch changes.insert(0, 1) expect(0, 1, 1) reinteract-0.5.0/lib/reinteract/notebook.py0000664000076400007640000004220011162516344015710 00000000000000# Copyright 2007-2009 Owen Taylor # Copyright 2008 Jon Kuhn # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import copy import gobject import imp import os import pkgutil import sys from notebook_info import NotebookInfo # Used to give each notebook a unique namespace _counter = 1 # Hook the import function in the global __builtin__ module; this is used to make # imports from a notebook locally scoped to that notebook. We do it this way # rather than replacing __builtins__ to avoid triggering restricted mode. import __builtin__ saved_import = __builtin__.__import__ def reinteract_import(name, globals=None, locals=None, fromlist=None, level=-1): if globals and '__reinteract_notebook' in globals: return globals['__reinteract_notebook'].do_import(name, globals, locals, fromlist, level) else: return saved_import(name, globals, locals, fromlist, level) __builtin__.__import__ = reinteract_import class HelpResult: def __init__(self, arg): self.arg = arg class _Helper: # We use a callable object here rather than a function so that we handle # help without arguments, just like the help builtin def __repr__(self): return "Type help(object) for help about object" def __call__(self, arg=None): if arg == None: return self return HelpResult(arg) ###################################################################### class NotebookFile(gobject.GObject): NONE = 0 NEEDS_EXECUTE = 1 EXECUTING = 2 EXECUTE_SUCCESS = 3 ERROR = 4 active = gobject.property(type=bool, default=False) modified = gobject.property(type=bool, default=False) state = gobject.property(type=int, default=NONE) worksheet = gobject.property(type=gobject.TYPE_PYOBJECT) # Having this here in the core code is completely random, however it doesn't actually # require importing GTK+, it's just returning a string. @staticmethod def stock_id_for_state(state): """Get the GTK+ stock ID to use for a particular state.""" if state == NotebookFile.NONE: return None elif state == NotebookFile.NEEDS_EXECUTE: return 'gtk-ok' elif state == NotebookFile.EXECUTING: return 'gtk-refresh' elif state == NotebookFile.EXECUTE_SUCCESS: return 'gtk-apply' elif state == NotebookFile.ERROR: return 'gtk-dialog-error' def __init__(self, path): gobject.GObject.__init__(self) self.path = path class WorksheetFile(NotebookFile): pass class LibraryFile(NotebookFile): pass class MiscFile(NotebookFile): pass ###################################################################### class Notebook(gobject.GObject): __gsignals__ = { 'files-changed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()) } def __init__(self, folder=None): gobject.GObject.__init__(self) global _counter self.__prefix = "__reinteract" + str(_counter) _counter += 1 self.folder = folder if folder: path = [folder] else: path = [] self.__path = path self.__modules = {} self.__root_module = imp.new_module(self.__prefix) self.__root_module.path = path sys.modules[self.__prefix] = self.__root_module self.files = {} self.worksheets = set() if folder: self.info = NotebookInfo(folder) else: self.info = None self.refresh() ############################################################ # Loading and Saving ############################################################ def __load_files(self, folder, old_files, new_files): if folder: full_folder = os.path.join(self.folder, folder) else: full_folder = self.folder files_added = False for f in os.listdir(full_folder): if folder == None and f == "index.rnb": continue # We handle filenames starting with . as hidden on all platforms, # valuing notebook portability over exact correspondance with # local convention. if f.startswith('.'): continue if folder: relative = os.path.join(folder, f) else: relative = f full_path = os.path.join(full_folder, f) if os.path.isdir(full_path): files_added = self.__load_files(relative, old_files, new_files) or files_added elif relative in old_files: new_files[relative] = old_files[relative] del old_files[relative] elif f.endswith('~'): pass else: lower = f.lower() if lower.endswith('.rws'): file = WorksheetFile(relative) absolute = os.path.join(full_folder, f) for worksheet in self.worksheets: if worksheet.filename and os.path.abspath(worksheet.filename) == absolute: file.worksheet = worksheet break elif lower.endswith('.py'): file = LibraryFile(relative) elif lower.endswith('.pyc') or lower.endswith('.pyo'): continue else: file = MiscFile(relative) new_files[relative] = file files_added = True return files_added ############################################################ # Import handling ############################################################ def __reset_all_modules(self): for (name, module) in self.__modules.iteritems(): del sys.modules[self.__prefix + "." + name] for worksheet in self.worksheets: worksheet.module_changed(name) self.__modules = {} def reset_module_by_filename(self, filename): filename = filename.lower() for (name, module) in self.__modules.iteritems(): # If the .py changed, we need to reload the module even if it was # loaded from a .pyc file. module_file = module.__file__.lower() if module_file.endswith(".pyc") or module_file.endswith(".pyo"): module_file = module_file[:-3] + "py" if module_file == filename: del sys.modules[self.__prefix + "." + name] del self.__modules[name] for worksheet in self.worksheets: worksheet.module_changed(name) return module def __load_local_module(self, fullname, loader): prefixed = self.__prefix + "." + fullname # Trick ... to change the builtins array for the module we are about # to load, we stick an empty module initialized the way we want into # sys.modules and count on imp.load_module() finding that and doing # the rest of the loading into that module new = imp.new_module(prefixed) self.setup_globals(new.__dict__) assert not prefixed in sys.modules sys.modules[prefixed] = new result = loader.load_module(prefixed) assert result == new return result # Unlike imp.find_module(), pkgutil.find_loader() doesn't take a path # argument, so when we want to look in a specific path we need to "roll # our own" out of lower level functionality. def __find_loader_in_path(self, fullname, path): for item in path: importer = pkgutil.get_importer(item) loader = importer.find_module(fullname) if loader is not None: return loader raise ImportError("no module named " + fullname) def __find_and_load(self, fullname, name, parent=None, local=None): # The 'imp' module doesn't support PEP 302 extensions like # sys.path_hooks (used for zipped eggs), so we use (undocumented) # functionality from pkgutil instead. if parent == None: assert local == None try: loader = self.__find_loader_in_path(fullname, self.__path) local = True except ImportError: loader = pkgutil.find_loader(fullname) if loader is None: raise ImportError("no module named " + fullname) local = False else: assert local != None if hasattr(parent, '__path__'): loader = self.__find_loader_in_path(fullname, parent.__path__) else: raise ImportError("no module named " + fullname) if local: module = self.__load_local_module(fullname, loader) self.__modules[name] = module else: module = loader.load_module(fullname) if parent != None: parent.__dict__[name] = module return module, local def __import_recurse(self, names): fullname = ".".join(names) try: return self.__modules[fullname], True except KeyError: pass try: return sys.modules[fullname], False except KeyError: pass if len(names) == 1: module, local = self.__find_and_load(fullname, names[-1]) else: parent, local = self.__import_recurse(names[0:-1]) module, _ = self.__find_and_load(fullname, names[-1], parent=parent, local=local) return module, local def __ensure_from_list_item(self, fullname, fromname, module, local): if fromname == "*": # * inside __all__, ignore return if not isinstance(fromname, basestring): raise TypeError("Item in from list is not a string") try: getattr(module, fromname) except AttributeError: self.__find_and_load(fullname + "." + fromname, fromname, parent=module, local=local) def do_import(self, name, globals=None, locals=None, fromlist=None, level=None): # Holding the import lock around the whole import process matches what # Python does internally. This does mean that the machinery of loading a slow # import blocks the import of an already loaded module in a different thread. # You could imagine trying to do the lookup without the lock and locking only # for loading, but ensuring the safety of that would be quite complex imp.acquire_lock() try: names = name.split('.') module, local = self.__import_recurse(names) if fromlist != None: # In 'from a.b import c', if a.b.c doesn't exist after loading a.b, The built-in # __import__ will try to load a.b.c as a module; do the same here. for fromname in fromlist: if fromname == "*": try: all = getattr(module, "__all__") for allname in all: self.__ensure_from_list_item(name, allname, module, local) except AttributeError: pass else: self.__ensure_from_list_item(name, fromname, module, local) return module elif local: return self.__modules[names[0]] else: return sys.modules[names[0]] finally: imp.release_lock() ############################################################ # Worksheet tracking ############################################################# def _add_worksheet(self, worksheet): # Called from Worksheet self.worksheets.add(worksheet) def _remove_worksheet(self, worksheet): # Called from Worksheet self.worksheets.remove(worksheet) ############################################################ # Public API ############################################################ def refresh(self): if not self.folder: return old_files = self.files self.files = {} files_added = self.__load_files(None, old_files, self.files) if files_added or len(old_files) > 0: self.emit('files-changed') def set_path(self, path): if path != self.__path: self.__path = path self.__root_module.path = path self.__reset_all_modules() def setup_globals(self, globals): globals['__reinteract_notebook'] = self globals['__reinteract_copy'] = copy.copy globals['help'] = _Helper() def file_for_absolute_path(self, absolute_path): assert absolute_path assert os.path.isabs(absolute_path) if not self.folder: return None relpath = None while absolute_path != self.folder: absolute_path, basename = os.path.split(absolute_path) if basename == '': # At root directory (or input had trailing slash) return None if relpath == None: relpath = basename else: relpath = os.path.join(basename, relpath) if relpath and relpath in self.files: return self.files[relpath] else: return None def save(self): pass if __name__ == '__main__': import copy import os import tempfile import zipfile from test_utils import assert_equals base = tempfile.mkdtemp("", "shell_buffer") def cleanup(): for root, dirs, files in os.walk(base, topdown=False): for name in files: os.remove(os.path.join(root, name)) for name in dirs: os.rmdir(os.path.join(root, name)) def cleanup_pyc(): # Not absolutely necessary, but makes things less confusing if we do # this between tests for root, dirs, files in os.walk(base, topdown=False): for name in files: if name.endswith(".pyc"): os.remove(os.path.join(root, name)) def write_file(name, contents): absname = os.path.join(base, name) dirname = os.path.dirname(absname) try: os.makedirs(dirname) except: pass f = open(absname, "w") f.write(contents) f.close() def write_zipfile(zippath, name, contents): abspath = os.path.join(base, zippath) dirpath = os.path.dirname(abspath) try: os.makedirs(dirpath) except: pass if os.path.exists(abspath): zip = zipfile.ZipFile(abspath, "a") else: zip = zipfile.ZipFile(abspath, "w") zip.writestr(name, contents) zip.close() def do_test(import_text, evaluate_text, expected): nb = Notebook(base) scope = {} nb.setup_globals(scope) exec import_text in scope result = eval(evaluate_text, scope) assert_equals(result, expected) cleanup_pyc() try: write_file("mod1.py", "a = 1") write_file("package1/__init__.py", "__all__ = ['mod2']") write_file("package1/mod2.py", "b = 2") write_file("package2/__init__.py", "") write_file("package2/mod3.py", "import package1.mod2\nc = package1.mod2.b + 1") sys.path.append(os.path.join(base, "ZippedModules.zip")) write_zipfile("ZippedModules.zip", "zipmod.py", "d = 4"); write_zipfile("ZippedModules.zip", "zippackage/__init__.py", ""); write_zipfile("ZippedModules.zip", "zippackage/mod2.py", "e = 5"); do_test("import mod1", "mod1.__file__", os.path.join(base, "mod1.py")) do_test("import mod1", "mod1.a", 1) do_test("import mod1 as m", "m.a", 1) do_test("from mod1 import a", "a", 1) do_test("from mod1 import a as a2", "a2", 1) do_test("import package1.mod2", "package1.mod2.b", 2) do_test("import package1.mod2 as m", "m.b", 2) do_test("from package1 import mod2", "mod2.b", 2) do_test("from package1 import *", "mod2.b", 2) # http://www.reinteract.org/trac/ticket/5 do_test("import package2.mod3", "package2.mod3.c", 3) do_test("import zipmod", "zipmod.d", 4) do_test("import zippackage.mod2", "zippackage.mod2.e", 5) nb = Notebook(base) assert_equals(nb.file_for_absolute_path(os.path.dirname(base)), None) assert_equals(nb.file_for_absolute_path(base), None) assert_equals(nb.file_for_absolute_path(os.path.join(base, "mod1.py")).path, "mod1.py") assert_equals(nb.file_for_absolute_path(os.path.join(base, "package1")), None) assert_equals(nb.file_for_absolute_path(os.path.join(base, "package1/")), None) assert_equals(nb.file_for_absolute_path(os.path.join(base, "package1/mod2.py")).path, "package1/mod2.py") finally: cleanup() reinteract-0.5.0/lib/reinteract/window_builder.py0000664000076400007640000000141311072035727017107 00000000000000# Copyright 2008 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import os import gtk from global_settings import global_settings class WindowBuilder: def __init__(self, name): filename = os.path.join(global_settings.dialogs_dir, name + ".xml") self.builder = gtk.Builder() self.builder.add_from_file(filename) def __getattr__(self, name): obj = self.builder.get_object(name) if obj: return obj else: raise AttributeError("%s instance has no attribute '%s'" % (self.__class__.__name__, name)) reinteract-0.5.0/lib/reinteract/notebook_window.py0000664000076400007640000001735611162516344017315 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk import os from base_notebook_window import BaseNotebookWindow from file_list import FileList from format_escaped import format_escaped from notebook import NotebookFile, WorksheetFile, LibraryFile from save_file import SaveFileBuilder gtk.rc_parse_string( """ style "notebook-close-button" { GtkWidget::focus-line-width = 0 GtkWidget::focus-padding = 0 GtkButton::inner-border = { 0, 0, 0, 0 } } widget "*.notebook-close-button" style : highest "notebook-close-button" """) class NotebookWindow(BaseNotebookWindow): UI_STRING=""" """ def __init__(self, notebook): BaseNotebookWindow.__init__(self, notebook) self.window.set_default_size(800, 800) ####################################################### # Overrides ####################################################### def _fill_content(self): hpaned = gtk.HPaned() position = self.state.get_pane_position() if position == -1: hpaned.set_position(200) else: hpaned.set_position(position) hpaned.connect('notify::position', self.on_hpaned_notify_position) self.main_vbox.pack_start(hpaned, expand=True, fill=True) scrolled_window = gtk.ScrolledWindow() scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) hpaned.pack1(scrolled_window, resize=False) self.__file_list = FileList(self.notebook) scrolled_window.add(self.__file_list) self.__file_list.connect('open-file', self.on_file_list_open_file) self.__file_list.connect('close-file', self.on_file_list_close_file) self.__file_list.connect('rename-file', self.on_file_list_rename_file) self.__file_list.connect('delete-file', self.on_file_list_delete_file) hpaned.pack2(self.nb_widget, resize=True) self.nb_widget.set_scrollable(True) def _add_editor(self, editor): # Set first since _add_editor() calls _update_editor_title() editor._notebook_tab_label = gtk.Label() editor._notebook_tab_status = gtk.Image() editor._notebook_tab_status.props.icon_size = gtk.ICON_SIZE_MENU BaseNotebookWindow._add_editor(self, editor) label_widget = gtk.HBox(False, 4) label_widget.pack_start(editor._notebook_tab_status, True, True, 0) label_widget.pack_start(editor._notebook_tab_label, True, True, 0) tab_button = gtk.Button() tab_button.set_name('notebook-close-button') tab_button.set_relief(gtk.RELIEF_NONE) tab_button.props.can_focus = False tab_button.connect('clicked', lambda *args: self.on_tab_close_button_clicked(editor)) label_widget.pack_start(tab_button, False, False, 0) close = gtk.image_new_from_stock('gtk-close', gtk.ICON_SIZE_MENU) tab_button.add(close) label_widget.show_all() self.nb_widget.set_tab_label(editor.widget, label_widget) self.nb_widget.set_tab_reorderable(editor.widget, True) def _update_editor_title(self, editor): BaseNotebookWindow._update_editor_title(self, editor) editor._notebook_tab_label.set_text(editor.title) def _update_editor_state(self, editor): BaseNotebookWindow._update_editor_state(self, editor) editor._notebook_tab_status.props.stock = NotebookFile.stock_id_for_state(editor.state) ####################################################### # Callbacks ####################################################### def on_tab_close_button_clicked(self, editor): self._close_editor(editor) def on_file_list_open_file(self, file_list, file): self.open_file(file) def on_file_list_close_file(self, file_list, file): for editor in self.editors: if editor.file == file: self._close_editor(editor) def on_file_list_rename_file(self, file_list, file): if file.active: # If we have the file open, we need to rename via the editor for editor in self.editors: if editor.file == file: editor.rename() # Reselect the new item in the list new_file = self.notebook.file_for_absolute_path(editor.filename) file_list.select_file(new_file) else: # Otherwise do it directly def check_name(name): return name != "" and name != file.path def do_rename(new_path): old_path = os.path.join(self.notebook.folder, file.path) os.rename(old_path, new_path) self.notebook.refresh() # Reselect the new item in the list new_file = self.notebook.file_for_absolute_path(new_path) file_list.select_file(new_file) title = "Rename '%s'" % file.path builder = SaveFileBuilder(title, file.path, "Rename", check_name) builder.dialog.set_transient_for(self.window) builder.name_entry.set_text(file.path) if isinstance(file, WorksheetFile): extension = "rws" elif isinstance(file, LibraryFile): extension = "py" else: extension = "" builder.prompt_for_name(self.notebook.folder, extension, do_rename) builder.dialog.destroy() def on_file_list_delete_file(self, file_list, file): dialog = gtk.MessageDialog(parent=self.window, buttons=gtk.BUTTONS_NONE, type=gtk.MESSAGE_WARNING) message = format_escaped("Really delete '%s'?", file.path) dialog.set_markup(message) dialog.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_DELETE, gtk.RESPONSE_OK) dialog.set_default_response(gtk.RESPONSE_CANCEL) response = dialog.run() dialog.destroy() if response != gtk.RESPONSE_OK: return for editor in self.editors: if editor.file == file: self._close_editor(editor) abspath = os.path.join(self.notebook.folder, file.path) os.remove(abspath) self.notebook.refresh() def on_hpaned_notify_position(self, pane, gparamspec): self.state.set_pane_position(pane.get_property('position')) reinteract-0.5.0/lib/reinteract/about_dialog.py0000664000076400007640000000372411162516344016531 00000000000000# Copyright 2007-2009 Owen Taylor # Copyright 2007 Luis Medina # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk import os import sys from global_settings import global_settings def _find_program_in_path(progname): try: path = os.environ['PATH'] except KeyError: path = os.defpath for dir in path.split(os.pathsep): p = os.path.join(dir, progname) if os.path.exists(p): return p return None def _find_url_open_program(): if sys.platform == 'darwin': return '/usr/bin/open' for progname in ['xdg-open', 'htmlview', 'gnome-open']: path = _find_program_in_path(progname) if path != None: return path return None def _open_url(dialog, url): prog = _find_url_open_program() os.spawnl(os.P_NOWAIT, prog, prog, url) class AboutDialog(gtk.AboutDialog): def __init__(self): if _find_url_open_program() != None: gtk.about_dialog_set_url_hook(_open_url) gtk.AboutDialog.__init__(self) self.set_name("Reinteract") if global_settings.icon_file.endswith(".icns"): # Workaround for limitations of the .icns loader; it can't do # the incremental loading needed for from_file_at_size() icon = gtk.gdk.pixbuf_new_from_file(global_settings.icon_file) icon = icon.scale_simple(64, 64, gtk.gdk.INTERP_BILINEAR) else: icon = gtk.gdk.pixbuf_new_from_file_at_size(global_settings.icon_file, 64, 64) self.set_logo(icon) self.set_version(global_settings.version) self.set_copyright("Copyright \302\251 2007-2009 Owen Taylor, Red Hat, Inc., and others") self.set_website("http://www.reinteract.org") self.connect("response", lambda d, r: d.destroy()) reinteract-0.5.0/lib/reinteract/application.py0000664000076400007640000001651111162516344016401 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## # # The global application object; it from global_settings because it handles tracking # the user interface objects of the current session, rather than global options and # preferences. import gtk import re import os import sys # SEE BOTTOM OF FILE FOR MOST LOCAL IMPORTS # # Done that way to allow 'from Application import application' # We'll have to rethink this if we ever statically compile reinteract from application_state import ApplicationState from global_settings import global_settings _VALID_CHAR = re.compile("[A-Za-z0-9._ -]") class Application(): def __init__(self): self.__unsaved_indices = [] self.windows = set() self.__about_dialog = None config_folder = global_settings.config_dir if not os.path.exists(config_folder): os.makedirs(config_folder) state_location = os.path.join(config_folder, 'reinteract.state') self.state = ApplicationState(state_location) def get_notebook_infos(self): paths = [] recent = self.state.get_recent_notebooks() notebooks_dir = global_settings.notebooks_dir recent_paths = [os.path.abspath(r.path) for r in recent] folder_paths = [os.path.join(notebooks_dir, f) for f in os.listdir(notebooks_dir)] paths = recent_paths + folder_paths example_state = self.state.get_notebook_state(global_settings.examples_dir) if example_state.get_last_opened() == -1: paths.append(global_settings.examples_dir) paths = [p for p in paths if os.path.isdir(p)] paths = list(set((os.path.normpath(path) for path in paths))) return [NotebookInfo(p) for p in paths] def validate_name(self, name): # Remove surrounding whitespace name = name.strip() if name == "": raise ValueError("Name cannot be empty") # Replace series of whitespace with a single space name = name.replace("\s+", " ") bad_chars = set() for c in name: if not _VALID_CHAR.match(c): bad_chars.add(c) bad = ", ".join(("'" + c + "'" for c in bad_chars)) if len(bad_chars) == 1: raise ValueError("Name contains invalid character: %s" % bad) elif len(bad_chars) > 0: raise ValueError("Name contains invalid characters: %s" % bad) elif name.startswith("."): raise ValueError("Name cannot start with a '.'") return name def __make_notebook_window(self, notebook): if global_settings.mini_mode: global MiniWindow from mini_window import MiniWindow return MiniWindow(notebook) else: global NotebookWindow from notebook_window import NotebookWindow return NotebookWindow(notebook) def open_notebook(self, path): for window in self.windows: if window.path == path: window.window.present() return window notebook = Notebook(path) window = self.__make_notebook_window(notebook) window.show() self.windows.add(window) self.state.notebook_opened(path) return window def find_notebook_path(self, path): # Given a path, possibly inside a notebook, find the notebook and the relative # path of the notebook inside the file relative = None tmp = path while True: if os.path.isdir(tmp): if os.path.exists(os.path.join(tmp, "index.rnb")): return tmp, relative parent, basename = os.path.split(tmp) if parent == tmp: # At the root # As a transition thing, for now allow specifying a folder without # an index.rnb as a folder if os.path.isdir(path): return path, None else: return None, None tmp = parent if relative == None: relative = basename else: relative = os.path.join(basename, relative) return tmp, relative def open_path(self, path): """Figure out what path points to, and open it appropriately""" absolute = os.path.abspath(path) basename, dirname = os.path.split(absolute) if basename.lower() == "index.rnb": notebook_path, relative = dirname, None else: notebook_path, relative = self.find_notebook_path(absolute) if notebook_path: window = self.open_notebook(notebook_path) if relative and relative in window.notebook.files: window.open_file(window.notebook.files[relative]) else: global EditorWindow from editor_window import EditorWindow window = EditorWindow() if not window.load(absolute): window.window.destroy() return False window.show() self.windows.add(window) return True def create_notebook(self, path, description=None): os.makedirs(path) notebook = Notebook(path) if description != None: notebook.info.description = description window = self.__make_notebook_window(notebook) window.show() self.windows.add(window) self.state.notebook_opened(path) return window def create_notebook_dialog(self, parent=None): return new_notebook.run(parent) def open_notebook_dialog(self, parent=None): return open_notebook.run(parent) def on_about_dialog_destroy(self, dialog): self.__about_dialog = None def show_about_dialog(self, parent=None): if not self.__about_dialog: self.__about_dialog = AboutDialog() self.__about_dialog.connect("destroy", self.on_about_dialog_destroy) self.__about_dialog.set_transient_for(parent) self.__about_dialog.present() def quit(self): for window in self.windows: if not window.confirm_discard(): return self.state.flush() gtk.main_quit() def window_closed(self, window): self.windows.remove(window) if not global_settings.main_menu_mode and len(self.windows) == 0: self.quit() def allocate_unsaved_index(self): """Allocate an index to be used when displaying an unsaved object ("Unsaved Worksheet 1")""" for i in xrange(0, len(self.__unsaved_indices)): if not self.__unsaved_indices[i]: self.__unsaved_indices[i] = True return i + 1 self.__unsaved_indices.append(True) return len(self.__unsaved_indices) def free_unsaved_index(self, index): """Free an index previously returned by allocate_unsaved_index()""" self.__unsaved_indices[index - 1] = False # The global singleton application = Application() from about_dialog import AboutDialog from notebook import Notebook from notebook_info import NotebookInfo import new_notebook import open_notebook if global_settings.main_menu_mode: from main_menu import main_menu reinteract-0.5.0/lib/reinteract/retokenize.py0000664000076400007640000003035111072035462016250 00000000000000# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import re TOKEN_KEYWORD = 1 TOKEN_NAME = 2 TOKEN_PUNCTUATION = 3 TOKEN_COMMENT = 4 TOKEN_STRING = 5 TOKEN_CONTINUATION = 6 TOKEN_NUMBER = 7 TOKEN_JUNK = 8 TOKEN_LPAREN = 9 TOKEN_RPAREN = 10 TOKEN_LSQB = 11 TOKEN_RSQB = 11 TOKEN_LBRACE = 12 TOKEN_RBRACE = 13 TOKEN_BACKQUOTE = 14 TOKEN_COLON = 15 TOKEN_DOT = 16 TOKEN_EQUAL = 17 TOKEN_AUGEQUAL = 18 TOKEN_BUILTIN_CONSTANT = 19 FLAG_OPEN = 1 FLAG_CLOSE = 2 _KEYWORDS = set([ 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield' ]) _IDENTIFIER_TOKENS = { 'None' : TOKEN_BUILTIN_CONSTANT, 'True' : TOKEN_BUILTIN_CONSTANT, 'False' : TOKEN_BUILTIN_CONSTANT } _PUNCTUATION_TOKENS = { '(' : TOKEN_LPAREN, ')' : TOKEN_RPAREN, '[' : TOKEN_LSQB, ']' : TOKEN_RSQB, '{' : TOKEN_LBRACE, '}' : TOKEN_RBRACE, '`' : TOKEN_BACKQUOTE, ':' : TOKEN_COLON, '=' : TOKEN_EQUAL, '+=' : TOKEN_AUGEQUAL, '-=' : TOKEN_AUGEQUAL, '*=' : TOKEN_AUGEQUAL, '/=' : TOKEN_AUGEQUAL, '%=' : TOKEN_AUGEQUAL, '&=' : TOKEN_AUGEQUAL, '|=' : TOKEN_AUGEQUAL, '^=' : TOKEN_AUGEQUAL, '<<=' : TOKEN_AUGEQUAL, '>>=' : TOKEN_AUGEQUAL, '**=' : TOKEN_AUGEQUAL, '//=' : TOKEN_AUGEQUAL } _PUNCTUATION_MATCH = { ')' : '(', ']' : '[', '}' : '{', } _TOKENIZE_RE = re.compile(r""" # Operators and delimeters (?P [@,:`;~\(\)\[\]\{\}] | [+%&|^-]=? | \*(?:\*=|\*|=|) | /(?:/=|/|=|) | <(?:<=|<|=|>|) | >(?:>=|>|=|) | =(?:=|) | !=) | (?P \#.*) | # Comment (?P [A-Za-z_][A-Za-z0-9_]*) | # Identifier (?P (?:[rR][uU]?|[uU][rR]?|) (?P (?: '''(?:\\.|[^'\\]|'(?!''))*(?:'''|(?=\\$)|$)) | # String delimited with ''' (?: \"""(?:\\.|[^"\\]|"(?!""))*(?:\"""|(?=\\$)|$)) | # String delimited with \""" (?: '(?:\\.|[^'\\])*(?:'|(?=\\$)|$)) | # String delimited with ' (?: "(?:\\.|[^"\\])*(?:"|(?=\\$)|$)) # String delimited with " ) ) | (?P \\) | # Line continuation # A "number-like", possibly invalid expression (?P 0[Xx][0-9A-Za-z_]* | (?: [0-9] | \.[0-9] ) [0-9.]* (?: [eE][+-]? [0-9A-Za-z_.]* | [0-9A-Za-z_.]* ) ) | (?P \.) | # isolated . (?P \s+) | # whitespace (?P [^\s!-\#%->@-~]+) | # Not-valid outside of a string... needs to # be + not +? to avoid splitting UTF-8 (?P .+?) # Other junk (vacuum anything notmatched) """, re.VERBOSE) _CLOSE_STRING_RE = { "'''": re.compile(r"(?:\\.|[^\'\\]|\'(?!\'\'))*(?:(\'\'\')|(?=\\$)|$)"), '"""': re.compile(r"(?:\\.|[^\"\\]|\"(?!\"\"))*(?:(\"\"\")|(?=\\$)|$)"), "'": re.compile(r"(?:\\.|[^\'\\])*(?:(\')|(?=\\$)|$)"), '"': re.compile(r"(?:\\.|[^\"\\])*(?:(\")|(?=\\$)|$)") } # A valid number; the idea is that when tokenizing, we want to keep # together sequences like 0junk or 0e+a and then mark them as entirely # invalid rather than breaking them into a "valid" number and a "valid" # part after that _NUMBER_RE = re.compile(r""" ^(?: 0j? | # 0 (or complex) 0[Xx][0-9A-Fa-f_]* | # Hex 0[0-7]+ | # Octal (?:[1-9][0-9]*|0)j? | # Decimal (or complex) (?:(?:[0-9]*\.[0-9]+|[0-9]+\.?)[eE][+-]?[0-9]+ | # Floating point (or complex) [0-9]*\.[0-9]+|[0-9]+\.)j? )$ """, re.VERBOSE) def tokenize_line(str, stack=None): if (stack == None): stack = [] else: stack = list(stack) tokens = [] pos = 0 if len(stack) > 0: if stack[-1] in _CLOSE_STRING_RE: delim = stack[-1] match = _CLOSE_STRING_RE[delim].match(str) assert(match) flags = 0 if match.group(1): flags |= FLAG_CLOSE stack.pop() tokens.append((TOKEN_STRING, match.start(), match.end(), flags)) pos = match.end() l = len(str) while pos < l: match = _TOKENIZE_RE.match(str, pos) assert(match) # print repr(match.group()), match.span(), match.groupdict() if not match.group('white'): flags = 0 token_type = None if match.group('punctuation'): token_type = TOKEN_PUNCTUATION s = match.group() if s in _PUNCTUATION_TOKENS: token_type = _PUNCTUATION_TOKENS[s] if token_type == TOKEN_BACKQUOTE: if len(stack) > 0 and stack[-1] == "`": flags |= FLAG_CLOSE stack.pop() else: flags |= FLAG_OPEN stack.append("`") elif s in _PUNCTUATION_MATCH: if len(stack) > 0 and stack[-1] == _PUNCTUATION_MATCH[s]: flags |= FLAG_CLOSE stack.pop() else: token_type = TOKEN_JUNK elif token_type == TOKEN_LPAREN or token_type == TOKEN_LSQB or token_type == TOKEN_LBRACE: flags |= FLAG_OPEN stack.append(s) elif match.group('identifier'): s = match.group() if s in _KEYWORDS: token_type = TOKEN_KEYWORD elif s in _IDENTIFIER_TOKENS: token_type = _IDENTIFIER_TOKENS[s] else: token_type = TOKEN_NAME elif match.group('number'): s = match.group() if _NUMBER_RE.match(s): token_type = TOKEN_NUMBER else: token_type = TOKEN_JUNK elif match.group('string'): token_type = TOKEN_STRING core = match.group('stringcore') if core.startswith('"""'): delim = '"""' elif core.startswith("'''"): delim = "'''" elif core.startswith("'"): delim = "'" else: delim = '"' if len(core) == len(delim) or \ not core.endswith(delim) or \ (core[len(core)-len(delim)-1] == '\\' and core[len(core)-len(delim)-2] != '\\'): flags |= FLAG_OPEN stack.append(delim) elif match.group('dot'): token_type = TOKEN_DOT elif match.group('comment'): token_type = TOKEN_COMMENT elif match.group('continuation'): token_type = TOKEN_CONTINUATION elif match.group('notvalid') or match.group('junk'): token_type = TOKEN_JUNK tokens.append((token_type, match.start(), match.end(), flags)) pos = match.end() # Catch an unterminated, uncontinued short string, and don't leave it on the stack # Would be nice to indicate an error here somehow, but I'm not sure how if len(stack) > 0 and (stack[-1] == "'" or stack[-1] == '"') and \ (len(tokens) == 0 or tokens[-1][0] != TOKEN_CONTINUATION): token_type, start, end, flags = tokens[-1] flags &= ~FLAG_OPEN tokens[-1] = (token_type, start, end, flags) stack.pop() return (tokens, stack) if __name__ == '__main__': import sys failed = False def expect(str, expected_tokens, in_stack=[], expected_stack=[]): tokens, stack = tokenize_line(str, stack=in_stack) result = [(token[0], str[token[1]:token[2]]) for token in tokens] success = True if len(tokens) == len(expected_tokens): for (t, e) in zip(result, expected_tokens): if t != e: success = False break else: success = False if not success: print "For %s, got %s, expected %s" % (repr(str), result, expected_tokens) failed = True if stack != expected_stack: print "For %s, in_stack=%s, got out_stack=%s, expected out_stack=%s" % (repr(str), in_stack, stack, expected_stack) failed = True expect('@', [(TOKEN_PUNCTUATION, '@')]) expect('(', [(TOKEN_LPAREN, '(')], expected_stack=['(']) expect('<<', [(TOKEN_PUNCTUATION, '<<')]) expect('<<=', [(TOKEN_AUGEQUAL, '<<=')]) expect('<<>', [(TOKEN_PUNCTUATION, '<<'), (TOKEN_PUNCTUATION, '>')]) expect("#foo", [(TOKEN_COMMENT, "#foo")]) expect("1 #foo", [(TOKEN_NUMBER, "1"), (TOKEN_COMMENT, "#foo")]) expect("abc", [(TOKEN_NAME, "abc")]) expect("if", [(TOKEN_KEYWORD, "if")]) expect("'abc'", [(TOKEN_STRING, "'abc'")]) expect(r"'a\'bc'", [(TOKEN_STRING, r"'a\'bc'")]) expect(r"'abc", [(TOKEN_STRING, r"'abc")]) expect("'abc\\", [(TOKEN_STRING, "'abc"), (TOKEN_CONTINUATION, "\\")], expected_stack=["'"]) expect('"""foo"', [(TOKEN_STRING, '"""foo"')], expected_stack=['"""']) expect("'''foo'", [(TOKEN_STRING, "'''foo'")], expected_stack=["'''"]) expect('0x0', [(TOKEN_NUMBER, '0x0')]) expect('1', [(TOKEN_NUMBER, '1')]) expect('1.e3', [(TOKEN_NUMBER, '1.e3')]) expect('.1e3', [(TOKEN_NUMBER, '.1e3')]) expect('1.1e3', [(TOKEN_NUMBER, '1.1e3')]) expect('1.1e+3', [(TOKEN_NUMBER, '1.1e+3')]) expect('1.1e0+3', [(TOKEN_NUMBER, '1.1e0'), (TOKEN_PUNCTUATION, '+'), (TOKEN_NUMBER, '3')]) expect('.', [(TOKEN_DOT, '.')]) expect('a.b', [(TOKEN_NAME, 'a'), (TOKEN_DOT, '.'), (TOKEN_NAME, 'b')]) expect('1a', [(TOKEN_JUNK, '1a')]) # Check that literal UTF-8 gets parsed correctly as a single token instead of split up expect('\xc3\xa4', [(TOKEN_JUNK, '\xc3\xa4')]) # But doens't swallow up trailing valid characters expect('\xc3\xa4foo', [(TOKEN_JUNK, '\xc3\xa4'), (TOKEN_NAME, "foo")]) # Stack tests expect('()', [(TOKEN_LPAREN, '('), (TOKEN_RPAREN, ')')]) expect('}', [(TOKEN_JUNK, '}')]) expect('(})', [(TOKEN_LPAREN, '('), (TOKEN_JUNK, '}'), (TOKEN_RPAREN, ')')]) expect('`', [(TOKEN_BACKQUOTE, '`')], expected_stack=['`']) expect('``', [(TOKEN_BACKQUOTE, '`'), (TOKEN_BACKQUOTE, '`')]) # Unterminated single line strings don't contribute to the stack expect('"', [(TOKEN_STRING, '"')], expected_stack=[]) expect(r'"abc\"', [(TOKEN_STRING, r'"abc\"')]) expect('"""foo""" """bar', [(TOKEN_STRING, '"""foo"""'), (TOKEN_STRING, '"""bar')], expected_stack=['"""']) # Testing starting with an open string expect('"', [(TOKEN_STRING, '"')], in_stack=['"']) expect('\\"', [(TOKEN_STRING, '\\"')], in_stack=['"']) expect('\\"" 1', [(TOKEN_STRING, '\\""'), (TOKEN_NUMBER, '1')], in_stack=['"']) expect("'", [(TOKEN_STRING, "'")], in_stack=["'"]) expect('foo"""', [(TOKEN_STRING, 'foo"""')], in_stack=['"""']) expect('foo', [(TOKEN_STRING, 'foo')], in_stack=['"""'], expected_stack=['"""']) expect('foo"', [(TOKEN_STRING, 'foo"')], in_stack=['"""'], expected_stack=['"""']) expect("foo'''", [(TOKEN_STRING, "foo'''")], in_stack=["'''"]) expect('foo', [(TOKEN_STRING, 'foo')], in_stack=["'''"], expected_stack=["'''"]) expect("foo'", [(TOKEN_STRING, "foo'")], in_stack=["'''"], expected_stack=["'''"]) if failed: sys.exit(1) else: sys.exit(0) reinteract-0.5.0/lib/reinteract/library_editor.py0000664000076400007640000000636111162516344017112 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import os import gobject import gtk import pango from application import application from editor import Editor from global_settings import global_settings from shell_buffer import ShellBuffer from shell_view import ShellView class LibraryEditor(Editor): DISCARD_FORMAT = 'Discard unsaved changes to library "%s"?' DISCARD_FORMAT_BEFORE_QUIT = 'Save the changes to library "%s" before quitting?' def __init__(self, notebook): Editor.__init__(self, notebook) self.buf = ShellBuffer(self.notebook, edit_only=True) self.view = ShellView(self.buf) self.__font_is_custom_connection = global_settings.connect('notify::editor-font-is-custom', self.__update_font) self.__font_name_connection = global_settings.connect('notify::editor-font-name', self.__update_font) self.__update_font() self.widget = gtk.ScrolledWindow() self.widget.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.widget.add(self.view) self.widget.show_all() self.buf.worksheet.connect('notify::filename', lambda *args: self._update_filename()) self.buf.worksheet.connect('notify::file', lambda *args: self._update_file()) self.buf.worksheet.connect('notify::code-modified', lambda *args: self._update_modified()) ####################################################### # Callbacks ####################################################### def __update_font(self, *arg): font_name = "monospace" if global_settings.editor_font_is_custom: font_name = global_settings.editor_font_name self.view.modify_font(pango.FontDescription(font_name)) ####################################################### # Overrides ####################################################### def _get_display_name(self): if self.buf.worksheet.filename == None: return "Unsaved Library %d" % self._unsaved_index else: return os.path.basename(self.buf.worksheet.filename) def _get_filename(self): return self.buf.worksheet.filename def _get_file(self): return self.buf.worksheet.file def _get_modified(self): return self.buf.worksheet.code_modified def _get_extension(self): return "py" def _save(self, filename): self.buf.worksheet.save(filename) self.notebook.reset_module_by_filename(filename) ####################################################### # Public API ####################################################### def close(self): Editor.close(self) self.buf.worksheet.close() global_settings.disconnect(self.__font_is_custom_connection) global_settings.disconnect(self.__font_name_connection) def load(self, filename): self.buf.worksheet.load(filename) self.buf.place_cursor(self.buf.get_start_iter()) def undo(self): self.buf.worksheet.undo() def redo(self): self.buf.worksheet.redo() reinteract-0.5.0/lib/reinteract/undo_stack.py0000664000076400007640000001247511072035711016227 00000000000000# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import re # Two consecutive inserts are merged together if the sum of the # two matches this. The (?!\n) is to defeat the normal regular # expression behavior where 'a$' matches 'a\n' because $ matches # before the last newline in the string COALESCE_RE = re.compile(r'^\S+ *(?!\n)$') class _InsertDeleteOp(object): def __init__(self, start, end, text): self.start = start self.end = end self.text = text def _insert(self, worksheet): worksheet.begin_user_action() worksheet.insert(self.start[0], self.start[1], self.text) worksheet.end_user_action() worksheet.place_cursor(self.end[0], self.end[1]) def _delete(self, worksheet): worksheet.begin_user_action() worksheet.delete_range(self.start[0], self.start[1], self.end[0], self.end[1]) worksheet.end_user_action() worksheet.place_cursor(self.start[0], self.start[1]) class InsertOp(_InsertDeleteOp): def redo(self, worksheet): self._insert(worksheet) def undo(self, worksheet): self._delete(worksheet) def __repr__(self): return "InsertOp(%s, %s, %s)" % (self.start, self.end, repr(self.text)) class DeleteOp(_InsertDeleteOp): def redo(self, worksheet): self._delete(worksheet) def undo(self, worksheet): self._insert(worksheet) def __repr__(self): return "DeleteOp(%s, %s, %s)" % (self.start, self.end, repr(self.text)) class BeginActionOp(object): def __repr__(self): return "BeginActionOp()" class EndActionOp(object): def __repr__(self): return "EndActionOp()" class UndoStack(object): def __init__(self, worksheet): self.__worksheet = worksheet self.__position = 0 # The position at which we last pruned the stack; everything after # this has been inserted consecutively without any intervening # undos and redos self.__prune_position = 0 self.__stack = [] self.__applying_undo = False self.__user_action_count = 0 self.__action_ops = 0 def undo(self): if self.__position == 0: return self.__position -= 1 self.__applying_undo = True try: if isinstance(self.__stack[self.__position], EndActionOp): self.__position -= 1 while not isinstance(self.__stack[self.__position], BeginActionOp): self.__stack[self.__position].undo(self.__worksheet) self.__position -= 1 else: self.__stack[self.__position].undo(self.__worksheet) finally: self.__applying_undo = False def redo(self): if self.__position == len(self.__stack): return self.__position += 1 self.__applying_undo = True try: if isinstance(self.__stack[self.__position - 1], BeginActionOp): self.__position += 1 while not isinstance(self.__stack[self.__position - 1], EndActionOp): self.__stack[self.__position - 1].redo(self.__worksheet) self.__position += 1 else: self.__stack[self.__position - 1].redo(self.__worksheet) finally: self.__applying_undo = False def __check_coalesce(self): assert self.__position == len(self.__stack) # Don't coalesce two ops unless they are actually adjacent in time if self.__position < self.__prune_position + 2: return cur = self.__stack[-1] prev = self.__stack[-2] if isinstance(cur, InsertOp) and isinstance(prev, InsertOp) and \ cur.start == prev.end and COALESCE_RE.match(prev.text + cur.text): prev.end = cur.end prev.text += cur.text self.__stack.pop() self.__position -= 1 def append_op(self, op): if self.__applying_undo: return if self.__position < len(self.__stack): assert self.__action_ops == 0 self.__stack[self.__position:] = [] self.__prune_position = self.__position self.__stack.append(op) self.__position += 1 if self.__user_action_count > 0: self.__action_ops += 1 else: self.__check_coalesce() def begin_user_action(self): self.__user_action_count += 1 def end_user_action(self): self.__user_action_count -= 1 if self.__user_action_count == 0: if self.__action_ops > 1: self.__stack.insert(len(self.__stack) - self.__action_ops, BeginActionOp()) self.__stack.append(EndActionOp()) self.__position += 2 elif self.__action_ops == 1: self.__check_coalesce() self.__action_ops = 0 def clear(self): self.__stack = [] self.__position = 0 def __repr__(self): return "UndoStack(stack=%s, position=%d)" % (self.__stack, self.__position) reinteract-0.5.0/lib/reinteract/base_window.py0000664000076400007640000002440611162516344016401 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import os import re import sys import gtk from application import application from file_list import FileList from format_escaped import format_escaped from global_settings import global_settings from library_editor import LibraryEditor from notebook import Notebook, NotebookFile from worksheet_editor import WorksheetEditor from preferences_dialog import show_preferences if global_settings.main_menu_mode: from main_menu import main_menu class BaseWindow: def __init__(self, notebook): self.notebook = notebook self.path = None self.current_editor = None self.ui_manager = gtk.UIManager() self.action_group = gtk.ActionGroup("main") self._add_actions(self.action_group) self.ui_manager.insert_action_group(self.action_group, 0) self.ui_manager.add_ui_from_string(self.UI_STRING) self.ui_manager.ensure_update() menu = self.ui_manager.get_widget("/TopMenu") toolbar = self.ui_manager.get_widget("/ToolBar") self._create_window(menu, toolbar) # We want each toplevel to have separate modality window_group = gtk.WindowGroup() window_group.add_window(self.window) self.window.add_accel_group(self.ui_manager.get_accel_group()) self.main_vbox.show_all() self.window.connect('key-press-event', self.on_key_press_event) self.window.connect('delete-event', self.on_delete_event) self.window.connect('notify::is-active', self.on_notify_is_active) ####################################################### # Implemented by subclasses ####################################################### def _create_window(self, menu, toolbar): self.window = gtk.Window() self.main_vbox = gtk.VBox() self.window.add(self.main_vbox) if not global_settings.main_menu_mode: self.main_vbox.pack_start(menu, expand=False, fill=False) self.main_vbox.pack_start(toolbar, expand=False, fill=False) def _add_actions(self, action_group): action_group.add_actions([ ('file', None, "_File"), ('edit', None, "_Edit"), ('help', None, "_Help"), ('new-notebook', gtk.STOCK_NEW, "New Note_book...", "n", None, self.on_new_notebook), ('open-notebook', gtk.STOCK_OPEN, "_Open Notebook...", "o", None, self.on_open_notebook), ('open', gtk.STOCK_OPEN, None, None, None, self.on_open), ('save', gtk.STOCK_SAVE, None, None, None, self.on_save), ('rename', None, "_Rename...", None, None, self.on_rename), ('close', gtk.STOCK_CLOSE, None, "w", None, self.on_close), ('quit', gtk.STOCK_QUIT, None, None, None, self.on_quit), ('cut', gtk.STOCK_CUT, None, None, None, self.on_cut), ('copy', gtk.STOCK_COPY, None, None, None, self.on_copy), ('copy-as-doctests', gtk.STOCK_COPY, "Copy as Doc_tests", "c", None, self.on_copy_as_doctests), ('paste', gtk.STOCK_PASTE, None, None, None, self.on_paste), ('delete', gtk.STOCK_DELETE, None, None, None, self.on_delete), ('about', gtk.STOCK_ABOUT, None, None, None, self.on_about), ('calculate', gtk.STOCK_REFRESH, "Ca_lculate", 'Return', None, self.on_calculate), ('break', gtk.STOCK_CANCEL, "_Break", 'Break', None, self.on_break), ('preferences', gtk.STOCK_PREFERENCES, "Prefere_nces", None, None, self.on_preferences), ]) def _close_current(self): raise NotImplementedError() def _close_window(self): if global_settings.main_menu_mode and self.window.is_active(): main_menu.window_deactivated(self) application.window_closed(self) self.window.destroy() ####################################################### # Utility ####################################################### def _set_action_sensitive(self, action_name, sensitive): action = self.action_group.get_action(action_name) action.set_sensitive(sensitive) if global_settings.main_menu_mode: if sensitive: main_menu.enable_action(action_name) else: main_menu.disable_action(action_name) def _load_editor(self, filename): if filename.endswith(".rws") or filename.endswith(".RWS"): editor = WorksheetEditor(self.notebook) elif filename.endswith(".py") or filename.endswith(".PY"): editor = LibraryEditor(self.notebook) else: dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_OK, type=gtk.MESSAGE_ERROR) dialog.set_markup(format_escaped("Don't know how to open '%s'", os.path.basename(filename))) dialog.format_secondary_text("'%s' does not have a recognized file extension" % filename) dialog.run() dialog.destroy() return None try: editor.load(filename) except IOError, e: dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_OK, type=gtk.MESSAGE_ERROR) dialog.set_markup(format_escaped("Cannot open '%s'", os.path.basename(filename))) dialog.format_secondary_text("Error opening '%s': %s" %(filename, e.strerror)) dialog.run() dialog.destroy() return None return editor ####################################################### # Callbacks ####################################################### def on_new_notebook(self, action): application.create_notebook_dialog(parent=self.window) def on_open_notebook(self, action): application.open_notebook_dialog(parent=self.window) def on_open(self, action): chooser = gtk.FileChooserDialog("Open File...", self.window, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) chooser.set_default_response(gtk.RESPONSE_OK) response = chooser.run() filename = None if response == gtk.RESPONSE_OK: filename = chooser.get_filename() if filename != None: application.open_path(filename) chooser.destroy() def on_save(self, action): if self.current_editor: self.current_editor.save() def on_rename(self, action): if self.current_editor: self.current_editor.rename() def on_close(self, action): self._close_current() def on_quit(self, action): application.quit() def on_undo(self, action): if self.current_editor: self.current_editor.undo() def on_redo(self, action): if self.current_editor: self.current_editor.redo() def on_cut(self, action): if self.current_editor: self.current_editor.view.emit('cut-clipboard') def on_copy(self, action): if self.current_editor: self.current_editor.view.emit('copy-clipboard') def on_copy_as_doctests(self, action): if self.current_editor: self.current_editor.view.copy_as_doctests() def on_paste(self, action): if self.current_editor: self.current_editor.view.emit('paste-clipboard') def on_delete(self, action): if self.current_editor: self.current_editor.view.delete_selection(True, self.view.get_editable()) def on_calculate(self, action): if self.current_editor and self.current_editor.needs_calculate: self.current_editor.calculate() def on_break(self, action): if self.current_editor: self.current_editor.buf.worksheet.interrupt() def on_preferences(self, action): show_preferences(parent=self.window) def on_about(self, action): application.show_about_dialog(self.window) def on_key_press_event(self, window, event): if global_settings.main_menu_mode: if main_menu.handle_key_press(event): return True # We have a Return accelerator, but this hooks up KP_Enter as well; # maybe someone wants that if ((event.keyval == gtk.keysyms.Return or event.keyval == gtk.keysyms.KP_Enter) and (event.state & gtk.gdk.CONTROL_MASK != 0) and (event.state & gtk.gdk.SHIFT_MASK == 0)): if self.current_editor and self.current_editor.needs_calculate: self.current_editor.calculate() return True return False def on_delete_event(self, window, event): self._close_window() return True def on_notify_is_active(self, window, paramspec): if global_settings.main_menu_mode: if window.is_active(): main_menu.window_activated(self) else: main_menu.window_deactivated(self) ####################################################### # Public API ####################################################### def show(self): self.window.show() def update_sensitivity(self): self._set_action_sensitive('calculate', self.current_editor != None and self.current_editor.needs_calculate) self._set_action_sensitive('break', self.current_editor != None and self.current_editor.state == NotebookFile.EXECUTING) # This seems more annoying than useful. gedit doesn't desensitize save # self._set_action_sensitive('save', self.current_editor != None and self.current_editor.modified) reinteract-0.5.0/lib/reinteract/thread_executor.py0000664000076400007640000003011511162516344017257 00000000000000# Copyright 2008 Owen Taylor # Copyright 2008 Kai Willadsen # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import ctypes import gobject import signal import sys import thread from statement import Statement # # The primary means we use to interrupt a running thread is a Python facility # to set an exception asynchronously on another thread. To keep it out of # unsuspecting hands, it's not bound in Python, so we need to accesss it # through pthreads. # _PyThreadState_SetAsyncExc = ctypes.pythonapi.PyThreadState_SetAsyncExc # # _PyThreadState_SetAsyncExc won't immediately wake up a thread that is blocking # in a syscall, so we also send a Unix signal to hopefully wake such a thread # up. (This can be foiled if the syscall is called within C code that catches # EINTR and restarts. In that case, we have no way of killing the thread without # breaking Python internal state so we don't try.) # # To make sending a signal wake the thread up out of the syscall without killing # the thread, we need a non-default no-op handler for the signal. The slightly # tricky thing about what we do is that signal.signal() is defined to affect only # the main thread, but the way it does it is set up a handler for all threads and # then ignore the signal in all but the main thread. So, our ignore_handler is # never called, but Python's handler does what we wanted to do (ignore the signal) # anyways. # if sys.platform == 'win32': _pthread_kill = None else: if sys.platform == 'darwin': # pthread_kill is in the C library on OS/X # ctypes.util.find_library("c") should work in theory, but doesn't _pthreads_dll = ctypes.CDLL("/usr/lib/libc.dylib") else: # Assume Linux. We intentionally don't guard this against failure # so that we get bug reports when we don't find libpthread _pthreads_dll = ctypes.CDLL("libpthread.so.0") _pthread_kill = _pthreads_dll.pthread_kill if _pthread_kill != None: def _ignore_handler(signum, frame): pass signal.signal(signal.SIGUSR1, _ignore_handler) class ThreadExecutor(gobject.GObject): """Class to execute Python statements asynchronously in a thread Signals ======= - B{statement-executing}(executor, statement) emitted when the executor starts processing a statement. There is no guarantee that this signal will be emitted for each processed statement. - B{statement-complete}(executor, statement) emitted when the executor is done with all processing it will do on a statement - B{complete}(executor): emitted when the executor is done with all processing """ __gsignals__ = { 'statement-executing' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)), 'statement-complete' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)), 'complete' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()), } def __init__(self, parent_statement=None): """Initialize the ThreadExecutor object @param parent_statement: prievous statement defining the execution environment for the first statement """ gobject.GObject.__init__(self) self.parent_statement = parent_statement self.statements = [] self.lock = thread.allocate_lock() self.idle_id = 0 self.last_complete = -1 self.last_signalled = -1 self.complete = False self.interrupted = False def __run_idle(self): self.lock.acquire() complete = self.complete last_complete = self.last_complete self.idle_id = 0 self.lock.release() for i in xrange(self.last_signalled + 1, last_complete + 1): self.emit('statement-complete', self.statements[i]) self.last_signalled = last_complete if self.complete: self.emit('complete') elif last_complete < len(self.statements) - 1: self.emit('statement-executing', self.statements[last_complete + 1]) return False def __queue_idle(self): # Must be called with the lock held if not self.idle_id: self.idle_id = gobject.idle_add(self.__run_idle) def __run_thread(self): # The patten used twice here of: # # try: # # do something with lock not held # self.lock.acquire() # except: # self.lock.acquire() # finally: # # do finishing steps # # Counts on two things: a) we can receive an unexpected exception like # KeyboardInterrupt only once b) that exception can't occur with the lock # held. Given those assumptions, we can be sure that the finishing steps # will be run and they won't be interrupted. # statement = None try: for i, statement in enumerate(self.statements): self.lock.acquire() statement.before_execute() self.__queue_idle() try: self.lock.release() statement.execute() self.lock.acquire() except: self.lock.acquire() finally: statement.after_execute() result_state = statement.state self.last_complete = i; self.__queue_idle() self.lock.release() if result_state != Statement.EXECUTE_SUCCESS: break self.lock.acquire() except KeyboardInterrupt, e: self.lock.acquire() except BaseException, e: self.lock.acquire() raise finally: self.complete = True self.last_complete = len(self.statements) - 1 self.__queue_idle() self.lock.release() def add_statement(self, statement): """Add a statement to the list of statements that the executor will execute.""" self.statements.append(statement) def compile(self): """Compile all statements. If compilation failed, then all processing for the executor is complete, so ::statement-complete is emitted for each statement, then ::complete is emitted. Otherwise no signals are emitted, until the executor is run using execute() @returns: True if all statements compiled successfully """ success = True parent = self.parent_statement for statement in self.statements: statement.set_parent(parent) if not statement.compile(): success = False parent = statement if not success: for statement in self.statements: self.emit('statement-complete', statement) self.emit('complete') return success def execute(self): """Execute the statements of the executor asynchronously in a thread.""" self.tid = thread.start_new_thread(self.__run_thread, ()) def interrupt(self): """Interrupts the execution of the executor if possible. Makes a best-effort attempt to interrupt the execution of the executor. An attempt is made to interrupt any blocking system calls, however if the execution is inside native code this may not be succesful. Long-running native code-computations will also not be interrupted. Once the thread is succesfully interrupted, execution finishes as per normal by emitting the ::statement-complete and ::complete signals, except that the state of the interrupted statement will be Statement.INTERRUPTED, and subsequence statements will have a state of Statement.COMPILE_SUCCESS. Calling interrupt() more than once will have no effect. """ # See note in __run_thread() as to why we need to lock and why we need to # protect against sending the KeyboardInterrupt exception more than once self.lock.acquire() if not self.complete and not self.interrupted: self.interrupted = True _PyThreadState_SetAsyncExc(self.tid, ctypes.py_object(KeyboardInterrupt)) if _pthread_kill != None: _pthread_kill(self.tid, signal.SIGUSR1) self.lock.release() ###################################################################### if __name__ == '__main__': #pragma: no cover gobject.threads_init() import stdout_capture stdout_capture.init() import time from notebook import Notebook from statement import Statement from test_utils import assert_equals from worksheet import Worksheet failed = False notebook = Notebook() worksheet = Worksheet(notebook) def test_execute(statements): executor = ThreadExecutor() for s, expected_state, expected_results in statements: statement = Statement(s, worksheet) statement._expected_state = expected_state statement._expected_results = expected_results statement._got_executing = False executor.add_statement(statement) loop = gobject.MainLoop() def on_statement_executing(executor, statement): if hasattr(statement, '_got_state'): statement._out_of_order = True statement._got_executing = True def on_statement_complete(executor, statement): statement._got_state = statement.state statement._got_results = statement.results statement._out_of_order = False def on_complete(executor): loop.quit() def interrupt(): executor.interrupt() global timed_out timed_out = False def timeout(): global timed_out timed_out = True loop.quit() executor.connect('statement-executing', on_statement_executing) executor.connect('statement-complete', on_statement_complete) executor.connect('complete', on_complete) if executor.compile(): executor.execute() interrupt_source = gobject.timeout_add(500, interrupt) timeout_source = gobject.timeout_add(1000, timeout) loop.run() if timed_out: raise AssertionError("Interrupting ThreadExecutor failed") gobject.source_remove(interrupt_source) gobject.source_remove(timeout_source) for s in executor.statements: assert_equals(s._got_state, s._expected_state) assert_equals(s._got_results, s._expected_results) if s._out_of_order: raise AssertionError("ThreadExecutor sent 'statement-executing' after 'statement-complete'") if s._expected_state == Statement.INTERRUPTED and not s._got_executing: raise AssertionError("ThreadExecutor did not send 'statement-executing' within timeout") test_execute( [ ("a = 1", Statement.COMPILE_SUCCESS, None), ("a =", Statement.COMPILE_ERROR, None) ]) test_execute( [ ("a = 1", Statement.EXECUTE_SUCCESS, []), ("a", Statement.EXECUTE_SUCCESS, ['1']) ]) test_execute( [ ("a = 1", Statement.EXECUTE_SUCCESS, []), ("b", Statement.EXECUTE_ERROR, None), ("c = 2", Statement.COMPILE_SUCCESS, None) ]) # Test interrupting straight python code test_execute( [ ("y = 1", Statement.EXECUTE_SUCCESS, []), ("for x in xrange(0,100000000): y = y* 2", Statement.INTERRUPTED, None), ("z = 1", Statement.COMPILE_SUCCESS, None) ]) # Test interrupting a blocking syscall, if support on this platform if _pthread_kill != None: test_execute( [ ("import sys", Statement.EXECUTE_SUCCESS, []), ("sys.stdin.readline()", Statement.INTERRUPTED, None), ("z = 1", Statement.COMPILE_SUCCESS, None) ]) reinteract-0.5.0/lib/reinteract/preferences_dialog.py0000664000076400007640000001103211162516344017707 00000000000000# Copyright 2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk from global_settings import global_settings from window_builder import WindowBuilder class PreferencesBuilder(WindowBuilder): def __init__(self): WindowBuilder.__init__(self, 'preferences') self.dialog.connect('response', self.__on_response) self.dialog.connect('delete-event', self.__on_delete_event) global_settings.connect('notify::editor-font-is-custom', self.__on_notify_editor_font_is_custom) self.__on_notify_editor_font_is_custom() self.editor_font_custom_check_button.connect('toggled', self.__on_editor_font_custom_check_button_toggled) self.__on_editor_font_custom_check_button_toggled() global_settings.connect('notify::editor-font-name', self.__on_notify_editor_font_name) self.__on_notify_editor_font_name() self.editor_font_button.connect('font-set', self.__on_editor_font_set) global_settings.connect('notify::doc-tooltip-font-is-custom', self.__on_notify_doc_tooltip_font_is_custom) self.__on_notify_doc_tooltip_font_is_custom() self.doc_tooltip_font_custom_check_button.connect('toggled', self.__on_doc_tooltip_font_custom_check_button_toggled) self.__on_doc_tooltip_font_custom_check_button_toggled() global_settings.connect('notify::doc-tooltip-font-name', self.__on_notify_doc_tooltip_font_name) self.__on_notify_doc_tooltip_font_name() self.doc_tooltip_font_button.connect('font-set', self.__on_doc_tooltip_font_set) global_settings.connect('notify::autocomplete', self.__on_notify_autocomplete) self.__on_notify_autocomplete() self.autocomplete_check_button.connect('toggled', self.__on_autocomplete_check_button_toggled) def __on_notify_editor_font_is_custom(self, *args): self.editor_font_custom_check_button.set_active(global_settings.editor_font_is_custom) def __on_notify_editor_font_name(self, *args): self.editor_font_button.set_font_name(global_settings.editor_font_name) def __on_editor_font_custom_check_button_toggled(self, *args): font_is_custom = self.editor_font_custom_check_button.get_active() self.editor_font_button.set_sensitive(font_is_custom) if font_is_custom != global_settings.editor_font_is_custom: global_settings.editor_font_is_custom = font_is_custom def __on_editor_font_set(self, font_button): font_name = font_button.get_font_name() if font_name != global_settings.editor_font_name: global_settings.editor_font_name = font_name def __on_notify_doc_tooltip_font_is_custom(self, *args): self.doc_tooltip_font_custom_check_button.set_active(global_settings.doc_tooltip_font_is_custom) def __on_notify_doc_tooltip_font_name(self, *args): self.doc_tooltip_font_button.set_font_name(global_settings.doc_tooltip_font_name) def __on_doc_tooltip_font_custom_check_button_toggled(self, *args): font_is_custom = self.doc_tooltip_font_custom_check_button.get_active() self.doc_tooltip_font_button.set_sensitive(font_is_custom) if font_is_custom != global_settings.doc_tooltip_font_is_custom: global_settings.doc_tooltip_font_is_custom = font_is_custom def __on_doc_tooltip_font_set(self, font_button): font_name = font_button.get_font_name() if font_name != global_settings.doc_tooltip_font_name: global_settings.doc_tooltip_font_name = font_name def __on_notify_autocomplete(self, *args): self.autocomplete_check_button.set_active(global_settings.autocomplete) def __on_autocomplete_check_button_toggled(self, *args): autocomplete = self.autocomplete_check_button.get_active() if autocomplete != global_settings.autocomplete: global_settings.autocomplete = autocomplete def __on_response(self, dialog, response_id): self.dialog.hide() def __on_delete_event(self, dialog, event): self.dialog.hide() return True _builder = None def show_preferences(parent=None): global _builder if not _builder: _builder = PreferencesBuilder() _builder.dialog.set_transient_for(parent) if _builder.dialog.flags() & gtk.VISIBLE == 0: _builder.dialog.show() else: _builder.dialog.present_with_time(gtk.get_current_event_time()) reinteract-0.5.0/lib/reinteract/worksheet_editor.py0000664000076400007640000000663511162516344017465 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import os import gobject import gtk import pango from application import application from editor import Editor from global_settings import global_settings from shell_buffer import ShellBuffer from shell_view import ShellView class WorksheetEditor(Editor): DISCARD_FORMAT = 'Discard unsaved changes to worksheet "%s"?' DISCARD_FORMAT_BEFORE_QUIT = 'Save the changes to worksheet "%s" before quitting?' def __init__(self, notebook): Editor.__init__(self, notebook) self.buf = ShellBuffer(self.notebook) self.view = ShellView(self.buf) self.__font_is_custom_connection = global_settings.connect('notify::editor-font-is-custom', self.__update_font) self.__font_name_connection = global_settings.connect('notify::editor-font-name', self.__update_font) self.__update_font() self.widget = gtk.ScrolledWindow() self.widget.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.widget.add(self.view) self.widget.show_all() self.buf.worksheet.connect('notify::filename', lambda *args: self._update_filename()) self.buf.worksheet.connect('notify::file', lambda *args: self._update_file()) self.buf.worksheet.connect('notify::code-modified', lambda *args: self._update_modified()) self.buf.worksheet.connect('notify::state', lambda *args: self._update_state()) ####################################################### # Callbacks ####################################################### def __update_font(self, *arg): font_name = "monospace" if global_settings.editor_font_is_custom: font_name = global_settings.editor_font_name self.view.modify_font(pango.FontDescription(font_name)) ####################################################### # Overrides ####################################################### def _get_display_name(self): if self.buf.worksheet.filename == None: return "Unsaved Worksheet %d" % self._unsaved_index else: return os.path.basename(self.buf.worksheet.filename) def _get_filename(self): return self.buf.worksheet.filename def _get_file(self): return self.buf.worksheet.file def _get_modified(self): return self.buf.worksheet.code_modified def _get_state(self): return self.buf.worksheet.state def _get_extension(self): return "rws" def _save(self, filename): self.buf.worksheet.save(filename) ####################################################### # Public API ####################################################### def close(self): Editor.close(self) self.buf.worksheet.close() global_settings.disconnect(self.__font_is_custom_connection) global_settings.disconnect(self.__font_name_connection) def load(self, filename): self.buf.worksheet.load(filename) self.buf.place_cursor(self.buf.get_start_iter()) self.calculate() def calculate(self): self.view.calculate() def undo(self): self.buf.worksheet.undo() def redo(self): self.buf.worksheet.redo() reinteract-0.5.0/lib/reinteract/notebook_info.py0000664000076400007640000000654111072035400016720 00000000000000# Copyright 2008 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## from ConfigParser import RawConfigParser, ParsingError import os import time def format_duration(past): if past < 60: # Sanity ... a date before 1972 return "" now = time.time() diff = now - past if diff <= 0: return "" elif diff < 90: return "A minute ago" elif diff < 60 * 60: return "%.0f minutes ago" % (diff / 60.) elif diff < 24 * 60 * 60: return "%.0f hours ago" % (diff / (60. * 60.)) time_struct = time.localtime(now) day_start = time.mktime((time_struct[0], time_struct[1], time_struct[2], 0, 0, 0, time_struct[6], time_struct[7], time_struct[8])) diff_days = (day_start - past) / (60. * 60. * 24.) if diff_days < 1: return "Yesterday" elif diff_days < 7: return "%.0f days ago" % (diff_days) elif diff_days < 10.5: return "1 week ago" elif diff_days < 30: return "%.0f weeks ago" % (diff_days / 7.) elif diff_days < 45: return "1 month ago" elif diff_days < 365: return "%.0f months ago" % (diff_days / 30.) elif diff_days < 550 * 1.5: return "1 year ago" else: return "%.0f years ago" % (diff_days / 365.) class NotebookInfo(object): def __init__(self, folder): self.folder = folder self.__load() def __load(self): self.__parser = RawConfigParser() # Fallback with the modtime of the folder as "last_modified" st = os.stat(self.folder) self.__parser.add_section('Notebook') self.__parser.set('Notebook', 'last_modified', str(st.st_mtime)) index_file = os.path.join(self.folder, "index.rnb") try: f = open(index_file, "r") except IOError, e: # If not readable, just ignore return try: self.__parser.readfp(f) except ParsingError: # If not readable, just ignore return finally: f.close() def __save(self): self.__parser.set('Notebook', 'last_modified', str(time.time())) index_file = os.path.join(self.folder, "index.rnb") f = open(index_file, "w") self.__parser.write(f) f.close() def update_last_modified(self): # last_modified is updated to the current time every time we save self.__save() @property def last_modified(self): if self.__parser.has_option('Notebook', 'last_modified'): return self.__parser.getfloat('Notebook', 'last_modified') return os.path.basename(self.folder) @property def last_modified_text(self): return format_duration(self.last_modified) @property def name(self): return os.path.basename(self.folder) def __get_description(self): if self.__parser.has_option('Notebook', 'description'): return self.__parser.get('Notebook', 'description') else: return "" def __set_description(self, description): self.__parser.set('Notebook', 'description', description) self.__save() description = property(__get_description, __set_description) reinteract-0.5.0/lib/reinteract/new_notebook.py0000664000076400007640000000661711162516344016575 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk import os from application import application from global_settings import global_settings from window_builder import WindowBuilder class CreateNotebookBuilder(WindowBuilder): def __init__(self): WindowBuilder.__init__(self, 'new-notebook') self.name_entry.connect('changed', self.__update_create_sensitivity) self.__update_create_sensitivity() self.description_text_view.set_accepts_tab(False) self.other_folder_radio_button.set_group(self.default_folder_radio_button) self.other_folder_radio_button.connect('toggled', self.__update_other_folder_sensitivity) self.__update_other_folder_sensitivity(self.other_folder_radio_button) self.other_folder_chooser.set_filename(global_settings.notebooks_dir) self.create_button.set_image(gtk.image_new_from_stock('gtk-new', gtk.ICON_SIZE_BUTTON)) def __update_create_sensitivity(self, *args): self.create_button.set_sensitive(self.name_entry.get_text().strip() != "") def __update_other_folder_sensitivity(self, *args): self.other_folder_chooser.set_sensitive(self.other_folder_radio_button.get_active()) def run(parent=None): builder = CreateNotebookBuilder() builder.dialog.set_transient_for(parent) result_window = None while True: response = builder.dialog.run() if response == 0: # gtk-builder-convert puts check/radio buttons in action-widgets continue if response != gtk.RESPONSE_OK: break error_message = None error_detail = None try: name = application.validate_name(builder.name_entry.get_text()) except ValueError, e: error_message = "Please choose a different name" error_detail = e.message if error_message == None: if builder.other_folder_radio_button.get_active(): parent_folder = builder.other_folder_chooser.get_filename() else: parent_folder = global_settings.notebooks_dir fullname = os.path.join(parent_folder, name) if os.path.exists(fullname): error_message = "Please choose a different name" error_detail = "'%s' already exists" % name if error_message == None: try: builder.dialog.hide() description = builder.description_text_view.get_buffer().props.text.strip() result_window = application.create_notebook(fullname, description=description) except OSError, e: builder.dialog.show() error_message = "Error creating notebook" error_detail = e.message if error_message: dialog = gtk.MessageDialog(parent=builder.dialog, buttons=gtk.BUTTONS_OK, type=gtk.MESSAGE_ERROR) dialog.set_markup(error_message) dialog.format_secondary_text(error_detail) dialog.run() dialog.destroy() continue break builder.dialog.destroy() return result_window reinteract-0.5.0/lib/reinteract/main_menu.py0000664000076400007640000000576211072035341016045 00000000000000# Copyright 2008 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gobject from about_dialog import AboutDialog from application import application from reinteract.native_main_menu import NativeMainMenu class MainMenu(NativeMainMenu): """This class is an interface to OS X main menu. (The interface of this class could likely be used for other types of main menu if the need ever arises.) The actual heavy-lifting is done in the NativeMainMenu superclass which is implemented in the native-code wrapper application. Here we just forward activated menu items in one direction, and enable/disabling of menu items in the other direction. """ def __init__(self): NativeMainMenu.__init__(self) self.__active_window = None self.__action_to_method_name = {} for action_name in self.get_action_names(): method_name = 'on_' + action_name.replace('-', '_') self.__action_to_method_name[action_name] = method_name self.__update_sensitivity() def run_action(self, action_name): method_name = self.__action_to_method_name[action_name] if self.__active_window and hasattr(self.__active_window, method_name): getattr(self.__active_window, method_name)(None) elif hasattr(self, method_name): getattr(self, method_name)() else: print action_name def do_action(self, action_name): # Recursing the main loop (which we do for various messages, etc), is a bad thing # to do out of a Quartz menu callback, so defer the real work to the next run of # the main loop gobject.idle_add(self.run_action, action_name, priority=gobject.PRIORITY_HIGH) def on_about(self): application.show_about_dialog() def on_new_notebook(self): application.create_notebook_dialog() def on_open_notebook(self): application.open_notebook_dialog() def on_quit(self): application.quit() def window_activated(self, window): if window != self.__active_window: self.__active_window = window self.__update_sensitivity() def window_deactivated(self, window): if window == self.__active_window: self.__active_window = None self.__update_sensitivity() def __update_sensitivity(self): for action_name, method_name in self.__action_to_method_name.iteritems(): if hasattr(self, method_name): pass # always active elif self.__active_window and hasattr(self.__active_window, method_name): self.enable_action(action_name) else: self.disable_action(action_name) if self.__active_window: self.__active_window.update_sensitivity() main_menu = MainMenu() reinteract-0.5.0/lib/reinteract/shell_view.py0000775000076400007640000007160511162516344016247 00000000000000# Copyright 2007-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gobject import gtk import re from shell_buffer import ShellBuffer, ADJUST_NONE, ADJUST_BEFORE, ADJUST_AFTER from chunks import StatementChunk, CommentChunk, BlankChunk from completion_popup import CompletionPopup from doc_popup import DocPopup from global_settings import global_settings from notebook import NotebookFile import sanitize_textview_ipc LEFT_MARGIN_WIDTH = 10 ALL_WHITESPACE_RE = re.compile("^\s*$") class ShellView(gtk.TextView): __gsignals__ = { 'backspace' : 'override', 'expose-event': 'override', 'focus-out-event': 'override', 'button-press-event': 'override', 'button-release-event': 'override', 'motion-notify-event': 'override', 'key-press-event': 'override', 'leave-notify-event': 'override', 'motion-notify-event': 'override', 'realize': 'override', 'unrealize': 'override', 'size-allocate': 'override' } def __init__(self, buf): self.edit_only = buf.worksheet.edit_only if not self.edit_only: buf.worksheet.connect('chunk-inserted', self.on_chunk_inserted) buf.worksheet.connect('chunk-changed', self.on_chunk_changed) buf.worksheet.connect('chunk-status-changed', self.on_chunk_status_changed) buf.worksheet.connect('notify::state', self.on_notify_state) # Track changes to update completion buf.connect_after('insert-text', self.on_after_insert_text) buf.connect_after('delete-range', self.on_after_delete_range) buf.connect_after('end-user-action', self.on_after_end_user_action) self.__inserted_in_user_action = False self.__deleted_in_user_action = False buf.connect('add-custom-result', self.on_add_custom_result) buf.connect('pair-location-changed', self.on_pair_location_changed) gtk.TextView.__init__(self, buf) if not self.edit_only: self.set_border_window_size(gtk.TEXT_WINDOW_LEFT, LEFT_MARGIN_WIDTH) self.set_left_margin(2) # Attach a "behavior object" to the view which, by ugly hacks, makes it # do simply and reasonable things for cut-and-paste and DND sanitize_textview_ipc.sanitize_view(self) self.add_events(gtk.gdk.LEAVE_NOTIFY_MASK) self.__completion_popup = CompletionPopup(self) self.__doc_popup = DocPopup() self.__mouse_over_object = None self.__mouse_over_timeout = None self.__mouse_over_start = buf.create_mark(None, buf.get_start_iter(), True) self.__arg_highlight_start = None self.__arg_highlight_end = None buf.connect('mark-set', self.on_mark_set) def __get_worksheet_line_yrange(self, line): buffer_line = self.get_buffer().pos_to_iter(line) return self.get_line_yrange(buffer_line) def __get_worksheet_line_at_y(self, y, adjust): buf = self.get_buffer() (buffer_line, _) = self.get_line_at_y(y) return buf.iter_to_pos(buffer_line, adjust)[0] def paint_chunk(self, cr, area, chunk, fill_color, outline_color): buf = self.get_buffer() (y, _) = self.__get_worksheet_line_yrange(chunk.start) (end_y, end_height) = self.__get_worksheet_line_yrange(chunk.end - 1) height = end_y + end_height - y (_, window_y) = self.buffer_to_window_coords(gtk.TEXT_WINDOW_LEFT, 0, y) cr.rectangle(area.x, window_y, area.width, height) cr.set_source_rgb(*fill_color) cr.fill() cr.rectangle(0.5, window_y + 0.5, LEFT_MARGIN_WIDTH - 1, height - 1) cr.set_source_rgb(*outline_color) cr.set_line_width(1) cr.stroke() def do_realize(self): gtk.TextView.do_realize(self) if not self.edit_only: self.get_window(gtk.TEXT_WINDOW_LEFT).set_background(self.style.white) # While the the worksheet is executing, we want to display a watch cursor # Trying to override the cursor setting of GtkTextView is really hard because # of things like hiding the cursor when typing, so we take the simple approach # of using an input-only "cover window" that we set the cursor on and # show on top of the GtkTextView's normal window. self.__watch_window = gtk.gdk.Window(self.window, self.allocation.width, self.allocation.height, gtk.gdk.WINDOW_CHILD, (gtk.gdk.SCROLL_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.POINTER_MOTION_HINT_MASK), gtk.gdk.INPUT_ONLY, x=0, y=0) self.__watch_window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) self.__watch_window.set_user_data(self) if self.get_buffer().worksheet.state == NotebookFile.EXECUTING: self.__watch_window.show() self.__watch_window.raise_() def do_unrealize(self): self.__watch_window.set_user_data(None) self.__watch_window.destroy() self.__watch_window = None gtk.TextView.do_unrealize(self) def do_size_allocate(self, allocation): gtk.TextView.do_size_allocate(self, allocation) if (self.flags() & gtk.REALIZED) != 0: self.__watch_window.resize(allocation.width, allocation.height) def __expose_window_left(self, event): (_, start_y) = self.window_to_buffer_coords(gtk.TEXT_WINDOW_LEFT, 0, event.area.y) start_line = self.__get_worksheet_line_at_y(start_y, adjust=ADJUST_AFTER) (_, end_y) = self.window_to_buffer_coords(gtk.TEXT_WINDOW_LEFT, 0, event.area.y + event.area.height - 1) end_line = self.__get_worksheet_line_at_y(end_y, adjust=ADJUST_BEFORE) buf = self.get_buffer() cr = event.window.cairo_create() for chunk in buf.worksheet.iterate_chunks(start_line, end_line + 1): if isinstance(chunk, StatementChunk): if chunk.executing: self.paint_chunk(cr, event.area, chunk, (0, 1, 0), (0, 0.5, 0)) elif chunk.error_message != None: self.paint_chunk(cr, event.area, chunk, (1, 0, 0), (0.5, 0, 0)) elif chunk.needs_compile: self.paint_chunk(cr, event.area, chunk, (1, 1, 0), (0.5, 0.5, 0)) elif chunk.needs_execute: self.paint_chunk(cr, event.area, chunk, (1, 0, 1), (0.5, 0.5, 0)) else: self.paint_chunk(cr, event.area, chunk, (0, 0, 1), (0, 0, 0.5)) def __draw_rect_outline(self, event, rect): if (rect.y + rect.height <= event.area.y or rect.y >= event.area.y + event.area.height): return cr = event.window.cairo_create() cr.set_line_width(1.) cr.rectangle(rect.x + 0.5, rect.y + 0.5, rect.width - 1, rect.height - 1) cr.set_source_rgb(0.6, 0.6, 0.6) cr.stroke() def __expose_arg_highlight(self, event): buf = self.get_buffer() # We want a rectangle enclosing the range between arg_highlight_start and # arg_highlight_end; the method here isn't correct in the presence of # RTL text, but the necessary Pango functionality isn't exposed to # a GtkTextView user. RTL code is rare. We also don't handle multiple-line # highlight regions right. (Return ends the highlight, so you'd need to paste) rect = self.get_iter_location(buf.get_iter_at_mark (self.__arg_highlight_start)) rect.x, rect.y = self.buffer_to_window_coords(gtk.TEXT_WINDOW_TEXT, rect.x, rect.y) rect.width = 0 end_rect = self.get_iter_location(buf.get_iter_at_mark (self.__arg_highlight_end)) end_rect.x, end_rect.y = self.buffer_to_window_coords(gtk.TEXT_WINDOW_TEXT, end_rect.x, end_rect.y) end_rect.width = 0 rect = rect.union(end_rect) self.__draw_rect_outline(event, rect) def __expose_pair_location(self, event): pair_location = self.get_buffer().get_pair_location() if pair_location == None: return rect = self.get_iter_location(pair_location) rect.x, rect.y = self.buffer_to_window_coords(gtk.TEXT_WINDOW_TEXT, rect.x, rect.y) self.__draw_rect_outline(event, rect) def do_expose_event(self, event): if not self.edit_only and event.window == self.get_window(gtk.TEXT_WINDOW_LEFT): self.__expose_window_left(event) return False gtk.TextView.do_expose_event(self, event) if event.window == self.get_window(gtk.TEXT_WINDOW_TEXT): if self.__arg_highlight_start: self.__expose_arg_highlight(event) else: self.__expose_pair_location(event) return False def __get_line_text(self, iter): start = iter.copy() start.set_line_index(0) end = iter.copy() end.forward_to_line_end() return start.get_slice(end) # This is likely overengineered, since we're going to try as hard as possible not to # have tabs in our worksheets. We don't do the funky handling of \f. def __count_indent(self, text): indent = 0 for c in text: if c == ' ': indent += 1 elif c == '\t': indent += 8 - (indent % 8) else: break return indent def __find_outdent(self, iter): buf = self.get_buffer() line, _ = buf.iter_to_pos(iter) current_indent = self.__count_indent(buf.worksheet.get_line(line)) while line > 0: line -= 1 line_text = buf.worksheet.get_line(line) # Empty lines don't establish indentation if ALL_WHITESPACE_RE.match(line_text): continue indent = self.__count_indent(line_text) if indent < current_indent: return re.match(r"^[\t ]*", line_text).group(0) return "" def __find_default_indent(self, iter): buf = self.get_buffer() line, offset = buf.iter_to_pos(iter) while line > 0: line -= 1 chunk = buf.worksheet.get_chunk(line) if isinstance(chunk, StatementChunk): return chunk.tokenized.get_next_line_indent(line - chunk.start) elif isinstance(chunk, CommentChunk): return " " * self.__count_indent(buf.worksheet.get_line(line)) return "" def __reindent_line(self, iter, indent_text): buf = self.get_buffer() line_text = self.__get_line_text(iter) prefix = re.match(r"^[\t ]*", line_text).group(0) diff = self.__count_indent(indent_text) - self.__count_indent(prefix) if diff == 0: return 0 common_len = 0 for a, b in zip(prefix, indent_text): if a != b: break common_len += 1 start = iter.copy() start.set_line_offset(common_len) end = iter.copy() end.set_line_offset(len(prefix)) # Nitpicky-detail. If the selection starts at the start of the line, and we are # inserting white-space there, then the whitespace should be *inside* the selection mark_to_start = None if common_len == 0 and buf.get_has_selection(): mark = buf.get_insert() if buf.get_iter_at_mark(mark).compare(start) == 0: mark_to_start = mark mark = buf.get_selection_bound() if buf.get_iter_at_mark(mark).compare(start) == 0: mark_to_start = mark buf.delete(start, end) buf.insert(end, indent_text[common_len:]) if mark_to_start != None: end.set_line_offset(0) buf.move_mark(mark_to_start, end) return diff def __reindent_selection(self, outdent): buf = self.get_buffer() bounds = buf.get_selection_bounds() if bounds == (): insert_mark = buf.get_insert() bounds = buf.get_iter_at_mark(insert_mark), buf.get_iter_at_mark(insert_mark) start, end = bounds line, _ = buf.iter_to_pos(start, adjust=ADJUST_AFTER) end_line, end_offset = buf.iter_to_pos(end, adjust=ADJUST_BEFORE) if end_offset == 0 and end_line > line: end_line -= 1 iter = buf.pos_to_iter(line) if outdent: indent_text = self.__find_outdent(iter) else: indent_text = self.__find_default_indent(iter) diff = self.__reindent_line(iter, indent_text) while True: line += 1 if line > end_line: return iter = buf.pos_to_iter(line) current_indent = self.__count_indent(self.__get_line_text(iter)) self.__reindent_line(iter, max(0, " " * (current_indent + diff))) def __hide_completion(self): if self.__completion_popup.showing: self.__completion_popup.popdown() def do_focus_out_event(self, event): self.__hide_completion() self.__doc_popup.popdown() return gtk.TextView.do_focus_out_event(self, event) def __rewrite_window(self, event): # Mouse events on the "watch window" that covers the text view # during calculation need to be forwarded to the real text window # since it looks bad if keynav works, but you can't click on the # window to set the cursor, select text, and so forth if event.window == self.__watch_window: event.window = self.get_window(gtk.TEXT_WINDOW_TEXT) # Events on the left-margin window also get written so the user can # click there when starting a drag selection. We need to adjust the # X coordinate in that case if not self.edit_only and event.window == self.get_window(gtk.TEXT_WINDOW_LEFT): event.window = self.get_window(gtk.TEXT_WINDOW_TEXT) if event.type == gtk.gdk._3BUTTON_PRESS: # Workaround for http://bugzilla.gnome.org/show_bug.cgi?id=573664 event.x = 50. else: event.x -= LEFT_MARGIN_WIDTH def do_button_press_event(self, event): self.__rewrite_window(event) self.__doc_popup.popdown() return gtk.TextView.do_button_press_event(self, event) def do_button_release_event(self, event): self.__rewrite_window(event) return gtk.TextView.do_button_release_event(self, event) def do_motion_notify_event(self, event): self.__rewrite_window(event) return gtk.TextView.do_motion_notify_event(self, event) def __remove_arg_highlight(self, cursor_to_end=True): buf = self.get_buffer() end = buf.get_iter_at_mark (self.__arg_highlight_end) buf.delete_mark(self.__arg_highlight_start) self.__arg_highlight_start = None buf.delete_mark(self.__arg_highlight_end) self.__arg_highlight_end = None if cursor_to_end: # If the arg_highlight ends at closing punctuation, skip over it tmp = end.copy() tmp.forward_char() text = buf.get_slice(end, tmp) if text in (")", "]", "}"): buf.place_cursor(tmp) else: buf.place_cursor(end) def do_key_press_event(self, event): buf = self.get_buffer() if self.__completion_popup.focused and self.__completion_popup.on_key_press_event(event): return True if self.__doc_popup.focused: self.__doc_popup.on_key_press_event(event) return True if not self.edit_only and event.keyval in (gtk.keysyms.F2, gtk.keysyms.KP_F2): self.__hide_completion() if self.__doc_popup.showing: self.__doc_popup.focus() else: self.show_doc_popup(focus_popup=True) return True if not self.__arg_highlight_start: self.__doc_popup.popdown() if event.keyval in (gtk.keysyms.KP_Enter, gtk.keysyms.Return): self.__hide_completion() if self.__arg_highlight_start: self.__remove_arg_highlight() self.__doc_popup.popdown() return True increase_indent = False insert = buf.get_iter_at_mark(buf.get_insert()) line, pos = buf.iter_to_pos(insert, adjust=ADJUST_NONE) # Inserting return inside a ResultChunk would normally do nothing # but we want to make it insert a line after the chunk if line == None and not buf.get_has_selection(): line, pos = buf.iter_to_pos(insert, adjust=ADJUST_BEFORE) iter = buf.pos_to_iter(line, -1) buf.place_cursor(iter) buf.insert_interactive(iter, "\n", True) return True buf.begin_user_action() gtk.TextView.do_key_press_event(self, event) # We need the chunks to be updated when computing the line indents buf.worksheet.rescan() insert = buf.get_iter_at_mark(buf.get_insert()) self.__reindent_line(insert, self.__find_default_indent(insert)) # If we have two comment lines in a row, assume a block comment if (line > 0 and isinstance(buf.worksheet.get_chunk(line), CommentChunk) and isinstance(buf.worksheet.get_chunk(line - 1), CommentChunk)): self.get_buffer().insert_interactive_at_cursor("# ", True) buf.end_user_action() return True elif event.keyval in (gtk.keysyms.Tab, gtk.keysyms.KP_Tab) and event.state & gtk.gdk.CONTROL_MASK == 0: buf.begin_user_action() self.__reindent_selection(outdent=False) buf.end_user_action() return True elif event.keyval == gtk.keysyms.ISO_Left_Tab and event.state & gtk.gdk.CONTROL_MASK == 0: buf.begin_user_action() self.__reindent_selection(outdent=True) buf.end_user_action() return True elif event.keyval == gtk.keysyms.space and event.state & gtk.gdk.CONTROL_MASK != 0: if self.__completion_popup.showing: if self.__completion_popup.spontaneous: self.__completion_popup.popup(spontaneous=False) else: self.__completion_popup.popdown() else: if self.__doc_popup.showing: self.__doc_popup.popdown() self.__completion_popup.popup(spontaneous=False) return True elif event.keyval in (gtk.keysyms.z, gtk.keysyms.Z) and \ (event.state & gtk.gdk.CONTROL_MASK) != 0 and \ (event.state & gtk.gdk.SHIFT_MASK) == 0: buf.worksheet.undo() return True # This is the gedit/gtksourceview binding to cause your hands to fall off elif event.keyval in (gtk.keysyms.z, gtk.keysyms.Z) and \ (event.state & gtk.gdk.CONTROL_MASK) != 0 and \ (event.state & gtk.gdk.SHIFT_MASK) != 0: buf.worksheet.redo() return True # This is the familiar binding (Eclipse, etc). Firefox supports both elif event.keyval in (gtk.keysyms.y, gtk.keysyms.Y) and event.state & gtk.gdk.CONTROL_MASK != 0: buf.worksheet.redo() return True return gtk.TextView.do_key_press_event(self, event) def __show_mouse_over(self): self.__mouse_over_timeout = None if self.__completion_popup.showing: return self.__doc_popup.set_target(self.__mouse_over_object) location = self.get_buffer().get_iter_at_mark(self.__mouse_over_start) self.__doc_popup.position_at_location(self, location) self.__doc_popup.popup() return False def __stop_mouse_over(self): if self.__mouse_over_timeout: gobject.source_remove(self.__mouse_over_timeout) self.__mouse_over_timeout = None self.__mouse_over_object = None def do_motion_notify_event(self, event): # Successful mousing-over depends on knowing the types of symbols so doing the # checks are pointless in edit-only mode if not self.edit_only and event.window == self.get_window(gtk.TEXT_WINDOW_TEXT) and not self.__doc_popup.focused: buf = self.get_buffer() x, y = self.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT, int(event.x), int(event.y)) iter, _ = self.get_iter_at_position(x, y) line, offset = buf.iter_to_pos(iter, adjust=ADJUST_NONE) if line != None: obj, start_line, start_offset, _,_ = buf.worksheet.get_object_at_location(line, offset) else: obj = None if not obj is self.__mouse_over_object: self.__stop_mouse_over() self.__doc_popup.popdown() if obj != None: start = buf.pos_to_iter(start_line, start_offset) buf.move_mark(self.__mouse_over_start, start) self.__mouse_over_object = obj try: timeout = self.get_settings().get_property('gtk-tooltip-timeout') except TypeError: # GTK+ < 2.12 timeout = 500 self.__mouse_over_timeout = gobject.timeout_add(timeout, self.__show_mouse_over) return gtk.TextView.do_motion_notify_event(self, event) def do_leave_notify_event(self, event): self.__stop_mouse_over() if not self.__doc_popup.focused: self.__doc_popup.popdown() return False def do_backspace(self): buf = self.get_buffer() insert = buf.get_iter_at_mark(buf.get_insert()) line, offset = buf.iter_to_pos(insert) current_chunk = buf.worksheet.get_chunk(line) if isinstance(current_chunk, StatementChunk) or isinstance(current_chunk, BlankChunk): line_text = buf.worksheet.get_line(line)[0:offset] if re.match(r"^[\t ]+$", line_text): self.__reindent_line(insert, self.__find_outdent(insert)) return return gtk.TextView.do_backspace(self) def __invalidate_status(self, chunk): buf = self.get_buffer() (start_y, start_height) = self.__get_worksheet_line_yrange(chunk.start) (end_y, end_height) = self.__get_worksheet_line_yrange(chunk.end - 1) (_, window_y) = self.buffer_to_window_coords(gtk.TEXT_WINDOW_LEFT, 0, start_y) if self.window: left_margin_window = self.get_window(gtk.TEXT_WINDOW_LEFT) left_margin_window.invalidate_rect((0, window_y, LEFT_MARGIN_WIDTH, end_y + end_height - start_y), False) def on_chunk_inserted(self, worksheet, chunk): self.__invalidate_status(chunk) def on_chunk_changed(self, worksheet, chunk, changed_lines): self.__invalidate_status(chunk) def on_chunk_status_changed(self, worksheet, chunk): self.__invalidate_status(chunk) def on_notify_state(self, worksheet, param_spec): if (self.flags() & gtk.REALIZED) != 0: if worksheet.state == NotebookFile.EXECUTING: self.__watch_window.show() self.__watch_window.raise_() else: self.__watch_window.hide() def on_after_insert_text(self, buf, location, text, len): if buf.worksheet.in_user_action() and not buf.in_modification(): self.__inserted_in_user_action = True def on_after_delete_range(self, buf, start, end): if buf.worksheet.in_user_action() and not buf.in_modification(): self.__deleted_in_user_action = True def on_after_end_user_action(self, buf): if not buf.worksheet.in_user_action(): if self.__completion_popup.showing: if self.__inserted_in_user_action or self.__deleted_in_user_action: self.__completion_popup.update() else: if self.__inserted_in_user_action and global_settings.autocomplete: self.__completion_popup.popup(spontaneous=True) self.__inserted_in_user_action = False self.__deleted_in_user_action = False def on_add_custom_result(self, buf, result, anchor): widget = result.create_widget() widget.show() self.add_child_at_anchor(widget, anchor) def on_mark_set(self, buffer, iter, mark): if self.__arg_highlight_start: # See if the user moved the cursor out of the highlight regionb buf = self.get_buffer() if mark != buf.get_insert(): return if (iter.compare(buf.get_iter_at_mark(self.__arg_highlight_start)) < 0 or iter.compare(buf.get_iter_at_mark(self.__arg_highlight_end)) > 0): self.__remove_arg_highlight(cursor_to_end=False) def __invalidate_char_position(self, iter): y, height = self.get_line_yrange(iter) if self.window: text_window = self.get_window(gtk.TEXT_WINDOW_TEXT) width, _ = text_window.get_size() text_window.invalidate_rect((0, y, width, height), False) def on_pair_location_changed(self, buf, old_position, new_position): if old_position: self.__invalidate_char_position(old_position) if new_position: self.__invalidate_char_position(new_position) def calculate(self): buf = self.get_buffer() buf.worksheet.calculate() # This is a hack to work around the fact that scroll_mark_onscreen() # doesn't wait for a size-allocate cycle, so doesn't properly handle # embedded request widgets self.size_request() self.size_allocate((self.allocation.x, self.allocation.y, self.allocation.width, self.allocation.height)) self.scroll_mark_onscreen(buf.get_insert()) def copy_as_doctests(self): buf = self.get_buffer() bounds = buf.get_selection_bounds() if bounds == (): start, end = buf.get_iter_at_mark(buf.get_insert()) else: start, end = bounds start_line, start_offset = buf.iter_to_pos(start, adjust=ADJUST_BEFORE) end_line, end_offset = buf.iter_to_pos(end, adjust=ADJUST_BEFORE) doctests = buf.worksheet.get_doctests(start_line, end_line + 1) self.get_clipboard(gtk.gdk.SELECTION_CLIPBOARD).set_text(doctests) def show_doc_popup(self, focus_popup=False): """Pop up the doc popup for the symbol at the insertion point, if any @param focus_popup: if True, the popup will be given keyboard focus """ buf = self.get_buffer() insert = buf.get_iter_at_mark(buf.get_insert()) line, offset = buf.iter_to_pos(insert, adjust=ADJUST_NONE) if line != None: obj, start_line, start_offset, _, _ = buf.worksheet.get_object_at_location(line, offset, include_adjacent=True) else: obj = None if obj != None: start = buf.pos_to_iter(start_line, start_offset) self.__stop_mouse_over() self.__doc_popup.set_target(obj) self.__doc_popup.position_at_location(self, start) if focus_popup: self.__doc_popup.popup_focused() else: self.__doc_popup.popup() def highlight_arg_region(self, start, end): """Highlight the region between start and end for argument insertion. A box will be drawn around the region as long as the cursor is inside the region. If the user hits return, the cursor will be moved to the end (and past a single closing punctuation at the end, if any.) @param start iter at the start of the highlight region @param end iter at the end of the highlight region """ buf = self.get_buffer() self.__arg_highlight_start = buf.create_mark(None, start, left_gravity=True) self.__arg_highlight_end = buf.create_mark(None, end, left_gravity=False) reinteract-0.5.0/lib/reinteract/sanitize_textview_ipc.py0000664000076400007640000002331411072035521020506 00000000000000# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## # # This file is about banging the IPC mechanisms of GtkTextView ... cut-and-paste, # middle-button-paste and DND into submission. Submission here means, in particular, # not including ResultChunk text in the result. # # The dependency of this on ShellView/ShellBuffer is slim ... we use a single # method buffer.get_public_text() to get a range of text without the results. # We also do RTTI in one case on ShellBuffer to detect cut-and-paste between # two ShellBuffers. # # Ideally there would eventually be mechanisms in GtkTextBuffer to make this all # easy... all we really want to do is provide a callback for "get IPC text", but # it's not clear how that would interact with all the (for this useless) # complexity that's been added there for custom serialization formats. # import cairo import gtk from shell_buffer import ShellBuffer class _IPCSanitizer(object): def __init__(self, view): self.view = view self.drag_start_position = None view.connect('cut-clipboard', self.on_cut_clipboard) view.connect('copy-clipboard', self.on_copy_clipboard) view.connect('button-press-event', self.on_button_press_event) view.connect('button-release-event', self.on_button_release_event) view.connect('motion-notify-event', self.on_motion_notify_event) view.connect('drag-data-get', self.on_drag_data_get) view.connect('drag-begin', self.on_drag_begin) # Cut and copy are the easy parts; we just override the action signals on the view, # and instead of doing all the complex copy-tags, serialize, in-process-special-case, etc, # stuff that the # that the GtkTextView def on_cut_clipboard(self, view): view.stop_emission('cut-clipboard') buf = view.get_buffer() bounds = buf.get_selection_bounds() if bounds == (): return start, end = bounds view.get_clipboard(gtk.gdk.SELECTION_CLIPBOARD).set_text(buf.get_public_text(*bounds)) buf.delete_interactive(start, end, view.get_editable()) def on_copy_clipboard(self, view): view.stop_emission('copy-clipboard') buf = view.get_buffer() bounds = buf.get_selection_bounds() if bounds == (): return view.get_clipboard(gtk.gdk.SELECTION_CLIPBOARD).set_text(buf.get_public_text(*bounds)) def __get_iter_at_event(self, event): x, y = self.view.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT, int(event.x), int(event.y)) return self.view.get_iter_at_location(x, y) def on_button_press_event(self, view, event): if event.type != gtk.gdk.BUTTON_PRESS or event.window != self.view.get_window(gtk.TEXT_WINDOW_TEXT): return False if event.button == 1: # DND tracking. See comment in on_motion_event location = self.__get_iter_at_event(event) bounds = view.get_buffer().get_selection_bounds() if bounds != () and location.in_range(*bounds): self.drag_start_position = (event.x, event.y) elif event.button == 2: # The middle-button paste is the part of this that gives us the most headaches, # since if we stole ownership of the "PRIMARY" clipboard from the buffer, it would # deselect. And there's no way to intercept the request for the text of the clipboard. # So, we just do as well as we can and fix middle-pasting from another (or the same) # ShellBuffer. # clipboard = view.get_clipboard(gtk.gdk.SELECTION_PRIMARY) owner = clipboard.get_owner() if isinstance(owner, ShellBuffer): buf = view.get_buffer() bounds = owner.get_selection_bounds() if bounds == (): return True location = self.__get_iter_at_event(event) buf.insert_interactive(location, owner.get_public_text(*bounds), view.get_editable()) return True return False def on_button_release_event(self, view, event): if event.window != self.view.get_window(gtk.TEXT_WINDOW_TEXT): return False if event.button == 1: # DND tracking. See comment in on_motion_event self.drag_start_position = None return False def on_motion_notify_event(self, view, event): if event.window != self.view.get_window(gtk.TEXT_WINDOW_TEXT): return False if self.drag_start_position != None: # We need to call gtk_drag_begin() ourselves so that we can provide the correct # target list. To do that, we duplicate the drag-and-logic, and just before the # text view would start the drag, we jump in and do it ourselves # start_x, start_y = self.drag_start_position if view.drag_check_threshold(int(start_x), int(start_y), int(event.x), int(event.y)): buf = view.get_buffer() bounds = buf.get_selection_bounds() # Synthesize a release event so GtkTextView doesn't start dragging on it's own release_event = gtk.gdk.Event(gtk.gdk.BUTTON_RELEASE) release_event.x = start_x release_event.y = start_y release_event.button = 1 release_event.window = event.window view.event(release_event) # but then we need to reselect, since the button release deselected if bounds != (): buf.select_range(*bounds) targets = gtk.target_list_add_text_targets() view.drag_begin(targets, gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE, 1, event) return True def on_drag_begin(self, view, context): # Since we are calling drag_begin ourselves, we also need to do the drag icon # icon creation. Well, OK, we could just go with the default drag icon.... # # Since we are doing it ourselves, we take the advantage to do a bit better # than the standard version: we don't wrap the lines, since that is wrong for # code, and (pure show-off) we fade out the text if we need to truncate it # The standard version goes to some effort to show both ends of the DND-region # which we don't try to duplicate. # MAX_WIDTH = 300 MAX_HEIGHT = 225 GRADIENT_SIZE = 25 BORDER_SIZE = 5 buf = view.get_buffer() bounds = buf.get_selection_bounds() if bounds == (): return text = buf.get_public_text(*bounds) layout = view.create_pango_layout(text) width, height = layout.get_pixel_size() pixmap_width = min(width, MAX_WIDTH) + BORDER_SIZE * 2 + 1 * 2 pixmap_height = min(height, MAX_HEIGHT) + BORDER_SIZE * 2 + 1 * 2 pixmap = gtk.gdk.Pixmap(view.get_window(gtk.TEXT_WINDOW_TEXT), pixmap_width, pixmap_height) # White background cr = pixmap.cairo_create() cr.set_source_rgb(1., 1., 1.) cr.paint() # Black outline cr.set_source_rgb(0., 0., 0.,) cr.rectangle(0.5, 0.5, pixmap_width - 1, pixmap_height - 1) cr.set_line_width(1) cr.stroke() # And the text cr.move_to(BORDER_SIZE + 1, BORDER_SIZE + 1) cr.show_layout(layout) # Pure show-off... fade out the text if it runs out of the region if width > MAX_WIDTH: pattern = cairo.LinearGradient(pixmap_width - GRADIENT_SIZE - 1, 0, pixmap_width - 1, 0) pattern.add_color_stop_rgba(0., 1., 1., 1., 0.) pattern.add_color_stop_rgba(1., 1., 1., 1., 1.) cr.set_source(pattern) cr.rectangle(pixmap_width - GRADIENT_SIZE - 1, 1, GRADIENT_SIZE, pixmap_height - 2) cr.fill() if height > MAX_HEIGHT: pattern = cairo.LinearGradient(0, pixmap_height - GRADIENT_SIZE - 1, 0, pixmap_height - 1) pattern.add_color_stop_rgba(0., 1., 1., 1., 0.) pattern.add_color_stop_rgba(1., 1., 1., 1., 1.) cr.set_source(pattern) cr.rectangle(1, pixmap_height - GRADIENT_SIZE - 1, pixmap_width - 2, GRADIENT_SIZE) cr.fill() # Bug in pygtk ... it doesn't support None for the mask, so we have to create a solid mask # http://bugzilla.gnome.org/show_bug.cgi?id=497781 mask = gtk.gdk.Pixmap(view.get_window(gtk.TEXT_WINDOW_TEXT), pixmap_width, pixmap_height, 1) # depth 1 == bitmap cr = mask.cairo_create() cr.set_source_rgb(1., 1., 1.) cr.paint() context.set_icon_pixmap(pixmap.get_colormap(), pixmap, mask, 0, 0) def on_drag_data_get(self, view, context, selection_data, info, time): # More straightforward than the rest of the DND handling, when drag target asks # for the text, just serve up the text in the selection as plain text # view.stop_emission('drag-data-get') buf = view.get_buffer() bounds = buf.get_selection_bounds() if bounds == (): return True selection_data.set_text(buf.get_public_text(*bounds)) def sanitize_view(view): # Attach our object to the view _IPCSanitizer(view) reinteract-0.5.0/lib/reinteract/recorded_object.py0000664000076400007640000001326011152366601017207 00000000000000# Copyright 2008 Owen Taylor # Copyright 2008 Kai Willadsen # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import copy import inspect def default_filter(baseclass, name): """Filter out attributes that should be excluded from a proxy class. @param baseclass: the class being proxied @param name: the C{baseclass} attribute being filtered @returns: False if C{baseclass.name} should not be proxied """ if not inspect.ismethod(getattr(baseclass, name)): return False if name.startswith('_'): return False return True class ReplayException(Exception): """ Exception class to help with locating an exception-causing call for a recorded class. Note that information such as line numbers is not used, so it's currently only slightly helpful. """ def __init__(self, orig_exception, orig_call): self.orig_exception = orig_exception self.orig_call = orig_call def __str__(self): exc_string = "on %(call_name)s()\n%(exc_name)s: %(exc_desc)s" % { 'call_name': self.orig_call[0], 'exc_name': self.orig_exception.__class__, 'exc_desc': str(self.orig_exception) } return exc_string class RecordedObject(object): """ A RecordedObject is a proxy for another object that Reinteract can't copy properly. It is designed for objects that are built up over a series of calls and then evaluated. This class should be used by subclassing C{RecordedObject} and then calling L{_set_target_class} on the new subclass. Because of the way that calls are recorded and replayed, exceptions from called methods will not be thrown until C{_replay} is called. To catch simple errors earlier, argument-checking support can be provided in subclasses by implementing a C{_check_} method for a given call. For example, to add argument checking for the C{plot} method, you would add the C{_check_plot} method to your subclass. """ def __init__(self): self._recreation_calls = [] def _replay(self, target): # At any point in time, an object's state can be recreated by # _replay()ing the calls recorded on it. for (call, args, kwargs) in self._recreation_calls: func = getattr(target, call) try: func(*args, **kwargs) except Exception, e: raise ReplayException(e, (call, args, kwargs)) def __copy__(self): new = self.__class__() new._recreation_calls = copy.copy(self._recreation_calls) return new def _check_call(self, name, args, kwargs, spec): # This tries to duplicate some of python's argument checking logic num_args = len(spec[0]) if spec[0] else 0 use_varargs = True if spec[1] else False use_kwargs = True if spec[2] else False num_defaults = len(spec[3]) if spec[3] else 0 given_args = len(args) + 1 # self not included min_args = num_args - num_defaults exact_args = num_defaults == 0 and not use_varargs if exact_args and given_args != num_args: raise TypeError("%(name)s() takes exactly %(reqd)d arguments (%(nargs)d given)" % { 'name': name, 'reqd': num_args, 'nargs': given_args }) elif given_args < min_args: raise TypeError("%(name)s() takes at least %(reqd)d arguments (%(nargs)d given)" % { 'name': name, 'reqd': min_args, 'nargs': given_args }) elif given_args > num_args and not use_varargs: raise TypeError("%(name)s() takes at most %(reqd)d arguments (%(nargs)d given)" % { 'name': name, 'reqd': num_args, 'nargs': given_args }) if kwargs and not use_kwargs: raise TypeError("%(name)s() got an unexpected keyword argument '%(kw)s'" % { 'name': name, 'kw': kwargs.iterkeys().next()}) @classmethod def _set_target_class(cls, baseclass, attr_filter=default_filter): """ Give class proxy methods from C{baseclass}, which can later be replayed. @param baseclass: the class to proxy @param attr_filter: a filter function for C{baseclass} attributes The C{attr_filter} function should take the baseclass and attribute name as arguments, and return True if an attribute should be included. This should be used to remove attributes that it makes little sense to include (e.g., C{__class__} or getters) or that you want to override. See L{default_filter}. """ def _create_proxy_method(name): spec = inspect.getargspec(getattr(baseclass, name)) try: func = getattr(cls, '_check_' + name) except AttributeError: func = getattr(cls, '_check_call') def record(self, *args, **kwargs): func(self, name, args, kwargs, spec) self._recreation_calls.append((name, args, kwargs)) return record whitelist = (d for d in dir(baseclass) if attr_filter(baseclass, d)) for attr in whitelist: if hasattr(cls, attr): raise AttributeError('%s already has attribute %s' % (cls, attr)) record = _create_proxy_method(attr) record.__name__ = attr record.__doc__ = getattr(baseclass, attr).__doc__ setattr(cls, attr, record) reinteract-0.5.0/lib/reinteract/popup.py0000664000076400007640000000626511072035450015240 00000000000000# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk # Space between a window the popup is "next to" and the popup HORIZONTAL_GAP = 5 # Space between the line of text where the cursor is and the popup VERTICAL_GAP = 5 class Popup(gtk.Window): """Base class for various popups""" __gsignals__ = { 'expose-event': 'override', } def __init__(self): gtk.Window.__init__(self, gtk.WINDOW_POPUP) self.set_border_width(1) self.showing = False self.focused = False def do_expose_event(self, event): gtk.Window.do_expose_event(self, event) # Draw a black rectangle around the popup cr = event.window.cairo_create() cr.set_line_width(1) cr.set_source_rgb(0., 0., 0.) cr.rectangle(0.5, 0.5, self.allocation.width - 1, self.allocation.height - 1) cr.stroke() return False def position_at_location(self, view, location): """Position the popup relative to a location within a gtk.TextView""" buf = view.get_buffer() cursor_rect = view.get_iter_location(location) cursor_rect.x, cursor_rect.y = view.buffer_to_window_coords(gtk.TEXT_WINDOW_TEXT, cursor_rect.x, cursor_rect.y) window = view.get_window(gtk.TEXT_WINDOW_TEXT) window_x, window_y = window.get_origin() cursor_rect.x += window_x cursor_rect.y += window_y x = cursor_rect.x y = cursor_rect.y + cursor_rect.height + VERTICAL_GAP _, height = self.get_size_request() # If the popup would go off the screen, pop it up above instead; should we # reverse the direction of the items here, as for a menu? I think that would # be more confusing than not doing so. if y + height > window.get_screen().get_height(): y = cursor_rect.y - VERTICAL_GAP - height # If we are already showing, at the right vertical position, move to the left # if necessary, but not to the right. This behavior is desirable for # the completion popup as we type extra characters if self.showing: old_x, old_y = self.window.get_position() if y == old_y or x >= old_x: return self.move(x, y) def position_next_to_window(self, window): """Position the popup so that it is immediately to the right of the specified window This only works properly if the window is undecorated, since we don't take the decorations into account. """ x, y = window.window.get_origin() width, height = window.window.get_size() self.move(x + width + HORIZONTAL_GAP, y) def focus(self): """Act as if the focus is on the popup (the parent still needs to send events to it )""" focus_in = gtk.gdk.Event(gtk.gdk.FOCUS_CHANGE) focus_in.window = self.window focus_in.in_ = True self.event(focus_in) self.focused = True reinteract-0.5.0/lib/reinteract/custom_result.py0000664000076400007640000000304411122056033016771 00000000000000# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk class CustomResult(object): def create_widget(self): raise NotImplementedError() def show_menu(widget, event, save_callback=None): """Convenience function to create a right-click menu with a Save As option""" toplevel = widget.get_toplevel() menu = gtk.Menu() menu.attach_to_widget(widget, None) menu_item = gtk.ImageMenuItem(stock_id=gtk.STOCK_SAVE_AS) menu_item.show() menu.add(menu_item) def on_selection_done(menu): menu.destroy() menu.connect('selection-done', on_selection_done) def on_activate(menu): chooser = gtk.FileChooserDialog("Save As...", toplevel, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK)) chooser.set_default_response(gtk.RESPONSE_OK) response = chooser.run() filename = None if response == gtk.RESPONSE_OK: filename = chooser.get_filename() chooser.destroy() if filename != None: save_callback(filename) menu_item.connect('activate', on_activate) menu.popup(None, None, None, event.button, event.time) reinteract-0.5.0/lib/reinteract/__init__.py0000664000076400007640000000000011063012627015612 00000000000000reinteract-0.5.0/lib/reinteract/completion_popup.py0000664000076400007640000002016011161233347017463 00000000000000# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk import inspect from popup import Popup from doc_popup import DocPopup from data_format import is_data_object from shell_buffer import ADJUST_NONE # Space between the line of text where the cursor is and the popup VERTICAL_GAP = 5 # Size of the popup WIDTH = 300 HEIGHT = 300 # If the user is just typing, the number of characters we require before # we start suggesting completions SPONTANEOUS_MIN_LENGTH = 3 class CompletionPopup(Popup): """Class implementing a completion popup for ShellView This class encapsulates the user interface logic for completion popups. The actual code to determine possible completions lives in tokenized_statement.py. """ def __init__(self, view): Popup.__init__(self) self.set_size_request(WIDTH, HEIGHT) self.__view = view sw = gtk.ScrolledWindow() self.add(sw) sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.__tree_model = gtk.ListStore(str, str, object) self.__tree = gtk.TreeView(self.__tree_model) self.__tree.set_headers_visible(False) self.__tree.get_selection().connect('changed', self.__on_selection_changed) self.__tree.connect('row-activated', self.__on_row_activated) cell = gtk.CellRendererText() column = gtk.TreeViewColumn(None, cell, text=0) self.__tree.append_column(column) sw.add(self.__tree) sw.show_all() self.set_default_size(WIDTH, HEIGHT) # A small amount of background shows between the scrollbar and the list; # which looks ugly if it is the only gray thing in the window, so change # the window background to white self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(65535, 65535, 65535)) self.__doc_popup= DocPopup(fixed_width=True, fixed_height=True, max_height=HEIGHT, can_focus=False) self._in_change = False self.spontaneous = False self.showing = False def __update_completions(self, spontaneous=False): buf = self.__view.get_buffer() self.__in_change = True self.__tree_model.clear() line, offset = buf.iter_to_pos(buf.get_iter_at_mark(buf.get_insert()), adjust=ADJUST_NONE) if line == None: completions = [] else: if spontaneous: min_length = SPONTANEOUS_MIN_LENGTH else: min_length = 0 completions = buf.worksheet.find_completions(line, offset, min_length) for display, completion, obj in completions: self.__tree_model.append([display, completion, obj]) if len(completions) > 0: self.__tree.set_cursor(0) self.__in_change = False self.__update_doc_popup() def __update_position(self): buf = self.__view.get_buffer() self.position_at_location(self.__view, buf.get_iter_at_mark(buf.get_insert())) def __update_doc_popup(self): if not self.showing: self.__doc_popup.popdown() return model, iter = self.__tree.get_selection().get_selected() if not iter: self.__doc_popup.popdown() return obj = model.get_value(iter, 2) # Long term it would be nice to preview the value of the # object, but it's distracting to show the class docs on int # for every integer constant, etc, which is what the DocPopup # does currently. if (obj == None or is_data_object(obj)): self.__doc_popup.popdown() return self.__doc_popup.set_target(obj) self.__doc_popup.popup() def __insert_completion(self, iter): completion = self.__tree_model.get_value(iter, 1) obj = self.__tree_model.get_value(iter, 2) buf = self.__view.get_buffer() default_editable = self.__view.get_editable() buf.insert_interactive_at_cursor(completion, default_editable) if inspect.isclass(obj) or inspect.isroutine(obj): # Show the doc popup to give the user information about what arguments # are posssible/required self.__view.show_doc_popup() # Insert a () and put the cursor in the middle buf.insert_interactive_at_cursor('(', default_editable) insert = buf.get_iter_at_mark(buf.get_insert()) mark_between_parens = buf.create_mark(None, insert, left_gravity=True) buf.insert_interactive_at_cursor(')', default_editable) iter = buf.get_iter_at_mark(mark_between_parens) self.__view.highlight_arg_region(iter, iter) buf.place_cursor(iter) buf.delete_mark(mark_between_parens) def __insert_selected(self): model, iter = self.__tree.get_selection().get_selected() self.__insert_completion(iter) def __on_selection_changed(self, selection): if not self.__in_change: self.__update_doc_popup() def __on_row_activated(self, view, path, column): self.__insert_completion(self.__tree_model.get_iter(path)) self.popdown() def popup(self, spontaneous=False): """Pop up the completion popup. If there are no possibilities completion at the insert cursor location, the popup is not popped up. If there is exactly one possibility and the spontaneous parameter is not provided , then completion is done immediately to that one possibility. @param spontaneous set to True if we're popping this up as a result of editing, rather than because of an explicit key shortcut. """ self.__update_completions(spontaneous=spontaneous) num_completions = len(self.__tree_model) if num_completions == 0: return elif num_completions == 1 and not spontaneous: self.__insert_selected() return self.__update_position() self.spontaneous = spontaneous if self.showing: return self.show() self.showing = True self.__doc_popup.position_next_to_window(self) self.__update_doc_popup() self.focus() def update(self): """Update the completion popup after the cursor is moved, or text is inserted. If there are no completion possibilities at the cursor when this is called, the popup is popped down. """ if not self.showing: return self.__update_completions(spontaneous=self.spontaneous) if len(self.__tree_model) == 0: self.popdown() return self.__update_position() def popdown(self): """Hide the completion if it is currently showing""" if not self.showing: return self.showing = False self.focused = False if self.__doc_popup.showing: self.__doc_popup.popdown() self.hide() def on_key_press_event(self, event): """Do key press handling while the popup is active. Returns True if the key press is handled, False otherwise. """ if event.keyval == gtk.keysyms.Escape: self.popdown() return True elif event.keyval in (gtk.keysyms.KP_Enter, gtk.keysyms.Return): self.__insert_selected() self.popdown() return True # These keys are forwarded to the popup to move the selected row elif event.keyval in (gtk.keysyms.Up, gtk.keysyms.KP_Up, gtk.keysyms.Down, gtk.keysyms.KP_Down, gtk.keysyms.Page_Up, gtk.keysyms.KP_Page_Up, gtk.keysyms.Page_Down, gtk.keysyms.KP_Page_Down): self.event(event) return True return False reinteract-0.5.0/lib/reinteract/config_file.py0000664000076400007640000001354611162516344016347 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## from ConfigParser import RawConfigParser, ParsingError, NoOptionError, NoSectionError import gobject import os import re _FLUSH_INTERVAL = 1000 # 1 second _need_quote_re = re.compile(r'[\s"]'); _backslash_re = re.compile(r'(\\)') _backslash_quote_re = re.compile(r'([\\"])') _unescape_re = re.compile(r'\\(.)') _list_item_re = re.compile(r'"(?:[^\\\"]+|\\.)*"|[^\s"]+') def _escape(s, unsafe_re): return unsafe_re.sub(r'\\\1', s) def _unescape(s): return _unescape_re.sub(r'\1', s) def _quote(s): if s == "" or _need_quote_re.search(s): return '"' + _escape(s, _backslash_quote_re) + '"' else: return _escape(s, _backslash_re) def _unquote(s): if len(s) >= 2 and s[0] == '"' and s[-1] == '"': return _unescape(s[1:-1]) else: return _unescape(s) def _quote_list(l): return " ".join((_quote(x) for x in l)) def _unquote_list(s): return [_unquote(x.group(0)) for x in _list_item_re.finditer(s)] class ConfigFile(object): """Class to load and store configuration and state infomration from an .INI-style file ConfigFile provides a high-evel interface around ConfigParser. It handles loading and saving the file (saving is automatically done in a timeout once a modification has been made, it auto-creates sections on demand, it handles quoting and has type-specific get and set functions with a the provision to pass a default to the get functions. """ def __init__(self, location): self.location = location self.flush_timeout = 0 self.parser = RawConfigParser() try: f = open(location, "r") except IOError, e: # If not readable, just ignore return try: self.parser.readfp(f) except ParsingError: # If not readable, just ignore return finally: f.close() def get_float(self, section, option, default=None): try: return self.parser.getfloat(section, option) except NoOptionError: return default except NoSectionError: return default def get_int(self, section, option, default=None): try: return self.parser.getint(section, option) except NoOptionError: return default except NoSectionError: return default def get_bool(self, section, option, default=None): try: return self.parser.get(section, option).lower() == 'true' except NoOptionError: return default except NoSectionError: return default def get_string(self, section, option, default=None): try: return _unquote(self.parser.get(section, option)) except NoOptionError: return default except NoSectionError: return default def get_list(self, section, option, default=None): try: return _unquote_list(self.parser.get(section, option)) except NoOptionError: return default except NoSectionError: return default def __set(self, section, option, value): if not self.parser.has_section(section): self.parser.add_section(section) self.parser.set(section, option, value) self.queue_flush() def set_int(self, section, option, value): self.__set(section, option, str(value)) def set_float(self, section, option, value): self.__set(section, option, str(value)) def set_bool(self, section, option, value): self.__set(section, option, str(value)) def set_string(self, section, option, value): self.__set(section, option, _quote(value)) def set_list(self, section, option, value): self.__set(section, option, _quote_list(value)) def remove_option(self, section, option): if self.parser.has_section(section): self.parser.remove_option(section, option) self.queue_flush() def flush(self): if self.flush_timeout != 0: gobject.source_remove(self.flush_timeout) self.flush_timeout = 0 tmpname = self.location + ".tmp" f = open(tmpname, "w") success = False try: self.parser.write(f) f.close() if os.path.exists(self.location): os.remove(self.location) os.rename(tmpname, self.location) success = True finally: if not success: f.close() try: os.remove(tmpname) except: pass def queue_flush(self): if self.flush_timeout == 0: self.flush_timeout = gobject.timeout_add(_FLUSH_INTERVAL, self.flush) ###################################################################### if __name__ == '__main__': #pragma: no cover import tempfile from test_utils import assert_equals def test_quote(s, expected): quoted = _quote(s) assert_equals(quoted, expected) unquoted = _unquote(quoted) assert_equals(unquoted, s) test_quote(r'', r'""') test_quote(r'foo', r'foo') test_quote(r'fo"o', r'"fo\"o"') test_quote(r'fo o', r'"fo o"') test_quote(r'fo\o', r'fo\\o') def test_quote_list(l, expected): quoted = _quote_list(l) assert_equals(quoted, expected) unquoted = _unquote_list(quoted) assert_equals(unquoted, l) test_quote_list(['foo'], 'foo') test_quote_list(['foo bar'], '"foo bar"') test_quote_list(['foo', 'bar'], 'foo bar') test_quote_list(['foo', 'bar baz'], 'foo "bar baz"') reinteract-0.5.0/lib/reinteract/iter_copy_from.py0000664000076400007640000000320611072035301017100 00000000000000# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk from ctypes import * # This works around a hole in the pygtk API, see: # # http://bugzilla.gnome.org/show_bug.cgi?id=481715 # # In theory, it's relatively robust against different architectures, # and even the more probable changes between GTK+/pygtk/Python versions, # but there's a lot that could go wrong. class _GtkTextIter(Structure): _fields_ = [ ("dummy1", c_void_p), ("dummy2", c_void_p), ("dummy3", c_int), ("dummy4", c_int), ("dummy5", c_int), ("dummy6", c_int), ("dummy7", c_int), ("dummy8", c_int), ("dummy9", c_void_p), ("dummy10", c_void_p), ("dummy11", c_int), ("dummy12", c_int), ("dummy13", c_int), ("dummy14", c_void_p) ] class _PyGBoxed_TextIter(Structure): _fields_ = [ ("PyObject_HEAD", c_byte * object.__basicsize__), ("boxed", POINTER(_GtkTextIter) ) ] def iter_copy_from(iter, other): iter_ctypes = _PyGBoxed_TextIter.from_address(id(iter)).boxed.contents other_ctypes = _PyGBoxed_TextIter.from_address(id(other)).boxed.contents for name, type in iter_ctypes._fields_: iter_ctypes.__setattr__(name, other_ctypes.__getattribute__(name)) reinteract-0.5.0/lib/reinteract/open_notebook.py0000664000076400007640000001476511072035440016741 00000000000000# Copyright 2008 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gobject import gtk import pango import re from application import application from global_settings import global_settings from notebook_window import NotebookWindow from window_builder import WindowBuilder class OpenNotebookBuilder(WindowBuilder): def __init__(self): WindowBuilder.__init__(self, 'open-notebook') tree = self.notebooks_tree self.model = gtk.ListStore(gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT) for info in application.get_notebook_infos(): iter = self.model.append() state = application.state.get_notebook_state(info.folder) self.model.set_value(iter, 0, info) self.model.set_value(iter, 1, state) tree.set_model(self.model) ############################## name_column = gtk.TreeViewColumn("Name") tree.append_column(name_column) cell_renderer = gtk.CellRendererText() name_column.pack_start(cell_renderer, True) name_column.set_cell_data_func(cell_renderer, self.__name_data_func) self.model.set_sort_func(0, self.__name_column_sort) name_column.set_sort_column_id(0) ############################## description_column = gtk.TreeViewColumn("Description") description_column.set_expand(True) tree.append_column(description_column) cell_renderer = gtk.CellRendererText() cell_renderer.props.ellipsize = pango.ELLIPSIZE_END description_column.pack_start(cell_renderer, True) description_column.set_cell_data_func(cell_renderer, self.__description_data_func) ############################## modified_column = gtk.TreeViewColumn("Last Modified") tree.append_column(modified_column) cell_renderer = gtk.CellRendererText() modified_column.pack_start(cell_renderer, True) modified_column.set_cell_data_func(cell_renderer, self.__modified_data_func) self.model.set_sort_func(2, self.__modified_column_sort) modified_column.set_sort_column_id(2) ############################## opened_column = gtk.TreeViewColumn("Last Opened") tree.append_column(opened_column) cell_renderer = gtk.CellRendererText() opened_column.pack_start(cell_renderer, True) opened_column.set_cell_data_func(cell_renderer, self.__opened_data_func) self.model.set_sort_func(3, self.__opened_column_sort) opened_column.set_sort_column_id(3) self.model.set_sort_column_id(3, gtk.SORT_ASCENDING) ############################## tree.get_selection().connect('changed', self.__update_open_button_sensitivity) self.__update_open_button_sensitivity() tree.connect('row-activated', self.on_row_activated) def __name_data_func(self, column, cell, model, iter): info = model.get_value(iter, 0) cell.props.text = info.name # This is a very inefficient thing to do in a cell-data func, but we assume # that the number of open windows is very small already_open = False for window in application.windows: if isinstance(window, NotebookWindow) and window.notebook.folder == info.folder: already_open = True if already_open: cell.props.weight = pango.WEIGHT_BOLD else: cell.props.weight_set = False def __name_column_sort(self, model, iter_a, iter_b): a = model.get_value(iter_a, 0) b = model.get_value(iter_b, 0) return cmp(a.name, b.name) def __description_data_func(self, column, cell, model, iter): info = model.get_value(iter, 0) # The short description is the description up to the first newline or # up to the first "sentence end" if that comes first description = re.sub(r"(.*?)(\n|\r|(<=\.)\s)(.*)", r"\1", info.description) cell.props.text = description def __modified_data_func(self, column, cell, model, iter): info = model.get_value(iter, 0) cell.props.text = info.last_modified_text def __modified_column_sort(self, model, iter_a, iter_b): a = model.get_value(iter_a, 0) b = model.get_value(iter_b, 0) return - cmp(a.last_modified, b.last_modified) def __opened_data_func(self, column, cell, model, iter): state = model.get_value(iter, 1) cell.props.text = state.get_last_opened_text() def __opened_column_sort(self, model, iter_a, iter_b): a = model.get_value(iter_a, 1) b = model.get_value(iter_b, 1) return - cmp(a.get_last_opened(), b.get_last_opened()) def __update_open_button_sensitivity(self, *args): self.open_button.set_sensitive(self.get_selected_info() != None) def on_row_activated(self, tree_view, path, column): self.dialog.response(gtk.RESPONSE_OK) def get_selected_info(self): model, selected = self.notebooks_tree.get_selection().get_selected() if selected: return model.get_value(selected, 0) else: return None def run(parent=None): builder = OpenNotebookBuilder() builder.dialog.set_transient_for(parent) result_window = None while True: response = builder.dialog.run() if response == 0: # gtk-builder-convert puts check/radio buttons in action-widgets continue if response == gtk.RESPONSE_OK: # We have to hide the modal dialog, or with metacity the new window pops at the back builder.dialog.hide() selected_info = builder.get_selected_info() result_window = application.open_notebook(selected_info.folder) elif response == 1: # Browse... chooser = gtk.FileChooserDialog("Open Notebook...", parent, gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) chooser.set_default_response(gtk.RESPONSE_OK) response = chooser.run() if response == gtk.RESPONSE_OK: filename = chooser.get_filename() result_window = application.open_notebook(filename) chooser.destroy() break builder.dialog.destroy() return result_window reinteract-0.5.0/lib/reinteract/format_escaped.py0000664000076400007640000000245011072035216017041 00000000000000# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## # # Very, very partial implementation of g_markup_printf_escaped(). Doesn't # handling things like a %c with an integer argument that evaluates to # a markup special character, or special characters in the repr() or str() # of an object. It also doesn't handle %(name)s type arguments with # keyword arguments. # # To do better at escaping everything, you'd probably want to apply the # implementation technique of g_markup_printf_escaped(). The main difficulty # of that is that you need then to be able to split the format string into # format specifiers and other sections, which means # a big regular expression encoding the format specifers defined by # http://docs.python.org/lib/typesseq-strings.html # from gobject import markup_escape_text def _escape(o): if isinstance(o, basestring): return markup_escape_text(o) else: return o def format_escaped(fmt, *args): return fmt % tuple((_escape(x) for x in args)) if __name__ == '__main__': assert format_escaped("%s %.4f", "&foo", 4.3) == "&foo 4.3000" reinteract-0.5.0/lib/reinteract/tokenized_statement.py0000664000076400007640000007247211162516344020166 00000000000000# Copyright 2007-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import inspect from retokenize import * # These are keywords where completion doesn't make sense afterwords, for # various reasons NO_COMPLETION_KEYWORDS = set([ 'as', 'class', 'def', 'for', 'lambda', # introduce new names 'from', 'import', # different completion space 'break', 'continue', 'finally', 'pass', 'try' # nothing allowed after keyword ]) # These are tokens that the Python grammer won't allow a TOKEN_NAME after; by # preventing completion here we prevent auto-complete from popping up completions # to a name when the user was trying to enter a keyword (like 'for x ') NO_COMPLETION_TOKENS = set([ TOKEN_NAME, TOKEN_STRING, TOKEN_NUMBER, TOKEN_JUNK, TOKEN_RPAREN, TOKEN_RSQB, TOKEN_BUILTIN_CONSTANT ]) def get_prefixes(items): result = set() for s in items: for l in xrange(1, len(s) + 1): result.add(s[0:l]) return result # We don't complete to keywords currently, so when in spontaneous completion # mode, it's annoying when you trying to type a keyword, we offer to complete # to random variables. Even if we supported keyword completion (nice addition) # it would still be annoying for common keywords KEYWORD_PREFIXES = get_prefixes([ 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from' 'if', 'import', 'in', 'is', 'global', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'with', 'while', 'yield' ]) class _TokenIter(object): def __init__(self, statement, line, i): self.statement = statement self.line = line self.i = i self.__update() def __update(self): self.token_type, self.start, self.end, self.flags = self.statement.tokens[self.line][self.i] def prev(self): if self.i > 0: self.i -= 1 else: l = self.line - 1 while True: if l < 0: raise StopIteration("Already at beginning") if len(self.statement.tokens[l]) > 0: break l -= 1 self.line = l self.i = len(self.statement.tokens[l]) - 1 self.__update() def next(self): if self.i + 1 < len(self.statement.tokens[self.line]): self.i += 1 else: l = self.line + 1 while True: if l >= len(self.statement.tokens): raise StopIteration("Already at end") if len(self.statement.tokens[l]) > 0: break l += 1 self.line = l self.i = 0 self.__update() def is_open(self): return self.flags & FLAG_OPEN != 0 def is_close(self): return self.flags & FLAG_CLOSE != 0 class TokenizedStatement(object): def __init__(self): self.lines = [] self.tokens = [] self.stacks = [] def set_lines(self, lines): """Set the lines in the Tokenized statement Returns None if nothing changed, otherwise returns a range (start, end) of lines that were added or changed. A return of an empty range means that some lines were deleted, but none added or changed. """ # We want to avoid retokenizing everything on pure insertions # to make editing not egregiously O(n^2); we don't care much # if we have to retokenize on other cases. old_lines = self.lines old_tokens = self.tokens old_stacks = self.stacks self.lines = lines tokens = self.tokens = [None] * len(lines) stacks = self.stacks = [None] * len(lines) # Iterate forward, find an unchanged segment of lines at the front m = min(len(lines), len(old_lines)) i = 0 while i < m: if lines[i] != old_lines[i]: break tokens[i] = old_tokens[i] stacks[i] = old_stacks[i] i += 1 if i == len(lines) and i == len(old_lines): # Nothing to do return None # Iterate backwards, find an unchanged segment of lines at the end m = min(len(lines) - i, len(old_lines) - i) j = 0 new_pos = len(lines) - 1 old_pos = len(old_lines) - 1 while j < m: if lines[new_pos] != old_lines[old_pos]: break tokens[new_pos] = old_tokens[old_pos] stacks[new_pos] = old_stacks[old_pos] new_pos -= 1 old_pos -= 1 j += 1 # Start tokenizing at the first changed line if i > 0: stack = stacks[i - 1] else: stack = [] change_start = -1 change_end = -1 while i < len(lines): if i > new_pos: # Once we are in the trailing section if identical # lines, and the stack is the same as it was before, # we can stop old_i = old_pos + i - new_pos - 1 if old_i < 0: old_stack = [] else: old_stack = old_stacks[old_i] if stack == old_stack: break if change_start == -1: change_start = i change_end = i + 1 tokens[i], stack = tokenize_line(lines[i], stack) stacks[i] = stack i += 1 return (change_start, change_end) def get_text(self): return "\n".join(self.lines) def get_tokens(self, line): return self.tokens[line] def _get_iter(self, line, index): # Get an iterator pointing to the token containing the specified # position. Return None if there no such token for i, (_, start, end, _) in enumerate(self.tokens[line]): if start > index: return None if start <= index and end > index: return _TokenIter(self, line, i) return None def _get_iter_before(self, line, index): # Get an iterator pointing the last token that is not completely after # the specified position. Returns None if the position is before any tokens tokens = self.tokens[line] if len(tokens) == 0 or index <= tokens[0][1]: while line > 0: line -= 1 if len(self.tokens[line]) > 0: return _TokenIter(self, line, len(self.tokens[line]) - 1) return None else: for i, (_, start, end, _) in enumerate(tokens): if index <= start: return _TokenIter(self, line, i - 1) return _TokenIter(self, line, len(tokens) - 1) def _get_start_iter(self): # Get an iterator pointing to the first token, or None if the statement # is empty line = 0 while line < len(self.lines) and len(self.tokens[line]) == 0: line += 1 if line == len(self.lines) or len(self.tokens[line]) == 0: return None return _TokenIter(self, line, 0) def get_pair_location(self, line, index): iter = self._get_iter(line, index) if iter == None: return None, None # We don't do pair matching on strings; it's obvious from the # fontification, even though strings can participate in the stack if iter.token_type == TOKEN_STRING: return None, None elif iter.is_close(): level = 0 while True: if iter.is_close(): level += 1 elif iter.is_open(): level -= 1 if level == 0: return iter.line, iter.start iter.prev() elif iter.is_open(): level = 0 while True: if iter.is_close(): level -= 1 elif iter.is_open(): level += 1 if level == 0: return iter.line, iter.start try: iter.next() except StopIteration: break return None, None def get_next_line_indent(self, line): base_line = line while True: prev_line = base_line - 1 if prev_line < 0: break if (len(self.stacks[prev_line]) == 0 and (len(self.tokens[prev_line]) == 0 or self.tokens[prev_line][-1][0] != TOKEN_CONTINUATION)): break base_line = prev_line indent_text = re.match(r"^[\t ]*", self.lines[base_line]).group(0) extra_indent = 0 tokens = self.tokens[line] if (len(tokens) > 0 and tokens[-1][0] == TOKEN_COLON or len(tokens) > 1 and tokens[-1][0] == TOKEN_COMMENT and tokens[-2][0] == TOKEN_COLON): extra_indent = 4 elif len(self.stacks[line]) > 0: extra_indent = 4 elif len(tokens) > 0 and tokens[-1][0] == TOKEN_CONTINUATION: extra_indent = 4 if extra_indent != 0: indent_text += " " * extra_indent return indent_text def __statement_is_import(self): iter = self._get_start_iter() if iter != None: while iter.token_type == TOKEN_CONTINUATION: try: iter.next() except StopIteration: break if iter.token_type == TOKEN_KEYWORD: keyword = self.lines[iter.line][iter.start:iter.end] if keyword == 'import' or keyword == 'from': return True return False # See if the iter points to a place where completion on the next # word doesn't make sense. def __check_no_completion_after(self, iter): if iter.token_type == TOKEN_KEYWORD: keyword = self.lines[iter.line][iter.start:iter.end] # example: no completion after 'for' return keyword in NO_COMPLETION_KEYWORDS if iter.token_type in NO_COMPLETION_TOKENS: # example: no completion after 'for x ' return True return False def __resolve_names(self, names, scope): obj = None for name in names: # First name is resolved against the scope if obj == None: try: obj = scope[name] except KeyError: return None # Subsequent names resolved else: try: obj = getattr(obj, name) except AttributeError: return None return obj def __sort_completions(self, completions): # Sort a set of completions with _ and __ names at the end. # (modifies completions and then returns it for convenience) def compare_completions(a, b): n_a = a[0] n_b = b[0] if n_a.startswith("__") and not n_b.startswith("__"): return 1 elif n_b.startswith("__") and not n_a.startswith("__"): return -1 elif n_a.startswith("_") and not n_b.startswith("_"): return 1 elif n_b.startswith("_") and not n_a.startswith("_"): return -1 else: return cmp(n_a, n_b) completions.sort(compare_completions) return completions def __list_scope(self, scope): # List possible completions given a scope directionary possible = scope.items() if '__builtins__' in scope: builtins = scope['__builtins__'] if not isinstance(builtins, dict): builtins = dir(builtins) for k in builtins: if not k in scope: possible.append((k, builtins[k])) return possible def __find_no_symbol_completions(self, scope): # Return the completions to offer when we don't have a start at a symbol result = [] for completion, obj in self.__list_scope(scope): result.append((completion, completion, obj)) return self.__sort_completions(result) def find_completions(self, line, index, scope, min_length=0): """Returns a list of possible completions at the given line and index. Scope is the scope to start calculating the comptions from. Each element in the returned list is a tuple of (display_form, text_to_insert, object_completed_to)' where object_completed_to can be used to determine the type of the completion or get docs about it. @param min_length if supplied, the minimum length to require for an isolated name before we complete against the scope. This is useful if we are suggesting completions without the user explicitly requesting it. """ # We turn off completion within an import statement, since it's less # than useful to complete to symbols in the current scope. Better would be to # actually examine the path and complete to real imports. if self.__statement_is_import(): return [] # We can offer completions if we are at a position of the form: # ([TOKEN_NAME|TOKEN_BUILTIN_CONSTANT] TOKEN_DOT)* (TOKEN_NAME|TOKEN_KEYWORD|TOKEN_BUILTIN_CONSTANT)? # # We work backwards from the last name, and build a list of names, then resolve # that list of names against the scope. # Look for a token right before the specified position. index - 1 is OK here # even though that byte may note b a character start since we are just # interested in a position inside the token iter = self._get_iter(line, index - 1) if iter != None and (iter.token_type == TOKEN_KEYWORD or iter.token_type == TOKEN_NAME or iter.token_type == TOKEN_BUILTIN_CONSTANT): end = min(iter.end, index) names = [self.lines[iter.line][iter.start:end]] try: iter.prev() except StopIteration: iter = None else: # For a TOKEN_DOT, we can be more forgiving and accept white space between the # token and the current position iter = self._get_iter_before(line, index) if iter != None and iter.token_type == TOKEN_DOT: names = [''] elif min_length > 0: return [] # This is a non-exhaustive list of places where we know that we shouldn't complete to the # the scope. (We could do better by special casing actual completions for TOKEN_RSQB, TOKEN_RBRACE, # TOKEN_STRING) elif iter != None and iter.token_type in (TOKEN_NAME, TOKEN_BUILTIN_CONSTANT, TOKEN_RPAREN, TOKEN_RSQB, TOKEN_RBRACE, TOKEN_STRING, TOKEN_NUMBER): return [] elif iter != None and self.__check_no_completion_after(iter): return [] else: return self.__find_no_symbol_completions(scope) while iter and iter.token_type == TOKEN_DOT: try: iter.prev() except StopIteration: return [] if iter.token_type != TOKEN_NAME and iter.token_type != TOKEN_BUILTIN_CONSTANT: return [] names.insert(0, self.lines[iter.line][iter.start:iter.end]) try: iter.prev() except StopIteration: iter = None if iter and self.__check_no_completion_after(iter): return [] # We resolve the leading portion of the name path if len(names) > 1: object = self.__resolve_names(names[0:-1], scope) if object == None: return [] else: if len(names[0]) < min_length: return [] # When we are in "spontaneous mode" (slightly hackish to use min_length # for this), we don't want to complete if the user might be typing a keyword if min_length > 0 and names[0] in KEYWORD_PREFIXES: return [] object = None # Then we complete the last element of the name path against what we resolved # to, or against the scope (if there was just one name) result = [] to_complete = names[-1] if object == None: for completion, obj in self.__list_scope(scope): if completion.startswith(to_complete): result.append((completion, completion[len(to_complete):], obj)) else: for completion in dir(object): if completion.startswith(to_complete): if inspect.ismodule(object): object_completed_to = getattr(object, completion, None) # We special case these because obj.__class__.__module__/__doc__ # are also a strings, not a method/property elif completion != '__module__' and completion != '__doc__': # Using the attribute of the class over the attribute of # the object gives us better docs on properties try: klass = getattr(object, '__class__') object_completed_to = getattr(klass, completion) except AttributeError: object_completed_to = getattr(object, completion) else: object_completed_to = None result.append((completion, completion[len(to_complete):], object_completed_to)) return self.__sort_completions(result) def get_object_at_location(self, line, index, scope, result_scope=None, include_adjacent=False): """Find the object at a particular location within the statement. Returns a tuple of (object, token_start_line, token_start_index, token_end_line, token_end_index) or None, None, None, None, None if there is no object @param scope: scope dictionary to start resolving names from. @param result_scope: scope to resolve names from on the left side of an assignment @param include_adjacent: if False, then line/index identifies a character in the buffer. If True, then line/index identifies a position between characters, and symbols before or after that position are included. """ NO_RESULT = None, None, None, None, None # Names within an import statement aren't there yet if self.__statement_is_import(): return NO_RESULT # We can resolve the object if we are inside the final token of a sequence of the form: # ([TOKEN_NAME|TOKEN_BUILTIN_CONSTANT] TOKEN_DOT)* (TOKEN_NAME|TOKEN_KEYWORD|TOKEN_BUILTIN_CONSTANT) # # We work backwards from the last name, and build a list of names, then resolve # that list of names against the scope iter = self._get_iter(line, index) if iter != None and not (iter.token_type == TOKEN_KEYWORD or iter.token_type == TOKEN_NAME or iter.token_type == TOKEN_BUILTIN_CONSTANT): iter = None if iter == None and include_adjacent and index > 0: iter = self._get_iter(line, index - 1) if iter != None and not (iter.token_type == TOKEN_KEYWORD or iter.token_type == TOKEN_NAME or iter.token_type == TOKEN_BUILTIN_CONSTANT): iter = None if iter == None: return NO_RESULT start_index = iter.start end_index = iter.end names = [self.lines[iter.line][iter.start:iter.end]] try: iter.prev() except StopIteration: pass while iter.token_type == TOKEN_DOT: try: iter.prev() except StopIteration: return NO_RESULT if iter.token_type != TOKEN_NAME and iter.token_type != TOKEN_BUILTIN_CONSTANT: return NO_RESULT names.insert(0, self.lines[iter.line][iter.start:iter.end]) if result_scope != None: while True: try: iter.next() except StopIteration: break if iter.token_type == TOKEN_EQUAL or iter.token_type == TOKEN_AUGEQUAL: scope = result_scope break obj = self.__resolve_names(names, scope) if obj != None: return obj, line, start_index, line, end_index else: return NO_RESULT def __repr__(self): return "TokenizedStatement" + repr([([(t[0], line[t[1]:t[2]]) for t in tokens], stack) for line, tokens, stack in zip(self.lines, self.tokens, self.stacks)]) if __name__ == '__main__': import sys failed = False def expect(ts, expected): result = [] for line, tokens, stack in zip(ts.lines, ts.tokens, ts.stacks): elements = [ line[t[1]:t[2]] for t in tokens ] if stack != []: elements.append(stack) result.append(elements) if result != expected: print "For:\n%s\nGot:\n%s\nExpected:\n%s\n" % ( "\n".join(ts.lines), "\n".join([repr(l) for l in result]), "\n".join([repr(l) for l in expected])) failed = True ts = TokenizedStatement() assert ts.set_lines(["1"]) == (0, 1) expect(ts, [["1"]]) ts = TokenizedStatement() assert ts.set_lines(['"""a','b"""']) == (0, 2) expect(ts, [['"""a',['"""']],['b"""']]) ts = TokenizedStatement() assert ts.set_lines(['(1 + 2','+ 3 + 4)']) == (0, 2) expect(ts, [['(', '1', '+', '2', ['(']], ['+', '3', '+', '4', ')']]) assert ts.set_lines(['(1 + 2','+ 3 + 4)']) == None expect(ts, [['(', '1', '+', '2', ['(']], ['+', '3', '+', '4', ')']]) assert ts.set_lines(['(1 + 2','+ 5 + 6)']) == (1, 2) expect(ts, [['(', '1', '+', '2', ['(']], ['+', '5', '+', '6', ')']]) assert ts.set_lines(['(3 + 4','+ 5 + 6)']) == (0, 1) expect(ts, [['(', '3', '+', '4', ['(']], ['+', '5', '+', '6', ')']]) assert ts.set_lines(['((1 + 2','+ 5 + 6)']) == (0, 2) expect(ts, [['(', '(', '1', '+', '2', ['(', '(']], ['+', '5', '+', '6', ')', ['(']]]) assert ts.set_lines(['((1 + 2', '+ 3 + 4)', '+ 5 + 6)']) == (1, 3) expect(ts, [['(', '(', '1', '+', '2', ['(', '(']], ['+', '3', '+', '4', ')', ['(']], ['+', '5', '+', '6', ')']]) assert ts.set_lines(['((1 + 2', '+ 3 + 4)']) == (-1, -1) # truncation ### Tests of iterator functionality ts = TokenizedStatement() ts.set_lines(['(1 + ','2)']) assert ts._get_iter(0, 2) == None assert ts._get_iter(1, 2) == None i = ts._get_iter(0, 3) assert i.token_type == TOKEN_PUNCTUATION assert i.start == 3 assert i.end == 4 i.prev() assert i.token_type == TOKEN_NUMBER assert i.start == 1 assert i.end == 2 i.prev() assert i.token_type == TOKEN_LPAREN assert i.start == 0 assert i.end == 1 raised = False try: i.prev() except StopIteration: raised = True assert raised assert i.start == 0 assert i.end == 1 i = ts._get_iter(0, 3) i.next() assert i.line == 1 assert i.start == 0 assert i.end == 1 i.next() assert i.start == 1 assert i.end == 2 raised = False try: i.next() except StopIteration: raised = True assert raised assert i.start == 1 assert i.end == 2 ### Tests of paired punctuation ts = TokenizedStatement() ts.set_lines(['a = ([(1 + ', '2), { "a" : "b" }', ']}']) # Pair location is not at a random position assert ts.get_pair_location(1, 2) == (None, None) # Pair location is None for an unpaired closed (which isn't a close at all) assert ts.get_pair_location(2, 1) == (None, None) # Pair location is None for an unpaired open assert ts.get_pair_location(0, 4) == (None, None) # Open punctuation assert ts.get_pair_location(0, 5) == (2, 0) assert ts.get_pair_location(1, 4) == (1, 16) # Close punctuation assert ts.get_pair_location(2, 0) == (0, 5) assert ts.get_pair_location(1, 16) == (1, 4) ### Tests of get_next_line_indent() ts = TokenizedStatement() lines = ([('if (True):', 4), (' pass', 4), ('if (True): # a true statement', 4), (' pass', 4), ('if (a >', 4), (' 1 +', 4), (' 5):', 4), (' pass', 4), ('"""A string', 4), (' more string', 4), (' string finish"""', 0), ('a = \\', 4), (' 1', 0), ]) ts.set_lines([text for text, _ in lines]) for i, (text, expected) in enumerate(lines): next_line_indent = ts.get_next_line_indent(i).count(" ") if next_line_indent != expected: print "For %s, got next_line_indent=%d, expected %d" % (text, next_line_indent, expected) failed = True ### Tests of find_completions() class MyObject: def method(self): pass scope = { '__builtins__': { 'len': len }, 'a': 1, 'abcd': 2, 'bcde': 3, 'indecent': 4, 'obj': MyObject() } def test_completion(line, expected, index = -1, min_length=0): if index == -1: index = len(line) ts = TokenizedStatement() ts.set_lines([line]) completions = [n for n, _, _ in ts.find_completions(0, index, scope, min_length=min_length)] if completions != expected: print "For %s/%d, got %s, expected %s" % (line,index,completions,expected) failed = True def test_multiline_completion(lines, line, index, expected): ts = TokenizedStatement() ts.set_lines(lines) completions = [n for n, _, _ in ts.find_completions(line, index, scope)] if completions != expected: print "For %s/%d/%d, got %s, expected %s" % (lines,line,index,completions,expected) failed = True test_completion("a", ['a', 'abcd']) test_completion("ab", ['abcd']) test_completion("ab", ['abcd'], min_length=2) test_completion("ab", [], min_length=3) test_completion("ab", ['a', 'abcd'], index=1) test_completion("foo.", []) test_completion("(a + b)", []) test_completion("", ['a', 'abcd', 'bcde', 'indecent', 'len', 'obj', "__builtins__"]) test_completion("foo + ", ['a', 'abcd', 'bcde', 'indecent', 'len', 'obj', "__builtins__"]) test_completion("l", ['len']) test_completion("obj.", ['method', '__doc__', '__module__']) test_completion("obj.m", ['method', '__doc__', '__module__'], index=4) test_completion("obj.m", ['method']) test_completion("obj.m().n", []) test_completion("import b, a", []) test_completion("from foo import a", []) test_completion("for a", []) # No completion to existing variables test_completion("for a in", []) # Don't complete to 'indecent', syntax doesn't allow it test_completion("in", [], min_length=2) # Don't complete to 'indecent', because we have a keyword prefix test_multiline_completion(["(obj.", "m"], 1, 0, ['method', '__doc__', '__module__']) test_multiline_completion(["(obj.", "m"], 1, 1, ['method']) ### Tests of get_object_at_location() def test_object_at_location(line, index, expected, include_adjacent=False): ts = TokenizedStatement() ts.set_lines([line]) obj, _, _, _, _ = ts.get_object_at_location(0, index, scope, include_adjacent=include_adjacent) if obj != expected: print "For %s/%d, got %s, expected %s" % (line,index,obj,expected) failed = True test_object_at_location("a", 0, 1) test_object_at_location("a", 1, None) test_object_at_location("obj.method", 0, scope['obj']) test_object_at_location("obj.method", 1, scope['obj']) test_object_at_location("obj.method", 4, scope['obj'].method) test_object_at_location("obj.met", 4, None) test_object_at_location("c a b", 2, 1, include_adjacent=True) test_object_at_location("c a b", 3, None, include_adjacent=False) test_object_at_location("c a b", 3, 1, include_adjacent=True) if failed: sys.exit(1) else: sys.exit(0) reinteract-0.5.0/lib/reinteract/worksheet.py0000664000076400007640000013351711162516344016117 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import sys import gobject import logging import os import re from StringIO import StringIO from change_range import ChangeRange from chunks import * from notebook import Notebook, NotebookFile from statement import Statement from thread_executor import ThreadExecutor from undo_stack import UndoStack, InsertOp, DeleteOp _debug = logging.getLogger("Worksheet").debug _DEFINE_GLOBALS = compile(""" global reinteract_output, reinteract_print def reinteract_output(*args): __reinteract_statement.do_output(*args) def reinteract_print(*args): __reinteract_statement.do_print(*args) """, __name__, 'exec') BLANK_RE = re.compile(r'^\s*$') BLANK = 0 COMMENT_RE = re.compile(r'^\s*#') COMMENT = 1 STATEMENT_START = 2 CONTINUATION_RE = re.compile(r'^(?:\s+|(?:else|elif|except|finally)[^A-Za-z0-9_])') CONTINUATION = 3 NEW_LINE_RE = re.compile(r'\n|\r|\r\n') def calc_line_class(text): if BLANK_RE.match(text): return BLANK elif COMMENT_RE.match(text): return COMMENT elif CONTINUATION_RE.match(text): return CONTINUATION else: return STATEMENT_START def order_positions(start_line, start_offset, end_line, end_offset): if start_line > end_line or (start_line == end_line and start_offset > end_offset): t = end_line end_line = start_line start_line = t t = end_offset end_offset = start_offset start_offset = t return start_line, start_offset, end_line, end_offset class Worksheet(gobject.GObject): __gsignals__ = { # text-* are emitted before we fix up our internal state, so what can be done # in them are limited. They are meant for keeping a UI in sync with the internal # state. 'text-inserted': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (int, int, str)), 'text-deleted': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (int, int, int, int)), 'lines-inserted': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (int, int)), 'lines-deleted': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (int, int)), 'chunk-inserted': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)), # Chunk changed is emitted when the text or tokenization of a chunk # changes. Note that "changes" here specifically includes being # replaced by identical text, so if I have the two chunks # # if # if # # And I delete the from the first 'i' to the second f, the first # chunk is considered to change, even though it's text remains 'if'. # This is because text in a buffering that is shadowing us may # be tagged with fonts/styles. # 'chunk-changed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT)), 'chunk-deleted': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)), 'chunk-status-changed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)), 'chunk-results-changed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)), # This is only for the convenience of the undo stack; otherwise we ignore cursor position 'place-cursor': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (int, int)) } def __init__(self, notebook, edit_only=False): gobject.GObject.__init__(self) self.notebook = notebook self.edit_only = edit_only self.__file = None self.__filename = None self.__code_modified = False self.global_scope = {} notebook.setup_globals(self.global_scope) exec _DEFINE_GLOBALS in self.global_scope self.__lines = [""] self.__chunks = [BlankChunk(0,1)] # There's quite a bit of complexity knowing when a change to lines changes # adjacent chunks. We use a simple and slightly inefficient algorithm for this # and just scan everything that might have changed. But we don't want typing # within a line to cause an unlimited rescan, so we keep track if the only # changes we've made are inserting/deleting within a line without changing # that lines class self.__changes = ChangeRange() self.__scan_adjacent = False self.__changed_chunks = set() self.__deleted_chunks = set() self.__freeze_changes_count = 0 self.__user_action_count = 0 self.__undo_stack = UndoStack(self) notebook._add_worksheet(self) def do_import(self, name, globals, locals, fromlist, level): __import__(self, name, globals, locals, fromlist, level) def iterate_chunks(self, start_line=0, end_line=None): if end_line == None or end_line > len(self.__chunks): end_line = len(self.__chunks) if start_line >= len(self.__chunks) or end_line <= start_line: return prev_chunk = None for i in xrange(start_line, end_line): chunk = self.__chunks[i] if chunk != prev_chunk: yield chunk prev_chunk = chunk def __freeze_changes(self): self.__freeze_changes_count += 1 def __thaw_changes(self): self.__freeze_changes_count -= 1 if self.__freeze_changes_count == 0: self.rescan() self.__emit_chunk_changes() def __emit_chunk_changes(self): deleted_chunks = self.__deleted_chunks self.__deleted_chunks = set() changed_chunks = self.__changed_chunks self.__changed_chunks = set() for chunk in deleted_chunks: self.emit('chunk-deleted', chunk) for chunk in sorted(changed_chunks, lambda a, b: cmp(a.start,b.start)): if chunk.newly_inserted: chunk.newly_inserted = False chunk.changes.clear() chunk.status_changed = False self.emit('chunk-inserted', chunk) elif not chunk.changes.empty(): changed_lines = range(chunk.changes.start, chunk.changes.end) chunk.changes.clear() chunk.status_changed = False self.emit('chunk-changed', chunk, changed_lines) if isinstance(chunk, StatementChunk) and chunk.status_changed: chunk.status_changed = False self.emit('chunk-status-changed', chunk) if isinstance(chunk, StatementChunk) and chunk.results_changed: chunk.results_changed = False self.emit('chunk-results-changed', chunk) def __chunk_changed(self, chunk): self.__changed_chunks.add(chunk) def __mark_rest_for_execute(self, start_line): if self.state != NotebookFile.NEEDS_EXECUTE: self.__set_state(NotebookFile.NEEDS_EXECUTE) # Mark all statements starting from start_line as needing execution. # We do this immediately when we change or delete a previous # StatementChunk. The alternative would be to do it when we # __thaw_changes(), which would conceivably be more efficient, but # it's hard to see how to handle deleted chunks in that case. for chunk in self.iterate_chunks(start_line): if isinstance(chunk, StatementChunk): if chunk.mark_for_execute(): self.__chunk_changed(chunk) else: # Everything after the first chunk that was previously # marked for execution must also have been marked for # execution, so we can stop break def __mark_changed_statement(self, chunk): self.__chunk_changed(chunk) self.__mark_rest_for_execute(chunk.end) def __remove_chunk(self, chunk): try: self.__changed_chunks.remove(chunk) except KeyError: pass if not chunk.newly_inserted: self.__deleted_chunks.add(chunk) if isinstance(chunk, StatementChunk): self.__mark_rest_for_execute(chunk.end) def __adjust_or_create_chunk(self, start, end, line_class): if line_class == BLANK: klass = BlankChunk elif line_class == COMMENT: klass = CommentChunk else: klass = StatementChunk # Look for an existing chunk of the right type chunk = None for i in xrange(start, end): if isinstance(self.__chunks[i], klass): chunk = self.__chunks[i] break if chunk != None: if chunk.end > end: # An old statement can only be turned into *one* new statement; once # we've used the chunk, we can't use it again self.__chunks[end:chunk.end] = (None for i in xrange(end, chunk.end)) else: chunk = klass() chunk.set_range(start, end) for c in self.iterate_chunks(start, end): assert c.start >= start if c == chunk: pass elif c.end <= end: self.__remove_chunk(c) else: c.set_range(end, c.end) self.__chunks[start:end] = (chunk for i in xrange(start, end)) return chunk def __assign_lines(self, chunk_start, lines, statement_end): if statement_end > chunk_start: chunk_lines = lines[0:statement_end - chunk_start] chunk = self.__adjust_or_create_chunk(chunk_start, statement_end, STATEMENT_START) chunk.set_lines(chunk_lines) if not chunk.changes.empty(): self.__mark_changed_statement(chunk) start = statement_end prev_class = CONTINUATION # Doesn't matter, not blank/continuation for i in xrange(statement_end, chunk_start + len(lines)): line_class = calc_line_class(self.__lines[i]) if line_class != prev_class and i > start: chunk = self.__adjust_or_create_chunk(start, i, prev_class) if not chunk.changes.empty(): self.__chunk_changed(chunk) start = i prev_class = line_class if chunk_start + len(lines) > start: chunk = self.__adjust_or_create_chunk(start, chunk_start + len(lines), prev_class) if not chunk.changes.empty(): self.__chunk_changed(chunk) def rescan(self): """Update the division of the worksheet into chunks based on the current text. As the buffer is edited, the division of the buffer into chunks is updated blindly without attention to the details of the new text. Normally, we will rescan and figure out the real chunks at the end of a user operation, however it is occasionally useful to do this early, for example, if we want to use the tokenized representation of a statement for the second part of a user operation. """ _debug(" Changed %s,%s (%s), scan_adjacent=%d", self.__changes.start, self.__changes.end, self.__changes.delta, self.__scan_adjacent) if self.__changes.empty(): return if self.__scan_adjacent: rescan_start = self.__changes.start rescan_end = self.__changes.end while rescan_start > 0: rescan_start -= 1 chunk = self.__chunks[rescan_start] if isinstance(chunk, StatementChunk): rescan_start = chunk.start break while rescan_end < len(self.__lines): chunk = self.__chunks[rescan_end] # The check for continuation line is needed because the first statement # in a buffer can start with a continuation line if isinstance(chunk, StatementChunk) and \ chunk.start == rescan_end and \ not CONTINUATION_RE.match(self.__lines[chunk.start]): break rescan_end = chunk.end else: rescan_start = self.__changes.start rescan_end = self.__changes.end self.__changes.clear() self.__scan_adjacent = False if self.__chunks[rescan_start] != None: rescan_start = self.__chunks[rescan_start].start; if self.__chunks[rescan_end - 1] != None: rescan_end = self.__chunks[rescan_end - 1].end; _debug(" Rescanning lines %s-%s", rescan_start, rescan_end) chunk_start = rescan_start statement_end = rescan_start chunk_lines = [] seen_start = False for line in xrange(rescan_start, rescan_end): line_text = self.__lines[line] line_class = calc_line_class(line_text) if line_class == BLANK: chunk_lines.append(line_text) elif line_class == COMMENT: chunk_lines.append(line_text) elif line_class == CONTINUATION and seen_start: chunk_lines.append(line_text) statement_end = line + 1 else: seen_start = True if len(chunk_lines) > 0: self.__assign_lines(chunk_start, chunk_lines, statement_end) chunk_start = line statement_end = line + 1 chunk_lines = [line_text] self.__assign_lines(chunk_start, chunk_lines, statement_end) def __set_line(self, line, text): if self.__lines[line] != None: old_class = calc_line_class(self.__lines[line]) else: old_class = None self.__lines[line] = text if old_class != calc_line_class(text): self.__scan_adjacent = True self.__changes.change(line, line + 1) def begin_user_action(self): self.__user_action_count += 1 self.__undo_stack.begin_user_action() self.__freeze_changes() def end_user_action(self): self.__user_action_count -= 1 self.__thaw_changes() self.__undo_stack.end_user_action() def in_user_action(self): return self.__user_action_count > 0 def __insert_lines(self, line, count, chunk): # Insert an integral number of lines into the given chunk at the given position # fixing up the chunk and the __chunks[]/__lines[] arrays self.__chunks[line:line] = (chunk for i in xrange(count)) self.__lines[line:line] = (None for i in xrange(count)) chunk.insert_lines(line, count) # Fix up the subsequent chunks for c in self.iterate_chunks(chunk.end): c.start += count c.end += count self.__changes.insert(line, count) self.__scan_adjacent = True self.__chunk_changed(chunk) self.emit('lines-inserted', line, line + count) def insert(self, line, offset, text): _debug("Inserting %r at %s,%s", text, line, offset) if len(text) == 0: return if self.state == NotebookFile.EXECUTING: return self.__freeze_changes() self.emit('text-inserted', line, offset, text) count = 0 ends_with_new_line = False for m in NEW_LINE_RE.finditer(text): count += 1 ends_with_new_line = m.end() == len(text) chunk = self.__chunks[line] left = self.__lines[line][0:offset] right = self.__lines[line][offset:] if count == 0: # Change within a single line self.__set_line(line, left + text + right) chunk.change_line(line) end_line = line end_offset = offset + len(text) else: if offset == 0 and ends_with_new_line: # This is a pure insertion of an integral number of lines # At a chunk boundary, extend the chunk before, not the chunk after if line > 0 and chunk.start == line: chunk = self.__chunks[line - 1] self.__insert_lines(line, count, chunk) else: if offset == 0: self.__insert_lines(line, count, chunk) chunk.change_line(line + count) else: self.__insert_lines(line + 1, count, chunk) chunk.change_line(line) # Now set the new text into the lines array iter = NEW_LINE_RE.finditer(text) i = line m = iter.next() self.__set_line(line, left + text[0:m.start()]) last = m.end() i += 1 while True: try: m = iter.next() except StopIteration: break self.__set_line(i, text[last:m.start()]) last = m.end() i += 1 if not (offset == 0 and ends_with_new_line): self.__set_line(i, text[last:] + right) end_line = i end_offset = len(text) - last self.__thaw_changes() self.__undo_stack.append_op(InsertOp((line, offset), (end_line, end_offset), text)) if self.__user_action_count > 0 and not self.code_modified: self.code_modified = True def __delete_lines(self, start_line, end_line): # Delete an integral number of lines, fixing up the affected chunks # and the __chunks[]/__lines[] arrays if end_line == start_line: # No lines deleted return for chunk in self.iterate_chunks(start_line): if chunk.start >= end_line: chunk.start -= (end_line - start_line) chunk.end -= (end_line - start_line) elif chunk.start >= start_line: if chunk.end <= end_line: self.__remove_chunk(chunk) else: chunk.delete_lines(chunk.start, end_line) self.__chunk_changed(chunk) chunk.end -= chunk.start - start_line chunk.start = start_line else: chunk.delete_lines(start_line, min(chunk.end, end_line)) self.__chunk_changed(chunk) self.__lines[start_line:end_line] = () self.__chunks[start_line:end_line] = () self.__changes.delete_range(start_line, end_line) self.__scan_adjacent = True self.emit('lines-deleted', start_line, end_line) def delete_range(self, start_line, start_offset, end_line, end_offset): _debug("Deleting from %s,%s to %s,%s", start_line, start_offset, end_line, end_offset) if self.state == NotebookFile.EXECUTING: return if start_line == end_line and start_offset == end_offset: return self.__freeze_changes() start_line, start_offset, end_line, end_offset = order_positions(start_line, start_offset, end_line, end_offset) deleted_text = self.get_text(start_line, start_offset, end_line, end_offset) self.emit('text-deleted', start_line, start_offset, end_line, end_offset) if start_offset == 0 and end_offset == 0: # Deleting some whole number of lines self.__delete_lines(start_line, end_line) else: left = self.__lines[start_line][0:start_offset] right = self.__lines[end_line][end_offset:] if start_offset == 0: self.__delete_lines(start_line, end_line) else: self.__delete_lines(start_line + 1, end_line + 1) self.__set_line(start_line, left + right) chunk = self.__chunks[start_line] chunk.change_line(start_line) self.__chunk_changed(chunk) self.__thaw_changes() self.__undo_stack.append_op(DeleteOp((start_line, start_offset), (end_line, end_offset), deleted_text)) if self.__user_action_count > 0 and not self.code_modified: self.code_modified = True def place_cursor(self, line, offset): _debug("Place cursor at %s,%s", line, offset) self.emit('place-cursor', line, offset) def undo(self): self.__undo_stack.undo() def redo(self): self.__undo_stack.redo() def module_changed(self, module_name): """Mark statements for execution after a change to the given module""" for chunk in self.iterate_chunks(): if not isinstance(chunk, StatementChunk): continue if chunk.statement == None: continue imports = chunk.statement.imports if imports == None: continue for module, _ in imports: if module == module_name: self.__mark_rest_for_execute(chunk.start) def calculate(self, wait=False): _debug("Calculating") self.__freeze_changes() parent = None have_error = False executor = None for chunk in self.iterate_chunks(): if isinstance(chunk, StatementChunk): changed = False if chunk.needs_compile or chunk.needs_execute: if not executor: executor = ThreadExecutor(parent) if executor: statement = chunk.get_statement(self) executor.add_statement(statement) parent = chunk.statement if executor: if wait: loop = gobject.MainLoop() def on_statement_execution_state_changed(executor, statement): if (statement.state == Statement.COMPILE_ERROR or statement.state == Statement.EXECUTE_ERROR or statement.state == Statement.INTERRUPTED): self.__executor_error = True statement.chunk.update_statement() if self.__freeze_changes_count == 0: self.__freeze_changes() self.__chunk_changed(statement.chunk) self.__thaw_changes() else: self.__chunk_changed(statement.chunk) def on_complete(executor): self.__executor = None self.__set_state(NotebookFile.ERROR if self.__executor_error else NotebookFile.EXECUTE_SUCCESS) if wait: loop.quit() self.__executor = executor self.__executor_error = False self.__set_state(NotebookFile.EXECUTING) executor.connect('statement-executing', on_statement_execution_state_changed) executor.connect('statement-complete', on_statement_execution_state_changed) executor.connect('complete', on_complete) if executor.compile(): executor.execute() if wait: loop.run() else: # Nothing to execute, we could have been in a non-success state if statements were deleted # at the end of the file. self.__set_state(NotebookFile.EXECUTE_SUCCESS) self.__thaw_changes() def interrupt(self): if self.state == NotebookFile.EXECUTING: self.__executor.interrupt() def __get_last_scope(self, chunk): # Get the last result scope we have that precedes the specified chunk scope = None line = chunk.start - 1 while line >= 0: previous_chunk = self.__chunks[line] # We intentionally don't check "needs_execute" ... if there is a result scope, # it's fair game for completion/help, even if it's old if isinstance(previous_chunk, StatementChunk) and previous_chunk.statement != None and previous_chunk.statement.result_scope != None: return previous_chunk.statement.result_scope break line = previous_chunk.start - 1 return self.global_scope def find_completions(self, line, offset, min_length=0): """Returns a list of possible completions at the given position. Each element in the returned list is a tuple of (display_form, text_to_insert, object_completed_to)' where object_completed_to can be used to determine the type of the completion or get docs about it. @param min_length if supplied, the minimum length to require for an isolated name before we complete against the scope. This is useful if we are suggesting completions without the user explicitly requesting it. """ chunk = self.__chunks[line] if not isinstance(chunk, StatementChunk) and not isinstance(chunk, BlankChunk): return [] scope = self.__get_last_scope(chunk) if isinstance(chunk, StatementChunk): return chunk.tokenized.find_completions(line - chunk.start, offset, scope, min_length=min_length) else: # A BlankChunk Create a dummy TokenizedStatement to get the completions # appropriate for the start of a line ts = TokenizedStatement() ts.set_lines(['']) return ts.find_completions(0, 0, scope, min_length=min_length) def get_object_at_location(self, line, offset, include_adjacent=False): """Find the object at a particular location within the worksheet @param include_adjacent: if False, then location identifies a character in the worksheet. If True, then location identifies a position between characters, and symbols before or after that position are included. @returns: a tuple of (object, start_line, start_offset, end_line, end_offset) or (None, None, None, None, None) """ chunk = self.__chunks[line] if not isinstance(chunk, StatementChunk): return None, None, None, None, None if chunk.statement != None and chunk.statement.result_scope != None: result_scope = chunk.statement.result_scope else: result_scope = None obj, start_line, start_index, end_line, end_index = \ chunk.tokenized.get_object_at_location(line - chunk.start, offset, self.__get_last_scope(chunk), result_scope, include_adjacent) if obj == None: return None, None, None, None, None start_line += chunk.start end_line += chunk.start return obj, start_line, start_index, end_line, end_index def __do_clear(self): self.delete_range(0, 0, len(self.__lines) - 1, len(self.__lines[len(self.__lines) - 1])); def clear(self): self.__do_clear() self.__set_filename_and_modified(None, False) # XXX: This prevents redoing New, would that "just work"? self.__undo_stack.clear() def get_text(self, start_line=0, start_offset=0, end_line=-1, end_offset=-1): if start_line < 0: start_line = len(self.__lines) -1 if end_line < 0: end_line = len(self.__lines) -1 if start_offset < 0: start_offset = len(self.__lines[start_line]) if end_offset < 0: end_offset = len(self.__lines[end_line]) start_line, start_offset, end_line, end_offset = order_positions(start_line, start_offset, end_line, end_offset) if start_line == end_line: return self.__lines[start_line][start_offset:end_offset] si = StringIO() line = start_line si.write(self.__lines[line][start_offset:]) line += 1 while line < end_line: si.write("\n") si.write(self.__lines[line][start_offset:]) line += 1 si.write("\n") si.write(self.__lines[line][:end_offset]) return si.getvalue() def get_doctests(self, start_line, end_line): si = StringIO() first = True for chunk in self.iterate_chunks(start_line, end_line + 1): for i in xrange(chunk.start, chunk.end): line_text = self.__lines[i] if isinstance(chunk, StatementChunk): if i != chunk.start: si.write("... ") else: si.write(">>> ") si.write(line_text) # Don't turn a trailing newline into two if i != len(self.__lines) - 1 or len(line_text) > 0: si.write("\n") if isinstance(chunk, StatementChunk) and chunk.results != None: for result in chunk.results: if isinstance(result, basestring): si.write(result) si.write("\n") return si.getvalue() def get_line_count(self): return len(self.__lines) def get_chunk(self, line): return self.__chunks[line] def get_line(self, line): return self.__lines[line] def __set_state(self, new_state): if self.edit_only: return self.state = new_state if self.__file: self.__file.state = new_state def __set_filename(self, filename): if filename == self.__filename: return if self.__file: self.__file.worksheet = None self.__file.modified = False self.__file.active = False self.__filename = filename if filename: self.__file = self.notebook.file_for_absolute_path(self.__filename) if self.__file: self.__file.worksheet = self self.__file.active = True self.__file.modified = self.__code_modified else: self.__file = None def __get_filename(self): return self.__filename filename = gobject.property(getter=__get_filename, setter=__set_filename, type=str, default=None) @gobject.property def file(self): return self.__file def __set_code_modified(self, code_modified): if code_modified == self.__code_modified: return self.__code_modified = code_modified if self.__file: self.__file.modified = code_modified def __get_code_modified(self): return self.__code_modified code_modified = gobject.property(getter=__get_code_modified, setter=__set_code_modified, type=bool, default=False) state = gobject.property(type=int, default=NotebookFile.EXECUTE_SUCCESS) def __set_filename_and_modified(self, filename, modified): self.freeze_notify() self.filename = filename self.code_modified = modified self.thaw_notify() def load(self, filename): f = open(filename) text = f.read() f.close() self.__do_clear() self.__set_filename_and_modified(filename, False) self.insert(0, 0, text) self.__undo_stack.clear() def save(self, filename=None): if filename == None: if self.__filename == None: raise ValueError("No current or specified filename") filename = self.__filename if not self.code_modified and filename == self.__filename: return filename_changed = filename != self.__filename tmpname = filename + ".tmp" # We use binary mode, since we don't want to munge line endings to the system default # on a load-save cycle f = open(tmpname, "wb") success = False try: first = True for line in self.__lines: if not first: f.write("\n") first = False f.write(line) f.close() # Windows can't save over an existing filename; we might want to check os.name to # see if we have to do this, but it's unlikely that the unlink will succeed and # the rename fail, so I think it's 'atomic' enough this way. if os.path.exists(filename): os.unlink(filename) os.rename(tmpname, filename) success = True # Need to refresh the notebook before saving so that we find the NotebookFile # properly in __set_filename_and_modified if filename_changed: self.notebook.refresh() self.__set_filename_and_modified(filename, False) if self.notebook.info: self.notebook.info.update_last_modified() finally: if not success: f.close() try: os.remove(tmpname) except: pass def close(self): if self.__file: self.__file.worksheet = None self.__file.modified = False self.__file.state = NotebookFile.NONE self.__file.active = False self.notebook._remove_worksheet(self) ###################################################################### if __name__ == '__main__': #pragma: no cover if "-d" in sys.argv: logging.basicConfig(level=logging.DEBUG, format="DEBUG: %(message)s") gobject.threads_init() import stdout_capture stdout_capture.init() S = StatementChunk B = BlankChunk C = CommentChunk def compare(l1, l2): if len(l1) != len(l2): return False for i in xrange(0, len(l1)): e1 = l1[i] e2 = l2[i] if type(e1) != type(e2) or e1.start != e2.start or e1.end != e2.end: return False return True worksheet = Worksheet(Notebook()) def expect(expected): chunks = [ x for x in worksheet.iterate_chunks() ] if not compare(chunks, expected): raise AssertionError("\nGot:\n %s\nExpected:\n %s" % (chunks, expected)) def expect_text(expected, start_line=0, start_offset=0, end_line=-1, end_offset=-1): text = worksheet.get_text(start_line, start_offset, end_line, end_offset) if (text != expected): raise AssertionError("\nGot:\n '%s'\nExpected:\n '%s'" % (text, expected)) def expect_doctests(expected, start_line, end_line): text = worksheet.get_doctests(start_line, end_line) if (text != expected): raise AssertionError("\nGot:\n '%s'\nExpected:\n '%s'" % (text, expected)) def expect_results(expected): results = [ (x.results if isinstance(x,StatementChunk) else None) for x in worksheet.iterate_chunks() ] if (results != expected): raise AssertionError("\nGot:\n '%s'\nExpected:\n '%s'" % (results, expected)) def insert(line, offset, text): worksheet.insert(line, offset, text) def delete(start_line, start_offset, end_line, end_offset): worksheet.delete_range(start_line, start_offset, end_line, end_offset) def calculate(): worksheet.calculate(wait=True) def clear(): worksheet.clear() def chunk_label(chunk): if chunk.end - chunk.start == 1: return "[%s]" % chunk.start else: return "[%s:%s]" % (chunk.start, chunk.end) class CI: def __init__(self, start, end): self.start = start self.end = end def __eq__(self, other): if not isinstance(other, CI): return False return self.start == other.start and self.end == other.end def __repr__(self): return "CI(%s, %s)" % (self.start, self.end) class CC: def __init__(self, start, end, changed_lines): self.start = start self.end = end self.changed_lines = changed_lines def __eq__(self, other): if not isinstance(other, CC): return False return self.start == other.start and self.end == other.end and self.changed_lines == other.changed_lines def __repr__(self): return "CC(%s, %s, %s)" % (self.start, self.end, self.changed_lines) class CD: def __eq__(self, other): if not isinstance(other, CD): return False return True def __repr__(self): return "CD()" class CSC: def __init__(self, start, end): self.start = start self.end = end def __eq__(self, other): if not isinstance(other, CSC): return False return self.start == other.start and self.end == other.end def __repr__(self): return "CSC(%s, %s)" % (self.start, self.end) class CRC: def __init__(self, start, end): self.start = start self.end = end def __eq__(self, other): if not isinstance(other, CRC): return False return self.start == other.start and self.end == other.end def __repr__(self): return "CRC(%s, %s)" % (self.start, self.end) log = [] def on_chunk_inserted(worksheet, chunk): _debug("...Chunk %s inserted", chunk_label(chunk)) log.append(CI(chunk.start, chunk.end)) def on_chunk_changed(worksheet, chunk, changed_lines): _debug("...Chunk %s changed", chunk_label(chunk)) log.append(CC(chunk.start, chunk.end, changed_lines)) def on_chunk_deleted(worksheet, chunk): _debug("...Chunk %s deleted", chunk_label(chunk)) log.append(CD()) def on_chunk_status_changed(worksheet, chunk): _debug("...Chunk %s status changed", chunk_label(chunk)) log.append(CSC(chunk.start, chunk.end)) def on_chunk_results_changed(worksheet, chunk): _debug("...Chunk %s results changed", chunk_label(chunk)) log.append(CRC(chunk.start, chunk.end)) def clear_log(): global log log = [] def expect_log(expected): if log != expected: raise AssertionError("\nGot:\n '%s'\nExpected:\n '%s'" % (log, expected)) clear_log() worksheet.connect('chunk-inserted', on_chunk_inserted) worksheet.connect('chunk-changed', on_chunk_changed) worksheet.connect('chunk-deleted', on_chunk_deleted) worksheet.connect('chunk-status-changed', on_chunk_status_changed) worksheet.connect('chunk-results-changed', on_chunk_results_changed) # Insertions insert(0, 0, "11\n22\n33") expect_text("11\n22\n33") expect([S(0,1), S(1,2), S(2,3)]) insert(0, 1, "a") expect_text("1a1\n22\n33") expect([S(0,1), S(1,2), S(2,3)]) insert(1, 1, "a\na") expect_text("1a1\n2a\na2\n33") expect([S(0,1), S(1,2), S(2,3), S(3,4)]) insert(1, 0, "bb\n") expect_text("1a1\nbb\n2a\na2\n33") expect([S(0,1), S(1,2), S(2,3), S(3,4), S(4, 5)]) insert(4, 3, "\n") expect_text("1a1\nbb\n2a\na2\n33\n") expect([S(0,1), S(1,2), S(2,3), S(3,4), S(4, 5), B(5, 6)]) # Deletions delete(4, 3, 5, 0) expect_text("1a1\nbb\n2a\na2\n33") expect([S(0,1), S(1,2), S(2,3), S(3,4), S(4, 5)]) delete(0, 1, 0, 2) expect_text("11\nbb\n2a\na2\n33") expect([S(0,1), S(1,2), S(2,3), S(3,4), S(4, 5)]) delete(0, 0, 1, 0) expect_text("bb\n2a\na2\n33") expect([S(0,1), S(1,2), S(2,3), S(3,4)]) delete(1, 1, 2, 1) expect_text("bb\n22\n33") expect([S(0,1), S(1,2), S(2,3)]) delete(2, 1, 1, 0) expect_text("bb\n3") expect([S(0,1), S(1,2)]) # Test deleting part of a BlankChunk clear() insert(0, 0, "if True\n: pass\n \n") delete(2, 4, 3, 0) # Check that tracking of changes works properly when there # is an insertion or deletion before the change clear() insert(0, 0, "1\n2") worksheet.begin_user_action() insert(1, 0, "#") insert(0, 0, "0\n") worksheet.end_user_action() expect_text("0\n1\n#2") expect([S(0,1), S(1,2), C(2,3)]) worksheet.begin_user_action() delete(2, 0, 2, 1) delete(0, 0, 1, 0) worksheet.end_user_action() expect([S(0,1), S(1,2)]) # Basic tokenization of valid python clear() insert(0, 0, "1\n\n#2\ndef a():\n 3") expect([S(0,1), B(1,2), C(2,3), S(3,5)]) clear() expect([B(0,1)]) # Multiple consecutive blank lines clear() insert(0, 0, "1") insert(0, 1, "\n") expect([S(0,1),B(1,2)]) insert(1, 0, "\n") expect([S(0,1),B(1,3)]) # Continuation lines at the beginning clear() insert(0, 0, "# Something\n pass") expect([C(0,1), S(1,2)]) delete(0, 0, 1, 0) expect([S(0,1)]) # Calculation clear() insert(0, 0, "1 + 1") calculate() expect_results([['2']]) clear() insert(0, 0, "if True:\n print 1\n print 1") calculate() expect_results([['1', '1']]) clear() insert(0, 0, "a = 1\nb = 2\na + b") calculate() expect_results([[], [], ['3']]) delete(1, 4, 1, 5) insert(1, 4, "3") calculate() expect_results([[], [], ['4']]) # # Test out signals and expect_log() # clear() clear_log() insert(0, 0, "1 + 1") expect_log([CD(), CI(0,1)]) calculate() expect_log([CSC(0,1), CRC(0,1)]) insert(0, 0, "#") expect_log([CD(), CI(0,1)]) # Deleting a chunk with results clear() insert(0, 0, "1\n2") calculate() expect([S(0,1),S(1,2)]) expect_results([['1'],['2']]) clear_log() delete(0, 0, 0, 1) expect([B(0,1),S(1,2)]) expect_log([CD(), CI(0,1), CSC(1,2)]) # Turning a statement into a continuation line clear() insert(0, 0, "1 \\\n+ 2\n") clear_log() insert(1, 0, " ") expect([S(0,2), B(2,3)]) expect_log([CD(), CC(0,2,[1])]) # And back delete(1, 0, 1, 1) expect([S(0,1), S(1,2), B(2,3)]) expect_log([CC(0,1,[]),CI(1,2)]) # Shortening the last chunk in the buffer clear() insert(0, 0, "def a():\n x = 1\n return 1") delete(1, 0, 2, 0) expect([S(0, 2)]) # Inserting a statement above a continuation line at the start of the buffer clear() insert(0, 0, "#def a(x):\n return x") delete(0, 0, 0, 1) expect([S(0,2)]) # Deleting an entire continuation line clear() insert(0, 0, "for i in (1,2):\n print i\n print i + 1\n") expect([S(0,3), B(3,4)]) delete(1, 0, 2, 0) expect([S(0,2), B(2,3)]) # Editing a continuation line, while leaving it a continuation clear() insert(0, 0, "1\\\n + 2\\\n + 3") delete(1, 0, 1, 1) expect([S(0,3)]) # Test that changes that substitute text with identical # text counts as changes # New text clear() insert(0, 0, "if") clear_log() worksheet.begin_user_action() delete(0, 1, 0, 2) insert(0, 1, "f") worksheet.end_user_action() expect([S(0,1)]) expect_log([CC(0,1,[0])]) # Text from elsewhere in the buffer clear() insert(0, 0, "if\nif") clear_log() delete(0, 1, 1, 1) expect([S(0,1)]) expect_log([CD(), CC(0,1,[0])]) # Test that commenting out a line marks subsequent lines for recalculation clear() insert(0, 0, "a = 1\na = 2\na") calculate() insert(1, 0, "#") assert worksheet.get_chunk(2).needs_execute # Test that we don't send out ::chunk-deleted signal for chunks for # which we never sent a ::chunk-inserted signal clear() insert(0, 0, "[1]") clear_log() worksheet.begin_user_action() insert(0, 2, "\n") worksheet.rescan() insert(1, 0, " ") worksheet.end_user_action() expect_log([CC(0,2,[0,1])]) # # Undo tests # clear() insert(0, 0, "1") worksheet.undo() expect_text("") worksheet.redo() expect_text("1") # Undoing insertion of a newline clear() insert(0, 0, "1 ") insert(0, 1, "\n") calculate() worksheet.undo() expect_text("1 ") # Test the "pruning" behavior of modifications after undos clear() insert(0, 0, "1") worksheet.undo() expect_text("") insert(0, 0, "2") worksheet.redo() # does nothing expect_text("2") insert(0, 0, "2\n") # Test coalescing consecutive inserts clear() insert(0, 0, "1") insert(0, 1, "2") worksheet.undo() expect_text("") # Test grouping of multiple undos by user actions clear() insert(0, 0, "1") worksheet.begin_user_action() delete(0, 0, 0, 1) insert(0, 0, "2") worksheet.end_user_action() worksheet.undo() expect_text("1") worksheet.redo() expect_text("2") # Make sure that coalescing doesn't coalesce one user action with # only part of another clear() insert(0, 0, "1") worksheet.begin_user_action() insert(0, 1, "2") delete(0, 0, 0, 1) worksheet.end_user_action() worksheet.undo() expect_text("1") worksheet.redo() expect_text("2") # # Tests of get_text() # clear() insert(0, 0, "12\n34\n56") expect_text("12\n34\n56", -1, -1, 0, 0) expect_text("", -1, -1, -1, -1) expect_text("1", 0, 0, 0, 1) expect_text("2\n3", 0, 1, 1, 1) expect_text("2\n3", 1, 1, 0, 1) # # Tests of get_doctests() # clear() insert(0, 0, """# A tests of doctests def a(x): return x + 1 a(2) """) calculate() expect_doctests("""# A tests of doctests >>> def a(x): ... return x + 1 >>> a(2) 3 """, 0, 5) expect_doctests(""">>> def a(x): ... return x + 1 """, 2, 2) # # Try writing to a file, and reading it back # import tempfile, os clear() expect([B(0,1)]) SAVE_TEST = """a = 1 a # A comment b = 2""" insert(0, 0, SAVE_TEST) calculate() handle, fname = tempfile.mkstemp(".rws", "reinteract_worksheet") os.close(handle) try: worksheet.save(fname) f = open(fname, "r") saved = f.read() f.close() if saved != SAVE_TEST: raise AssertionError("Got '%s', expected '%s'", saved, SAVE_TEST) worksheet.load(fname) calculate() expect_text(SAVE_TEST) expect([S(0,1), S(1,2), C(2,3), B(3,4), S(4,5)]) expect_results([[], ['1'], None, None, []]) finally: os.remove(fname) clear() expect([B(0,1)]) reinteract-0.5.0/lib/reinteract/mini_window.py0000664000076400007640000001513111162516344016416 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk import os from application import application from base_notebook_window import BaseNotebookWindow from format_escaped import format_escaped from global_settings import global_settings from notebook import NotebookFile class MiniWindow(BaseNotebookWindow): UI_STRING=""" """ def __init__(self, notebook): self.__pages_items = [] BaseNotebookWindow.__init__(self, notebook) self.window.set_default_size(800, 600) ####################################################### # Overrides ####################################################### def _create_window(self, menu, toolbar): BaseNotebookWindow._create_window(self, menu, toolbar) toolbar.set_style(gtk.TOOLBAR_ICONS) def _fill_content(self): self.nb_widget.set_show_tabs(False) self.main_vbox.pack_start(self.nb_widget, expand=True, fill=True) def _add_actions(self, action_group): BaseNotebookWindow._add_actions(self, action_group) action_group.add_actions([ ('notebook', None, "_Notebook"), ('pages', None, "_Pages") ]) def _add_editor(self, editor): BaseNotebookWindow._add_editor(self, editor) self.__update_pages() def _close_editor(self, editor): BaseNotebookWindow._close_editor(self, editor) self.__update_pages() def _update_editor_title(self, editor): BaseNotebookWindow._update_editor_title(self, editor) if hasattr(editor, '_menu_item_label'): editor._menu_item_label.set_markup(format_escaped("%s", editor.title)) def _update_editor_state(self, editor): BaseNotebookWindow._update_editor_state(self, editor) if hasattr(editor, '_menu_item_status'): editor._menu_item_status.props.stock = NotebookFile.stock_id_for_state(editor.state) ####################################################### # Utility ####################################################### def __create_editor_item(self, editor): def on_activate(item): self._make_editor_current(editor) item = gtk.ImageMenuItem("") editor._menu_item_label = item.get_child() editor._menu_item_label.set_markup(format_escaped("%s", editor.title)) item.connect('activate', on_activate) editor._menu_item_status = gtk.Image() editor._menu_item_status.props.icon_size = gtk.ICON_SIZE_MENU editor._menu_item_status.props.stock = NotebookFile.stock_id_for_state(editor.state) item.set_image(editor._menu_item_status) return item def __create_file_item(self, file): def on_activate(item): self.open_file(file) item = gtk.MenuItem(os.path.basename(file.path)) item.connect('activate', on_activate) item.editor = None return item def __sort_files(self, file_a, file_b): name_a = os.path.basename(file_a.path) name_b = os.path.basename(file_b.path) c = cmp(name_a.lower(), name_b.lower()) if c != 0: return c return cmp(name_a, name_b) def __update_pages(self): for item in self.__pages_items: item.destroy() items = self.__pages_items = [] open_editors = {} for editor in self.editors: if editor.file == None: items.append(self.__create_editor_item(editor)) else: open_editors[editor.file.path] = editor if len(items) > 0: items.append(gtk.SeparatorMenuItem()) for file in sorted(self.notebook.files.values(), self.__sort_files): if file.path in open_editors: editor = open_editors[file.path] item = self.__create_editor_item(editor) else: item = self.__create_file_item(file) items.append(item) if len(items) > 0: items.append(gtk.SeparatorMenuItem()) menu = self.ui_manager.get_widget("/TopMenu/PagesMenu").get_submenu() items.reverse() for item in items: item.show() menu.prepend(item) ####################################################### # Callbacks ####################################################### # Override the next to to get "one window at a time" behavior. We cheat and open # the new and close the old to avoid writing code to retarget an existing MiniWindow, # though that probably wouldn't be that hard. (And would look better). Doing it this # way is more to prototype out the user interface idea. def on_new_notebook(self, action): if not self._confirm_discard(): return new_window = application.create_notebook_dialog(parent=self.window) if new_window: self._close_window() def on_open_notebook(self, action): if not self._confirm_discard(): return new_window = application.open_notebook_dialog(parent=self.window) if new_window: self._close_window() reinteract-0.5.0/lib/reinteract/main.py0000664000076400007640000001007111162516344015015 00000000000000# Copyright 2007-2009 Owen Taylor # Copyright 2008 Kai Willadsen # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gobject import gtk import logging from optparse import OptionParser import os import stdout_capture import sys gobject.threads_init() stdout_capture.init() from global_settings import global_settings from application import application def main(): if sys.version_info < (2, 5, 0): message = "Reinteract requires Python 2.5 or newer" print >>sys.stderr, message try: dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_OK, type=gtk.MESSAGE_ERROR, message_format=message) dialog.run() finally: sys.exit(1) # When launched from the finder on OS X, the command line will have a # -psx (process serial number) argument. Strip that out. sys.argv = filter(lambda x: not x.startswith("-psn"), sys.argv) parser = OptionParser() parser.add_option("-u", "--ui", choices=("standard", "mini"), default="standard", help="the user interface mode (standard or mini)") parser.add_option("-d", "--debug", action="store_true", help="enable internal debug messages") options, args = parser.parse_args() if options.debug: logging.basicConfig(level=logging.DEBUG) global_settings.mini_mode = options.ui == "mini" user_ext_path = os.path.expanduser(os.path.join('~', '.reinteract', 'modules')) if os.path.exists(user_ext_path): sys.path[0:0] = [user_ext_path] gtk.window_set_default_icon_name("reinteract") gobject.set_application_name("Reinteract") if len(args) > 0: if options.ui == "standard": for arg in args: application.open_path(os.path.abspath(arg)) if len(application.windows) == 0: # nothing opened successfully sys.exit(1) else: # mini-mode, can specify one notebook if len(args) > 1: print >>sys.stderr, "Ignoring extra command line arguments." absolute = os.path.abspath(args[0]) # We look to see if we can find the specified notebook so that we can # produce a good error message instead of opening a worksheet window notebook_path, relative = application.find_notebook_path(absolute) if not notebook_path: if os.path.isdir(absolute): error_message = "'%s' is not a Reinteract notebook" % args[0] else: error_message = "'%s' is not inside a Reinteract notebook" % args[0] dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_OK, type=gtk.MESSAGE_ERROR, message_format=error_message) dialog.run() sys.exit(1) if not application.open_path(absolute): sys.exit(1) else: recent_notebooks = application.state.get_recent_notebooks(max_count=1) if len(recent_notebooks) > 0: notebook_dir = recent_notebooks[0].path window = application.open_notebook(notebook_dir) else: notebook_dir = os.path.expanduser(os.path.join(global_settings.notebooks_dir, "Main")) if not os.path.exists(notebook_dir): window = application.create_notebook(notebook_dir, description="Notebook for scratch work.\nCreate worksheets here if they are not part of a larger project, or for quick experiments.") else: window = application.open_notebook(notebook_dir) # This really should be a more general check for "is writeable" if notebook_dir != global_settings.examples_dir: window.add_initial_worksheet() gtk.main() reinteract-0.5.0/lib/reinteract/save_file.py0000664000076400007640000000472311162516344016035 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk import os from application import application from window_builder import WindowBuilder class SaveFileBuilder(WindowBuilder): def __init__(self, title, display_name, save_button_text, check_name=None): WindowBuilder.__init__(self, 'save-file') if check_name != None: self.check_name = check_name self.dialog.set_title(title) self.dialog.set_default_response(gtk.RESPONSE_OK) self.message_label.set_text("Please enter a new name for '%s'" % display_name) self.name_entry.connect('changed', self.__update_save_sensitivity) self.__update_save_sensitivity() self.save_button.set_label(save_button_text) self.save_button.set_image(gtk.image_new_from_stock('gtk-save', gtk.ICON_SIZE_BUTTON)) def __update_save_sensitivity(self, *args): self.save_button.set_sensitive(self.check_name(self.name_entry.get_text().strip())) def check_name(self, name): return name != "" def prompt_for_name(self, folder, extension, action): while True: response = self.dialog.run() if response != gtk.RESPONSE_OK: break raw_name = self.name_entry.get_text() error_message = None try: raw_name = application.validate_name(raw_name) except ValueError, e: error_message = e.message if not error_message: if not (raw_name.lower().endswith("." + extension)): raw_name += "." + extension if not error_message: fullname = os.path.join(folder, raw_name) if os.path.exists(fullname): error_message = "'%s' already exists" % raw_name if error_message: dialog = gtk.MessageDialog(parent=self.dialog, buttons=gtk.BUTTONS_OK, type=gtk.MESSAGE_ERROR) dialog.set_markup("Please choose a different name") dialog.format_secondary_text(error_message) dialog.run() dialog.destroy() continue action(fullname) break reinteract-0.5.0/lib/reinteract/editor.py0000664000076400007640000001373211162516344015366 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import os import gobject import gtk import pango from application import application from format_escaped import format_escaped from notebook import NotebookFile from shell_buffer import ShellBuffer from shell_view import ShellView from save_file import SaveFileBuilder class Editor(gobject.GObject): def __init__(self, notebook): gobject.GObject.__init__(self) self.notebook = notebook self._unsaved_index = application.allocate_unsaved_index() ####################################################### # Utility ####################################################### def _clear_unsaved(self): if self._unsaved_index != None: application.free_unsaved_index(self._unsaved_index) self._unsaved_index = None def _update_filename(self, *args): self.notify('filename') self.notify('title') def _update_modified(self, *args): self.notify('modified') self.notify('title') def _update_state(self, *args): self.notify('state') def _update_file(self): self.notify('file') def __prompt_for_name(self, title, save_button_text, action, check_name=None): builder = SaveFileBuilder(title, self._get_display_name(), save_button_text, check_name) builder.dialog.set_transient_for(self.widget.get_toplevel()) if self._get_filename() != None: builder.name_entry.set_text(os.path.basename(self._get_filename())) builder.prompt_for_name(self.notebook.folder, self._get_extension(), action) builder.dialog.destroy() ####################################################### # Implemented by subclasses ####################################################### def _get_display_name(self): raise NotImplementedError() def _get_modified(self): raise NotImplementedError() def _get_state(self): return NotebookFile.NONE def _get_filename(self): return NotImplementedError() def _get_file(self): return NotImplementedError() def _get_extension(self): return NotImplementedError() def _save(self, filename): return NotImplementedError() ####################################################### # Public API ####################################################### def close(self): if self._unsaved_index != None: application.free_unsaved_index(self._unsaved_index) self._unsaved_index = None self.widget.destroy() def confirm_discard(self, before_quit=False): if not self.modified: return True if before_quit: message_format = self.DISCARD_FORMAT_BEFORE_QUIT continue_button_text = '_Quit without saving' else: message_format = self.DISCARD_FORMAT continue_button_text = '_Discard' if self._get_filename() == None: save_button_text = gtk.STOCK_SAVE_AS else: save_button_text = gtk.STOCK_SAVE message = format_escaped("" + message_format + "", self._get_display_name()) dialog = gtk.MessageDialog(parent=self.widget.get_toplevel(), buttons=gtk.BUTTONS_NONE, type=gtk.MESSAGE_WARNING) dialog.set_markup(message) dialog.add_buttons(continue_button_text, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, save_button_text, 1) dialog.set_default_response(1) response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_OK: return True elif response == 1: self.save() if self.modified: return False else: return True else: return False def load(self, filename): raise NotImplementedError() def save(self, filename=None): if filename == None: filename = self._get_filename() if filename == None: def action(fullname): self._save(fullname) self._clear_unsaved() self.notebook.refresh() self.__prompt_for_name(title="Save As...", save_button_text="_Save", action=action) else: self._save(filename) def rename(self): if self._get_filename() == None: self.save() return old_name = os.path.basename(self._get_filename()) title = "Rename '%s'" % old_name def check_name(name): return name != "" and name != old_name def action(fullname): old_filename = self._get_filename() self._save(fullname) self._clear_unsaved() os.remove(old_filename) self.notebook.refresh() self.__prompt_for_name(title=title, save_button_text="_Rename", action=action, check_name=check_name) @property def needs_calculate(self): return (self.state != NotebookFile.EXECUTE_SUCCESS and self.state != NotebookFile.NONE and self.state != NotebookFile.EXECUTING) def calculate(self): pass def undo(self): pass def redo(self): pass @gobject.property def filename(self): return self._get_filename() @gobject.property def file(self): return self._get_file() @gobject.property def modified(self): return self._get_modified() @gobject.property def state(self): return self._get_state() @gobject.property def title(self): if self.modified: return "*" + self._get_display_name() else: return self._get_display_name() reinteract-0.5.0/lib/reinteract/base_notebook_window.py0000664000076400007640000002471311162516344020302 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import os import re import sys import gtk from application import application from base_window import BaseWindow from library_editor import LibraryEditor from notebook import LibraryFile, NotebookFile, WorksheetFile from window_builder import WindowBuilder from worksheet_editor import WorksheetEditor class BaseNotebookWindow(BaseWindow): def __init__(self, notebook): BaseWindow.__init__(self, notebook) self.state = application.state.get_notebook_state(notebook.folder) # We'll call window.set_default_size() later with an appropriate # default size for the BaseNotebookWindow subclass. The size set by # window.resize() takes precedence. (width, height) = self.state.get_size() if width != -1 and height != -1: self.window.resize(width, height) self.window.connect('configure-event', self.on_configure_event) self.path = notebook.folder self.editors = [] self.nb_widget = gtk.Notebook() self.nb_widget.connect_after('switch-page', self.on_page_switched) self.nb_widget.connect('page-reordered', self.on_page_reordered) self._fill_content() self.main_vbox.show_all() self.__initial_editor = None open_file_paths = self.state.get_open_files() current_file = self.state.get_current_file() for path in open_file_paths: if not path in self.notebook.files: continue file = self.notebook.files[path] self.open_file(file) current_file_editor = None if current_file != None: filename = os.path.join(notebook.folder, current_file) for editor in self.editors: if editor.filename == filename: current_file_editor = editor if current_file_editor == None and len(self.editors) > 0: current_file_editor = self.editors[0] if current_file_editor != None: self._make_editor_current(current_file_editor) current_file_editor.view.grab_focus() self.__update_title() ####################################################### # Implemented by subclasses ####################################################### def _fill_contents(self, editor): raise NotImplementedError() def _add_editor(self, editor): self.editors.append(editor) self.nb_widget.add(editor.widget) editor.widget._notebook_window_editor = editor editor.connect('notify::title', self.on_editor_notify_title) editor.connect('notify::filename', self.on_editor_notify_filename) editor.connect('notify::modified', self.on_editor_notify_modified) editor.connect('notify::state', self.on_editor_notify_state) self._update_editor_title(editor) self._update_editor_state(editor) self._update_open_files() def _close_editor(self, editor): if not editor.confirm_discard(): return if editor == self.current_editor: # Either we'll switch page and a new editor will be set, or we have no pages left self.current_editor = None if editor == self.__initial_editor: self.__initial_editor = None self.editors.remove(editor) editor.widget._notebook_window_editor = None editor.close() self.__update_title() self._update_open_files() self.update_sensitivity() def _update_editor_state(self, editor): self.update_sensitivity() def _update_editor_title(self, editor): if editor == self.current_editor: self.__update_title() ####################################################### # Overrides ####################################################### def _add_actions(self, action_group): BaseWindow._add_actions(self, action_group) action_group.add_actions([ ('notebook-properties', gtk.STOCK_PROPERTIES, "Notebook _Properties", None, None, self.on_notebook_properties), ('new-worksheet', gtk.STOCK_NEW, "_New Worksheet", "n", None, self.on_new_worksheet), ('new-library', gtk.STOCK_NEW, "New _Library", "", None, self.on_new_library), ('calculate-all', gtk.STOCK_REFRESH, "Calculate _All", "Return", None, self.on_calculate_all), ]) def _close_current(self): if self.current_editor: self._close_editor(self.current_editor) def _close_window(self): if not self._confirm_discard(): return BaseWindow._close_window(self) ####################################################### # Utility ####################################################### def _make_editor_current(self, editor): self.nb_widget.set_current_page(self.nb_widget.page_num(editor.widget)) def __close_initial_editor(self): if self.__initial_editor and not self.__initial_editor.filename and not self.__initial_editor.modified: self._close_editor(self.__initial_editor) self.__initial_editor = None def __new_worksheet(self): editor = WorksheetEditor(self.notebook) self._add_editor(editor) self._make_editor_current(editor) return editor def __new_library(self): editor = LibraryEditor(self.notebook) self._add_editor(editor) self._make_editor_current(editor) return editor def __update_title(self, *args): if self.current_editor: title = self.current_editor.title + " - " + os.path.basename(self.notebook.folder) + " - Reinteract" else: title = os.path.basename(self.notebook.folder) + " - Reinteract" self.window.set_title(title) def _confirm_discard(self, before_quit=False): for editor in self.editors: if editor.modified: # Let the user see what they are discard or not discarding self.window.present_with_time(gtk.get_current_event_time()) self._make_editor_current(editor) if not editor.confirm_discard(before_quit=before_quit): return False return True def _update_open_files(self): open_file_paths = [] for child in self.nb_widget.get_children(): file = child._notebook_window_editor.file if not file: continue open_file_paths.append(file.path) self.state.set_open_files(open_file_paths) def _update_current_file(self): file = self.current_editor.file if file != None: self.state.set_current_file(file.path) else: self.state.set_current_file(None) def _update_size(self, width, height): self.state.set_size(width, height) ####################################################### # Callbacks ####################################################### def on_notebook_properties(self, action): builder = WindowBuilder('notebook-properties') builder.dialog.set_transient_for(self.window) builder.dialog.set_title("%s - Properties" % self.notebook.info.name) builder.name_entry.set_text(self.notebook.info.name) builder.name_entry.set_sensitive(False) builder.description_text_view.get_buffer().props.text = self.notebook.info.description response = builder.dialog.run() if response == gtk.RESPONSE_OK: self.notebook.info.description = builder.description_text_view.get_buffer().props.text builder.dialog.destroy() def on_new_worksheet(self, action): self.__new_worksheet() def on_new_library(self, action): self.__new_library() def on_calculate_all(self, action): for editor in self.editors: if editor.needs_calculate: editor.calculate() def on_page_switched(self, notebook, _, page_num): widget = self.nb_widget.get_nth_page(page_num) for editor in self.editors: if editor.widget == widget: self.current_editor = editor self.__update_title() self._update_current_file() self.update_sensitivity() break def on_page_reordered(self, notebook, page, new_page_num): self._update_open_files() def on_editor_notify_title(self, editor, *args): self._update_editor_title(editor) def on_editor_notify_filename(self, editor, *args): self._update_open_files() self._update_current_file() def on_editor_notify_modified(self, editor, *args): if editor == self.current_editor: self.update_sensitivity() def on_editor_notify_state(self, editor, *args): self._update_editor_state(editor) def on_configure_event(self, window, event): self._update_size(event.width, event.height) return False ####################################################### # Public API ####################################################### def confirm_discard(self): if not self._confirm_discard(before_quit=True): return False return True def open_file(self, file): filename = os.path.join(self.notebook.folder, file.path) for editor in self.editors: if editor.file == file: self._make_editor_current(editor) return True editor = self._load_editor(filename) if not editor: return False self._add_editor(editor) self._make_editor_current(editor) self.__close_initial_editor() return True def add_initial_worksheet(self): """If there are no editors open, add a new blank worksheet""" if len(self.editors) == 0: self.__initial_editor = self.__new_worksheet() self.__initial_editor.view.grab_focus() def update_sensitivity(self): BaseWindow.update_sensitivity(self) some_need_calculate = False for editor in self.editors: if editor.needs_calculate: some_need_calculate = True self._set_action_sensitive('calculate-all', some_need_calculate) reinteract-0.5.0/lib/reinteract/doc_popup.py0000664000076400007640000002616011153257447016075 00000000000000# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import pango import gtk import data_format import doc_format from global_settings import global_settings from popup import Popup MAX_HEIGHT = 300 PADDING = 5 # Size of fonts in the doc popup relative to normal application font size FONT_SCALE = 0.9 class DocPopup(Popup): """Class implementing a popup showing docs about an object""" __gsignals__ = { 'destroy': 'override', 'size-request': 'override', 'size-allocate': 'override', 'map': 'override', 'style-set': 'override' } # # There are basically three modes to the popup: # # - Enough space for the text (also used when can_focus=False) # - Needs vertical scrollbar, not focused (shows 'Press F2 for focus at the bottom) # - Needs vertical scrollbar, focused (has scrollbar) # # Trying to deal with all these different modes by using scrolled windows # and vboxes would make it really hard to get the details right. Instead we # get the ultimate control by overriding the container methods of gtk.Window # and doing everything ourself. See: # # - The calls to __set_parent() in __init__ # - The overrides of do_map(), do_forall(), do_size_request(), do_size_allocate() # def __init__(self, fixed_height=False, fixed_width=False, max_height=MAX_HEIGHT, can_focus=True): Popup.__init__(self) self.__fixed_height = fixed_height self.__fixed_width = fixed_width self.__max_height = max_height self.__can_focus = can_focus self.__view = gtk.TextView() self.__view.set_editable(False) bg_color = gtk.gdk.Color(0xffff, 0xffff, 0xbfbf) self.__view.modify_base(gtk.STATE_NORMAL, bg_color) self.modify_bg(gtk.STATE_NORMAL, bg_color) self.set_app_paintable(True) self.__view.modify_text(gtk.STATE_NORMAL, gtk.gdk.Color(0, 0, 0)) self.__view.set_parent(self) self.__view.show() self.__view.grab_focus() self.__font_is_custom_connection = global_settings.connect('notify::doc-tooltip-font-is-custom', self.__update_font) self.__font_name_connection = global_settings.connect('notify::doc-tooltip-font-name', self.__update_font) self.__update_font() self.__scrollbar = gtk.VScrollbar() self.__scrollbar.set_parent(self) self.__scrollbar.show() self.__view.emit('set-scroll-adjustments', None, self.__scrollbar.get_adjustment()) self.__vscrolled = False self.set_resizable(False) buf = self.__view.get_buffer() self.__bold_tag = buf.create_tag(None, weight=pango.WEIGHT_BOLD) self.__heading_type_tag = buf.create_tag(None, weight=pango.WEIGHT_BOLD, pixels_below_lines=5) self.__inline_type_tag = self.__bold_tag self.__value_tag = buf.create_tag(None, family="monospace") self.__target = None self.focused = False def __update_font(self, *args): if global_settings.doc_tooltip_font_is_custom: self.__font = pango.FontDescription(global_settings.doc_tooltip_font_name) else: self.__font = self.get_style().font_desc # We round the scaled font size to an integer point size, because fonts may # (or may not be) set up to look better at integer point sizes new_size = 1024 * int(FONT_SCALE * self.__font.get_size() / 1024) self.__font.set_size(new_size) self.__view.modify_font(self.__font) def set_target(self, target): """Set the object that the popup is showing documentation about""" if target is self.__target: return self.__target = target buf = self.__view.get_buffer() buf.delete(buf.get_start_iter(), buf.get_end_iter()) if target != None: if data_format.is_data_object(target): data_format.insert_formatted(buf, buf.get_start_iter(), target, self.__heading_type_tag, self.__inline_type_tag, self.__value_tag) else: doc_format.insert_docs(buf, buf.get_start_iter(), target, self.__bold_tag) buf.place_cursor(buf.get_start_iter()) self.__scrollbar.get_adjustment().set_value(0.) def do_destroy(self): global_settings.disconnect(self.__font_is_custom_connection) global_settings.disconnect(self.__font_name_connection) def do_size_request(self, request): view_width, view_height = self.__view.size_request() bw = self.get_border_width() request.height = view_height + 2 * (bw + PADDING) self.__vscrolled = self.__max_height > 0 and request.height > self.__max_height self.__scrollbar.set_child_visible(self.focused and self.__vscrolled) if self.__fixed_height: request.height = self.__max_height else: if self.__max_height > 0 and request.height > self.__max_height: request.height = self.__max_height request.width = view_width + 2 * (bw + PADDING) if self.focused and self.__vscrolled: scrollbar_width, _ = self.__scrollbar.size_request() request.width += scrollbar_width # fixed_width doesn't mean completely fixed, it means to put a floor on it so we don't bounce # the size too much metrics = self.get_pango_context().get_metrics(self.__font) if self.__fixed_width: request.width = max(request.width, metrics.get_approximate_char_width() * (90. / pango.SCALE)) # We always want a maximum width so that faulty docs don't cause us to have widths many times # the width of the screen request.width = min(request.width, metrics.get_approximate_char_width() * (120. / pango.SCALE)) def __create_f2_layout(self): return self.create_pango_layout("Press 'F2' for focus") def do_size_allocate(self, allocation): self.allocation = allocation if self.focused and self.__vscrolled: scrollbar_width, _ = self.__scrollbar.size_request() else: scrollbar_width = 0 bw = self.get_border_width() child_allocation = gtk.gdk.Rectangle() child_allocation.x = bw + PADDING child_allocation.width = allocation.width - 2 * (bw + PADDING) - scrollbar_width if self.__vscrolled and self.__can_focus: if not self.focused: layout = self.__create_f2_layout() _, height = layout.get_pixel_size() child_allocation.y = bw + PADDING child_allocation.height = allocation.height - 2 * bw - PADDING - height else: child_allocation.y = bw child_allocation.height = allocation.height - 2 * bw else: child_allocation.y = bw + PADDING child_allocation.height = allocation.height - 2 * (bw + PADDING) self.__view.size_allocate(child_allocation) if self.focused and self.__vscrolled: child_allocation.x = allocation.width - scrollbar_width - 1 child_allocation.y = 1 child_allocation.width = scrollbar_width child_allocation.height = allocation.height - 2 self.__scrollbar.size_allocate(child_allocation) def do_expose_event(self, event): Popup.do_expose_event(self, event) if self.__can_focus and not self.focused and self.__vscrolled: layout = self.__create_f2_layout() width, height = layout.get_pixel_size() cr = event.window.cairo_create() cr.set_source_rgb(0., 0., 0.) cr.rectangle(0, self.allocation.height - height, self.allocation.width, 1) cr.fill() cr.move_to(self.allocation.width - width - 5, self.allocation.height - height) cr.show_layout(layout) def do_forall(self, include_internals, func, data): if include_internals: func(self.__view, data) func(self.__scrollbar, data) def do_map(self): Popup.do_map(self) self.__view.map() if self.focused and self.__vscrolled: self.__scrollbar.map() def do_style_set(self, old_style): # Calling update_font() from the ::style-set handler on the view would # trigger an infinite loop, but it's fine to do it from the handler on # the toplevel window self.__update_font() def __show(self, focus): if self.showing: if focus: self.focus() return # We want to avoid: # # - get the size for the popup without validating the TextView # - allocate at that size, queuing a resize because the # gtk_text_view_size_allocate() flushes the "first validate idle" # - popup small # - resize larger # # So before we show the popup at all, we allocate the TextView # at a large size so it can figure out how big it really wants # to be, and queue a resize at that size. Then we go ahead and # show the window. self.__view.size_request() self.__view.size_allocate(gtk.gdk.Rectangle(0, 0, 10000, 1000)) self.__view.queue_resize() if focus: # changing the focus state can change our requisition by showing # the scrollbar. We set the focused flag first so we show at the # right size. self.focused = True self.queue_resize() self.show() if focus: self.focus() self.showing = True def popup(self): """Show the popup""" self.__show(focus=False) def popup_focused(self): """Show the popup initially focused""" self.__show(focus=True) def popdown(self): """Hide the popup""" if not self.showing: return self.showing = False if self.focused: self.focused = False self.queue_resize() self.hide() def focus(self): assert self.__can_focus Popup.focus(self) if self.showing: self.queue_resize() def on_key_press_event(self, event): """Do key press handling while the popup is focused. Returns True if the key press is handled, False otherwise. """ if event.keyval == gtk.keysyms.Escape: self.popdown() return True else: return self.event(event) if __name__ == "__main__": # INTERACTIVE import re popup = DocPopup() popup.set_target(re) popup.popup() popup = DocPopup() popup.set_target(re) popup.move(0, 325) popup.popup_focused() popup = DocPopup(can_focus=False) popup.set_target(re) popup.move(0, 650) popup.popup() popup = DocPopup() popup.set_target(range(200)) popup.move(500, 0) popup.popup_focused() gtk.main() reinteract-0.5.0/lib/reinteract/editor_window.py0000664000076400007640000001072211162516344016751 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk import pango import os import sys from application import application from base_window import BaseWindow from global_settings import global_settings from notebook import Notebook class EditorWindow(BaseWindow): UI_STRING=""" """ def __init__(self): BaseWindow.__init__(self, Notebook()) self.path = None self.window.set_default_size(700, 800) self.main_vbox.show_all() ####################################################### # Overrides ####################################################### def _add_actions(self, action_group): BaseWindow._add_actions(self, action_group) action_group.add_actions([ ('save-as', gtk.STOCK_SAVE_AS, None, None, None, self.on_save_as), ]) def _close_current(self): self._close_window() def _close_window(self): if not self.current_editor.confirm_discard(): return True BaseWindow._close_window(self) ####################################################### # Utility ####################################################### def __save_as(self): chooser = gtk.FileChooserDialog("Save As...", self.window, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK)) chooser.set_default_response(gtk.RESPONSE_OK) response = chooser.run() filename = None if response == gtk.RESPONSE_OK: filename = chooser.get_filename() if filename != None: self.current_editor.save(filename) self.path = filename self.notebook.set_path([os.path.dirname(filename)]) chooser.destroy() def __update_title(self, *args): self.window.set_title(self.current_editor.title + " - Reinteract") ####################################################### # Callbacks ####################################################### def on_save(self, action): if self.current_editor.filename == None: self.__save_as() else: self.current_editor.save() def on_save_as(self, action): self.__save_as() ####################################################### # Public API ####################################################### def confirm_discard(self): if self.current_editor and not self.current_editor.confirm_discard(): return False return True def load(self, filename): editor = self._load_editor(filename) if not editor: return False if self.current_editor: self.current_editor.destroy() self.current_editor = editor self.current_editor.connect('notify::modified', lambda *args: self.update_sensitivity()) self.current_editor.connect('notify::title', self.__update_title) self.current_editor.connect('notify::state', lambda *args: self.update_sensitivity()) self.main_vbox.pack_start(self.current_editor.widget, expand=True, fill=True) self.path = filename self.update_sensitivity() self.current_editor.view.grab_focus() self.__update_title() return True reinteract-0.5.0/lib/reinteract/shell_buffer.py0000664000076400007640000007611411162516344016543 00000000000000# Copyright 2007-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## from __future__ import with_statement import gobject import gtk import logging import pango from custom_result import CustomResult from chunks import StatementChunk,CommentChunk import doc_format from notebook import HelpResult from statement import WarningResult import retokenize from worksheet import Worksheet, NEW_LINE_RE _debug = logging.getLogger("ShellBuffer").debug # See comment in iter_copy_from.py try: gtk.TextIter.copy_from def _copy_iter(dest, src): dest.copy_from(src) except AttributeError: from iter_copy_from import iter_copy_from as _copy_iter class _RevalidateIters: def __init__(self, buffer, *iters): self.buffer = buffer self.iters = iters def __enter__(self): self.marks = map(lambda iter: (iter, self.buffer.create_mark(None, iter, True)), self.iters) def __exit__(self, exception_type, exception_value, exception_traceback): for iter, mark in self.marks: _copy_iter(iter, self.buffer.get_iter_at_mark(mark)) self.buffer.delete_mark(mark) ADJUST_BEFORE = 0 ADJUST_AFTER = 1 ADJUST_NONE = 2 ####################################################### # GtkTextView fixups ####################################################### # Return value of iter.forward_line() is useless "whether the iter is # derefenceable" ... causes bugs with empty last lines where you move # onto the last line and it is immediately not dereferenceable def _forward_line(iter): """iter.forward_line() with fixed-up return value (moved to next line)""" line = iter.get_line() iter.forward_line() return iter.get_line() != line # Mostly for consistency ... iter.forward_line() has more useful return value # (moved) then backward_line def _backward_line(iter): """iter.backward_line() with fixed-up return value (moved to next line)""" line = iter.get_line() iter.backward_line() return iter.get_line() != line #################################################################### class ShellBuffer(gtk.TextBuffer): __gsignals__ = { 'begin-user-action': 'override', 'end-user-action': 'override', 'insert-text': 'override', 'delete-range': 'override', 'add-custom-result': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT)), 'pair-location-changed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT)) } def __init__(self, notebook, edit_only=False): gtk.TextBuffer.__init__(self) self.worksheet = Worksheet(notebook, edit_only) self.worksheet.connect('text-inserted', self.on_text_inserted) self.worksheet.connect('text-deleted', self.on_text_deleted) self.worksheet.connect('lines-inserted', self.on_lines_inserted) self.worksheet.connect('lines-deleted', self.on_lines_deleted) self.worksheet.connect('chunk-inserted', self.on_chunk_inserted) self.worksheet.connect('chunk-changed', self.on_chunk_changed) self.worksheet.connect('chunk-deleted', self.on_chunk_deleted) self.worksheet.connect('chunk-status-changed', self.on_chunk_status_changed) self.worksheet.connect('chunk-results-changed', self.on_chunk_results_changed) self.worksheet.connect('place-cursor', self.on_place_cursor) self.__result_tag = self.create_tag(family="monospace", style="italic", wrap_mode=gtk.WRAP_WORD, editable=False) # Order here is significant ... we want the recompute tag to have higher priority, so # define it second self.__warning_tag = self.create_tag(foreground="#aa8800") self.__error_tag = self.create_tag(foreground="#aa0000") self.__recompute_tag = self.create_tag(foreground="#888888") self.__comment_tag = self.create_tag(foreground="#3f7f5f") self.__bold_tag = self.create_tag(weight=pango.WEIGHT_BOLD) self.__help_tag = self.create_tag(family="sans", style=pango.STYLE_NORMAL, paragraph_background="#ffff88", left_margin=10, right_margin=10) punctuation_tag = None self.__fontify_tags = { retokenize.TOKEN_KEYWORD : self.create_tag(foreground="#7f0055", weight=600), retokenize.TOKEN_NAME : None, retokenize.TOKEN_COMMENT : self.__comment_tag, retokenize.TOKEN_BUILTIN_CONSTANT : self.create_tag(foreground="#55007f"), retokenize.TOKEN_STRING : self.create_tag(foreground="#00aa00"), retokenize.TOKEN_PUNCTUATION : punctuation_tag, retokenize.TOKEN_CONTINUATION : punctuation_tag, retokenize.TOKEN_LPAREN : punctuation_tag, retokenize.TOKEN_RPAREN : punctuation_tag, retokenize.TOKEN_LSQB : punctuation_tag, retokenize.TOKEN_RSQB : punctuation_tag, retokenize.TOKEN_LBRACE : punctuation_tag, retokenize.TOKEN_RBRACE : punctuation_tag, retokenize.TOKEN_BACKQUOTE : punctuation_tag, retokenize.TOKEN_COLON : punctuation_tag, retokenize.TOKEN_DOT : punctuation_tag, retokenize.TOKEN_EQUAL : punctuation_tag, retokenize.TOKEN_AUGEQUAL : punctuation_tag, retokenize.TOKEN_NUMBER : None, retokenize.TOKEN_JUNK : self.create_tag(underline="error"), } self.__line_marks = [self.create_mark(None, self.get_start_iter(), True)] self.__line_marks[0].line = 0 self.__in_modification_count = 0 self.__have_pair = False self.__pair_mark = self.create_mark(None, self.get_start_iter(), True) ####################################################### # Utility ####################################################### def __begin_modification(self): self.__in_modification_count += 1 def __end_modification(self): self.__in_modification_count -= 1 def __insert_results(self, chunk): if not isinstance(chunk, StatementChunk): return if chunk.results_start_mark: raise RuntimeError("__insert_results called when we already have results") if (chunk.results == None or len(chunk.results) == 0) and chunk.error_message == None: return self.__begin_modification() location = self.pos_to_iter(chunk.end - 1) if not location.ends_line(): location.forward_to_line_end() # We don't want to move the insert cursor in the common case of # inserting a result right at the insert cursor if location.compare(self.get_iter_at_mark(self.get_insert())) == 0: saved_insert = self.create_mark(None, location, True) else: saved_insert = None self.insert(location, "\n") chunk.results_start_mark = self.create_mark(None, location, True) chunk.results_start_mark.source = chunk if chunk.error_message: results = [ chunk.error_message ] else: results = chunk.results first = True for result in results: if not first: self.insert(location, "\n") first = False if isinstance(result, basestring): self.insert(location, result) elif isinstance(result, WarningResult): start_mark = self.create_mark(None, location, True) self.insert(location, result.message) start = self.get_iter_at_mark(start_mark) self.delete_mark(start_mark) self.apply_tag(self.__warning_tag, start, location) elif isinstance(result, HelpResult): start_mark = self.create_mark(None, location, True) doc_format.insert_docs(self, location, result.arg, self.__bold_tag) start = self.get_iter_at_mark(start_mark) self.delete_mark(start_mark) self.apply_tag(self.__help_tag, start, location) elif isinstance(result, CustomResult): anchor = self.create_child_anchor(location) self.emit("add-custom-result", result, anchor) location = self.get_iter_at_child_anchor(anchor) location.forward_char() # Skip over child start = self.get_iter_at_mark(chunk.results_start_mark) self.apply_tag(self.__result_tag, start, location) chunk.results_end_mark = self.create_mark(None, location, True) chunk.results_start_mark.source = chunk if saved_insert != None: self.place_cursor(self.get_iter_at_mark(saved_insert)) self.delete_mark(saved_insert) self.__end_modification() def __delete_results_marks(self, chunk): if not (isinstance(chunk, StatementChunk) and chunk.results_start_mark): return self.delete_mark(chunk.results_start_mark) self.delete_mark(chunk.results_end_mark) chunk.results_start_mark = None chunk.results_end_mark = None def __delete_results(self, chunk): if not (isinstance(chunk, StatementChunk) and chunk.results_start_mark): return self.__begin_modification() start = self.get_iter_at_mark(chunk.results_start_mark) end = self.get_iter_at_mark(chunk.results_end_mark) # Delete the newline before the result along with the result start.backward_line() if not start.ends_line(): start.forward_to_line_end() self.delete(start, end) self.__delete_results_marks(chunk) self.__end_modification() def __set_pair_location(self, location): changed = False old_location = None if location == None: if self.__have_pair: old_location = self.get_iter_at_mark(self.__pair_mark) self.__have_pair = False changed = True else: if not self.__have_pair: self.__have_pair = True self.move_mark(self.__pair_mark, location) changed = True else: old_location = self.get_iter_at_mark(self.__pair_mark) if location.compare(old_location) != 0: self.move_mark(self.__pair_mark, location) changed = True if changed: self.emit('pair-location-changed', old_location, location) def __calculate_pair_location(self): location = self.get_iter_at_mark(self.get_insert()) # GTK+-2.10 has fractionally-more-efficient buffer.get_has_selection() selection_bound = self.get_iter_at_mark(self.get_selection_bound()) if location.compare(selection_bound) != 0: self.__set_pair_location(None) return location = self.get_iter_at_mark(self.get_insert()) line, offset = self.iter_to_pos(location, adjust=ADJUST_NONE) if line == None: self.__set_pair_location(None) return chunk = self.worksheet.get_chunk(line) if not isinstance(chunk, StatementChunk): self.__set_pair_location(None) return if offset == 0: self.__set_pair_location(None) return pair_line, pair_start = chunk.tokenized.get_pair_location(line - chunk.start, offset - 1) if pair_line == None: self.__set_pair_location(None) return pair_iter = self.pos_to_iter(chunk.start + pair_line, pair_start) self.__set_pair_location(pair_iter) def __fontify_statement_chunk(self, chunk, changed_lines): iter = self.pos_to_iter(chunk.start) i = 0 for l in changed_lines: while i < l: iter.forward_line() i += 1 end = iter.copy() if not end.ends_line(): end.forward_to_line_end() self.remove_all_tags(iter, end) end = iter.copy() for token_type, start_index, end_index, _ in chunk.tokenized.get_tokens(l): tag = self.__fontify_tags[token_type] if tag != None: iter.set_line_index(start_index) end.set_line_index(end_index) self.apply_tag(tag, iter, end) ####################################################### # Overrides for GtkTextView behavior ####################################################### def do_begin_user_action(self): self.worksheet.begin_user_action() def do_end_user_action(self): self.worksheet.end_user_action() if not self.worksheet.in_user_action(): self.__calculate_pair_location() def do_insert_text(self, location, text, text_len): if self.__in_modification_count > 0: gtk.TextBuffer.do_insert_text(self, location, text, text_len) return line, offset = self.iter_to_pos(location, adjust=ADJUST_NONE) if line == None: return with _RevalidateIters(self, location): self.worksheet.insert(line, offset, text[0:text_len]) def do_delete_range(self, start, end): if self.__in_modification_count > 0: gtk.TextBuffer.do_delete_range(self, start, end) return start_line, start_offset = self.iter_to_pos(start, adjust=ADJUST_AFTER) end_line, end_offset = self.iter_to_pos(end, adjust=ADJUST_AFTER) # If start and end crossed, then they were both within a result. Ignore # (This really shouldn't happen) if start_line > end_line or (start_line == end_line and start_offset > end_offset): return # If start and end ended up at the same place, then we must have been # trying to join a result with a adjacent text line. Treat that as joining # the two text lines. if start_line == end_line and start_offset == end_offset: if start_offset == 0: # Start of the line after if start_line > 0: start_line -= 1 start_offset = len(self.worksheet.get_line(start_line)) else: # End of the previous line if end_line < self.worksheet.get_line_count() - 1: end_line += 1 end_offset = 0 with _RevalidateIters(self, start, end): self.worksheet.delete_range(start_line, start_offset, end_line, end_offset) def do_mark_set(self, location, mark): try: gtk.TextBuffer.do_mark_set(self, location, mark) except NotImplementedError: # the default handler for ::mark-set was added in GTK+-2.10 pass if mark != self.get_insert() and mark != self.get_selection_bound(): return if not self.worksheet.in_user_action(): self.__calculate_pair_location() ####################################################### # Callbacks on worksheet changes ####################################################### def on_text_inserted(self, worksheet, line, offset, text): self.__begin_modification() location = self.pos_to_iter(line, offset) # The inserted text may carry a set of results away from the chunk # that produced it. Worksheet doesn't care what we do with the # result chunks on an insert location, as long as the resulting # text (ignoring results) matches what it expects. If the # text doesn't start with a newline, then the chunk above is # necessarily modified, and we'll fix things up when we get the # ::chunk-changed. If the text starts with a newline, then we # insert after the results, since it doesn't matter. But we # also have to fix the cursor. chunk = worksheet.get_chunk(line) if (line == chunk.end - 1 and NEW_LINE_RE.match(text) and isinstance(chunk, StatementChunk) and offset == len(chunk.tokenized.lines[-1]) and chunk.results_start_mark): result_end = self.get_iter_at_mark(chunk.results_end_mark) cursor_location = self.get_iter_at_mark(self.get_insert()) if (location.compare(cursor_location) == 0): self.place_cursor(result_end) location = result_end self.insert(location, text, -1) # Worksheet considers an insertion of multiple lines of text at # offset 0 to shift that line down. Since our line start marks # have left gravity and don't move, we need to fix them up. if offset == 0: count = 0 for m in NEW_LINE_RE.finditer(text): count += 1 if count > 0: mark = self.__line_marks[line] iter = self.get_iter_at_mark(mark) while count > 0: iter.forward_line() count -= 1 self.move_mark(mark, iter) self.__end_modification() def on_text_deleted(self, worksheet, start_line, start_offset, end_line, end_offset): self.__begin_modification() start = self.pos_to_iter(start_line, start_offset) end = self.pos_to_iter(end_line, end_offset) # The range may contain intervening results; Worksheet doesn't care # if we delete them or not, but the resulting text in the buffer (ignoring # results) matches what it expects. In the normal case, we just delete # the results, and if they belong to a statement above, they will be added # back when we get the ::chunk-changed signal. There is a special case when # the chunk above doesn't change; when we delete from * to * in: # # 1 + 1 * # /2/ # [ ... more stuff ] # * # # In this case, we adjust the range to start at the end of the first result, # But we also have to fix up the cursor. # start_chunk = worksheet.get_chunk(start_line) if (isinstance(start_chunk, StatementChunk) and start_chunk.results_start_mark and start_line == start_chunk.end - 1 and start_offset == len(start_chunk.tokenized.lines[-1]) and end.get_line_offset() == 0 and end.ends_line()): cursor_location = self.get_iter_at_mark(self.get_insert()) if (start.compare(cursor_location) < 0 and end.compare(cursor_location) >= 0): self.place_cursor(start) start = self.get_iter_at_mark(start_chunk.results_end_mark) start_line += 1 for chunk in worksheet.iterate_chunks(start_line, end_line): if chunk != worksheet.get_chunk(end_line): self.__delete_results_marks(chunk) self.delete(start, end) self.__end_modification() def on_lines_inserted(self, worksheet, start, end): _debug("...lines %d:%d inserted", start, end) if start == 0: iter = self.get_start_iter() else: iter = self.pos_to_iter(start - 1) iter.forward_line() while True: for mark in iter.get_marks(): if hasattr(mark, 'source'): # A result chunk! iter = self.get_iter_at_mark(mark.source.results_end_mark) iter.forward_line() continue break self.__line_marks[start:start] = (None for x in xrange(start, end)) for i in xrange(start, end): self.__line_marks[i] = self.create_mark(None, iter, True) self.__line_marks[i].line = i iter.forward_line() for i in xrange(end, len(self.__line_marks)): self.__line_marks[i].line += (end - start) def on_lines_deleted(self, worksheet, start, end): _debug("...lines %d:%d deleted", start, end) for i in xrange(start, end): self.delete_mark(self.__line_marks[i]) self.__line_marks[start:end] = [] for i in xrange(start, len(self.__line_marks)): self.__line_marks[i].line -= (end - start) def on_chunk_inserted(self, worksheet, chunk): _debug("...chunk %s inserted", chunk); chunk.results_start_mark = None chunk.results_end_mark = None self.on_chunk_changed(worksheet, chunk, range(0, chunk.end - chunk.start)) def on_chunk_deleted(self, worksheet, chunk): _debug("...chunk %s deleted", chunk); self.__delete_results(chunk) def on_chunk_changed(self, worksheet, chunk, changed_lines): _debug("...chunk %s changed", chunk); if chunk.results_start_mark: # Check that the result is still immediately after the chunk, and if # not, delete it and insert it again iter = self.pos_to_iter(chunk.end - 1) if (not _forward_line(iter) or not chunk.results_start_mark in iter.get_marks()): self.__delete_results(chunk) self.__insert_results(chunk) else: self.__insert_results(chunk) if isinstance(chunk, StatementChunk): self.__fontify_statement_chunk(chunk, changed_lines) elif isinstance(chunk, CommentChunk): start = self.pos_to_iter(chunk.start) end = self.pos_to_iter(chunk.end - 1, len(self.worksheet.get_line(chunk.end - 1))) self.remove_all_tags(start, end) self.apply_tag(self.__comment_tag, start, end) def on_chunk_status_changed(self, worksheet, chunk): _debug("...chunk %s status changed", chunk); pass def on_chunk_results_changed(self, worksheet, chunk): _debug("...chunk %s results changed", chunk); self.__delete_results(chunk) self.__insert_results(chunk) def on_place_cursor(self, worksheet, line, offset): self.place_cursor(self.pos_to_iter(line, offset)) ####################################################### # Public API ####################################################### def pos_to_iter(self, line, offset=0): """Get an iter at the specification code line and offset @param line: the line in the code of the worksheet (not the gtk.TextBuffer line) @param offset: the character within the line (defaults 0). -1 means end """ iter = self.get_iter_at_mark(self.__line_marks[line]) if offset < 0: offset = len(self.worksheet.get_line(line)) iter.set_line_offset(offset) return iter def iter_to_pos(self, iter, adjust=ADJUST_BEFORE): """Get the code line and offset at the given iterator Return a tuple of (code_line, offset). @param iter: an iterator within the buffer @param adjust: how to handle the case where the iterator isn't on a line of code. ADJUST_BEFORE: end previous line of code ADJUST_AFTER: start of next line of code ADJUST_NONE: return (None, None) """ offset = iter.get_line_offset() tmp = iter.copy() tmp.set_line_offset(0) for mark in tmp.get_marks(): if hasattr(mark, 'line'): return (mark.line, offset) if adjust == ADJUST_NONE: return None, None if adjust == ADJUST_AFTER: while _forward_line(tmp): for mark in tmp.get_marks(): if hasattr(mark, 'line'): return mark.line, 0 # Not found, we must be in a result chunk after the last line # fall through to the !after case while _backward_line(tmp): for mark in tmp.get_marks(): if hasattr(mark, 'line'): if not tmp.ends_line(): tmp.forward_to_line_end() return mark.line, tmp.get_line_offset() raise AssertionError("Not reached") def get_public_text(self, start=None, end=None): """Gets the text in the buffer in the specified range, ignoring results This method satisfies the contract required by sanitize_textview_ipc.py start - iter for the end of the text (None == buffer start) end - iter for the start of the text (None == buffer end) """ if start == None: start = self.get_start_iter(); if end == None: end = self.get_end_iter(); start_line, start_offset = self.iter_to_pos(start, adjust=ADJUST_AFTER) end_line, end_offset = self.iter_to_pos(end, adjust=ADJUST_BEFORE) return self.worksheet.get_text(start_line, start_offset, end_line, end_offset) def get_pair_location(self): """Return an iter pointing to the character paired with the character before the cursor, or None""" if self.__have_pair: return self.get_iter_at_mark(self.__pair_mark) else: return None def in_modification(self): """Return True if the text buffer is modifying its contents itself This can be useful to distinguish user edits from internal edits. """ return self.__in_modification_count > 0 ###################################################################### # The tests we include here are tests of the interaction of editing # with results. Results don't appear inline in a Worksheet, so these # tests have to be here rather than with Worksheet. Almost all other # testing is done in Worksheet. # if __name__ == '__main__': #pragma: no cover import sys gobject.threads_init() from notebook import Notebook if "-d" in sys.argv: logging.basicConfig(level=logging.DEBUG, format="DEBUG: %(message)s") from StringIO import StringIO import stdout_capture stdout_capture.init() buf = ShellBuffer(Notebook()) def insert(line, offset, text): i = buf.get_iter_at_line_offset(line, offset) buf.insert_interactive(i, text, True) def delete(start_line, start_offset, end_line, end_offset): i = buf.get_iter_at_line_offset(start_line, start_offset) j = buf.get_iter_at_line_offset(end_line, end_offset) buf.delete_interactive(i, j, True) def calculate(): buf.worksheet.calculate(True) def clear(): buf.worksheet.clear() def expect(expected): si = StringIO() i = buf.get_start_iter() while True: end = i.copy() if not end.ends_line(): end.forward_to_line_end() text = buf.get_slice(i, end) line, _ = buf.iter_to_pos(i, adjust=ADJUST_NONE) if line != None: chunk = buf.worksheet.get_chunk(line) else: chunk = None if chunk and isinstance(chunk, StatementChunk): if line == chunk.start: si.write(">>> ") else: si.write("... ") si.write(text) if _forward_line(i): si.write("\n") else: break result = si.getvalue() if not result == expected: raise AssertionError("\nGot:\n%s\nExpected:\n%s" % (result, expected)) # Calculation resulting in result chunks insert(0, 0, "1 \\\n + 2\n3\n") calculate() expect(""">>> 1 \\ ... + 2 3 >>> 3 3 """) # Check that splitting a statement with a delete results in the # result chunk being moved to the last line of the first half delete(1, 0, 1, 1) expect(""">>> 1 \\ 3 >>> + 2 >>> 3 3 """) # Editing a line with an existing error chunk to fix the error clear() insert(0, 0, "a\na = 2") calculate() insert(0, 0, "2") delete(0, 1, 0, 2) calculate() expect(""">>> 2 2 >>> a = 2""") # Test an attempt to join a ResultChunk onto a previous chunk; should join # the line with the following line, moving the result chunk clear() insert(0, 0, "1\n"); calculate() expect(""">>> 1 1 """) delete(0, 1, 1, 0) expect(""">>> 1 1""") # Test an attempt to join a chunk onto a previous ResultChunk, should move # the ResultChunk and do the modification clear() expect("") insert(0, 0, "1\n2\n"); calculate() expect(""">>> 1 1 >>> 2 2 """) delete(1, 1, 2, 0) expect(""">>> 12 1 """) # Test inserting random text inside a result chunk, should ignore clear() insert(0, 0, "1\n2"); calculate() expect(""">>> 1 1 >>> 2 2""") insert(1, 0, "foo") expect(""">>> 1 1 >>> 2 2""") # Calculation resulting in a multi-line result change clear() insert(0, 0, "for i in range(0, 3): print i") calculate() expect(""">>> for i in range(0, 3): print i 0 1 2""") # Test deleting a range containing both results and statements clear() insert(0, 0, "1\n2\n3\n4\n") calculate() expect(""">>> 1 1 >>> 2 2 >>> 3 3 >>> 4 4 """) delete(2, 0, 5, 0) expect(""">>> 1 1 >>> 4 4 """) # Inserting an entire new statement in the middle insert(2, 0, "2.5\n") expect(""">>> 1 1 >>> 2.5 >>> 4 4 """) calculate() expect(""">>> 1 1 >>> 2.5 2.5 >>> 4 4 """) # Check that inserting a blank line at the beginning of a statement leaves # the result behind insert(2, 0, "\n") expect(""">>> 1 1 >>> 2.5 2.5 >>> 4 4 """) # Test deleting a range including a result and joining two statements clear() insert(0, 0, "12\n34") calculate() expect(""">>> 12 12 >>> 34 34""") delete(0, 1, 2, 1) expect(""">>> 14 12""") # Test a deletion that splits the buffer into two (invalid) pieces clear() insert(0, 0, "try:\n a = 1\nfinally:\n print 'Done'") calculate() expect(""">>> try: ... a = 1 ... finally: ... print 'Done' Done""") delete(2, 7, 2, 8) calculate() expect(""">>> try: ... a = 1 invalid syntax >>> finally ... print 'Done' invalid syntax""") # Try an insertion that combines the two pieces and makes them valid # again (combining across the error result chunk) insert(3, 7, ":") calculate() expect(""">>> try: ... a = 1 ... finally: ... print 'Done' Done""") # Test an undo of an insert that caused insertion of result chunks clear() insert(0, 0, "2\n") expect(""">>> 2 """) calculate() expect(""">>> 2 2 """) insert(0, 0, "1\n") calculate() buf.worksheet.undo() expect(""">>> 2 2 """) # Test insertion of WarningResult clear() insert(0, 0, """class A(object): def __copy__(self): raise RuntimeError("Can't copy") def __repr__(a): return 'A()' def foo(x): return x a = A() a.foo()""") calculate() expect(""">>> class A(object): ... def __copy__(self): raise RuntimeError("Can't copy") ... def __repr__(a): return 'A()' ... def foo(x): return x >>> a = A() >>> a.foo() 'a' apparently modified, but can't copy it A()""") reinteract-0.5.0/lib/reinteract/stdout_capture.py0000664000076400007640000000531411072035642017137 00000000000000# Copyright 2008 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import threading import sys def init(): """Initialize the stdout_capture module. This must be called before using the StdoutCapture class""" global _saved_stdout _saved_stdout = sys.stdout sys.stdout = _StdoutStack() class _StdoutStack(threading.local): """The StdoutStack object is used to allow overriding sys.stdout in a per-thread manner""" def __init__(self): self.stack = [] self.current = _saved_stdout def write(self, str): self.current.write(str) def push(self, value): self.stack.append(self.current) self.current = value def pop(self): self.current = self.stack.pop() class StdoutCapture: """ The StdoutCapture object allows temporarily redirecting writes to sys.stdout to call a function You must call stdout_capture.init() before using this function >>> s = "" >>> def capture_it(str): ... global s ... s += str >>> c = StdoutCapture(capture_it) >>> c.push() >>> try: ... print "Foo" ... finally: ... c.pop() >>> s "Foo\\n" """ def __init__(self, write_function): self.__write_function = write_function def push(self): """Temporarily make the capture object active""" if not isinstance(sys.stdout, _StdoutStack): raise RuntimeError("stdout_capture.init() has not been called, or sys.stdout has been overridden again") sys.stdout.push(self) def pop(self): """End the effect of the previous call to pop""" if not isinstance(sys.stdout, _StdoutStack): raise RuntimeError("stdout_capture.init() has not been called, or sys.stdout has been overridden again") sys.stdout.pop() # Support 'with StdoutCapture(func):' for the future, though reinteract currently limits # itself to Python-2.4. def __enter__(self): self.push() def __exit__(self, *args): self.pop() def write(self, str): self.__write_function(str) if __name__ == "__main__": init() s = "" def capture_it(str): global s s += str #with StdoutCapture(capture_it): # print "Foo" # #asssert s == "Foo\n" s = "" c = StdoutCapture(capture_it) c.push() try: print "Foo" finally: c.pop() assert s == "Foo\n" reinteract-0.5.0/lib/reinteract/rewrite.py0000664000076400007640000010645711162516344015570 00000000000000# Copyright 2007-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import parser import token import symbol import sys class UnsupportedSyntaxError(Exception): """Exception thrown when some type of Python code that we can't support was used""" def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class _RewriteState(object): def __init__(self, output_func_name=None, print_func_name=None, future_features=None): self.mutated = [] self.output_func_name = output_func_name self.print_func_name = print_func_name self.future_features = future_features def add_mutated(self, path): # Make sure our "mutation" isn't something like "asdfa".length(); we # will miss some valid mutations that we could handle like # (some_list).append(5). If such cases ever become and issue, we # could add some code here to simplify them into a "normal" form. if path[0][1][0] == token.NAME: if not path in self.mutated: self.mutated.append(path) def _do_match(t, pattern, start_pos=0, start_pattern_index=0): # Match an AST tree against a pattern. Along with symbol/token names, patterns # can contain strings: # # '': ignore the matched item # 'name': store the matched item into the result dict under 'name' # '*': matches multiple items (greedy); ignore matched items # '*name': matches items (greedy); store the matched items as a sequence into the result dict # # Returns None if nothing matched or a dict of key/value pairs # # start_pos/start_pattern_index are used to match a trailing portion of the # tree against a trailing portion of the pattern; this is used internally to implement # non-terminal wildcards in patterns. # if start_pattern_index == 0: if (t[0] != pattern[0]): return None result = {} pos = max(1, start_pos) for i in xrange(max(1, start_pattern_index), len(pattern)): if isinstance(pattern[i], tuple): if pos >= len(t): return None subresult = _do_match(t[pos], pattern[i]) if subresult == None: return None result.update(subresult) else: if len(pattern[i]) > 0 and pattern[i][0] == '*': if i + 1 < len(pattern): # Non-final *, need to find where the tail portion matches, start # backwards from the end to implement a greedy match for tail_pos in xrange(len(t) - 1, pos - 1, -1): tail_result = _do_match(t, pattern, start_pos=tail_pos, start_pattern_index=i + 1) if tail_result != None: result.update(tail_result) break else: return None else: tail_pos = len(t) if pattern[i] != '*': result[pattern[i][1:]] = t[pos:tail_pos] return result else: if pos >= len(t): return None if pattern[i] != '': result[pattern[i]] = t[pos] pos += 1 if pos > len(t): return None else: return result _path_pattern = \ (symbol.test, (symbol.or_test, (symbol.and_test, (symbol.not_test, (symbol.comparison, (symbol.expr, (symbol.xor_expr, (symbol.and_expr, (symbol.shift_expr, (symbol.arith_expr, (symbol.term, (symbol.factor, (symbol.power, '*path'))))))))))))) def _is_test_path(t): # Check if the given AST is "test" of the form 'a.b...c' (where there # may be slices and method calls in the path). If it matches, # returns 'a.b...c, otherwise returns None args = _do_match(t, _path_pattern) if args == None: return None else: return args['path'] _method_call_pattern = \ (symbol.test, (symbol.or_test, (symbol.and_test, (symbol.not_test, (symbol.comparison, (symbol.expr, (symbol.xor_expr, (symbol.and_expr, (symbol.shift_expr, (symbol.arith_expr, (symbol.term, (symbol.factor, (symbol.power, '*path', (symbol.trailer, (token.DOT, ''), (token.NAME, '')), (symbol.trailer, (token.LPAR, ''), '*')))))))))))))) def _is_test_method_call(t): # Check if the given AST is a "test" of the form 'a...b.c()' If it # matches, returns 'a...b', otherwise returns None args = _do_match(t, _method_call_pattern) if args == None: return None else: return args['path'] _attribute_pattern = \ (symbol.test, (symbol.or_test, (symbol.and_test, (symbol.not_test, (symbol.comparison, (symbol.expr, (symbol.xor_expr, (symbol.and_expr, (symbol.shift_expr, (symbol.arith_expr, (symbol.term, (symbol.factor, (symbol.power, '*path', (symbol.trailer, (token.DOT, ''), (token.NAME, ''))))))))))))))) def _is_test_attribute(t): # Check if the given AST is a "test" of the form 'a...b.c' If it # matches, returns 'a...b', otherwise returns None args = _do_match(t, _attribute_pattern) if args == None: return None else: return args['path'] _slice_pattern = \ (symbol.test, (symbol.or_test, (symbol.and_test, (symbol.not_test, (symbol.comparison, (symbol.expr, (symbol.xor_expr, (symbol.and_expr, (symbol.shift_expr, (symbol.arith_expr, (symbol.term, (symbol.factor, (symbol.power, '*path', (symbol.trailer, (token.LSQB, ''), '*')))))))))))))) def _is_test_slice(t): # Check if the given AST is a "test" of the form 'a...b[c]' If it # matches, returns 'a...b', otherwise returns None args = _do_match(t, _slice_pattern) if args == None: return None else: return args['path'] def _do_create_funccall_expr_stmt(name, trailer): return (symbol.expr_stmt, (symbol.testlist, (symbol.test, (symbol.or_test, (symbol.and_test, (symbol.not_test, (symbol.comparison, (symbol.expr, (symbol.xor_expr, (symbol.and_expr, (symbol.shift_expr, (symbol.arith_expr, (symbol.term, (symbol.factor, (symbol.power, (symbol.atom, (token.NAME, name)), trailer))))))))))))))) def _create_funccall_expr_stmt(name, args): # Creates an 'expr_stmt' that calls a function. args is a list of # "test" AST's to pass as arguments to the function if len(args) == 0: trailer = (symbol.trailer, (token.LPAR, '('), (token.RPAR, ')')) else: arglist = [ symbol.arglist ] for a in args: if len(arglist) > 1: arglist.append((token.COMMA, ',')) arglist.append((symbol.argument, a)) trailer = (symbol.trailer, (token.LPAR, ')'), arglist, (token.RPAR, ')')) return _do_create_funccall_expr_stmt(name, trailer) def _rewrite_tree(t, state, actions): # Generic rewriting of an AST, actions is a map of symbol/token type to function # to call to produce a modified version of the the subtree result = t for i in xrange(1, len(t)): subnode = t[i] subtype = subnode[0] if actions.has_key(subtype): filtered = actions[subtype](subnode, state) if filtered != subnode: if result is t: result = list(t) result[i] = filtered return result def _rewrite_expr_stmt(t, state): # expr_stmt: testlist (augassign (yield_expr|testlist) | # ('=' (yield_expr|testlist))*) assert(t[0] == symbol.expr_stmt) assert(t[1][0] == symbol.testlist) if len(t) == 2: # testlist subnode = t[1] for i in xrange(1, len(subnode)): subsubnode = subnode[i] if subsubnode[0] == symbol.test: path = _is_test_method_call(subsubnode) if path != None: state.add_mutated(path) if state.output_func_name != None: return _create_funccall_expr_stmt(state.output_func_name, filter(lambda x: type(x) != int and x[0] == symbol.test, subnode)) else: return t else: if (t[2][0] == symbol.augassign): # testlist augassign (yield_expr|testlist) subnode = t[1] assert(len(subnode) == 2) # can only augassign one thing, despite the grammar # Depending on what a is, a += b can modify a. For example appending # to an array with a += [3]. If a is immutable (a number say), then copying # it is unnecessary, but cheap path = _is_test_path(subnode[1]) if path != None: state.add_mutated(path) else: # testlist ('=' (yield_expr|testlist))+ for i in xrange(1, len(t) - 1): if (t[i + 1][0] == token.EQUAL): subnode = t[i] assert(subnode[0] == symbol.testlist) for j in xrange(1, len(subnode)): subsubnode = subnode[j] if subsubnode[0] == symbol.test: path = _is_test_slice(subsubnode) if path == None: path = _is_test_attribute(subnode[1]) if path != None: state.add_mutated(path) return t def _rewrite_print_stmt(t, state): # print_stmt: 'print' ( [ test (',' test)* [','] ] | # '>>' test [ (',' test)+ [','] ] ) if state.print_func_name !=None and t[2][0] == symbol.test: return _create_funccall_expr_stmt(state.print_func_name, filter(lambda x: type(x) != int and x[0] == symbol.test, t)) else: return t def _rewrite_global_stmt(t, state): raise UnsupportedSyntaxError("The global statement is not supported") def _rewrite_small_stmt(t, state): # small_stmt: (expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | # import_stmt | global_stmt | exec_stmt | assert_return) return _rewrite_tree(t, state, { symbol.expr_stmt: _rewrite_expr_stmt, symbol.print_stmt: _rewrite_print_stmt, symbol.global_stmt: _rewrite_global_stmt }) # Future special handling: import_stmt # Not valid: flow_stmt, global_stmt def _rewrite_simple_stmt(t, state): # simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE return _rewrite_tree(t, state, { symbol.small_stmt: _rewrite_small_stmt }) def _rewrite_suite(t, state): # suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT return _rewrite_tree(t, state, { symbol.simple_stmt: _rewrite_simple_stmt, symbol.stmt: _rewrite_stmt }) def _rewrite_block_stmt(t, state): return _rewrite_tree(t, state, { symbol.suite: _rewrite_suite }) _rewrite_compound_stmt_actions = { symbol.if_stmt: _rewrite_block_stmt, symbol.while_stmt: _rewrite_block_stmt, symbol.for_stmt: _rewrite_block_stmt, symbol.try_stmt: _rewrite_block_stmt, symbol.funcdef: _rewrite_block_stmt, symbol.with_stmt: _rewrite_block_stmt } def _rewrite_compound_stmt(t, state): # compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef return _rewrite_tree(t, state, _rewrite_compound_stmt_actions) def _rewrite_stmt(t, state): # stmt: simple_stmt | compound_stmt return _rewrite_tree(t, state, { symbol.simple_stmt: _rewrite_simple_stmt, symbol.compound_stmt: _rewrite_compound_stmt }) def _create_future_import_statement(future_features): import_as_names = [symbol.import_as_names] for feature in future_features: if len(import_as_names) > 1: import_as_names.append((token.COMMA, ',')) import_as_names.append((symbol.import_as_name, (token.NAME, feature))) return (symbol.stmt, (symbol.simple_stmt, (symbol.small_stmt, (symbol.import_stmt, (symbol.import_from, (token.NAME, 'from'), (symbol.dotted_name, (token.NAME, '__future__')), (token.NAME, 'import'), import_as_names))), (token.NEWLINE, ''))) def _rewrite_file_input(t, state): # file_input: (NEWLINE | stmt)* ENDMARKER if state.future_features: # Ideally, we'd be able to pass in flags to the AST.compile() operation as we can with the # builtin compile() function. Lacking that ability, we just munge an import statement into # the start of the syntax tree return ((symbol.file_input, _create_future_import_statement(state.future_features)) + tuple((_rewrite_stmt(x, state) if x[0] == symbol.stmt else x) for x in t[1:])) else: return _rewrite_tree(t, state, { symbol.stmt: _rewrite_stmt }) ###################################################################### # Import procesing # dotted_name: NAME ('.' NAME)* def _process_dotted_name(t): assert t[0] == symbol.dotted_name joined = "".join((t[i][1] for i in xrange(1, len(t)))) basename = t[-1][1] return joined, basename # dotted_as_name: dotted_name [('as' | NAME) NAME] def _process_dotted_as_name(t): assert t[0] == symbol.dotted_as_name name, basename = _process_dotted_name(t[1]) if len(t) == 2: as_name = basename else: assert len(t) == 4 assert t[2] == (token.NAME, 'as') as_name = t[3][1] return (name, [( '.', as_name )]) # dotted_as_names: dotted_as_name (',' dotted_as_name)* def _process_dotted_as_names(t): assert t[0] == symbol.dotted_as_names result = [] for i in xrange(1, len(t)): if t[i][0] == token.COMMA: continue result.append(_process_dotted_as_name(t[i])) return result # import_name: 'import' dotted_as_names def _process_import_name(t): assert t[0] == symbol.import_name assert t[1] == (token.NAME, 'import') return _process_dotted_as_names(t[2]) # import_as_name: NAME [('as' | NAME) NAME] def _process_import_as_name(t): assert t[0] == symbol.import_as_name assert t[1][0] == token.NAME if len(t) == 2: return (t[1][1], t[1][1]) else: assert len(t) == 4 assert t[3][0] == token.NAME return (t[1][1], t[3][1]) # import_as_names: import_as_name (',' import_as_name)* [','] def _process_import_as_names(t): assert t[0] == symbol.import_as_names result = [] for i in xrange(1, len(t)): if t[i][0] == token.COMMA: continue sym, as_name = _process_import_as_name(t[i]) result.append((sym, as_name)) return result # import_from: ('from' ('.'* dotted_name | '.'+) # 'import' ('*' | '(' import_as_names ')' | import_as_names)) def _process_import_from(t): assert t[0] == symbol.import_from assert t[1] == (token.NAME, 'from') name = "" i = 2 while t[i][0] == token.DOT: name += "." i += 1 if t[i][0] == symbol.dotted_name: joined, _ = _process_dotted_name(t[i]) name += joined i += 1 assert t[i] == (token.NAME, 'import') i += 1 if t[i][0] == token.STAR: import_map = '*' elif t[i][0] == token.LPAR: import_map = _process_import_as_names(t[i + 1]) assert t[i + 2][0] == token.RPAR else: import_map = _process_import_as_names(t[i]) return [(name, import_map)] _import_pattern = \ (symbol.file_input, (symbol.stmt, (symbol.simple_stmt, (symbol.small_stmt, (symbol.import_stmt, 'imp')), '*')), '*') # import_stmt: import_name | import_from def _get_imports(t): args = _do_match(t, _import_pattern) if args: imp = args['imp'] if imp[0] == symbol.import_name: return _process_import_name(imp) else: assert imp[0] == symbol.import_from return _process_import_from(imp) else: return None ###################################################################### # Turn list of paths that are mutated into code to copy them def _get_path_root(path): atom_value = path[0][1] assert atom_value[0] == token.NAME return atom_value[1] def _describe_path(path): # Turn a path into a (skeletal) textual description # path: atom trailer* # atom: ('(' [yield_expr|testlist_gexp] ')' | # '[' [listmaker] ']' | # '{' [dictmaker] '}' | # '`' testlist1 '`' | # NAME | NUMBER | STRING+) atom_value = path[0][1] if atom_value[0] == token.NAME: result = atom_value[1] elif atom_value[0] == token.LPAR: result = "(...)" elif atom_value[0] == token.LSQB: result = "[...]" elif atom_value[0] == token.LBRACE: result = "{...}" elif atom_value[0] == token.BACKQUOTE: result = "`...`" elif atom_value[0] == token.NUMBER: result = str(atom_value[1]) elif atom_value[0] == token.STRING: result = '"..."' # trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME for trailer in path[1:]: trailer_value = trailer[1] if trailer_value[0] == token.LPAR: result += "(...)" elif trailer_value[0] == token.LSQB: result += "[...]" elif trailer_value[0] == token.DOT: result += "." + trailer[2][1] return result def create_path_test(path): return (symbol.test, (symbol.or_test, (symbol.and_test, (symbol.not_test, (symbol.comparison, (symbol.expr, (symbol.xor_expr, (symbol.and_expr, (symbol.shift_expr, (symbol.arith_expr, (symbol.term, (symbol.factor, (symbol.power,) + path)))))))))))) def _create_copy_code(path, copy_func_name): path_test = create_path_test(path) return (symbol.file_input, (symbol.stmt, (symbol.simple_stmt, (symbol.small_stmt, (symbol.expr_stmt, (symbol.testlist, path_test), (token.EQUAL, '='), (symbol.testlist, (symbol.test, (symbol.or_test, (symbol.and_test, (symbol.not_test, (symbol.comparison, (symbol.expr, (symbol.xor_expr, (symbol.and_expr, (symbol.shift_expr, (symbol.arith_expr, (symbol.term, (symbol.factor, (symbol.power, (symbol.atom, (token.NAME, copy_func_name)), (symbol.trailer, (token.LPAR, '('), (symbol.arglist, (symbol.argument, path_test)), (token.RPAR, ')')))))))))))))))))), (token.NEWLINE, '\n'))), (token.ENDMARKER, '\n')) def _compile_copy_code(path, copy_func_name): copy_code = _create_copy_code(path, copy_func_name) return parser.sequence2ast(copy_code).compile() def _compile_mutations(paths, copy_func_name): # First add prefixes - if a.b.c is mutated, then we need to # shallow-copy first a and then a.b paths_to_copy = set() # path: atom trailer* # trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME # # We normally chop of trailers one by one, but if we have # .NAME(...) (two trailers) then we chop that off as one piece # for path in paths: while True: # Dont' try to copy things that don't look like they # can be assigned to if path[-1][1][0] != token.LPAR: paths_to_copy.add(path) if len(path) == 1: break if (path[-1][1][0] == token.LPAR and len(path) > 2 and path[-2][1][0] == token.DOT): path = path[0:-2] else: path = path[0:-1] # Sort the paths with shorter paths earlier so that we copy prefixes # before longer versions paths_to_copy = sorted(paths_to_copy, lambda x,y: cmp(len(x),len(y))) return [(_get_path_root(path), _describe_path(path), _compile_copy_code(path, copy_func_name)) for path in paths_to_copy] ###################################################################### class Rewriter: """Class to rewrite and extract information from Python code""" def __init__(self, code, encoding="utf8", future_features=None): """Initialize the Rewriter object @param code: the text to compile @param encoding: the encoding of the text @param future_features: a list of names from the __future__ module """ if (isinstance(code, unicode)): code = code.encode("utf8") encoding = "utf8" self.code = code self.encoding = encoding self.future_features = future_features self.original = parser.suite(code).totuple() def get_imports(self): """ Return information about any imports made by the statement @returns: A list of tuples, which each tuple is either (module_name, '*'), (module_name, [('.', as_name)]), or (module_name, [(name, as_name), ...]). """ return _get_imports(self.original) def rewrite_and_compile(self, output_func_name=None, print_func_name=None, copy_func_name="__copy"): """ Compiles the parse tree into code, while rewriting the parse tree according to the output_func_name and print_func_name arguments. At the same time, the code is scanned for possible mutations, and a list is returned. Each item in the list is a tuple of: - The name of the variable at the root of the path to the object (e.g., for a.b.c, "a") - A string describing what should be copied. The string may include ellipses (...) for complex areas - it's meant as a human description - Code that can be evaluated to copy the object. @param output_func_name: the name of function used to wrap statements that are simply expressions. (More than one argument will be passed if the statement is in the form of a list.) Can be None. @param print_func_name: the name of a function used to replace print statements without a destination file. Can be None. @param copy_func_name: the name of a function used to make shallow copies of objects. Should have the same semantics as copy.copy (will normally be an import of copy.copy) Defaults to __copy. @returns: a tuple of the compiled code followed by a list of mutations """ state = _RewriteState(output_func_name=output_func_name, print_func_name=print_func_name, future_features=self.future_features) rewritten = _rewrite_file_input(self.original, state) encoded = (symbol.encoding_decl, rewritten, self.encoding) try: compiled = parser.sequence2ast(encoded).compile() except parser.ParserError, e: if "Illegal number of children for try/finally node" in e.message: raise UnsupportedSyntaxError("try/except/finally not supported due to Python issue 4529") else: raise UnsupportedSyntaxError("Unexpected parser error: " + e.message); return (compiled, _compile_mutations(state.mutated, copy_func_name)) ##################################################3 if __name__ == '__main__': import copy import re def rewrite_and_compile(code, output_func_name=None, future_features=None, print_func_name=None, encoding="utf8"): return Rewriter(code, encoding, future_features).rewrite_and_compile(output_func_name, print_func_name) def create_file_input(s): # Wrap up a statement (like an expr_stmt) into a file_input, so we can # parse/compile it return (symbol.file_input, (symbol.stmt, (symbol.simple_stmt, (symbol.small_stmt, s), (token.NEWLINE, '\n'))), (token.ENDMARKER, '\n')) def create_constant_test(c): # Create a test symbol which is a constant number return (symbol.test, (symbol.or_test, (symbol.and_test, (symbol.not_test, (symbol.comparison, (symbol.expr, (symbol.xor_expr, (symbol.and_expr, (symbol.shift_expr, (symbol.arith_expr, (symbol.term, (symbol.factor, (symbol.power, (symbol.atom, (token.NUMBER, str(c)))))))))))))))) # # Test _create_funccall_expr_stmt # def test_funccall(args): t = create_file_input(_create_funccall_expr_stmt('set_test_args', map(lambda c: create_constant_test(c), args))) test_args = [ 'UNSET' ] def set_test_args(*args): test_args[:] = args scope = { 'set_test_args': set_test_args } exec parser.sequence2ast(t).compile() in scope assert tuple(test_args) == args test_funccall(()) test_funccall((1,)) test_funccall((1,2)) # # Test that our intercepting of bare expressions to save the output works # def test_output(code, expected): compiled, _ = rewrite_and_compile(code, output_func_name='reinteract_output') test_args = [] def set_test_args(*args): test_args[:] = args scope = { 'reinteract_output': set_test_args } exec compiled in scope if tuple(test_args) != tuple(expected): raise AssertionError("Got '%s', expected '%s'" % (test_args, expected)) test_output('a=3', ()) test_output('1', (1,)) test_output('1,2', (1,2)) test_output('1;2', (2,)) test_output('a=3; a', (3,)) # # Test that our intercepting of print works # def test_print(code, expected): compiled, _ = rewrite_and_compile(code, print_func_name='reinteract_print') test_args = [] def set_test_args(*args): test_args[:] = args scope = { 'reinteract_print': set_test_args } exec compiled in scope if tuple(test_args) != tuple(expected): raise AssertionError("Got '%s', expected '%s'" % (test_args, expected)) test_print('a=3', ()) test_print('print 1', (1,)) test_print('print 1,2', (1,2)) test_print('print "",', ("",)) test_print('for i in [0]: print i', (0,)) test_print('import sys; print >>sys.stderr, "",', ()) # # Test catching possible mutations of variables # def test_mutated(code, expected, prepare=None, assert_old=None, assert_new=None): compiled, mutated = rewrite_and_compile(code) # # Basic test - check the root and description for the returned list of mutations # mutated_root_desc = sorted(((root, description) for (root, description, _) in mutated)) # Extract the root from a description (just take the first word) def expand_root_desc(description): m = re.match(r"([a-zA-Z_0-9]+)", description) return m.group(1), description expected_root_desc = sorted((expand_root_desc(x) for x in expected)) if tuple(mutated_root_desc) != tuple(expected_root_desc): raise AssertionError("Got '%s', expected '%s'" % (mutated, expected)) # More complex test # # a) create old scope, execute 'prepare' in it # b) copy old scope, execute each copy statement # c) execute the code # c) run assertion checks in old and new scope if prepare: old_scope = { '__copy' : copy.copy } exec prepare in old_scope new_scope = dict(old_scope) for _, _, copy_code in mutated: exec copy_code in new_scope exec compiled in new_scope old_ok = eval(assert_old, old_scope) if not old_ok: raise AssertionError("Old scope assertion '%s' failed" % assert_old) new_ok = eval(assert_new, new_scope) if not new_ok: raise AssertionError("New scope assertion '%s' failed" % assert_new) test_mutated('a[0] = 1', ('a',), 'a = [2]', 'a[0] == 2', 'a[0] == 1') test_mutated('a[0], b[0] = 1, 2', ('a', 'b'), 'a,b = [2],[1]', 'a[0],b[0] == 2,1', 'a[0],b[0] == 1,2') test_mutated('a[0], _ = 1', ('a')) test_mutated('a[0], b[0] = c[0], d[0] = 1, 2', ('a', 'b', 'c', 'd')) test_mutated('a[0][1] = 1', ('a', 'a[...]'), 'a = [[0,2],1]', 'a[0][1] == 2', 'a[0][1] == 1') # This isn't fully right - in the new scope b should be [1], not [] test_mutated('a[0].append(1)', ('a', 'a[...]'), 'b = []; a = [b]', 'b == [] and a == [b]', 'b == [] and a == [[1]]') test_mutated('a += 1', ('a',)) test_mutated('a[0] += 1', ('a', 'a[...]')) prepare = """ class A: def __init__(self): self.b = 1 def addmul(self, x,y): self.b += x * y def get_a(self): return self.a pass a = A() a.a = A() """ test_mutated('a.b = 2', ('a',), prepare, 'a.b == 1', 'a.b == 2') test_mutated('a.b = 2', ('a',), prepare, 'a.b == 1', 'a.b == 2') test_mutated('a.a.b = 2', ('a','a.a'), prepare, 'a.a.b == 1', 'a.a.b == 2') test_mutated('a.a.b += 1', ('a','a.a','a.a.b'), prepare, 'a.a.b == 1', 'a.a.b == 2') test_mutated('a.addmul(1,2)', ('a',), prepare, 'a.b == 1', 'a.b == 3') test_mutated('a.a.addmul(1,2)', ('a', 'a.a'), prepare, 'a.a.b == 1', 'a.a.b == 3') # These don't actually work properly since we don't know to copy a.a # So we just check the descriptions and not the execution test_mutated('a.get_a().b = 2', ('a',)) test_mutated('a.get_a().a.b = 2', ('a', 'a.get_a(...).a')) # # Test handling of encoding # def test_encoding(code, expected, encoding=None): if encoding != None: compiled, _ = rewrite_and_compile(code, encoding=encoding, output_func_name='reinteract_output') else: compiled, _ = rewrite_and_compile(code, output_func_name='reinteract_output') test_args = [] def set_test_args(*args): test_args[:] = args scope = { 'reinteract_output': set_test_args } exec compiled in scope if test_args[0] != expected: raise AssertionError("Got '%s', expected '%s'" % (test_args[0], expected)) test_encoding(u"u'\u00e4'".encode("utf8"), u'\u00e4') test_encoding(u"u'\u00e4'", u'\u00e4') test_encoding(u"u'\u00e4'".encode("iso-8859-1"), u'\u00e4', "iso-8859-1") # # Test import detection # def test_imports(code, expected): rewriter = Rewriter(code) result = rewriter.get_imports() if result != expected: raise AssertionError("Got '%s', expected '%s'" % (result, expected)) test_imports('a + 1', None) test_imports('import re', [('re', [('.', 're')])]) test_imports('import re as r', [('re', [('.', 'r')])]) test_imports('import re, os as o', [('re', [('.', 're')]), ('os', [('.', 'o')])]) test_imports('from re import match', [('re', [('match', 'match')])]) test_imports('from re import match as m', [('re', [('match', 'm')])]) test_imports('from re import match as m, sub as s', [('re', [('match', 'm'), ('sub', 's')])]) test_imports('from re import (match as m, sub as s)', [('re', [('match', 'm'), ('sub', 's')])]) test_imports('from ..re import match', [('..re', [('match', 'match')])]) test_imports('from re import *', [('re', '*')]) test_imports('from __future__ import division', [('__future__', [('division', 'division')])]) # # Test passing in future_features to use in compilation # scope = {} compiled, _ = rewrite_and_compile('a = 1/2', future_features=['with_statement', 'division']) exec compiled in scope assert scope['a'] == 0.5 reinteract-0.5.0/lib/reinteract/statement.py0000775000076400007640000003000511162516344016077 00000000000000# Copyright 2007-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import copy import pkgutil import traceback import sys from custom_result import CustomResult import notebook from notebook import HelpResult from rewrite import Rewriter, UnsupportedSyntaxError from stdout_capture import StdoutCapture class WarningResult(object): def __init__(self, message): self.message = message class Statement: """ Class that wraps a section of Python code for compilation and execution. (The section doesn't actually have to be a single statement.) """ NEW = 0 COMPILE_SUCCESS = 1 COMPILE_ERROR = 2 EXECUTING = 3 EXECUTE_SUCCESS = 4 EXECUTE_ERROR = 5 INTERRUPTED = 6 def __init__(self, text, worksheet, parent=None): self.__text = text self.__worksheet = worksheet #: current state of the statement (one of the constants defined within the class) self.state = Statement.NEW #: description of the imports of the statement. Set after compilation. See L{Rewriter.get_imports} self.imports = None #: names imported from __future__. Used when compiling subsequent statements self.future_features = None #: scope at the end of successful execution self.result_scope = None #: list of results from the statement. Set after successful execution self.results = None #: error_message: error message in case of compilation or execution error self.error_message = None #: line where error occured in case of compilation or execution error self.error_line = None #: offset within line of a compilation error self.error_offset = None self.__compiled = None self.__parent_future_features = None self.set_parent(parent) self.__stdout_buffer = None self.__capture = None def set_parent(self, parent): """Set the parent statement for this statement. The parent statement provides context for the compilation and execution of a statement. After setting the parent statement the statement will need to be reexecuted and may need to be recompiled. (Recompilation is needed if the set of features imported from __future__ changes.) """ self.__parent = parent def compile(self): """Compile the statement. @returns: True if the statement was succesfully compiled. """ if self.__parent: new_future_features = self.__parent.future_features else: new_future_features = None if new_future_features != self.__parent_future_features: self.__parent_future_features = new_future_features elif self.state != Statement.NEW: return self.state != Statement.COMPILE_ERROR self.error_message = None self.error_line = None self.error_offset = None try: rewriter = Rewriter(self.__text, future_features=self.__parent_future_features) self.imports = rewriter.get_imports() self.__compiled, self.__mutated = rewriter.rewrite_and_compile(output_func_name='reinteract_output', copy_func_name="__reinteract_copy") except SyntaxError, e: self.error_message = e.msg self.error_line = e.lineno self.error_offset = e.offset self.state = Statement.COMPILE_ERROR return False except UnsupportedSyntaxError, e: self.error_message = e.value self.state = Statement.COMPILE_ERROR return False self.future_features = self.__parent_future_features if self.imports != None: for module, symbols in self.imports: if module == '__future__' and symbols != '*' and symbols[0][0] != '.': merged = set() if self.future_features: merged.update(self.future_features) merged.update((sym for sym, _ in symbols)) self.future_features = sorted(merged) self.state = Statement.COMPILE_SUCCESS return True def do_output(self, *args): """Called by execution of statements with non-None output (see L{Rewriter})""" if len(args) == 1: arg = args[0] if args[0] is None: return elif isinstance(args[0], CustomResult) or isinstance(args[0], HelpResult): self.results.append(args[0]) else: self.results.append(repr(args[0])) self.result_scope['_'] = args[0] else: self.results.append(repr(args)) self.result_scope['_'] = args def do_print(self, *args): """Called by execution of print statements (see L{Rewriter})""" self.results.append(" ".join(map(str, args))) def __stdout_write(self, str): if self.__stdout_buffer == None: self.__stdout_buffer = str else: self.__stdout_buffer += str pos = 0 while True: next = self.__stdout_buffer.find("\n", pos) if next < 0: break self.results.append(self.__stdout_buffer[pos:next]) pos = next + 1 if pos > 0: self.__stdout_buffer = self.__stdout_buffer[pos:] def before_execute(self): """Set up for execution Although before_execute() and after_execute() are automatically called when execute() is invoked, provision is made to call them separately to allow the caller to add locking so that execute() can be interrupted safely. before_execute() and after_execute() must not themselves not be interrupted and after_execute() must be called if before_execute() is called; with those provisions the operation of execute() can be interrupted at any point and the statement will be left in a sane state. """ assert self.state != Statement.NEW and self.state != Statement.COMPILE_ERROR self.state = Statement.EXECUTING self.__worksheet.global_scope['__reinteract_statement'] = self self.__capture = StdoutCapture(self.__stdout_write) self.__capture.push() def after_execute(self): """Do cleanup tasks after execution See before_setup for details. """ if self.state == Statement.EXECUTING: self.state = Statement.INTERRUPTED self.results = None self.result_scope = None self.__worksheet.global_scope['__reinteract_statement'] = None self.__stdout_buffer = None self.__capture.pop() self.__capture = None def __get_module_filename(self, m): filename = m.__file__ if filename[-4:] in ('.pyc', '.PYC', '.pyo', '.PYO'): return filename[:-1] else: return filename def __format_traceback(self, error_type, value, tb): # The top two frames are always statement.__do_execute and the compiled # statement, so we skip them as not useful. We additionally skip frames that # are inside the notebook and pkgutil modules because these are likely our # our custom import implementation skip_filenames = [self.__get_module_filename(m) for m in (notebook, pkgutil)] extracted = filter(lambda x: x[0] not in skip_filenames, traceback.extract_tb(tb)[2:]) formatted = "".join(traceback.format_list(extracted)) last_line = "".join(traceback.format_exception_only(error_type, value)) return (formatted + last_line).rstrip() def __do_execute(self): root_scope = self.__worksheet.global_scope if self.__parent: scope = copy.copy(self.__parent.result_scope) else: scope = copy.copy(root_scope) self.results = [] self.result_scope = scope self.__stdout_buffer = None for root, description, copy_code in self.__mutated: try: # If the path to the mutated object starts with a module, ignore it; # our copy magic only applies to worksheet-loca variables if root in scope and type(scope[root]) != type(sys): exec copy_code in scope, scope except: self.results.append(WarningResult("'%s' apparently modified, but can't copy it" % description)) try: exec self.__compiled in scope, scope if self.__stdout_buffer != None and self.__stdout_buffer != '': self.results.append(self.__stdout_buffer) self.state = Statement.EXECUTE_SUCCESS except KeyboardInterrupt, e: raise e except: self.results = None self.result_scope = None error_type, value, tb = sys.exc_info() self.error_message = self.__format_traceback(error_type, value, tb) self.error_line = tb.tb_frame.f_lineno self.error_offset = None self.state = Statement.EXECUTE_ERROR return self.state == Statement.EXECUTE_SUCCESS def execute(self): """Execute the statement""" was_in_execute = self.state == Statement.EXECUTING if not was_in_execute: self.before_execute() try: return self.__do_execute() finally: if not was_in_execute: self.after_execute() def mark_for_execute(self): """Mark a statement that executed succesfully as needing execution again""" if self.state != Statement.NEW and self.state != Statement.COMPILE_ERROR: self.state = Statement.COMPILE_SUCCESS if __name__=='__main__': import stdout_capture from notebook import Notebook from worksheet import Worksheet from test_utils import assert_equals stdout_capture.init() nb = Notebook() worksheet = Worksheet(nb) def expect_result(text, result): s = Statement(text, worksheet) s.compile() s.execute() if isinstance(result, basestring): assert_equals(s.results[0], result) else: assert_equals(s.results, result) # A bare expression should give the repr of the expression expect_result("'a'", repr('a')) expect_result("1,2", repr((1,2))) # Print, on the other hand, gives the string form of the expression, with # one result object per output line expect_result("print 'a'", 'a') expect_result("print 'a', 'b'", ['a b']) expect_result("print 'a\\nb'", ['a','b']) # Test that we copy a variable before mutating it (when we can detect # the mutation) s1 = Statement("b = [0]", worksheet) s1.compile() s1.execute() s2 = Statement("b[0] = 1", worksheet, parent=s1) s2.compile() s2.execute() s3 = Statement("b[0]", worksheet, parent=s2) s3.compile() s3.execute() assert_equals(s3.results[0], "1") s2a = Statement("b[0]", worksheet, parent=s1) s2a.compile() s2a.execute() assert_equals(s2a.results[0], "0") # Tests of catching errors s1 = Statement("b = ", worksheet) assert_equals(s1.compile(), False) assert s1.error_message != None s1 = Statement("b", worksheet) assert_equals(s1.compile(), True) assert_equals(s1.execute(), False) assert s1.error_message != None # Tests of 'from __future__ import...' s1 = Statement("from __future__ import division", worksheet) s1.compile() assert_equals(s1.future_features, ['division']) s2 = Statement("from __future__ import with_statement", worksheet, parent=s1) s2.compile() assert_equals(s2.future_features, ['division', 'with_statement']) s1 = Statement("import __future__", worksheet) # just a normal import assert_equals(s1.future_features, None) reinteract-0.5.0/lib/reinteract/application_state.py0000664000076400007640000001100711162516344017574 00000000000000# Copyright 2008-2009 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gobject import os import re import time _brackets_re = re.compile(r'([\]\[])') from notebook_info import format_duration from config_file import ConfigFile def _hex_escape(s, unsafe_re): return unsafe_re.sub(lambda x: '%%%02x' % ord(x.group(1)), s) def _section_name(path): return _hex_escape(path, _brackets_re) class NotebookState: def __init__(self, app_state, path): self.path = path self.app_state = app_state self.section_name = _section_name(path) def get_open_files(self): return self.app_state.get_list(self.section_name, 'open_files', []) def get_last_opened(self): return self.app_state.get_float(self.section_name, 'last_opened', -1) def get_last_opened_text(self): return format_duration(self.get_last_opened()) def get_current_file(self): value = self.app_state.get_string(self.section_name, 'current_file') def get_size(self): width = self.app_state.get_int(self.section_name, 'width', -1) height = self.app_state.get_int(self.section_name, 'height', -1) return (width, height) def get_pane_position(self): return self.app_state.get_int(self.section_name, 'pane_position', -1) def set_open_files(self, files): self.app_state.set_list(self.section_name, 'open_files', files) def set_current_file(self, file): if file: self.app_state.set_string(self.section_name, 'current_file', file) else: self.app_state.remove_option(self.section_name, 'current_file') def set_size(self, width, height): self.app_state.set_int(self.section_name, 'width', width) self.app_state.set_int(self.section_name, 'height', height) def set_pane_position(self, position): self.app_state.set_int(self.section_name, 'pane_position', position) def update_last_opened(self): self.app_state.set_float(self.section_name, 'last_opened', time.time()) class ApplicationState(ConfigFile): def __init__(self, location): ConfigFile.__init__(self, location) self.notebook_states = {} def __get_recent_notebook_paths(self): return self.get_list('Reinteract', 'recent_notebooks', []) def notebook_opened(self, path): nb_state = self.get_notebook_state(path) nb_state.update_last_opened() old_paths = self.__get_recent_notebook_paths() try: old_paths.remove(path) except ValueError: pass old_paths.insert(0, path) self.set_list('Reinteract', 'recent_notebooks', old_paths) def get_recent_notebooks(self, max_count=10): paths = self.__get_recent_notebook_paths() if max_count >= 0: paths = paths[0:max_count] return [self.get_notebook_state(path) for path in paths] def get_notebook_state(self, path): if not path in self.notebook_states: self.notebook_states[path] = NotebookState(self, path) return self.notebook_states[path] ###################################################################### if __name__ == '__main__': #pragma: no cover import tempfile from test_utils import assert_equals def test_section_name(path, expected): section_name = _section_name(path) assert_equals(section_name, expected) test_section_name('C:\foo', 'C:\foo') test_section_name('foo[]', 'foo%5b%5d') ###### f, location = tempfile.mkstemp(".state", "reinteract") os.close(f) try: nb_path = "C:\\Foo\\Bar" application_state = ApplicationState(location) application_state.notebook_opened(nb_path) nb_state = application_state.get_notebook_state(nb_path) nb_state.set_open_files(["foo.rws", "bar.rws"]) application_state.flush() application_state = ApplicationState(location) recent_notebooks = application_state.get_recent_notebooks() assert_equals(len(recent_notebooks), 1) assert_equals(recent_notebooks[0].path, nb_path) nb_state = application_state.get_notebook_state(nb_path) assert nb_state.get_last_opened() > 0 assert_equals(nb_state.get_open_files(), ["foo.rws", "bar.rws"]) finally: try: os.remove(location) except: pass reinteract-0.5.0/COPYING0000664000076400007640000000250511162516344011647 00000000000000Copyright (c) 2007-2009 Owen Taylor, Red Hat, Inc., and others All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. reinteract-0.5.0/NEWS0000664000076400007640000000000011075764504011305 00000000000000reinteract-0.5.0/epydoc.conf0000664000076400007640000000013411063001407012727 00000000000000[epydoc] private: no link: Reinteract reinteract-0.5.0/acinclude.m40000664000076400007640000000222611070066774013012 00000000000000# Taken from pyobject. It's Copyright Johan Dahlin and others. See the # version control history in pygobject and pygtk for full details. dnl a macro to check for ability to create python extensions dnl JD_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) dnl function also defines PYTHON_INCLUDES AC_DEFUN([JD_CHECK_PYTHON_HEADERS], [AC_REQUIRE([AM_PATH_PYTHON]) AC_MSG_CHECKING(for headers required to compile python extensions) dnl deduce PYTHON_INCLUDES py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"` py_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"` if test -x "$PYTHON-config"; then PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null` else PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" if test "$py_prefix" != "$py_exec_prefix"; then PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" fi fi AC_SUBST(PYTHON_INCLUDES) dnl check if the headers exist: save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" AC_TRY_CPP([#include ],dnl [AC_MSG_RESULT(found) $1],dnl [AC_MSG_RESULT(not found) $2]) CPPFLAGS="$save_CPPFLAGS" ]) reinteract-0.5.0/INSTALL0000664000076400007640000000010310717052602011632 00000000000000See the README file. [ This file is here to make automake happy ] reinteract-0.5.0/Makefile.am0000664000076400007640000002276611161346302012655 00000000000000LIST_END = SUBDIRS = data dialogs bin_SCRIPTS = bin/reinteract dist_noinst_SCRIPTS = \ bin/uninst.py \ bin/Reinteract.pyw reinteractpkgdir = $(REINTERACT_PACKAGE_DIR) reinteractpkg_PYTHON = \ lib/reinteract/__init__.py \ lib/reinteract/about_dialog.py \ lib/reinteract/application.py \ lib/reinteract/application_state.py \ lib/reinteract/base_window.py \ lib/reinteract/base_notebook_window.py \ lib/reinteract/change_range.py \ lib/reinteract/chunks.py \ lib/reinteract/completion_popup.py \ lib/reinteract/config_file.py \ lib/reinteract/custom_result.py \ lib/reinteract/data_format.py \ lib/reinteract/doc_format.py \ lib/reinteract/doc_popup.py \ lib/reinteract/editor.py \ lib/reinteract/editor_window.py \ lib/reinteract/file_list.py \ lib/reinteract/format_escaped.py \ lib/reinteract/global_settings.py \ lib/reinteract/iter_copy_from.py \ lib/reinteract/library_editor.py \ lib/reinteract/main.py \ lib/reinteract/main_menu.py \ lib/reinteract/mini_window.py \ lib/reinteract/new_notebook.py \ lib/reinteract/notebook.py \ lib/reinteract/notebook_info.py \ lib/reinteract/notebook_window.py \ lib/reinteract/open_notebook.py \ lib/reinteract/popup.py \ lib/reinteract/preferences_dialog.py \ lib/reinteract/recorded_object.py \ lib/reinteract/retokenize.py \ lib/reinteract/rewrite.py \ lib/reinteract/sanitize_textview_ipc.py \ lib/reinteract/save_file.py \ lib/reinteract/shell_buffer.py \ lib/reinteract/shell_view.py \ lib/reinteract/statement.py \ lib/reinteract/stdout_capture.py \ lib/reinteract/test_utils.py \ lib/reinteract/thread_executor.py \ lib/reinteract/tokenized_statement.py \ lib/reinteract/undo_stack.py \ lib/reinteract/window_builder.py \ lib/reinteract/worksheet.py \ lib/reinteract/worksheet_editor.py \ $(LIST_END) replaydir = $(pythondir) replay_PYTHON = lib/replay.py replotdir = $(pythondir) replot_PYTHON = lib/replot.py examplesdir = $(pkgdatadir)/examples examples_DATA = \ examples/basics.rws \ examples/imshow.rws \ examples/index.rnb \ examples/play.rws \ examples/plot.rws \ examples/plot2.rws \ $(LIST_END) TOOLS_EXTRA = \ tools/common/__init__.py \ tools/common/am_parser.py \ tools/common/builder.py \ tools/common/utils.py # Input files for the WiX-based Windows installer WIX_FILES = \ tools/build_msi/BrowsePage.wxs \ tools/build_msi/BrowsePage2.wxs \ tools/build_msi/CancelPage.wxs \ tools/build_msi/FatalErrorPage.wxs \ tools/build_msi/FeaturesPage.wxs \ tools/build_msi/ProgressPage.wxs \ tools/build_msi/ReinteractUI.wxs \ tools/build_msi/SuccessPage.wxs \ tools/build_msi/WelcomePage.wxs \ tools/build_msi/Overrides.wxl \ tools/build_msi/reinteractBanner.bmp # Scripts and other files used for Windows installer WIX_EXTRA = \ tools/build_msi/README \ tools/build_msi/build_msi.py \ tools/build_msi/wrapper.c \ tools/compiledir.py # Scripts and other files used for OS X installer BUNDLE_EXTRA = \ tools/build_bundle/README \ tools/build_bundle/build_bundle.py \ tools/build_bundle/build_bundle.sh \ tools/build_bundle/reinteract-dmg-background.png \ tools/build_bundle/reinteract-dmg-background.svg \ tools/build_bundle/reinteract.dsstore BUILD_DEPS_OSX_EXTRA = \ tools/build_deps_osx/Python-2.5.2-framework-arch-only.patch \ tools/build_deps_osx/Python-2.5.2-framework-arch.patch \ tools/build_deps_osx/README \ tools/build_deps_osx/build.sh \ tools/build_deps_osx/gdk-quartz-eventloop-rework-20080905.patch \ tools/build_deps_osx/gdk-window-process-updates-hook.patch \ tools/build_deps_osx/gtk-dont-steal-update-region.patch \ tools/build_deps_osx/i386.cache \ tools/build_deps_osx/jhbuildrc-reinteract \ tools/build_deps_osx/pango-relocate.patch \ tools/build_deps_osx/ppc.cache \ tools/build_deps_osx/pycairo-unknown-surface-types.patch \ tools/build_deps_osx/reinteract-bootstrap.modules \ tools/build_deps_osx/reinteract.modules # Wrapper binary for OS X that sets the paths and loads the main menu noinst_PROGRAMS = if PLATFORM_OSX noinst_PROGRAMS += ReinteractWrapper build-local-app: ReinteractWrapper rm -rf Reinteract.app mkdir -p Reinteract.app/Contents/MacOS cp -p ReinteractWrapper Reinteract.app/Contents/MacOS/Reinteract mkdir -p Reinteract.app/Contents/Resources cp -p $(top_srcdir)/data/Info.plist Reinteract.app/Contents cp -pr $(top_srcdir)/data/MainMenu.nib Reinteract.app/Contents/Resources cp -p $(top_srcdir)/data/Reinteract.icns Reinteract.app/Contents/Resources touch Reinteract.app/Contents/Resources/UNINSTALLED all-local: build-local-app if INSTALL_APP install-exec-hook: build-local-app for f in `find Reinteract.app -type f` ; do \ b=`basename $$f` ; \ d=`dirname $$f` ; \ if test $$b = Reinteract ; then \ $(MKDIR_P) $(DESTDIR)$(APPDIR)/$$d ; \ $(INSTALL_PROGRAM) $$f $(DESTDIR)$(APPDIR)/$$f ;\ elif test $$b = UNINSTALLED ; then \ : ; \ else \ $(MKDIR_P) $(DESTDIR)$(APPDIR)/$$d ; \ $(INSTALL_DATA) $$f $(DESTDIR)$(APPDIR)/$$f ; \ fi \ done endif endif ReinteractWrapper_SOURCES = \ src/reinteract_wrapper_osx/main.m \ src/reinteract_wrapper_osx/MenuController.m \ src/reinteract_wrapper_osx/MenuController.h \ src/reinteract_wrapper_osx/pyNativeMainMenu.m \ src/reinteract_wrapper_osx/pyNativeMainMenu.h if USE_PYTHON_THUNKS ReinteractWrapper_SOURCES += \ src/reinteract_wrapper_osx/ThunkPython.c \ src/reinteract_wrapper_osx/ThunkPython.h endif INCLUDES = \ $(PYTHON_INCLUDES) \ $(WRAPPER_CFLAGS) \ -DEXAMPLESDIR=\"$(examplesdir)\" \ -DDIALOGSDIR=\"$(pkgdatadir)/dialogs\" \ -DICONDIR=\"$(pkgdatadir)\" ReinteractWrapper_LDFLAGS = -framework Cocoa $(PYTHON_LIBS) TESTS=tools/run_tests.sh EXTRA_DIST = \ ChangeLog \ autogen.sh \ epydoc.conf \ bin/reinteract.in \ $(examples_DATA) \ README \ $(TOOLS_EXTRA) \ $(WIX_FILES) \ $(WIX_EXTRA) \ $(BUNDLE_EXTRA) \ $(BUILD_DEPS_OSX_EXTRA) \ src/reinteract_wrapper_osx/README \ tools/run_tests.sh \ $(LIST_END) DISTCLEANFILES = \ $(LIST_END) MAINTAINERCLEANFILES = \ aclocal.m4 \ ChangeLog \ config/install-sh \ config/missing \ config/py-compile \ configure \ Makefile.in \ NEWS \ $(LIST_END) api-docs: @conf=`cd $(top_srcdir) && pwd`/epydoc.conf ; \ out=`pwd`/api-docs ; \ modules="" ; \ for pkg in $(reinteractpkg_PYTHON) ; do \ modules="$$modules `echo $$pkg | sed s@^lib/@@`" ; \ done; \ cd $(top_srcdir)/lib && PYTHONPATH="$PYTHONPATH:reinteract" epydoc -v --config=$$conf --output=$$out $$modules distcheck-hook: @echo "Checking against files in git" @failed=false; \ for f in `cd $(srcdir) && git-ls-files -x .gitignore` ; do \ if test -e $(distdir)/$$f ; then : ; else \ echo File missing from distribution: $$f ; \ failed=true ; \ fi \ done ; \ if $$failed ; then \ exit 1 ; \ fi .PHONY: api-docs build-local-app