%!PS-Adobe-2.0 %%Creator: dvips(k) 5.96.1 Copyright 2007 Radical Eye Software %%Title: paper-letter/dist.dvi %%CreationDate: Fri Dec 19 16:19:47 2008 %%Pages: 73 %%PageOrder: Ascend %%BoundingBox: 0 0 612 792 %%DocumentFonts: Helvetica Helvetica-Oblique Times-Roman Times-Bold %%+ CMSY10 Courier Helvetica-Bold Times-Italic Courier-Bold %%+ Times-BoldItalic Courier-Oblique %%DocumentPaperSizes: Letter %%EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -N0 -t letter -o paper-letter/dist.ps %+ paper-letter/dist.dvi %DVIPSParameters: dpi=600 %DVIPSSource: TeX output 2008.12.19:1619 %%BeginProcSet: tex.pro 0 0 %! /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin /FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array /BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get }B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr 1 add N}if}B/CharBuilder{save 3 1 roll S A/base get 2 index get S /BitMaps get S get/Cd X pop/ctr 0 N Cdx 0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx sub Cy .1 sub]{Ci}imagemask restore}B/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn /BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put }if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N /p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ /Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) (LaserWriter 16/600)]{A length product length le{A length product exch 0 exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end %%EndProcSet %%BeginProcSet: 8r.enc 0 0 % File 8r.enc TeX Base 1 Encoding Revision 2.0 2002-10-30 % % @@psencodingfile@{ % author = "S. Rahtz, P. MacKay, Alan Jeffrey, B. Horn, K. Berry, % W. Schmidt, P. Lehman", % version = "2.0", % date = "27nov06", % filename = "8r.enc", % email = "tex-fonts@@tug.org", % docstring = "This is the encoding vector for Type1 and TrueType % fonts to be used with TeX. This file is part of the % PSNFSS bundle, version 9" % @} % % The idea is to have all the characters normally included in Type 1 fonts % available for typesetting. This is effectively the characters in Adobe % Standard encoding, ISO Latin 1, Windows ANSI including the euro symbol, % MacRoman, and some extra characters from Lucida. % % Character code assignments were made as follows: % % (1) the Windows ANSI characters are almost all in their Windows ANSI % positions, because some Windows users cannot easily reencode the % fonts, and it makes no difference on other systems. The only Windows % ANSI characters not available are those that make no sense for % typesetting -- rubout (127 decimal), nobreakspace (160), softhyphen % (173). quotesingle and grave are moved just because it's such an % irritation not having them in TeX positions. % % (2) Remaining characters are assigned arbitrarily to the lower part % of the range, avoiding 0, 10 and 13 in case we meet dumb software. % % (3) Y&Y Lucida Bright includes some extra text characters; in the % hopes that other PostScript fonts, perhaps created for public % consumption, will include them, they are included starting at 0x12. % These are /dotlessj /ff /ffi /ffl. % % (4) hyphen appears twice for compatibility with both ASCII and Windows. % % (5) /Euro was assigned to 128, as in Windows ANSI % % (6) Missing characters from MacRoman encoding incorporated as follows: % % PostScript MacRoman TeXBase1 % -------------- -------------- -------------- % /notequal 173 0x16 % /infinity 176 0x17 % /lessequal 178 0x18 % /greaterequal 179 0x19 % /partialdiff 182 0x1A % /summation 183 0x1B % /product 184 0x1C % /pi 185 0x1D % /integral 186 0x81 % /Omega 189 0x8D % /radical 195 0x8E % /approxequal 197 0x8F % /Delta 198 0x9D % /lozenge 215 0x9E % /TeXBase1Encoding [ % 0x00 /.notdef /dotaccent /fi /fl /fraction /hungarumlaut /Lslash /lslash /ogonek /ring /.notdef /breve /minus /.notdef /Zcaron /zcaron % 0x10 /caron /dotlessi /dotlessj /ff /ffi /ffl /notequal /infinity /lessequal /greaterequal /partialdiff /summation /product /pi /grave /quotesingle % 0x20 /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash % 0x30 /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question % 0x40 /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O % 0x50 /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore % 0x60 /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o % 0x70 /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright /asciitilde /.notdef % 0x80 /Euro /integral /quotesinglbase /florin /quotedblbase /ellipsis /dagger /daggerdbl /circumflex /perthousand /Scaron /guilsinglleft /OE /Omega /radical /approxequal % 0x90 /.notdef /.notdef /.notdef /quotedblleft /quotedblright /bullet /endash /emdash /tilde /trademark /scaron /guilsinglright /oe /Delta /lozenge /Ydieresis % 0xA0 /.notdef /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron % 0xB0 /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown % 0xC0 /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis % 0xD0 /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls % 0xE0 /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis % 0xF0 /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis ] def %%EndProcSet %%BeginProcSet: texps.pro 0 0 %! TeXDict begin/rf{findfont dup length 1 add dict begin{1 index/FID ne 2 index/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]FontType 0 ne{/Metrics exch def dict begin Encoding{exch dup type/integertype ne{ pop pop 1 sub dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get div def}ifelse}forall Metrics/Metrics currentdict end def}{{1 index type /nametype eq{exit}if exch pop}loop}ifelse[2 index currentdict end definefont 3 -1 roll makefont/setfont cvx]cvx def}def/ObliqueSlant{dup sin S cos div neg}B/SlantFont{4 index mul add}def/ExtendFont{3 -1 roll mul exch}def/ReEncodeFont{CharStrings rcheck{/Encoding false def dup[ exch{dup CharStrings exch known not{pop/.notdef/Encoding true def}if} forall Encoding{]exch pop}{cleartomark}ifelse}if/Encoding exch def}def end %%EndProcSet %%BeginFont: CMSY10 %!PS-AdobeFont-1.1: CMSY10 1.0 %%CreationDate: 1991 Aug 15 07:20:57 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMSY10) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle -14.035 def /isFixedPitch false def end readonly def /FontName /CMSY10 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 13 /circlecopyrt put dup 15 /bullet put dup 102 /braceleft put dup 103 /braceright put readonly def /FontBBox{-29 -960 1116 775}readonly def currentdict end currentfile eexec D9D66F633B846A97B686A97E45A3D0AA052F09F9C8ADE9D907C058B87E9B6964 7D53359E51216774A4EAA1E2B58EC3176BD1184A633B951372B4198D4E8C5EF4 A213ACB58AA0A658908035BF2ED8531779838A960DFE2B27EA49C37156989C85 E21B3ABF72E39A89232CD9F4237FC80C9E64E8425AA3BEF7DED60B122A52922A 221A37D9A807DD01161779DDE7D31FF2B87F97C73D63EECDDA4C49501773468A 27D1663E0B62F461F6E40A5D6676D1D12B51E641C1D4E8E2771864FC104F8CBF 5B78EC1D88228725F1C453A678F58A7E1B7BD7CA700717D288EB8DA1F57C4F09 0ABF1D42C5DDD0C384C7E22F8F8047BE1D4C1CC8E33368FB1AC82B4E96146730 DE3302B2E6B819CB6AE455B1AF3187FFE8071AA57EF8A6616B9CB7941D44EC7A 71A7BB3DF755178D7D2E4BB69859EFA4BBC30BD6BB1531133FD4D9438FF99F09 4ECC068A324D75B5F696B8688EEB2F17E5ED34CCD6D047A4E3806D000C199D7C 515DB70A8D4F6146FE068DC1E5DE8BC57030ACE57A0A31C99BEDB251A0ECAD78 253AB320C099669BFED2878A6C4038A5BCEB5B4C28040BB8B4AC2C167BB2C999 ED93E2F4AE3E4B44B7B6B469C36A24080D4BEDB5523D202E920D8898DEBD5EB0 CAC3C5D5F01A87F7B15BD1C197B344F7D94E965CBFE73E8A65A2AA6A6F93B878 03E30E60F1390C2FB671C8D36E7D6E516A20079B48CA9BE632F5A8D1250F01EE 6809D6C5B51AE3D1B4C244195E4AB5E68F2AF1D7556B9D03035E08B962A33B44 426A3B5BEF3BA86E4BFE8C823D42816B59DAE9EBD42C115A1E75B0E6427720BF 773EA85158709B4DF3065233F27ABA8B9C2A08836C709D0EA9398CF5390BA7F1 C0090EDBE1341070EF06FBE8A3883CE2BA449345BD309D7A3E92012E550D1EBB 5E181951EB8A711C9F8C5458A781EF88F745DCAD2673DB8275DE88B1D3D8755C 031E739FC739613C7F971A91C8DF6B853006AB7054F4526F46808BD3005FB838 6AEDEAD0FF3186925EC6968D050B12AF2B0706C2A518813BDAFAE671EC302FBE 13663F378DEF187673479F19470EE537B9085501189B0A0A13E976B127FA5C14 BB610001611B1E0F45675C7A0CE2C692C5D869CC92D05AE80520187FD25C54F0 96BAA48612DD7A6255645213503284EAD599260E903794957EC5E64B98450E32 7C4F233A5A15B17456CFC2856B9665A4499F1A77D0448FC63D0EA28B247B4129 DD06D1EEA14FD95229A4D4B78493FE33DFA2F13A2E8236BCD6DD0ACBB4211005 3A97E68C19CD6C9BB69700D4492C3502187B6C16EC8B6E77AC066FADAA1D3AA7 69D84EC85239598287A77AFE4A2D10ACE92E98433CA550F3492EAAD0F60225D1 B5245CB029B1F7C0D16F7D74574EDD9C8B6A80C53869AEA0A027C745A6F1B975 C2336403D5BD9F4C0E1BC339488055F4CC1B08D36BC7FA25336FA6A86EEF3BF7 0C11727965C871E4024585C9D97BA0312DFFAC33F79413505A5825292FD1BCFB B856B4C1EA73B36662A85726DD1C761E5B3546EAFAC917B22293F43D219D4ECF 8471 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont TeXDict begin 40258431 52099146 1000 600 600 (paper-letter/dist.dvi) @start /Fa 133[50 4[50 50 50 50 1[50 50 50 4[50 1[50 1[50 1[50 1[50 18[50 19[50 2[50 1[50 3[50 50 8[50 39[{ TeXBase1Encoding ReEncodeFont}20 83.022 /Courier-Oblique rf /Fb 139[60 60 60 1[60 1[60 1[60 2[60 4[60 60 1[60 1[60 95[{TeXBase1Encoding ReEncodeFont}11 99.6264 /Courier rf /Fc 134[72 72 72 72 72 72 72 72 1[72 72 72 72 72 72 1[72 72 72 72 72 72 72 72 72 1[72 48[72 46[{ TeXBase1Encoding ReEncodeFont}25 119.552 /Courier rf /Fd 138[46 2[32 3[46 65 23 2[23 3[37 42 1[42 42 97[{ TeXBase1Encoding ReEncodeFont}10 83.022 /Times-BoldItalic rf /Fe 135[37 3[21 1[25 1[42 3[17 6[42 3[42 94[37 2[{ TeXBase1Encoding ReEncodeFont}8 74.7198 /Helvetica-Oblique rf /Ff 134[42 3[46 1[42 2[46 3[21 2[21 3[42 46 42 46 51[21 46[{TeXBase1Encoding ReEncodeFont}11 74.7198 /Helvetica-Bold rf /Fg 133[50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 1[50 6[50 3[50 1[50 1[50 6[50 1[50 50 50 50 50 10[50 5[50 8[50 50 40[{ TeXBase1Encoding ReEncodeFont}41 83.022 /Courier-Bold rf /Fh 214[25 25 40[{TeXBase1Encoding ReEncodeFont}2 74.7198 /Times-Roman rf /Fi 206[25 49[{TeXBase1Encoding ReEncodeFont}1 49.8132 /Times-Roman rf /Fj 206[29 49[{TeXBase1Encoding ReEncodeFont}1 58.1154 /Times-Roman rf /Fk 162[40 1[40 91[{ TeXBase1Encoding ReEncodeFont}2 119.552 /Times-Roman rf /Fl 134[50 50 2[55 28 50 33 1[55 55 55 83 22 50 1[22 55 55 1[55 55 50 55 55 12[61 3[66 78 2[55 6[66 15[55 55 55 55 55 55 1[28 43[50 2[{TeXBase1Encoding ReEncodeFont}33 99.6264 /Helvetica rf /Fm 134[33 1[48 33 33 18 26 22 1[33 33 33 1[18 2[18 33 33 22 29 33 29 33 29 8[48 3[41 5[48 4[22 4[48 21[17 22 5[22 36[37 2[{TeXBase1Encoding ReEncodeFont}29 66.4176 /Times-Roman rf /Fn 130[45 1[45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 1[45 1[45 45 45 1[45 45 45 45 45 45 45 45 1[45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 1[45 3[45 1[45 45 45 45 45 45 45 45 45 1[45 45 45 45 3[45 45 45 33[{TeXBase1Encoding ReEncodeFont}79 74.7198 /Courier rf /Fo 104[120 2[40 40 25[60 60 86 60 66 33 60 40 1[66 66 66 100 27 60 1[27 66 66 33 66 66 60 66 66 8[80 113 80 86 73 80 86 1[80 93 86 100 66 2[33 86 93 73 80 86 86 80 80 6[33 66 66 66 66 66 66 66 66 66 66 33 33 40 1[70 1[40 40 1[80 35[60 2[{TeXBase1Encoding ReEncodeFont} 66 119.552 /Helvetica rf /Fp 133[32 37 37 55 37 42 23 32 32 42 42 42 42 60 23 37 23 23 42 42 23 37 42 37 42 42 28 10[60 46 42 2[51 2[69 46 55 1[28 3[51 60 6[56 10[42 42 2[21 28 21 1[42 2[28 36[42 2[{TeXBase1Encoding ReEncodeFont}46 83.022 /Times-Italic rf /Fq 167[80 113 80 86 73 80 86 2[93 86 1[73 2[33 86 93 73 80 69[{TeXBase1Encoding ReEncodeFont}15 119.552 /Helvetica-Bold rf /Fr 133[50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 1[50 1[50 1[50 50 1[50 50 50 50 50 50 50 1[50 50 50 50 50 2[50 50 50 50 50 50 50 50 50 1[50 50 50 50 1[50 50 50 1[50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 2[50 50 50 50 33[{TeXBase1Encoding ReEncodeFont}78 83.022 /Courier rf /Fs 104[83 29[42 42 60 42 46 23 42 28 1[46 46 46 69 18 42 1[18 46 46 23 46 46 42 46 46 9[78 1[60 51 55 60 1[55 2[69 3[23 60 65 51 55 60 60 55 55 7[46 46 46 46 46 46 46 46 46 46 1[23 28 3[28 28 37[42 2[{TeXBase1Encoding ReEncodeFont}55 83.022 /Helvetica rf /Ft 104[83 28[37 42 42 60 42 46 28 32 37 46 46 42 46 69 23 46 1[23 46 42 28 37 46 37 46 42 28 8[83 60 60 1[46 60 1[51 65 60 78 55 2[32 1[65 51 55 60 60 55 60 1[42 1[47 2[28 42 42 42 42 42 42 42 42 42 42 1[21 28 21 1[42 28 28 28 5[28 30[46 2[{TeXBase1Encoding ReEncodeFont}67 83.022 /Times-Bold rf /Fu 152[42 42 86[42 1[83 13[{}4 83.022 /CMSY10 rf /Fv 104[83 2[37 37 24[37 42 42 60 42 42 23 32 28 42 42 42 42 65 23 42 23 23 42 42 28 37 42 37 42 37 28 5[51 60 60 78 60 60 51 46 55 1[46 60 60 74 51 60 32 28 60 60 46 51 60 55 55 60 1[37 3[23 23 42 42 42 42 42 42 42 42 42 42 23 21 28 21 47 42 28 28 28 65 69 3[28 29[46 46 2[{TeXBase1Encoding ReEncodeFont}82 83.022 /Times-Roman rf /Fw 103[25 29[37 37 37 54 37 42 21 37 25 42 42 42 42 62 17 37 17 17 42 42 21 42 42 37 42 42 6[46 3[50 1[46 50 54 2[58 54 62 3[21 54 1[46 50 54 54 1[50 76 42 1[44 2[21 4[42 1[42 42 42 42 21 21 25 2[29 5[42 32[37 37 2[{TeXBase1Encoding ReEncodeFont}58 74.7198 /Helvetica rf /Fx 134[50 1[72 1[55 33 1[44 2[50 55 4[28 55 1[33 44 55 2[50 13[55 2[61 9[61 70[{ TeXBase1Encoding ReEncodeFont}16 99.6264 /Times-Bold rf /Fy 139[28 1[33 4[78 28 2[28 50 2[44 1[44 50 44 27[61 72 9[28 50 50 5[50 50 50 3[25 44[{TeXBase1Encoding ReEncodeFont}19 99.6264 /Times-Roman rf /Fz 134[72 72 3[40 1[48 2[80 80 5[80 80 1[80 80 2[80 9[135 15[112 4[96 96 65[{ TeXBase1Encoding ReEncodeFont}15 143.462 /Helvetica rf /FA 140[72 6[32 6[80 3[80 14[104 28[80 1[80 80 3[40 46[{ TeXBase1Encoding ReEncodeFont}9 143.462 /Helvetica-Oblique rf /FB 134[103 103 149 1[115 57 103 69 1[115 115 115 172 46 103 1[46 115 115 57 115 115 103 115 115 8[138 195 1[149 126 138 149 1[138 161 149 172 115 2[57 2[126 138 149 149 138 138 62[103 2[{TeXBase1Encoding ReEncodeFont}41 206.559 /Helvetica rf end %%EndProlog %%BeginSetup %%Feature: *Resolution 600dpi TeXDict begin %%BeginPaperSize: Letter /setpagedevice where { pop << /PageSize [612 792] >> setpagedevice } { /letter where { pop letter } if } ifelse %%EndPaperSize end %%EndSetup %%Page: 1 1 TeXDict begin 1 0 bop 0 83 3901 9 v 1330 446 a FB(Distr)s(ib)l(uting)57 b(Python)g(Modules)3015 676 y FA(Release)38 b(2.5.3)3204 1852 y Fz(Greg)h(W)-6 b(ard)2921 2035 y(Anthon)n(y)38 b(Baxter)3044 4091 y Fy(19th)24 b(December)l(,)h(2008)2676 5201 y Fx(Python)g(Softwar)n(e)h(F)n(oundation)2807 5317 y Fy(Email:)k Fw(distutils-sig@p)n(ython.org)p eop end %%Page: 2 2 TeXDict begin 2 1 bop 0 83 a Fv(Cop)o(yright)380 80 y(c)357 83 y Fu(\015)20 b Fv(2001-2008)d(Python)i(Softw)o(are)h(F)o(oundation.) i(All)f(rights)f(reserv)o(ed.)0 230 y(Cop)o(yright)380 227 y(c)357 230 y Fu(\015)g Fv(2000)f(BeOpen.com.)24 b(All)c(rights)g(reserv)o(ed.)0 377 y(Cop)o(yright)380 374 y(c)357 377 y Fu(\015)g Fv(1995-2000)d(Corporation)h(for)h (National)h(Research)g(Initiati)n(v)o(es.)k(All)d(rights)f(reserv)o (ed.)0 524 y(Cop)o(yright)380 521 y(c)357 524 y Fu(\015)g Fv(1991-1995)d(Stichting)j(Mathematisch)f(Centrum.)24 b(All)d(rights)f(reserv)o(ed.)0 671 y(See)h(the)f(end)f(of)h(this)h (document)d(for)i(complete)f(license)h(and)g(permissions)f (information.)p eop end %%Page: 1 3 TeXDict begin 1 2 bop 1796 2633 a Ft(Abstract)0 2863 y Fv(This)28 b(document)e(describes)h(the)g(Python)g(Distrib)n(ution)g (Utilities)i(\(\223Distutils\224\))f(from)e(the)i(module)e(de)n(v)o (eloper')-5 b(s)26 b(point)h(of)g(vie)n(w)-5 b(,)0 2962 y(describing)20 b(ho)n(w)i(to)f(use)i(the)e(Distutils)i(to)f(mak)o(e)g (Python)e(modules)h(and)g(e)o(xtensions)g(easily)h(a)n(v)n(ailable)f (to)h(a)h(wider)e(audience)f(with)0 3062 y(v)o(ery)f(little)i(o)o(v)o (erhead)d(for)h(b)n(uild/release/install)h(mechanics.)p eop end %%Page: 2 4 TeXDict begin 2 3 bop eop end %%Page: 1 5 TeXDict begin 1 4 bop 2764 747 a FB(CONTENTS)0 1594 y Ft(1)83 b(An)20 b(Intr)o(oduction)g(to)g(Distutils)2750 b(1)125 1694 y Fv(1.1)110 b(Concepts)20 b(&)g(T)-6 b(erminology)80 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)g(.)143 b(1)125 1793 y(1.2)110 b(A)21 b(Simple)f(Example)43 b(.)e(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.) f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)143 b(1)125 1893 y(1.3)110 b(General)20 b(Python)f(terminology)39 b(.)j(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) h(.)f(.)g(.)g(.)143 b(3)125 1993 y(1.4)110 b(Distutils-speci\002c)21 b(terminology)58 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)143 b(3)0 2175 y Ft(2)83 b(Writing)20 b(the)g(Setup)h(Script)2859 b(5)125 2275 y Fv(2.1)110 b(Listing)20 b(whole)g(packages)78 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) g(.)h(.)f(.)g(.)g(.)143 b(6)125 2374 y(2.2)110 b(Listing)20 b(indi)n(vidual)f(modules)31 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)143 b(6)125 2474 y(2.3)110 b(Describing)19 b(e)o(xtension)g(modules)45 b(.)c(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) f(.)g(.)g(.)143 b(7)125 2574 y(2.4)110 b(Relationships)20 b(between)g(Distrib)n(utions)f(and)h(P)o(ackages)63 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(10)125 2673 y(2.5)110 b(Installing)20 b(Scripts)49 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)g(.)102 b(11)125 2773 y(2.6)110 b(Installing)20 b(P)o(ackage)f(Data)76 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(12)125 2873 y(2.7)110 b(Installing)20 b(Additional)f(Files)54 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)g(.)102 b(12)125 2972 y(2.8)110 b(Additional)19 b(meta-data)34 b(.)42 b(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(13)125 3072 y(2.9)110 b(Deb)n(ugging)18 b(the)j(setup)f(script)34 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)g(.)102 b(14)0 3254 y Ft(3)83 b(Writing)20 b(the)g(Setup)h(Con\002guration)e(File)2382 b(15)0 3437 y(4)83 b(Cr)o(eating)18 b(a)j(Sour)o(ce)e(Distrib)n(ution)2602 b(19)125 3537 y Fv(4.1)110 b(Specifying)19 b(the)h(\002les)h(to)g (distrib)n(ute)52 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(19)125 3636 y(4.2)110 b(Manifest-related)19 b(options)48 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.) h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(21)0 3819 y Ft(5)83 b(Cr)o(eating)18 b(Built)j(Distrib)n(utions)2700 b(23)125 3919 y Fv(5.1)110 b(Creating)20 b(dumb)f(b)n(uilt)h(distrib)n (utions)72 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) h(.)f(.)g(.)g(.)102 b(24)125 4018 y(5.2)110 b(Creating)20 b(RPM)h(packages)55 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(24)125 4118 y(5.3)110 b(Creating)20 b(W)m(indo)n(ws)g(Installers)42 b(.)g(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) h(.)f(.)g(.)g(.)102 b(26)0 4301 y Ft(6)83 b(Registering)19 b(with)i(the)f(P)o(ackage)f(Index)2439 b(29)125 4400 y Fv(6.1)110 b(The)20 b(.p)o(ypirc)f(\002le)43 b(.)f(.)f(.)g(.)h(.)f(.) g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) g(.)h(.)f(.)g(.)g(.)102 b(29)0 4583 y Ft(7)83 b(Uploading)19 b(P)o(ackages)h(to)g(the)g(P)o(ackage)f(Index)2216 b(31)0 4765 y(8)83 b(Examples)3346 b(33)125 4865 y Fv(8.1)110 b(Pure)20 b(Python)f(distrib)n(ution)g(\(by)h(module\))58 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(33)125 4965 y(8.2)110 b(Pure)20 b(Python)f(distrib)n(ution)g(\(by)h (package\))35 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) f(.)g(.)g(.)102 b(34)125 5064 y(8.3)110 b(Single)20 b(e)o(xtension)f (module)42 b(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(36)0 5247 y Ft(9)83 b(Extending)20 b(Distutils)3012 b(39)125 5347 y Fv(9.1)110 b(Inte)o(grating)18 b(ne)n(w)i(commands)j(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) h(.)f(.)g(.)g(.)102 b(39)p 0 5549 3901 4 v 3882 5649 a Fs(i)p eop end %%Page: 2 6 TeXDict begin 2 5 bop 125 83 a Fv(9.2)110 b(Adding)19 b(ne)n(w)h(distrib)n(ution)f(types)46 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(40)0 266 y Ft(10)41 b(Command)20 b(Refer)o(ence)2943 b(41)125 365 y Fv(10.1)68 b(Installing)20 b(modules:)k(the)c Fr(install)g Fv(command)e(f)o(amily)76 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) g(.)102 b(41)125 465 y(10.2)68 b(Creating)20 b(a)h(source)e(distrib)n (ution:)24 b(the)c Fr(sdist)g Fv(command)44 b(.)d(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) g(.)g(.)102 b(41)0 648 y Ft(11)41 b(API)20 b(Refer)o(ence)3174 b(43)125 747 y Fv(11.1)68 b Fr(distutils.core)19 b Fv(\227)h(Core)g (Distutils)i(functionality)64 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(43)125 847 y(11.2)68 b Fr(distutils.ccompiler)18 b Fv(\227)i(CCompiler)g(base)g(class)70 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.) 102 b(44)125 946 y(11.3)68 b Fr(distutils.unixccompiler)17 b Fv(\227)k(Unix)e(C)j(Compiler)73 b(.)42 b(.)f(.)g(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(49)125 1046 y(11.4)68 b Fr(distutils.msvccompiler)17 b Fv(\227)k(Microsoft)e(Compiler)38 b(.)k(.)f(.)g(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(50)125 1146 y(11.5)68 b Fr(distutils.bcppcompiler)17 b Fv(\227)k(Borland)e(Compiler)36 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(50)125 1245 y(11.6)68 b Fr(distutils.cygwincompiler)17 b Fv(\227)j(Cygwin)g(Compiler)66 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(50)125 1345 y(11.7)68 b Fr(distutils.emxccompiler)17 b Fv(\227)k(OS/2)f(EMX)g(Compiler)53 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(50)125 1445 y(11.8)68 b Fr(distutils.mwerkscompiler)17 b Fv(\227)j(Metro)n(werks)f(CodeW)-7 b(arrior)19 b(support)40 b(.)h(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(50)125 1544 y(11.9)68 b Fr(distutils.archive_util)17 b Fv(\227)k(Archi)n(ving)d(utilities)35 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.) f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g (.)102 b(50)125 1644 y(11.10)26 b Fr(distutils.dep_util)18 b Fv(\227)j(Dependenc)o(y)c(checking)40 b(.)h(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) g(.)102 b(51)125 1743 y(11.11)26 b Fr(distutils.dir_util)18 b Fv(\227)j(Directory)d(tree)j(operations)68 b(.)42 b(.)f(.)g(.)g(.)h (.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) g(.)102 b(51)125 1843 y(11.12)26 b Fr(distutils.file_util)18 b Fv(\227)i(Single)g(\002le)h(operations)81 b(.)41 b(.)h(.)f(.)g(.)g(.) h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)g(.)102 b(52)125 1943 y(11.13)26 b Fr(distutils.util)19 b Fv(\227)h(Miscellaneous)g(other)f(utility)h(functions)65 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) h(.)f(.)g(.)g(.)102 b(52)125 2042 y(11.14)26 b Fr(distutils.dist)19 b Fv(\227)h(The)g(Distrib)n(ution)g(class)57 b(.)41 b(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)g(.)h(.)f(.)g(.)g(.)102 b(54)125 2142 y(11.15)26 b Fr(distutils.extension)18 b Fv(\227)i(The)g(Extension)f(class)63 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(54)125 2242 y(11.16)26 b Fr(distutils.debug)18 b Fv(\227)j(Distutils)g(deb)n(ug)e (mode)29 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(54)125 2341 y(11.17)26 b Fr(distutils.errors)18 b Fv(\227)j (Distutils)g(e)o(xceptions)31 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) g(.)g(.)102 b(54)125 2441 y(11.18)26 b Fr(distutils.fancy_getopt)17 b Fv(\227)k(Wrapper)e(around)f(the)i(standard)g(getopt)f(module)45 b(.)c(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(55)125 2540 y(11.19)26 b Fr(distutils.filelist)18 b Fv(\227)j(The)e(FileList)j (class)61 b(.)42 b(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(56)125 2640 y(11.20)26 b Fr(distutils.log)19 b Fv(\227)h(Simple)h (PEP)f(282-style)f(logging)h(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(56)125 2740 y(11.21)26 b Fr(distutils.spawn)18 b Fv(\227)j(Spa)o(wn)f (a)g(sub-process)42 b(.)f(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(56)125 2839 y(11.22)26 b Fr(distutils.sysconfig)18 b Fv(\227)i(System)h(con\002guration)c(information)39 b(.)i(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)g(.)102 b(56)125 2939 y(11.23)26 b Fr(distutils.text_file)18 b Fv(\227)i(The)g(T)-6 b(e)o(xtFile)20 b(class)59 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(57)125 3039 y(11.24)26 b Fr(distutils.version)18 b Fv(\227)j(V)-9 b(ersion)19 b(number)g(classes)47 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.) 102 b(58)125 3138 y(11.25)26 b Fr(distutils.cmd)19 b Fv(\227)h(Abstract)h(base)f(class)h(for)f(Distutils)h(commands)27 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) g(.)g(.)102 b(58)125 3238 y(11.26)26 b Fr(distutils.command)18 b Fv(\227)j(Indi)n(vidual)d(Distutils)j(commands)51 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)g(.)102 b(59)125 3337 y(11.27)26 b Fr (distutils.command.bdist)17 b Fv(\227)k(Build)f(a)h(binary)d(installer) 75 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)g(.)102 b(59)125 3437 y(11.28)26 b Fr (distutils.command.bdist_packager)15 b Fv(\227)21 b(Abstract)f(base)g (class)h(for)f(packagers)33 b(.)42 b(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(59)125 3537 y(11.29)26 b Fr(distutils.command.bdist_dumb)16 b Fv(\227)21 b(Build)f(a)h(\223dumb\224)d(installer)24 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.) 102 b(59)125 3636 y(11.30)26 b Fr(distutils.command.bdist_msi)16 b Fv(\227)21 b(Build)f(a)h(Microsoft)e(Installer)h(binary)f(package)38 b(.)j(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(59)125 3736 y(11.31)26 b Fr(distutils.command.bdist_rpm)16 b Fv(\227)21 b(Build)f(a)h(binary)e (distrib)n(ution)g(as)i(a)f(Redhat)g(RPM)h(and)f(SRPM)25 b(.)102 b(59)125 3836 y(11.32)26 b Fr(distutils.command.bdist_wininst) 15 b Fv(\227)21 b(Build)f(a)h(W)m(indo)n(ws)f(installer)73 b(.)41 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(59)125 3935 y(11.33)26 b Fr(distutils.command.sdist)17 b Fv(\227)k(Build)f(a)h(source)e(distrib)n(ution)80 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g (.)102 b(59)125 4035 y(11.34)26 b Fr(distutils.command.build)17 b Fv(\227)k(Build)f(all)h(\002les)g(of)f(a)g(package)74 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) g(.)g(.)102 b(59)125 4134 y(11.35)26 b Fr(distutils.command.build_clib) 16 b Fv(\227)21 b(Build)f(an)o(y)f(C)j(libraries)d(in)i(a)f(package)f (.)42 b(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(59)125 4234 y(11.36)26 b Fr(distutils.command.build_ext)16 b Fv(\227)21 b(Build)f(an)o(y)g(e)o(xtensions)f(in)h(a)h(package)67 b(.)42 b(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(59)125 4334 y(11.37)26 b Fr(distutils.command.build_py)16 b Fv(\227)21 b(Build)f(the)h(.p)o(y/.p)o(yc)d(\002les)j(of)f(a)h (package)54 b(.)42 b(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(59)125 4433 y(11.38)26 b Fr(distutils.command.build_scripts)15 b Fv(\227)21 b(Build)f(the)h(scripts)f(of)g(a)h(package)76 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(59)125 4533 y(11.39)26 b Fr(distutils.command.clean)17 b Fv(\227)k(Clean)f(a)h (package)d(b)n(uild)i(area)70 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(59)125 4633 y(11.40)26 b Fr(distutils.command.config)17 b Fv(\227)j(Perform)f (package)g(con\002guration)68 b(.)42 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(59)125 4732 y(11.41)26 b Fr(distutils.command.install)16 b Fv(\227)21 b(Install)g(a)f(package) 55 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(59)125 4832 y(11.42)26 b Fr(distutils.command.install_data)16 b Fv(\227)k(Install)h(data)f (\002les)h(from)e(a)i(package)52 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)g(.)102 b(59)125 4932 y(11.43)26 b Fr (distutils.command.install_headers)15 b Fv(\227)21 b(Install)f(C/C)2470 4925 y(++)2585 4932 y(header)f(\002les)i(from)f(a)g(package)70 b(.)41 b(.)g(.)102 b(59)125 5031 y(11.44)26 b Fr (distutils.command.install_lib)16 b Fv(\227)21 b(Install)f(library)f (\002les)i(from)e(a)i(package)e(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)g(.)102 b(59)125 5131 y(11.45)26 b Fr (distutils.command.install_scripts)15 b Fv(\227)21 b(Install)f(script)g (\002les)h(from)f(a)g(package)44 b(.)d(.)g(.)g(.)h(.)f(.)g(.)g(.)102 b(59)125 5230 y(11.46)26 b Fr(distutils.command.register)16 b Fv(\227)21 b(Re)o(gister)f(a)h(module)e(with)h(the)g(Python)f(P)o (ackage)g(Inde)o(x)29 b(.)42 b(.)f(.)g(.)g(.)102 b(59)125 5330 y(11.47)26 b(Creating)20 b(a)h(ne)n(w)f(Distutils)h(command)g(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.) 102 b(60)p 0 5549 3901 4 v 0 5649 a Fs(ii)p eop end %%Page: 3 7 TeXDict begin 3 6 bop 0 83 a Ft(Module)21 b(Index)3321 b(61)0 266 y(Index)3614 b(63)p 0 5549 3901 4 v 3845 5649 a Fs(iii)p eop end %%Page: 4 8 TeXDict begin 4 7 bop 0 5549 3901 4 v 0 5649 a Fs(iv)p eop end %%Page: 1 9 TeXDict begin 1 8 bop 0 83 3901 9 v 3503 230 a Fs(CHAPTER)3641 427 y Fq(ONE)p 0 515 V 1501 978 a FB(An)57 b(Introduction)g(to)h (Distutils)0 1457 y Fv(This)33 b(document)f(co)o(v)o(ers)f(using)i(the) g(Distutils)h(to)g(distrib)n(ute)f(your)e(Python)h(modules,)k (concentrating)30 b(on)j(the)g(role)g(of)g(de)n(v)o(el-)0 1556 y(oper/distrib)n(utor:)38 b(if)28 b(you')l(re)e(looking)g(for)h (information)e(on)j(installing)f(Python)g(modules,)h(you)f(should)g (refer)g(to)h(the)g Fp(Installing)0 1656 y(Python)19 b(Modules)h Fv(manual.)0 1983 y Fo(1.1)121 b(Concepts)35 b(&)e(T)-14 b(er)s(minology)0 2216 y Fv(Using)32 b(the)f(Distutils)i (is)g(quite)e(simple,)k(both)c(for)g(module)f(de)n(v)o(elopers)g(and)h (for)g(users/administrators)f(installing)i(third-party)0 2316 y(modules.)40 b(As)27 b(a)f(de)n(v)o(eloper)m(,)e(your)h (responsibilities)g(\(apart)g(from)f(writing)h(solid,)i (well-documented)c(and)i(well-tested)h(code,)g(of)0 2415 y(course!\))e(are:)125 2629 y Fu(\017)41 b Fv(write)20 b(a)h(setup)f(script)g(\(`)p Fw(setup)m(.p)n(y)p Fv(')e(by)i(con)m(v)o (ention\))125 2795 y Fu(\017)41 b Fv(\(optional\))18 b(write)i(a)h(setup)f(con\002guration)d(\002le)125 2961 y Fu(\017)41 b Fv(create)19 b(a)i(source)f(distrib)n(ution)125 3127 y Fu(\017)41 b Fv(\(optional\))18 b(create)i(one)f(or)h(more)g(b)n (uilt)g(\(binary\))e(distrib)n(utions)0 3340 y(Each)i(of)g(these)g (tasks)h(is)g(co)o(v)o(ered)d(in)i(this)h(document.)0 3487 y(Not)f(all)h(module)e(de)n(v)o(elopers)f(ha)n(v)o(e)i(access)h (to)f(a)h(multitude)e(of)h(platforms,)e(so)j(it')-5 b(s)21 b(not)f(al)o(w)o(ays)h(feasible)f(to)g(e)o(xpect)g(them)f(to)i(create)0 3587 y(a)h(multitude)d(of)i(b)n(uilt)h(distrib)n(utions.)k(It)c(is)g (hoped)d(that)i(a)h(class)g(of)f(intermediaries,)e(called)i Fp(pac)n(ka)o(g)o(er)o(s)p Fv(,)g(will)h(arise)f(to)g(address)g(this)0 3686 y(need.)33 b(P)o(ackagers)22 b(will)i(tak)o(e)g(source)e(distrib)n (utions)g(released)h(by)g(module)f(de)n(v)o(elopers,)g(b)n(uild)g(them) h(on)g(one)g(or)g(more)f(platforms,)0 3786 y(and)27 b(release)g(the)g (resulting)g(b)n(uilt)g(distrib)n(utions.)46 b(Thus,)28 b(users)g(on)e(the)i(most)f(popular)f(platforms)g(will)i(be)f(able)g (to)h(install)g(most)0 3885 y(popular)22 b(Python)g(module)g(distrib)n (utions)h(in)g(the)h(most)f(natural)g(w)o(ay)g(for)g(their)g(platform,) g(without)g(ha)n(ving)f(to)i(run)e(a)i(single)g(setup)0 3985 y(script)c(or)g(compile)f(a)i(line)f(of)g(code.)0 4313 y Fo(1.2)121 b(A)33 b(Simple)f(Example)0 4545 y Fv(The)27 b(setup)h(script)f(is)i(usually)e(quite)g(simple,)i(although) d(since)h(it')-5 b(s)29 b(written)e(in)h(Python,)g(there)f(are)h(no)f (arbitrary)f(limits)i(to)g(what)0 4645 y(you)c(can)g(do)g(with)h(it,)h (though)d(you)h(should)g(be)g(careful)g(about)g(putting)f(arbitrarily)g (e)o(xpensi)n(v)o(e)g(operations)g(in)i(your)e(setup)i(script.)0 4745 y(Unlik)o(e,)20 b(say)-5 b(,)21 b(Autoconf-style)d(con\002gure)h (scripts,)h(the)h(setup)g(script)f(may)g(be)h(run)f(multiple)g(times)h (in)g(the)g(course)e(of)i(b)n(uilding)e(and)0 4844 y(installing)h(your) f(module)g(distrib)n(ution.)0 4991 y(If)25 b(all)g(you)f(w)o(ant)h(to)g (do)g(is)g(distrib)n(ute)g(a)g(module)f(called)g Fr(foo)p Fv(,)i(contained)d(in)i(a)h(\002le)f(`)p Fw(f)n(oo)m(.p)n(y)p Fv(',)f(then)g(your)g(setup)g(script)h(can)g(be)g(as)0 5091 y(simple)20 b(as)h(this:)p 0 5549 3901 4 v 3854 5649 a Fs(1)p eop end %%Page: 2 10 TeXDict begin 2 9 bop 236 83 a Fn(from)44 b(distutils.core)f(import)h (setup)236 174 y(setup\(name='foo',)505 266 y(version='1.0',)505 357 y(py_modules=['foo'],)505 448 y(\))0 735 y Fv(Some)20 b(observ)n(ations:)125 921 y Fu(\017)41 b Fv(most)20 b(information)e(that)i(you)f(supply)g(to)i(the)f(Distutils)h(is)g (supplied)e(as)i(k)o(e)o(yw)o(ord)e(ar)o(guments)f(to)i(the)g Fr(setup\(\))g Fv(function)125 1073 y Fu(\017)41 b Fv(those)23 b(k)o(e)o(yw)o(ord)f(ar)o(guments)g(f)o(all)j(into)e(tw)o(o)h(cate)o (gories:)32 b(package)22 b(metadata)i(\(name,)f(v)o(ersion)g(number\))f (and)h(information)208 1173 y(about)c(what')-5 b(s)20 b(in)h(the)f(package)f(\(a)h(list)h(of)f(pure)f(Python)g(modules,)g(in) i(this)f(case\))125 1325 y Fu(\017)41 b Fv(modules)19 b(are)h(speci\002ed)g(by)f(module)g(name,)h(not)f(\002lename)h(\(the)g (same)g(will)h(hold)f(true)g(for)f(packages)g(and)h(e)o(xtensions\))125 1478 y Fu(\017)41 b Fv(it')-5 b(s)21 b(recommended)d(that)i(you)g (supply)g(a)h(little)g(more)f(metadata,)g(in)h(particular)e(your)g (name,)h(email)h(address)f(and)g(a)h(URL)g(for)208 1577 y(the)f(project)f(\(see)h(section)g(2)h(for)e(an)h(e)o(xample\))0 1763 y(T)-7 b(o)20 b(create)g(a)g(source)f(distrib)n(ution)g(for)g (this)i(module,)d(you)h(w)o(ould)g(create)h(a)h(setup)e(script,)h(`)p Fw(setup)m(.p)n(y)p Fv(',)e(containing)g(the)i(abo)o(v)o(e)e(code,)0 1863 y(and)i(run:)236 2010 y Fn(python)44 b(setup.py)g(sdist)0 2296 y Fv(which)21 b(will)h(create)f(an)g(archi)n(v)o(e)f(\002le)i (\(e.g.,)f(tarball)g(on)i(U)t Fm(N)t(I)t(X)r Fv(,)f(ZIP)g(\002le)g(on)f (W)m(indo)n(ws\))f(containing)g(your)g(setup)h(script)g(`)p Fw(setup)m(.p)n(y)p Fv(',)0 2396 y(and)i(your)f(module)g(`)p Fw(f)n(oo)m(.p)n(y)p Fv('.)32 b(The)23 b(archi)n(v)o(e)e(\002le)j(will) g(be)g(named)e(`)p Fw(f)n(oo-1.0.tar)l(.gz)p Fv(')d(\(or)k(`)p Fw(.zip)p Fv('\),)f(and)h(will)h(unpack)e(into)h(a)g(directory)0 2495 y(`)p Fw(f)n(oo-1.0)p Fv('.)0 2642 y(If)g(an)g(end-user)e(wishes)i (to)g(install)h(your)d Fr(foo)i Fv(module,)f(all)h(she)h(has)f(to)g(do) f(is)i(do)n(wnload)d(`)p Fw(f)n(oo-1.0.tar)l(.gz)p Fv(')e(\(or)j(`)p Fw(.zip)p Fv('\),)g(unpack)f(it,)0 2742 y(and\227from)d(the)i(`)p Fw(f)n(oo-1.0)p Fv(')e(directory\227run)236 2980 y Fn(python)44 b(setup.py)g(install)0 3267 y Fv(which)20 b(will)h(ultimately)e(cop)o (y)g(`)p Fw(f)n(oo)m(.p)n(y)p Fv(')g(to)h(the)g(appropriate)e (directory)g(for)i(third-party)e(modules)h(in)h(their)g(Python)f (installation.)0 3414 y(This)24 b(simple)h(e)o(xample)e(demonstrates)g (some)h(fundamental)e(concepts)h(of)h(the)g(Distutils.)39 b(First,)26 b(both)d(de)n(v)o(elopers)f(and)i(installers)0 3513 y(ha)n(v)o(e)i(the)h(same)f(basic)h(user)f(interf)o(ace,)h(i.e.)45 b(the)26 b(setup)h(script.)44 b(The)26 b(dif)n(ference)e(is)k(which)e (Distutils)h Fp(commands)f Fv(the)o(y)f(use:)39 b(the)0 3613 y Fr(sdist)19 b Fv(command)f(is)j(almost)f(e)o(xclusi)n(v)o(ely)e (for)h(module)f(de)n(v)o(elopers,)g(while)i Fr(install)f Fv(is)i(more)d(often)h(for)h(installers)g(\(although)0 3712 y(most)g(de)n(v)o(elopers)e(will)j(w)o(ant)g(to)f(install)h(their) f(o)n(wn)f(code)h(occasionally\).)0 3859 y(If)26 b(you)f(w)o(ant)h(to)g (mak)o(e)g(things)g(really)f(easy)h(for)g(your)f(users,)i(you)e(can)h (create)g(one)f(or)h(more)f(b)n(uilt)h(distrib)n(utions)f(for)h(them.) 42 b(F)o(or)0 3959 y(instance,)22 b(if)g(you)f(are)h(running)e(on)h(a)i (W)m(indo)n(ws)e(machine,)g(and)g(w)o(ant)h(to)h(mak)o(e)e(things)h (easy)g(for)f(other)g(W)m(indo)n(ws)g(users,)i(you)e(can)0 4059 y(create)28 b(an)g(e)o(x)o(ecutable)f(installer)h(\(the)g(most)h (appropriate)d(type)i(of)g(b)n(uilt)g(distrib)n(ution)f(for)h(this)h (platform\))d(with)j(the)f Fr(bdist_-)0 4158 y(wininst)19 b Fv(command.)k(F)o(or)d(e)o(xample:)236 4396 y Fn(python)44 b(setup.py)g(bdist_wininst)0 4683 y Fv(will)21 b(create)f(an)g(e)o(x)o (ecutable)e(installer)m(,)i(`)p Fw(f)n(oo-1.0.win32.e)n(x)n(e)p Fv(')o(,)15 b(in)20 b(the)g(current)f(directory)-5 b(.)0 4830 y(Other)38 b(useful)g(b)n(uilt)h(distrib)n(ution)e(formats)h(are)g (RPM,)h(implemented)e(by)h(the)h Fr(bdist_rpm)e Fv(command,)k(Solaris)d Ft(pkgtool)0 4929 y Fv(\()p Fr(bdist_pkgtool)p Fv(\),)26 b(and)g(HP-UX)h Ft(swinstall)g Fv(\()p Fr(bdist_sdux)p Fv(\).)43 b(F)o(or)26 b(e)o(xample,)h(the)g(follo)n(wing)e(command)g (will)i(create)g(an)0 5029 y(RPM)21 b(\002le)g(called)f(`)p Fw(f)n(oo-1.0.noarch.r)r(pm)p Fv(':)236 5267 y Fn(python)44 b(setup.py)g(bdist_rpm)p 0 5549 3901 4 v 0 5649 a Fs(2)2450 b(Chapter)24 b(1.)52 b(An)23 b(Introduction)h(to)f(Distutils)p eop end %%Page: 3 11 TeXDict begin 3 10 bop 0 83 a Fv(\(The)22 b Fr(bdist_rpm)f Fv(command)f(uses)j(the)f Fr(rpm)g Fv(e)o(x)o(ecutable,)f(therefore)f (this)j(has)f(to)h(be)f(run)g(on)f(an)i(RPM-based)e(system)i(such)f(as) 0 183 y(Red)f(Hat)f(Linux,)f(SuSE)h(Linux,)f(or)h(Mandrak)o(e)f (Linux.\))0 330 y(Y)-9 b(ou)20 b(can)g(\002nd)g(out)f(what)i(distrib)n (ution)e(formats)g(are)h(a)n(v)n(ailable)g(at)g(an)o(y)g(time)g(by)g (running)236 568 y Fn(python)44 b(setup.py)g(bdist)g(--help-formats)0 1016 y Fo(1.3)121 b(Gener)o(al)34 b(Python)g(ter)s(minology)0 1249 y Fv(If)23 b(you')l(re)e(reading)g(this)i(document,)f(you)f (probably)g(ha)n(v)o(e)h(a)h(good)f(idea)h(of)f(what)h(modules,)f(e)o (xtensions,)g(and)g(so)i(forth)d(are.)33 b(Ne)n(v-)0 1349 y(ertheless,)23 b(just)g(to)g(be)f(sure)g(that)h(e)n(v)o(eryone)d (is)k(operating)c(from)i(a)h(common)d(starting)i(point,)g(we)h(of)n (fer)f(the)g(follo)n(wing)f(glossary)h(of)0 1449 y(common)c(Python)h (terms:)0 1662 y Ft(module)41 b Fv(the)25 b(basic)g(unit)f(of)h(code)f (reusability)g(in)h(Python:)33 b(a)25 b(block)f(of)g(code)g(imported)f (by)h(some)h(other)f(code.)37 b(Three)24 b(types)h(of)208 1761 y(modules)19 b(concern)f(us)j(here:)j(pure)c(Python)f(modules,)g (e)o(xtension)f(modules,)h(and)h(packages.)0 1927 y Ft(pur)o(e)g (Python)g(module)41 b Fv(a)24 b(module)e(written)h(in)g(Python)g(and)f (contained)g(in)h(a)h(single)f(`)p Fw(.p)n(y)p Fv(')g(\002le)h(\(and)e (possibly)h(associated)g(`)p Fw(.p)n(yc)p Fv(')208 2027 y(and/or)18 b(`)p Fw(.p)n(y)o(o)p Fv(')h(\002les\).)25 b(Sometimes)20 b(referred)f(to)h(as)h(a)g(\223pure)e(module.)-6 b(\224)0 2193 y Ft(extension)20 b(module)41 b Fv(a)19 b(module)e(written)i(in)f(the)h(lo)n(w-le)n(v)o(el)e(language)g(of)h (the)h(Python)e(implementation:)22 b(C/C)3251 2186 y(++)3365 2193 y(for)c(Python,)f(Ja)n(v)n(a)208 2293 y(for)22 b(Jython.)31 b(T)-7 b(ypically)22 b(contained)g(in)g(a)i(single)e(dynamically)f (loadable)h(pre-compiled)e(\002le,)k(e.g.)32 b(a)23 b(shared)f(object)h (\(`)p Fw(.so)p Fv('\))208 2392 y(\002le)g(for)e(Python)h(e)o (xtensions)f(on)j(U)t Fm(N)t(I)t(X)r Fv(,)g(a)f(DLL)f(\(gi)n(v)o(en)f (the)h(`)p Fw(.p)n(yd)p Fv(')g(e)o(xtension\))e(for)i(Python)f(e)o (xtensions)h(on)g(W)m(indo)n(ws,)g(or)208 2492 y(a)27 b(Ja)n(v)n(a)h(class)h(\002le)f(for)f(Jython)f(e)o(xtensions.)46 b(\(Note)27 b(that)g(currently)-5 b(,)27 b(the)h(Distutils)g(only)f (handles)f(C/C)3303 2485 y(++)3426 2492 y(e)o(xtensions)g(for)208 2592 y(Python.\))0 2758 y Ft(package)40 b Fv(a)22 b(module)d(that)j (contains)e(other)g(modules;)h(typically)f(contained)g(in)h(a)g (directory)f(in)h(the)g(\002lesystem)h(and)e(distinguished)208 2857 y(from)f(other)g(directories)g(by)h(the)g(presence)f(of)h(a)h (\002le)g(`)p 1796 2857 23 4 v 1823 2857 V 53 w Fw(init)p 1946 2857 V 1972 2857 V 53 w(.p)n(y)p Fv('.)0 3023 y Ft(r)o(oot)e(package)40 b Fv(the)22 b(root)g(of)g(the)h(hierarchy)d(of) i(packages.)30 b(\(This)22 b(isn')o(t)g(really)g(a)h(package,)e(since)i (it)g(doesn')o(t)e(ha)n(v)o(e)h(an)g(`)p 3576 3023 V 3603 3023 V 54 w Fw(init)p 3727 3023 V 3753 3023 V 52 w(.p)n(y)p Fv(')208 3123 y(\002le.)51 b(But)30 b(we)f(ha)n(v)o(e)g(to)g (call)g(it)h(something.\))49 b(The)29 b(v)n(ast)g(majority)f(of)h(the)g (standard)e(library)h(is)i(in)f(the)g(root)f(package,)i(as)208 3223 y(are)21 b(man)o(y)g(small,)h(standalone)e(third-party)f(modules)i (that)h(don')o(t)e(belong)g(to)i(a)g(lar)o(ger)e(module)g(collection.) 29 b(Unlik)o(e)21 b(re)o(gular)208 3322 y(packages,)33 b(modules)d(in)i(the)g(root)f(package)f(can)i(be)g(found)e(in)i(man)o (y)e(directories:)47 b(in)32 b(f)o(act,)j(e)n(v)o(ery)30 b(directory)g(listed)i(in)208 3422 y Fr(sys.path)19 b Fv(contrib)n(utes)g(modules)g(to)h(the)h(root)e(package.)0 3749 y Fo(1.4)121 b(Distutils-speci\002c)32 b(ter)s(minology)0 3982 y Fv(The)20 b(follo)n(wing)e(terms)j(apply)e(more)g (speci\002cally)h(to)g(the)h(domain)e(of)g(distrib)n(uting)g(Python)g (modules)h(using)f(the)h(Distutils:)0 4195 y Ft(module)h(distrib)n (ution)41 b Fv(a)16 b(collection)f(of)g(Python)f(modules)h(distrib)n (uted)f(together)h(as)h(a)g(single)f(do)n(wnloadable)e(resource)h(and)h (meant)208 4295 y(to)26 b(be)g(installed)h Fp(en)f(masse)p Fv(.)44 b(Examples)25 b(of)i(some)f(well-kno)n(wn)e(module)h(distrib)n (utions)h(are)g(Numeric)g(Python,)g(PyXML,)208 4395 y(PIL)h(\(the)f (Python)g(Imaging)f(Library\),)i(or)g(mxBase.)45 b(\(This)27 b(w)o(ould)f(be)h(called)g(a)h Fp(pac)n(ka)o(g)o(e)p Fv(,)f(e)o(xcept)f(that)h(term)g(is)h(already)208 4494 y(tak)o(en)19 b(in)i(the)f(Python)f(conte)o(xt:)24 b(a)c(single)h (module)d(distrib)n(ution)h(may)h(contain)f(zero,)h(one,)f(or)h(man)o (y)f(Python)g(packages.\))0 4660 y Ft(pur)o(e)h(module)h(distrib)n (ution)42 b Fv(a)24 b(module)e(distrib)n(ution)g(that)i(contains)f (only)f(pure)h(Python)g(modules)f(and)h(packages.)34 b(Sometimes)208 4760 y(referred)18 b(to)i(as)h(a)g(\223pure)e(distrib)n (ution.)-6 b(\224)0 4926 y Ft(non-pur)o(e)20 b(module)g(distrib)n (ution)42 b Fv(a)17 b(module)d(distrib)n(ution)h(that)h(contains)g(at)g (least)h(one)f(e)o(xtension)e(module.)23 b(Sometimes)15 b(referred)208 5026 y(to)20 b(as)h(a)f(\223non-pure)e(distrib)n(ution.) -6 b(\224)0 5192 y Ft(distrib)n(ution)21 b(r)o(oot)39 b Fv(the)26 b(top-le)n(v)o(el)d(directory)g(of)i(your)f(source)g(tree)h (\(or)g(source)f(distrib)n(ution\);)i(the)f(directory)f(where)g(`)p Fw(setup)m(.p)n(y)p Fv(')208 5291 y(e)o(xists.)h(Generally)19 b(`)p Fw(setup)m(.p)n(y)p Fv(')g(will)i(be)f(run)f(from)g(this)i (directory)-5 b(.)p 0 5549 3901 4 v 0 5649 a Fs(1.3.)52 b(Gener)o(al)24 b(Python)f(ter)r(minology)2635 b(3)p eop end %%Page: 4 12 TeXDict begin 4 11 bop 0 5549 3901 4 v 0 5649 a Fs(4)p eop end %%Page: 5 13 TeXDict begin 5 12 bop 0 83 3901 9 v 3503 230 a Fs(CHAPTER)3623 427 y Fq(TW)n(O)p 0 515 V 1724 978 a FB(Wr)s(iting)57 b(the)h(Setup)f(Scr)s(ipt)0 1468 y Fv(The)24 b(setup)g(script)h(is)g (the)g(centre)f(of)g(all)h(acti)n(vity)f(in)h(b)n(uilding,)f(distrib)n (uting,)g(and)g(installing)g(modules)g(using)g(the)g(Distutils.)39 b(The)0 1568 y(main)20 b(purpose)e(of)i(the)g(setup)g(script)g(is)h(to) f(describe)f(your)g(module)g(distrib)n(ution)g(to)h(the)g(Distutils,)h (so)f(that)g(the)g(v)n(arious)f(commands)0 1667 y(that)24 b(operate)e(on)h(your)g(modules)f(do)i(the)f(right)g(thing.)35 b(As)24 b(we)g(sa)o(w)g(in)g(section)g(1.2)f(abo)o(v)o(e,)f(the)i (setup)f(script)h(consists)g(mainly)f(of)0 1767 y(a)i(call)g(to)g Fr(setup\(\))p Fv(,)g(and)f(most)h(information)d(supplied)i(to)h(the)f (Distutils)i(by)e(the)h(module)e(de)n(v)o(eloper)g(is)i(supplied)f(as)h (k)o(e)o(yw)o(ord)0 1866 y(ar)o(guments)18 b(to)i Fr(setup\(\))p Fv(.)0 2013 y(Here')-5 b(s)22 b(a)g(slightly)f(more)g(in)m(v)n(olv)o (ed)f(e)o(xample,)g(which)h(we')o(ll)h(follo)n(w)f(for)g(the)h(ne)o(xt) f(couple)f(of)h(sections:)29 b(the)21 b(Distutils')i(o)n(wn)e(setup)0 2113 y(script.)k(\(K)n(eep)19 b(in)g(mind)g(that)h(although)e(the)h (Distutils)i(are)e(included)f(with)i(Python)f(1.6)g(and)g(later)m(,)g (the)o(y)g(also)h(ha)n(v)o(e)f(an)g(independent)0 2213 y(e)o(xistence)f(so)h(that)f(Python)f(1.5.2)h(users)g(can)h(use)f(them) g(to)h(install)g(other)f(module)f(distrib)n(utions.)23 b(The)18 b(Distutils')i(o)n(wn)d(setup)i(script,)0 2312 y(sho)n(wn)g(here,)h(is)h(used)f(to)g(install)h(the)f(package)f(into)h (Python)f(1.5.2.\))236 2459 y Fn(#!/usr/bin/env)43 b(python)236 2642 y(from)h(distutils.core)f(import)h(setup)236 2824 y(setup\(name='Distutils',)505 2916 y(version='1.0',)505 3007 y(description='Python)e(Distribution)h(Utilities',)505 3098 y(author='Greg)g(Ward',)505 3190 y (author_email='gward@python.net',)505 3281 y (url='http://www.python.org/sigs/distutil)o(s-sig/)o(',)505 3372 y(packages=['distutils',)e('distutils.command'],)460 3464 y(\))0 3750 y Fv(There)15 b(are)g(only)g(tw)o(o)h(dif)n(ferences)e (between)h(this)h(and)f(the)g(tri)n(vial)h(one-\002le)f(distrib)n (ution)f(presented)g(in)i(section)f(1.2:)23 b(more)15 b(metadata,)0 3850 y(and)20 b(the)g(speci\002cation)g(of)g(pure)f (Python)g(modules)h(by)f(package,)g(rather)h(than)f(by)h(module.)k (This)d(is)g(important)e(since)h(the)h(Distutils)0 3949 y(consist)e(of)f(a)g(couple)g(of)g(dozen)f(modules)g(split)i(into)f (\(so)g(f)o(ar\))g(tw)o(o)h(packages;)f(an)g(e)o(xplicit)g(list)h(of)f (e)n(v)o(ery)f(module)g(w)o(ould)h(be)g(tedious)0 4049 y(to)i(generate)f(and)h(dif)n(\002cult)g(to)g(maintain.)k(F)o(or)c (more)f(information)f(on)i(the)g(additional)f(meta-data,)g(see)h (section)g(2.8.)0 4196 y(Note)d(that)h(an)o(y)f(pathnames)f(\(\002les)i (or)f(directories\))f(supplied)g(in)i(the)f(setup)h(script)f(should)f (be)i(written)f(using)g(the)i(U)t Fm(N)t(I)t(X)i Fv(con)m(v)o(ention,)0 4295 y(i.e.)44 b(slash-separated.)f(The)26 b(Distutils)i(will)f(tak)o (e)g(care)f(of)h(con)m(v)o(erting)c(this)k(platform-neutral)d (representation)g(into)j(whate)n(v)o(er)e(is)0 4395 y(appropriate)16 b(on)j(your)e(current)h(platform)f(before)g(actually)i(using)f(the)h (pathname.)k(This)c(mak)o(es)f(your)g(setup)g(script)h(portable)f (across)0 4495 y(operating)27 b(systems,)32 b(which)d(of)g(course)f(is) i(one)f(of)g(the)g(major)g(goals)g(of)g(the)g(Distutils.)53 b(In)29 b(this)h(spirit,)h(all)f(pathnames)e(in)h(this)0 4594 y(document)g(are)h(slash-separated.)55 b(\(Mac)30 b(OS)i(9)e(programmers)e(should)i(k)o(eep)g(in)g(mind)g(that)h(the)g Fp(absence)e Fv(of)h(a)h(leading)f(slash)0 4694 y(indicates)20 b(a)h(relati)n(v)o(e)e(path,)g(the)i(opposite)e(of)h(the)g(Mac)g(OS)h (con)m(v)o(ention)c(with)j(colons.\))0 4841 y(This,)32 b(of)d(course,)h(only)f(applies)g(to)g(pathnames)f(gi)n(v)o(en)g(to)i (Distutils)g(functions.)51 b(If)29 b(you,)h(for)f(e)o(xample,)h(use)g (standard)e(Python)0 4940 y(functions)21 b(such)i(as)g Fr(glob.glob\(\))e Fv(or)i Fr(os.listdir\(\))e Fv(to)h(specify)g (\002les,)j(you)c(should)h(be)h(careful)e(to)i(write)g(portable)e(code) 0 5040 y(instead)f(of)g(hardcoding)d(path)j(separators:)p 0 5549 3901 4 v 3854 5649 a Fs(5)p eop end %%Page: 6 14 TeXDict begin 6 13 bop 416 174 a Fn(glob.glob\(os.path.join\('mydir',) 39 b('subdir',)k(')2343 187 y(*)2388 174 y(.html'\)\))416 266 y(os.listdir\(os.path.join\('mydir',)c('subdir'\)\))0 713 y Fo(2.1)121 b(Listing)33 b(whole)i(pac)n(kages)0 945 y Fv(The)26 b Fw(pac)o(kages)f Fv(option)h(tells)h(the)f(Distutils) i(to)e(process)g(\(b)n(uild,)h(distrib)n(ute,)h(install,)g(etc.\))44 b(all)27 b(pure)e(Python)g(modules)h(found)e(in)0 1045 y(each)c(package)f(mentioned)g(in)h(the)h Fw(pac)o(kages)e Fv(list.)27 b(In)20 b(order)f(to)i(do)f(this,)g(of)g(course,)g(there)g (has)h(to)f(be)h(a)f(correspondence)d(between)0 1145 y(package)24 b(names)h(and)g(directories)f(in)i(the)f(\002lesystem.)41 b(The)25 b(def)o(ault)g(correspondence)d(is)27 b(the)e(most)g(ob)o (vious)f(one,)i(i.e.)41 b(package)0 1244 y Fr(distutils)22 b Fv(is)h(found)f(in)h(the)f(directory)f(`)p Fw(distutils)p Fv(')g(relati)n(v)o(e)h(to)h(the)g(distrib)n(ution)f(root.)32 b(Thus,)23 b(when)f(you)g(say)h Fr(packages)48 b(=)0 1344 y(['foo'])26 b Fv(in)i(your)e(setup)h(script,)i(you)d(are)h (promising)f(that)h(the)g(Distutils)h(will)g(\002nd)f(a)h(\002le)g(`)p Fw(f)n(oo/)p 2992 1344 23 4 v 3017 1344 V 52 w(init)p 3141 1344 V 3166 1344 V 52 w(.p)n(y)p Fv(')f(\(which)f(might)h(be)0 1444 y(spelled)21 b(dif)n(ferently)f(on)h(your)f(system,)i(b)n(ut)g (you)f(get)g(the)h(idea\))f(relati)n(v)o(e)g(to)h(the)f(directory)f (where)h(your)g(setup)g(script)h(li)n(v)o(es.)29 b(If)21 b(you)0 1543 y(break)e(this)i(promise,)e(the)h(Distutils)h(will)g (issue)g(a)g(w)o(arning)e(b)n(ut)h(still)h(process)f(the)g(brok)o(en)f (package)f(an)o(yw)o(ays.)0 1690 y(If)29 b(you)g(use)h(a)g(dif)n (ferent)e(con)m(v)o(ention)e(to)k(lay)g(out)f(your)f(source)h (directory)-5 b(,)30 b(that')-5 b(s)30 b(no)f(problem:)42 b(you)29 b(just)h(ha)n(v)o(e)f(to)h(supply)f(the)0 1790 y Fw(pac)o(kage)p 287 1790 V 25 w(dir)17 b Fv(option)g(to)h(tell)h(the) f(Distutils)h(about)e(your)g(con)m(v)o(ention.)k(F)o(or)c(e)o(xample,)g (say)h(you)g(k)o(eep)f(all)i(Python)d(source)i(under)e(`)p Fw(lib)p Fv(',)0 1889 y(so)23 b(that)g(modules)f(in)h(the)g(\223root)f (package\224)g(\(i.e.,)h(not)f(in)h(an)o(y)f(package)g(at)h(all\))g (are)g(in)g(`)p Fw(lib)p Fv(',)f(modules)g(in)h(the)g Fr(foo)g Fv(package)f(are)g(in)0 1989 y(`)p Fw(lib/f)n(oo)p Fv(',)17 b(and)j(so)g(forth.)k(Then)19 b(you)h(w)o(ould)f(put)236 2227 y Fn(package_dir)43 b(=)i({'':)f('lib'})0 2514 y Fv(in)24 b(your)e(setup)i(script.)36 b(The)23 b(k)o(e)o(ys)g(to)h(this) g(dictionary)e(are)i(package)e(names,)i(and)g(an)f(empty)g(package)f (name)i(stands)f(for)h(the)f(root)0 2613 y(package.)k(The)22 b(v)n(alues)f(are)g(directory)f(names)h(relati)n(v)o(e)g(to)h(your)e (distrib)n(ution)g(root.)28 b(In)22 b(this)g(case,)g(when)f(you)f(say)i Fr(packages)48 b(=)0 2713 y(['foo'])p Fv(,)19 b(you)g(are)i(promising)d (that)i(the)h(\002le)f(`)p Fw(lib/f)n(oo/)p 1662 2713 V 1686 2713 V 51 w(init)p 1810 2713 V 1836 2713 V 52 w(.p)n(y)p Fv(')g(e)o(xists.)0 2860 y(Another)27 b(possible)g(con)m(v)o (ention)e(is)k(to)f(put)g(the)g Fr(foo)g Fv(package)f(right)g(in)h(`)p Fw(lib)p Fv(',)h(the)f Fr(foo.bar)f Fv(package)f(in)j(`)p Fw(lib/bar)p Fv(',)e(etc.)48 b(This)0 2959 y(w)o(ould)19 b(be)i(written)f(in)g(the)g(setup)g(script)g(as)236 3198 y Fn(package_dir)43 b(=)i({'foo':)f('lib'})0 3484 y Fv(A)38 b Fp(pac)n(ka)o(g)o(e)p Fr(:)98 b Fp(dir)39 b Fv(entry)e(in)h(the)f Fw(pac)o(kage)p 1395 3484 V 25 w(dir)g Fv(dictionary)f(implicitly)h (applies)g(to)g(all)h(packages)f(belo)n(w)f Fp(pac)n(ka)o(g)o(e)p Fv(,)41 b(so)d(the)0 3584 y Fr(foo.bar)28 b Fv(case)h(is)g (automatically)f(handled)f(here.)49 b(In)29 b(this)g(e)o(xample,)g(ha)n (ving)e Fr(packages)49 b(=)g(['foo',)g('foo.bar'])0 3684 y Fv(tells)27 b(the)g(Distutils)g(to)f(look)g(for)g(`)p Fw(lib/)p 1121 3684 V 1146 3684 V 52 w(init)p 1270 3684 V 1295 3684 V 52 w(.p)n(y)p Fv(')g(and)g(`)p Fw(lib/bar/)p 1876 3684 V 1900 3684 V 50 w(init)p 2023 3684 V 2049 3684 V 53 w(.p)n(y)p Fv('.)42 b(\(K)n(eep)26 b(in)h(mind)e(that)i (although)d Fw(pac)o(kage)p 3534 3684 V 25 w(dir)i Fv(applies)0 3783 y(recursi)n(v)o(ely)-5 b(,)21 b(you)g(must)i(e)o(xplicitly)e(list) j(all)f(packages)f(in)g Fw(pac)o(kages)p Fv(:)29 b(the)23 b(Distutils)h(will)f Fp(not)f Fv(recursi)n(v)o(ely)f(scan)h(your)g (source)g(tree)0 3883 y(looking)c(for)i(an)o(y)f(directory)g(with)h(an) g(`)p 1151 3883 V 1178 3883 V 54 w Fw(init)p 1302 3883 V 1328 3883 V 52 w(.p)n(y)p Fv(')g(\002le.\))0 4210 y Fo(2.2)121 b(Listing)33 b(individual)h(modules)0 4443 y Fv(F)o(or)20 b(a)i(small)f(module)e(distrib)n(ution,)h(you)g(might)g (prefer)f(to)i(list)h(all)g(modules)d(rather)h(than)h(listing)g (packages\227especially)d(the)j(case)0 4543 y(of)c(a)g(single)g(module) e(that)i(goes)g(in)g(the)g(\223root)f(package\224)f(\(i.e.,)i(no)f (package)g(at)h(all\).)24 b(This)17 b(simplest)g(case)h(w)o(as)f(sho)n (wn)f(in)i(section)e(1.2;)0 4642 y(here)k(is)h(a)f(slightly)g(more)g (in)m(v)n(olv)o(ed)e(e)o(xample:)236 4881 y Fn(py_modules)43 b(=)i(['mod1',)f('pkg.mod2'])0 5167 y Fv(This)28 b(describes)f(tw)o(o)h (modules,)g(one)f(of)h(them)f(in)h(the)f(\223root\224)g(package,)h(the) f(other)g(in)h(the)g Fr(pkg)f Fv(package.)46 b(Again,)29 b(the)e(def)o(ault)0 5267 y(package/directory)i(layout)i(implies)h (that)h(these)f(tw)o(o)h(modules)e(can)h(be)g(found)f(in)h(`)p Fw(mod1.p)n(y)p Fv(')f(and)g(`)p Fw(pkg/mod2.p)n(y)p Fv(',)i(and)e(that)0 5366 y(`)p Fw(pkg/)p 174 5366 V 200 5366 V 53 w(init)p 324 5366 V 350 5366 V 52 w(.p)n(y)p Fv(')20 b(e)o(xists)g(as)h(well.)k(And)20 b(again,)f(you)g(can)h(o)o(v) o(erride)e(the)i(package/directory)c(correspondence)h(using)i(the)h Fw(pac)o(kage)p 3854 5366 V 25 w(-)p 0 5549 3901 4 v 0 5649 a Fs(6)2540 b(Chapter)24 b(2.)51 b(Wr)q(iting)25 b(the)f(Setup)g(Scr)q(ipt)p eop end %%Page: 7 15 TeXDict begin 7 14 bop 0 83 a Fw(dir)20 b Fv(option.)0 410 y Fo(2.3)121 b(Descr)r(ibing)33 b(e)l(xtension)j(modules)0 643 y Fv(Just)29 b(as)f(writing)g(Python)f(e)o(xtension)f(modules)h(is) i(a)f(bit)g(more)g(complicated)e(than)h(writing)h(pure)f(Python)g (modules,)h(describing)0 743 y(them)21 b(to)g(the)g(Distutils)h(is)h(a) e(bit)h(more)e(complicated.)26 b(Unlik)o(e)21 b(pure)f(modules,)g(it') -5 b(s)23 b(not)d(enough)f(just)j(to)g(list)g(modules)e(or)h(packages)0 843 y(and)i(e)o(xpect)f(the)i(Distutils)g(to)g(go)f(out)g(and)g(\002nd) g(the)g(right)g(\002les;)j(you)c(ha)n(v)o(e)h(to)h(specify)f(the)g(e)o (xtension)f(name,)h(source)g(\002le\(s\),)h(and)0 942 y(an)o(y)19 b(compile/link)g(requirements)f(\(include)h(directories,)g (libraries)h(to)g(link)g(with,)g(etc.\).)0 1089 y(All)28 b(of)e(this)i(is)f(done)f(through)f(another)h(k)o(e)o(yw)o(ord)f(ar)o (gument)f(to)j Fr(setup\(\))p Fv(,)h(the)f Fw(e)n(xt)p 2588 1089 23 4 v 26 w(modules)f Fv(option.)44 b Fw(e)n(xt)p 3301 1089 V 26 w(modules)26 b Fv(is)i(just)f(a)0 1189 y(list)21 b(of)e Fr(Extension)g Fv(instances,)g(each)h(of)f(which)g (describes)g(a)i(single)e(e)o(xtension)f(module.)24 b(Suppose)18 b(your)h(distrib)n(ution)f(includes)0 1288 y(a)28 b(single)g(e)o (xtension,)g(called)f Fr(foo)h Fv(and)f(implemented)f(by)h(`)p Fw(f)n(oo)m(.c)p Fv('.)46 b(If)27 b(no)h(additional)e(instructions)h (to)h(the)f(compiler/link)o(er)f(are)0 1388 y(needed,)19 b(describing)f(this)j(e)o(xtension)e(is)i(quite)f(simple:)236 1626 y Fn(Extension\('foo',)42 b(['foo.c']\))0 1913 y Fv(The)19 b Fr(Extension)f Fv(class)j(can)e(be)g(imported)f(from)h Fr(distutils.core)e Fv(along)i(with)g Fr(setup\(\))p Fv(.)24 b(Thus,)19 b(the)h(setup)f(script)g(for)g(a)0 2012 y(module)g(distrib)n(ution)g(that)h(contains)g(only)f(this)i(one)e (e)o(xtension)g(and)h(nothing)e(else)j(might)e(be:)236 2159 y Fn(from)44 b(distutils.core)f(import)h(setup,)g(Extension)236 2250 y(setup\(name='foo',)505 2342 y(version='1.0',)505 2433 y(ext_modules=[Extension\('foo',)c(['foo.c']\)],)505 2524 y(\))0 2811 y Fv(The)31 b Fr(Extension)g Fv(class)i(\(actually)-5 b(,)33 b(the)e(underlying)e(e)o(xtension-b)n(uilding)f(machinery)i (implemented)g(by)h(the)h Fr(build_ext)0 2911 y Fv(command\))25 b(supports)h(a)i(great)f(deal)g(of)g(\003e)o(xibility)g(in)h (describing)e(Python)g(e)o(xtensions,)i(which)e(is)j(e)o(xplained)c(in) j(the)f(follo)n(wing)0 3010 y(sections.)0 3295 y Fl(2.3.1)100 b(Extension)29 b(names)g(and)g(pac)n(kages)0 3498 y Fv(The)19 b(\002rst)g(ar)o(gument)e(to)i(the)g Fr(Extension)e Fv(constructor)g (is)j(al)o(w)o(ays)f(the)g(name)g(of)f(the)h(e)o(xtension,)f(including) f(an)o(y)h(package)f(names.)0 3598 y(F)o(or)j(e)o(xample,)236 3836 y Fn(Extension\('foo',)42 b(['src/foo1.c',)h('src/foo2.c']\))0 4122 y Fv(describes)20 b(an)g(e)o(xtension)f(that)h(li)n(v)o(es)g(in)g (the)h(root)e(package,)g(while)236 4360 y Fn(Extension\('pkg.foo',)42 b(['src/foo1.c',)g('src/foo2.c']\))0 4647 y Fv(describes)17 b(the)g(same)g(e)o(xtension)e(in)j(the)f Fr(pkg)g Fv(package.)22 b(The)17 b(source)f(\002les)i(and)f(resulting)f(object)g(code)h(are)g (identical)f(in)i(both)e(cases;)0 4747 y(the)28 b(only)f(dif)n(ference) e(is)k(where)e(in)h(the)g(\002lesystem)g(\(and)f(therefore)f(where)h (in)h(Python')-5 b(s)27 b(namespace)g(hierarchy\))e(the)i(resulting)0 4846 y(e)o(xtension)19 b(li)n(v)o(es.)0 4993 y(If)h(you)g(ha)n(v)o(e)f (a)i(number)e(of)h(e)o(xtensions)f(all)i(in)g(the)f(same)g(package)f (\(or)h(all)h(under)e(the)h(same)h(base)f(package\),)f(use)h(the)h Fw(e)n(xt)p 3597 4993 V 26 w(pac)o(kage)0 5093 y Fv(k)o(e)o(yw)o(ord)d (ar)o(gument)g(to)j Fr(setup\(\))p Fv(.)j(F)o(or)c(e)o(xample,)p 0 5549 3901 4 v 0 5649 a Fs(2.3.)52 b(Descr)q(ibing)24 b(e)n(xtension)e(modules)2559 b(7)p eop end %%Page: 8 16 TeXDict begin 8 15 bop 236 83 a Fn(setup\(...)505 174 y(ext_package='pkg',)505 266 y(ext_modules=[Extension\('foo',)40 b(['foo.c']\),)1088 357 y(Extension\('subpkg.bar',)h(['bar.c']\)],)460 448 y(\))0 735 y Fv(will)21 b(compile)e(`)p Fw(f)n(oo)m(.c)p Fv(')g(to)h(the)h(e)o(xtension)d Fr(pkg.foo)p Fv(,)h(and)h(`)p Fw(bar)l(.c)p Fv(')g(to)g Fr(pkg.subpkg.bar)p Fv(.)0 1020 y Fl(2.3.2)100 b(Extension)29 b(source)g(\002les)0 1223 y Fv(The)j(second)f(ar)o(gument)f(to)j(the)f Fr(Extension)f Fv(constructor)f(is)j(a)g(list)h(of)d(source)h(\002les.)62 b(Since)32 b(the)h(Distutils)g(currently)d(only)0 1322 y(support)e(C,)i(C)440 1315 y(++)534 1322 y(,)i(and)d(Objecti)n(v)o (e-C)g(e)o(xtensions,)h(these)g(are)f(normally)f(C/C)2367 1315 y(++)2461 1322 y(/Objecti)n(v)o(e-C)h(source)g(\002les.)53 b(\(Be)30 b(sure)g(to)f(use)0 1422 y(appropriate)e(e)o(xtensions)i(to)g (distinguish)g(C)1332 1415 y(++)1456 1422 y(source)g(\002les:)45 b(`)p Fw(.cc)p Fv(')30 b(and)f(`)p Fw(.cpp)p Fv(')f(seem)i(to)g(be)f (recognized)f(by)h(both)i(U)t Fm(N)t(I)t(X)h Fv(and)0 1522 y(W)m(indo)n(ws)20 b(compilers.\))0 1668 y(Ho)n(we)n(v)o(er)m(,)j (you)h(can)g(also)g(include)g(SWIG)h(interf)o(ace)e(\(`)p Fw(.i)p Fv('\))g(\002les)i(in)g(the)f(list;)k(the)c Fr(build_ext)f Fv(command)g(kno)n(ws)g(ho)n(w)h(to)h(deal)0 1768 y(with)18 b(SWIG)h(e)o(xtensions:)k(it)18 b(will)h(run)e(SWIG)i(on)e(the)h (interf)o(ace)f(\002le)i(and)e(compile)g(the)h(resulting)f(C/C)3006 1761 y(++)3119 1768 y(\002le)i(into)f(your)e(e)o(xtension.)0 1915 y Ft(**SWIG)k(support)g(is)i(r)o(ough)d(ar)o(ound)h(the)g(edges)g (and)h(lar)o(gely)e(untested!**)0 2062 y Fv(This)h(w)o(arning)f (notwithstanding,)f(options)h(to)i(SWIG)f(can)g(be)h(currently)d (passed)i(lik)o(e)h(this:)236 2300 y Fn(setup\(...)505 2391 y(ext_modules=[Extension\('_foo',)40 b(['foo.i'],)1536 2483 y(swig_opts=['-modern',)i('-I../include']\)],)505 2574 y(py_modules=['foo'],)460 2665 y(\))0 2952 y Fv(Or)20 b(on)g(the)g(commandline)e(lik)o(e)j(this:)236 3190 y Fn(>)45 b(python)f(setup.py)f(build_ext)h(--swig-opts="-modern)d (-I../include")0 3476 y Fv(On)16 b(some)g(platforms,)f(you)g(can)h (include)f(non-source)f(\002les)j(that)f(are)g(processed)f(by)g(the)i (compiler)d(and)i(included)e(in)i(your)f(e)o(xtension.)0 3576 y(Currently)-5 b(,)15 b(this)j(just)f(means)f(W)m(indo)n(ws)g (message)g(te)o(xt)h(\(`)p Fw(.mc)p Fv('\))f(\002les)h(and)f(resource)g (de\002nition)f(\(`)p Fw(.rc)p Fv('\))h(\002les)i(for)d(V)-5 b(isual)17 b(C)3562 3569 y(++)3656 3576 y(.)25 b(These)0 3676 y(will)c(be)f(compiled)f(to)h(binary)f(resource)g(\(`)p Fw(.res)p Fv('\))g(\002les)i(and)f(link)o(ed)f(into)h(the)g(e)o(x)o (ecutable.)0 3961 y Fl(2.3.3)100 b(Preprocessor)30 b(options)0 4164 y Fv(Three)16 b(optional)g(ar)o(guments)g(to)h Fr(Extension)f Fv(will)i(help)f(if)h(you)e(need)h(to)g(specify)g(include)f (directories)g(to)i(search)f(or)g(preprocessor)0 4263 y(macros)j(to)g(de\002ne/unde\002ne:)j Fr(include_dirs)p Fv(,)18 b Fr(define_macros)p Fv(,)g(and)i Fr(undef_macros)p Fv(.)0 4410 y(F)o(or)28 b(e)o(xample,)g(if)h(your)d(e)o(xtension)h (requires)g(header)g(\002les)i(in)f(the)h(`)p Fw(include)p Fv(')c(directory)i(under)f(your)h(distrib)n(ution)g(root,)i(use)g(the)0 4510 y Fr(include_dirs)19 b Fv(option:)236 4748 y Fn(Extension\('foo',) 42 b(['foo.c'],)i(include_dirs=['include']\))0 5034 y Fv(Y)-9 b(ou)22 b(can)h(specify)g(absolute)f(directories)g(there;)i(if) f(you)g(kno)n(w)f(that)h(your)e(e)o(xtension)h(will)i(only)e(be)h(b)n (uilt)g(on)i(U)t Fm(N)t(I)t(X)h Fv(systems)d(with)0 5134 y(X11R6)d(installed)g(to)g(`)p Fw(/usr)p Fv(',)f(you)h(can)g(get)g(a)o (w)o(ay)g(with)p 0 5549 3901 4 v 0 5649 a Fs(8)2540 b(Chapter)24 b(2.)51 b(Wr)q(iting)25 b(the)f(Setup)g(Scr)q(ipt)p eop end %%Page: 9 17 TeXDict begin 9 16 bop 236 174 a Fn(Extension\('foo',)42 b(['foo.c'],)i(include_dirs=['/usr/include/X11']\))0 461 y Fv(Y)-9 b(ou)25 b(should)g(a)n(v)n(oid)g(this)h(sort)g(of)f (non-portable)d(usage)k(if)f(you)g(plan)g(to)h(distrib)n(ute)f(your)g (code:)35 b(it')-5 b(s)27 b(probably)c(better)i(to)h(write)g(C)0 560 y(code)20 b(lik)o(e)236 799 y Fn(#include)44 b()0 1085 y Fv(If)22 b(you)g(need)g(to)h(include)e(header)g(\002les)j(from)d (some)i(other)f(Python)f(e)o(xtension,)g(you)h(can)g(tak)o(e)h(adv)n (antage)e(of)h(the)g(f)o(act)h(that)g(header)0 1185 y(\002les)28 b(are)e(installed)h(in)g(a)g(consistent)g(w)o(ay)f(by)h(the)g (Distutils)g Fr(install_header)e Fv(command.)43 b(F)o(or)26 b(e)o(xample,)h(the)g(Numerical)0 1284 y(Python)e(header)h(\002les)h (are)g(installed)f(\(on)g(a)h(standard)h(U)t Fm(N)t(I)t(X)h Fv(installation\))d(to)h(`)p Fw(/usr/local/include/p)n(ytho)o(n1)o (.5/N)o(umer)q(i)o(cal)p Fv('.)38 b(\(The)0 1384 y(e)o(xact)24 b(location)g(will)i(dif)n(fer)e(according)f(to)i(your)e(platform)h(and) g(Python)g(installation.\))38 b(Since)25 b(the)g(Python)e(include)h (directory\227)0 1484 y(`)p Fw(/usr/local/include/p)n(ytho)o(n1)o(.5)p Fv(')13 b(in)20 b(this)g(case\227is)g(al)o(w)o(ays)f(included)f(in)i (the)f(search)g(path)g(when)f(b)n(uilding)g(Python)g(e)o(xtensions,)h (the)0 1583 y(best)i(approach)d(is)j(to)f(write)g(C)h(code)f(lik)o(e) 236 1822 y Fn(#include)44 b()0 2061 y Fv(If)17 b(you)f(must)h(put)g(the)g(`)p Fw(Numer)q(ical)p Fv(')e(include)h(directory)f(right)h(into)h(your)f(header)g(search)g (path,)h(though,)f(you)g(can)g(\002nd)h(that)g(directory)0 2160 y(using)j(the)g(Distutils)h Fr(distutils.sysconfig)c Fv(module:)236 2399 y Fn(from)44 b(distutils.sysconfig)e(import)i (get_python_inc)236 2490 y(incdir)g(=)h (os.path.join\(get_python_inc\(plat_spec)o(ific=1)o(\),)39 b('Numerical'\))236 2581 y(setup\(...,)505 2673 y(Extension\(...,)k (include_dirs=[incdir]\),)505 2764 y(\))0 3050 y Fv(Ev)o(en)29 b(though)f(this)j(is)g(quite)f(portable\227it)e(will)j(w)o(ork)f(on)f (an)o(y)h(Python)f(installation,)i(re)o(gardless)e(of)h (platform\227it')-5 b(s)29 b(probably)0 3150 y(easier)20 b(to)h(just)f(write)h(your)e(C)i(code)e(in)i(the)f(sensible)g(w)o(ay)-5 b(.)0 3297 y(Y)c(ou)38 b(can)h(de\002ne)f(and)g(unde\002ne)f (pre-processor)f(macros)i(with)h(the)g Fr(define_macros)e Fv(and)h Fr(undef_macros)f Fv(options.)0 3397 y Fr(define_macros)30 b Fv(tak)o(es)j(a)f(list)i(of)e Fr(\(name,)48 b(value\))32 b Fv(tuples,)j(where)c Fr(name)h Fv(is)h(the)g(name)e(of)h(the)g(macro) g(to)g(de\002ne)f(\(a)0 3496 y(string\))23 b(and)g Fr(value)g Fv(is)i(its)f(v)n(alue:)32 b(either)23 b(a)h(string)f(or)h Fr(None)p Fv(.)35 b(\(De\002ning)22 b(a)i(macro)f Fr(FOO)g Fv(to)h Fr(None)g Fv(is)g(the)g(equi)n(v)n(alent)e(of)h(a)h(bare)0 3596 y Fr(#define)49 b(FOO)21 b Fv(in)g(your)f(C)i(source:)k(with)21 b(most)g(compilers,)f(this)i(sets)g Fr(FOO)f Fv(to)g(the)h(string)e Fr(1)p Fv(.\))28 b Fr(undef_macros)19 b Fv(is)j(just)g(a)f(list)0 3695 y(of)f(macros)f(to)i(unde\002ne.)0 3842 y(F)o(or)f(e)o(xample:)236 4080 y Fn(Extension\(...,)685 4172 y(define_macros=[\('NDEBUG',)40 b('1'\),)1357 4263 y(\('HAVE_STRFTIME',)i(None\)],)685 4354 y(undef_macros=['HAVE_FOO',)e('HAVE_BAR']\))0 4641 y Fv(is)21 b(the)f(equi)n(v)n(alent)f(of)h(ha)n(ving)f(this)i(at)f(the) g(top)g(of)g(e)n(v)o(ery)f(C)i(source)f(\002le:)236 4879 y Fn(#define)44 b(NDEBUG)g(1)236 4970 y(#define)g(HAVE_STRFTIME)236 5062 y(#undef)g(HAVE_FOO)236 5153 y(#undef)g(HAVE_BAR)p 0 5549 3901 4 v 0 5649 a Fs(2.3.)52 b(Descr)q(ibing)24 b(e)n(xtension)e(modules)2559 b(9)p eop end %%Page: 10 18 TeXDict begin 10 17 bop 0 83 a Fl(2.3.4)100 b(Libr)o(ar)s(y)29 b(options)0 286 y Fv(Y)-9 b(ou)20 b(can)h(also)h(specify)e(the)h (libraries)g(to)g(link)f(against)h(when)f(b)n(uilding)g(your)g(e)o (xtension,)f(and)i(the)g(directories)f(to)h(search)f(for)h(those)0 386 y(libraries.)j(The)16 b Fr(libraries)h Fv(option)f(is)i(a)f(list)i (of)e(libraries)f(to)i(link)f(against,)g Fr(library_dirs)e Fv(is)j(a)g(list)g(of)f(directories)g(to)g(search)0 485 y(for)25 b(libraries)f(at)i(link-time,)f(and)g Fr(runtime_library_dirs) d Fv(is)k(a)g(list)g(of)f(directories)g(to)g(search)g(for)f(shared)h (\(dynamically)0 585 y(loaded\))19 b(libraries)h(at)g(run-time.)0 732 y(F)o(or)g(e)o(xample,)e(if)j(you)e(need)h(to)g(link)g(against)f (libraries)h(kno)n(wn)f(to)h(be)g(in)h(the)f(standard)f(library)g (search)h(path)g(on)f(tar)o(get)h(systems)236 970 y Fn(Extension\(...,) 685 1061 y(libraries=['gdbm',)41 b('readline']\))0 1348 y Fv(If)20 b(you)f(need)h(to)g(link)g(with)g(libraries)g(in)h(a)f (non-standard)d(location,)i(you')o(ll)h(ha)n(v)o(e)f(to)i(include)e (the)h(location)f(in)i Fr(library_dirs)p Fv(:)236 1586 y Fn(Extension\(...,)685 1677 y(library_dirs=['/usr/X11R6/lib'],)685 1769 y(libraries=['X11',)42 b('Xt']\))0 2055 y Fv(\(Again,)19 b(this)h(sort)h(of)f(non-portable)d(construct)i(should)g(be)h(a)n(v)n (oided)f(if)i(you)e(intend)g(to)i(distrib)n(ute)e(your)g(code.\))0 2202 y Ft(**Should)h(mention)g(clib)h(libraries)g(her)o(e)f(or)g (somewher)o(e)g(else!**)0 2483 y Fl(2.3.5)100 b(Other)28 b(options)0 2686 y Fv(There)19 b(are)h(still)i(some)e(other)f(options)g (which)h(can)g(be)g(used)g(to)h(handle)e(special)h(cases.)0 2832 y(The)h Fw(e)n(xtr)o(a)p 319 2832 23 4 v 26 w(objects)g Fv(option)f(is)i(a)g(list)g(of)f(object)g(\002les)h(to)g(be)f(passed)g (to)h(the)f(link)o(er)-5 b(.)29 b(These)21 b(\002les)h(must)f(not)g(ha) n(v)o(e)g(e)o(xtensions,)f(as)j(the)0 2932 y(def)o(ault)c(e)o(xtension) g(for)h(the)g(compiler)f(is)i(used.)0 3079 y Fw(e)n(xtr)o(a)p 168 3079 V 26 w(compile)p 453 3079 V 25 w(args)f Fv(and)f Fw(e)n(xtr)o(a)p 948 3079 V 26 w(link)p 1087 3079 V 26 w(args)h Fv(can)g(be)f(used)h(to)g(specify)f(additional)f(command)g (line)i(options)f(for)g(the)h(respecti)n(v)o(e)e(com-)0 3179 y(piler)i(and)g(link)o(er)f(command)f(lines.)0 3325 y Fw(e)n(xpor)s(t)p 214 3325 V 25 w(symbols)27 b Fv(is)f(only)f(useful) g(on)h(W)m(indo)n(ws.)41 b(It)26 b(can)f(contain)g(a)h(list)h(of)e (symbols)g(\(functions)f(or)i(v)n(ariables\))e(to)i(be)g(e)o(xported.)0 3425 y(This)d(option)f(is)i(not)e(needed)g(when)g(b)n(uilding)g (compiled)g(e)o(xtensions:)29 b(Distutils)24 b(will)g(automatically)d (add)i Fr(initmodule)e Fv(to)j(the)0 3525 y(list)d(of)f(e)o(xported)e (symbols.)0 3848 y Fo(2.4)121 b(Relationships)35 b(betw)o(een)g(Distr)r (ib)n(utions)f(and)g(P)-5 b(ac)n(kages)0 4081 y Fv(A)21 b(distrib)n(ution)e(may)g(relate)i(to)f(packages)f(in)h(three)g (speci\002c)g(w)o(ays:)104 4287 y(1.)41 b(It)20 b(can)g(require)f (packages)g(or)h(modules.)104 4444 y(2.)41 b(It)20 b(can)g(pro)o(vide)e (packages)h(or)h(modules.)104 4601 y(3.)41 b(It)20 b(can)g(obsolete)f (packages)h(or)f(modules.)0 4807 y(These)h(relationships)f(can)h(be)g (speci\002ed)g(using)g(k)o(e)o(yw)o(ord)e(ar)o(guments)g(to)j(the)f Fr(distutils.core.setup\(\))c Fv(function.)0 4954 y(Dependencies)22 b(on)i(other)f(Python)g(modules)g(and)g(packages)g(can)h(be)g (speci\002ed)g(by)f(supplying)g(the)h Fp(r)m(equir)m(es)g Fv(k)o(e)o(yw)o(ord)e(ar)o(gument)0 5054 y(to)e Fr(setup\(\))p Fv(.)k(The)c(v)n(alue)g(must)g(be)g(a)h(list)g(of)f(strings.)25 b(Each)19 b(string)h(speci\002es)h(a)f(package)f(that)h(is)h(required,) e(and)g(optionally)g(what)0 5154 y(v)o(ersions)g(are)h(suf)n (\002cient.)0 5300 y(T)-7 b(o)27 b(specify)g(that)g(an)o(y)f(v)o (ersion)g(of)h(a)g(module)f(or)h(package)e(is)j(required,)f(the)g (string)g(should)f(consist)h(entirely)f(of)h(the)g(module)f(or)0 5400 y(package)19 b(name.)24 b(Examples)19 b(include)g Fr('mymodule')g Fv(and)h Fr('xml.parsers.expat')p Fv(.)p 0 5549 3901 4 v 0 5649 a Fs(10)2494 b(Chapter)24 b(2.)51 b(Wr)q(iting)25 b(the)f(Setup)g(Scr)q(ipt)p eop end %%Page: 11 19 TeXDict begin 11 18 bop 0 83 a Fv(If)19 b(speci\002c)h(v)o(ersions)e (are)h(required,)f(a)i(sequence)e(of)h(quali\002ers)g(can)g(be)h (supplied)e(in)h(parentheses.)24 b(Each)19 b(quali\002er)f(may)h (consist)h(of)0 183 y(a)h(comparison)d(operator)g(and)i(a)g(v)o(ersion) f(number)-5 b(.)24 b(The)c(accepted)f(comparison)f(operators)h(are:)236 330 y Fn(<)179 b(>)h(==)236 421 y(<=)134 b(>=)h(!=)0 707 y Fv(These)21 b(can)h(be)g(combined)d(by)i(using)h(multiple)f (quali\002ers)g(separated)g(by)g(commas)g(\(and)f(optional)h (whitespace\).)28 b(In)22 b(this)g(case,)g(all)0 807 y(of)e(the)g(quali\002ers)g(must)g(be)g(matched;)f(a)i(logical)f(AND)g (is)h(used)f(to)h(combine)d(the)j(e)n(v)n(aluations.)0 954 y(Let')-5 b(s)21 b(look)e(at)i(a)f(b)n(unch)f(of)h(e)o(xamples:)285 1180 y Ft(Requir)o(es)g(Expr)o(ession)p 1279 1210 4 100 v 318 w(Explanation)p 235 1213 3431 4 v 285 1283 a Fr(==1.0)p 1279 1313 4 100 v 796 w Fv(Only)f(v)o(ersion)g Fr(1.0)h Fv(is)i(compatible)285 1383 y Fr(>1.0,)48 b(!=1.5.1,)h(<2.0)p 1279 1413 V 99 w Fv(An)o(y)19 b(v)o(ersion)g(after)h Fr(1.0)g Fv(and)g(before)e Fr(2.0)j Fv(is)g(compatible,)d(e)o(xcept)h Fr(1.5.1)0 1608 y Fv(No)n(w)26 b(that)g(we)g(can)g(specify)f (dependencies,)g(we)h(also)g(need)g(to)g(be)f(able)h(to)g(specify)f (what)h(we)h(pro)o(vide)c(that)j(other)f(distrib)n(utions)0 1707 y(can)e(require.)32 b(This)23 b(is)h(done)e(using)h(the)g Fp(pr)l(o)o(vides)g Fv(k)o(e)o(yw)o(ord)e(ar)o(gument)g(to)i Fr(setup\(\))p Fv(.)33 b(The)23 b(v)n(alue)f(for)g(this)i(k)o(e)o(yw)o (ord)d(is)j(a)g(list)g(of)0 1807 y(strings,)f(each)f(of)g(which)g (names)h(a)g(Python)e(module)g(or)i(package,)e(and)h(optionally)f (identi\002es)i(the)f(v)o(ersion.)31 b(If)22 b(the)h(v)o(ersion)e(is)j (not)0 1907 y(speci\002ed,)c(it)h(is)g(assumed)e(to)i(match)e(that)i (of)f(the)g(distrib)n(ution.)0 2054 y(Some)g(e)o(xamples:)456 2280 y Ft(Pr)o(o)o(vides)g(Expr)o(ession)p 1222 2310 V 99 w(Explanation)p 406 2313 3088 4 v 456 2383 a Fr(mypkg)p 1222 2413 4 100 v 568 w Fv(Pro)o(vide)f Fr(mypkg)p Fv(,)g(using)h(the)g (distrib)n(ution)f(v)o(ersion)456 2482 y Fr(mypkg)49 b(\(1.1\))p 1222 2512 V 269 w Fv(Pro)o(vide)19 b Fr(mypkg)h Fv(v)o(ersion)e(1.1,)i(re)o(gardless)e(of)i(the)h(distrib)n(ution)e(v)o (ersion)0 2708 y(A)25 b(package)e(can)i(declare)f(that)h(it)g (obsoletes)f(other)g(packages)g(using)g(the)h Fp(obsoletes)f Fv(k)o(e)o(yw)o(ord)f(ar)o(gument.)36 b(The)24 b(v)n(alue)g(for)g(this) i(is)0 2807 y(similar)e(to)f(that)h(of)f(the)h Fp(r)m(equir)m(es)g Fv(k)o(e)o(yw)o(ord:)30 b(a)24 b(list)h(of)e(strings)g(gi)n(ving)g (module)f(or)h(package)f(speci\002ers.)36 b(Each)23 b(speci\002er)g (consists)0 2907 y(of)h(a)i(module)d(or)h(package)g(name)g(optionally)f (follo)n(wed)g(by)h(one)g(or)h(more)f(v)o(ersion)f(quali\002ers.)38 b(V)-9 b(ersion)24 b(quali\002ers)g(are)h(gi)n(v)o(en)e(in)0 3007 y(parentheses)c(after)h(the)g(module)f(or)h(package)f(name.)0 3153 y(The)e(v)o(ersions)g(identi\002ed)f(by)h(the)h(quali\002ers)f (are)g(those)g(that)h(are)f(obsoleted)g(by)g(the)g(distrib)n(ution)f (being)h(described.)23 b(If)17 b(no)g(quali\002ers)0 3253 y(are)j(gi)n(v)o(en,)f(all)i(v)o(ersions)e(of)h(the)g(named)f (module)g(or)h(package)e(are)j(understood)c(to)k(be)f(obsoleted.)0 3580 y Fo(2.5)121 b(Installing)34 b(Scr)r(ipts)0 3813 y Fv(So)26 b(f)o(ar)g(we)g(ha)n(v)o(e)f(been)g(dealing)g(with)g(pure)g (and)g(non-pure)e(Python)i(modules,)h(which)f(are)h(usually)f(not)g (run)g(by)h(themselv)o(es)f(b)n(ut)0 3913 y(imported)19 b(by)g(scripts.)0 4060 y(Scripts)24 b(are)f(\002les)i(containing)d (Python)g(source)h(code,)h(intended)e(to)i(be)f(started)h(from)e(the)i (command)e(line.)35 b(Scripts)24 b(don')o(t)e(require)0 4159 y(Distutils)j(to)g(do)f(an)o(ything)e(v)o(ery)i(complicated.)36 b(The)24 b(only)g(cle)n(v)o(er)f(feature)h(is)h(that)f(if)h(the)g (\002rst)g(line)f(of)h(the)f(script)g(starts)i(with)e Fr(#!)0 4259 y Fv(and)g(contains)g(the)g(w)o(ord)g(\223p)o(ython\224,)f (the)h(Distutils)i(will)f(adjust)f(the)h(\002rst)g(line)f(to)h(refer)f (to)g(the)h(current)e(interpreter)f(location.)37 b(By)0 4359 y(def)o(ault,)24 b(it)h(is)g(replaced)d(with)i(the)g(current)f (interpreter)f(location.)36 b(The)23 b Ft(--executable)g Fv(\(or)g Ft(-e)p Fv(\))h(option)f(will)h(allo)n(w)g(the)g(interpreter) 0 4458 y(path)c(to)g(be)g(e)o(xplicitly)f(o)o(v)o(erridden.)0 4605 y(The)h Fw(scr)q(ipts)h Fv(option)e(simply)g(is)j(a)e(list)h(of)f (\002les)h(to)g(be)f(handled)f(in)h(this)h(w)o(ay)-5 b(.)24 b(From)c(the)g(PyXML)g(setup)g(script:)236 4843 y Fn(setup\(...)505 4935 y(scripts=['scripts/xmlproc_parse',)39 b('scripts/xmlproc_val'])505 5026 y(\))p 0 5549 3901 4 v 0 5649 a Fs(2.5.)52 b(Installing)25 b(Scr)q(ipts)3012 b(11)p eop end %%Page: 12 20 TeXDict begin 12 19 bop 0 86 a Fo(2.6)121 b(Installing)34 b(P)-5 b(ac)n(kage)34 b(Data)0 319 y Fv(Often,)f(additional)c(\002les)j (need)e(to)h(be)g(installed)g(into)g(a)g(package.)55 b(These)31 b(\002les)h(are)f(often)f(data)g(that')-5 b(s)32 b(closely)e(related)h(to)g(the)0 419 y(package')-5 b(s)22 b(implementation,)g(or)g(te)o(xt)i(\002les)g(containing)d (documentation)f(that)j(might)g(be)g(of)g(interest)g(to)g(programmers)e (using)i(the)0 518 y(package.)g(These)d(\002les)i(are)e(called)g Fp(pac)n(ka)o(g)o(e)f(data)p Fv(.)0 665 y(P)o(ackage)e(data)h(can)g(be) g(added)f(to)h(packages)f(using)h(the)g Fr(package_data)f Fv(k)o(e)o(yw)o(ord)f(ar)o(gument)g(to)i(the)g Fr(setup\(\))f Fv(function.)23 b(The)0 765 y(v)n(alue)g(must)g(be)g(a)h(mapping)d (from)h(package)g(name)h(to)g(a)h(list)g(of)f(relati)n(v)o(e)f(path)h (names)g(that)g(should)g(be)g(copied)f(into)h(the)g(package.)0 865 y(The)j(paths)g(are)g(interpreted)e(as)j(relati)n(v)o(e)e(to)h(the) g(directory)f(containing)f(the)i(package)f(\(information)e(from)i(the)h Fr(package_dir)0 964 y Fv(mapping)19 b(is)i(used)f(if)h(appropriate\);) d(that)j(is,)g(the)g(\002les)g(are)g(e)o(xpected)e(to)h(be)h(part)f(of) g(the)h(package)e(in)h(the)h(source)f(directories.)25 b(The)o(y)0 1064 y(may)20 b(contain)f(glob)g(patterns)h(as)h(well.)0 1211 y(The)f(path)g(names)f(may)h(contain)f(directory)g(portions;)g(an) o(y)g(necessary)h(directories)f(will)i(be)f(created)f(in)i(the)f (installation.)0 1358 y(F)o(or)k(e)o(xample,)g(if)g(a)h(package)e (should)g(contain)g(a)i(subdirectory)d(with)i(se)n(v)o(eral)g(data)g (\002les,)i(the)e(\002les)i(can)e(be)g(arranged)e(lik)o(e)j(this)f(in)0 1457 y(the)c(source)g(tree:)236 1695 y Fn(setup.py)236 1787 y(src/)416 1878 y(mypkg/)595 1969 y(__init__.py)595 2061 y(module.py)595 2152 y(data/)774 2243 y(tables.dat)774 2335 y(spoons.dat)774 2426 y(forks.dat)0 2712 y Fv(The)g(corresponding) d(call)j(to)h Fr(setup\(\))e Fv(might)h(be:)236 2951 y Fn(setup\(...,)505 3042 y(packages=['mypkg'],)505 3133 y(package_dir={'mypkg':)42 b('src/mypkg'},)505 3225 y (package_data={'mypkg':)f(['data/)1851 3238 y(*)1896 3225 y(.dat']},)505 3316 y(\))0 3602 y Fv(Ne)n(w)20 b(in)h(v)o(ersion)e (2.4.)0 3930 y Fo(2.7)121 b(Installing)34 b(Additional)g(Files)0 4163 y Fv(The)27 b Fw(data)p 308 4163 23 4 v 25 w(\002les)h Fv(option)e(can)h(be)g(used)g(to)h(specify)f(additional)f(\002les)i (needed)e(by)h(the)g(module)f(distrib)n(ution:)38 b(con\002guration)25 b(\002les,)0 4262 y(message)20 b(catalogs,)g(data)g(\002les,)h(an)o (ything)d(which)h(doesn')o(t)g(\002t)i(in)f(the)h(pre)n(vious)d(cate)o (gories.)0 4409 y Fw(data)p 151 4409 V 25 w(\002les)j Fv(speci\002es)g(a)f(sequence)f(of)h(\()p Fp(dir)m(ectory)p Fv(,)g Fp(\002les)p Fv(\))g(pairs)g(in)g(the)g(follo)n(wing)f(w)o(ay:) 236 4647 y Fn(setup\(...)505 4739 y(data_files=[\('bitmaps',)41 b(['bm/b1.gif',)i('bm/b2.gif']\),)1043 4830 y(\('config',)g (['cfg/data.cfg']\),)1043 4921 y(\('/etc/init.d',)g(['init-script']\)]) 460 5013 y(\))0 5299 y Fv(Note)24 b(that)g(you)g(can)g(specify)f(the)h (directory)f(names)h(where)f(the)i(data)f(\002les)h(will)g(be)f (installed,)h(b)n(ut)f(you)f(cannot)g(rename)g(the)i(data)0 5399 y(\002les)c(themselv)o(es.)p 0 5549 3901 4 v 0 5649 a Fs(12)2494 b(Chapter)24 b(2.)51 b(Wr)q(iting)25 b(the)f(Setup)g(Scr)q (ipt)p eop end %%Page: 13 21 TeXDict begin 13 20 bop 0 83 a Fv(Each)21 b(\()p Fp(dir)m(ectory)p Fv(,)f Fp(\002les)p Fv(\))h(pair)g(in)g(the)g(sequence)f(speci\002es)i (the)f(installation)g(directory)e(and)i(the)g(\002les)h(to)f(install)h (there.)27 b(If)21 b Fp(dir)m(ectory)0 183 y Fv(is)f(a)f(relati)n(v)o (e)g(path,)f(it)i(is)g(interpreted)d(relati)n(v)o(e)i(to)g(the)g (installation)g(pre\002x)f(\(Python')-5 b(s)18 b Fr(sys.prefix)f Fv(for)i(pure-Python)d(packages,)0 282 y Fr(sys.exec_prefix)26 b Fv(for)i(packages)f(that)h(contain)f(e)o(xtension)g(modules\).)48 b(Each)28 b(\002le)h(name)f(in)g Fp(\002les)h Fv(is)g(interpreted)d (relati)n(v)o(e)0 382 y(to)g(the)h(`)p Fw(setup)m(.p)n(y)p Fv(')d(script)j(at)g(the)f(top)g(of)g(the)g(package)f(source)h(distrib) n(ution.)42 b(No)26 b(directory)e(information)g(from)i Fp(\002les)g Fv(is)h(used)f(to)0 482 y(determine)19 b(the)h(\002nal)g (location)g(of)f(the)i(installed)f(\002le;)h(only)e(the)h(name)g(of)g (the)g(\002le)h(is)g(used.)0 628 y(Y)-9 b(ou)19 b(can)g(specify)f(the)h Fw(data)p 820 628 23 4 v 26 w(\002les)g Fv(options)g(as)h(a)f(simple)g (sequence)f(of)h(\002les)i(without)d(specifying)g(a)h(tar)o(get)g (directory)-5 b(,)17 b(b)n(ut)i(this)h(is)g(not)0 728 y(recommended,)d(and)i(the)h Fr(install)g Fv(command)e(will)i(print)g (a)g(w)o(arning)f(in)h(this)h(case.)k(T)-7 b(o)20 b(install)h(data)f (\002les)h(directly)e(in)h(the)g(tar)o(get)0 828 y(directory)-5 b(,)18 b(an)i(empty)f(string)h(should)f(be)h(gi)n(v)o(en)f(as)i(the)f (directory)-5 b(.)0 1155 y Fo(2.8)121 b(Additional)34 b(meta-data)0 1388 y Fv(The)20 b(setup)g(script)g(may)g(include)f (additional)g(meta-data)g(be)o(yond)f(the)i(name)g(and)f(v)o(ersion.)24 b(This)c(information)e(includes:)279 1614 y Ft(Meta-Data)p 1124 1644 4 100 v 512 w(Description)p 2817 1644 V 1282 w(V)-8 b(alue)p 3371 1644 V 354 w(Notes)p 229 1647 3442 4 v 279 1717 a Fr(name)p 1124 1747 4 100 v 697 w Fv(name)19 b(of)h(the)g(package)p 2817 1747 V 1007 w(short)g(string)p 3371 1747 V 227 w(\(1\))279 1817 y Fr(version)p 1124 1847 V 547 w Fv(v)o(ersion)f(of)h(this)g(release)p 2817 1847 V 968 w(short)g(string)p 3371 1847 V 179 w(\(1\)\(2\))279 1916 y Fr(author)p 1124 1946 V 597 w Fv(package)f(author')-5 b(s)19 b(name)p 2817 1946 V 931 w(short)h(string)p 3371 1946 V 227 w(\(3\))279 2016 y Fr(author_email)p 1124 2046 V 297 w Fv(email)g(address)g(of)g(the)g(package)f(author)p 2817 2046 V 499 w(email)h(address)p 3371 2046 V 149 w(\(3\))279 2116 y Fr(maintainer)p 1124 2146 V 397 w Fv(package)f(maintainer')-5 b(s)19 b(name)p 2817 2146 V 788 w(short)h(string)p 3371 2146 V 227 w(\(3\))279 2215 y Fr(maintainer_email)p 1124 2245 V 97 w Fv(email)g(address)g(of)g(the)g(package)f(maintainer)p 2817 2245 V 356 w(email)h(address)p 3371 2245 V 149 w(\(3\))279 2315 y Fr(url)p 1124 2345 V 747 w Fv(home)f(page)h(for)f(the)h(package) p 2817 2345 V 797 w(URL)p 3371 2345 V 438 w(\(1\))279 2415 y Fr(description)p 1124 2444 V 347 w Fv(short,)f(summary)g (description)g(of)h(the)g(package)p 2817 2444 V 280 w(short)g(string)p 3371 2444 V 279 2514 a Fr(long_description)p 1124 2544 V 97 w Fv(longer)f(description)f(of)i(the)g(package)p 2817 2544 V 585 w(long)f(string)p 3371 2544 V 279 2614 a Fr(download_url)p 1124 2644 V 297 w Fv(location)g(where)h(the)g (package)f(may)g(be)h(do)n(wnloaded)p 2817 2644 V 97 w(URL)p 3371 2644 V 438 w(\(4\))279 2713 y Fr(classifiers)p 1124 2743 V 347 w Fv(a)g(list)i(of)e(classi\002ers)p 2817 2743 V 1096 w(list)h(of)f(strings)p 3371 2743 V 170 w(\(4\))279 2813 y Fr(platforms)p 1124 2843 V 447 w Fv(a)g(list)i(of)e(platforms)p 2817 2843 V 1103 w(list)h(of)f (strings)p 3371 2843 V 0 3037 a(Notes:)0 3250 y Ft(\(1\))40 b Fv(These)20 b(\002elds)h(are)f(required.)0 3416 y Ft(\(2\))40 b Fv(It)21 b(is)g(recommended)c(that)j(v)o(ersions)g(tak)o(e)g(the)g (form)f Fp(major)-9 b(.minor)r Fk([)p Fp(.patc)o(h)p Fk([)p Fp(.sub)12 b Fk(])g(])p Fv(.)0 3582 y Ft(\(3\))40 b Fv(Either)20 b(the)g(author)f(or)h(the)g(maintainer)f(must)h(be)g (identi\002ed.)0 3748 y Ft(\(4\))40 b Fv(These)19 b(\002elds)g(should)f (not)g(be)h(used)f(if)h(your)e(package)h(is)h(to)g(be)g(compatible)e (with)i(Python)e(v)o(ersions)h(prior)g(to)g(2.2.3)g(or)g(2.3.)24 b(The)208 3848 y(list)d(is)g(a)n(v)n(ailable)f(from)f(the)h(PyPI)g (website.)0 4014 y Ft(')m(short)g(string')41 b Fv(A)20 b(single)g(line)h(of)e(te)o(xt,)h(not)g(more)g(than)f(200)h (characters.)0 4180 y Ft('long)g(string')40 b Fv(Multiple)20 b(lines)h(of)f(plain)f(te)o(xt)h(in)h(reStructuredT)-6 b(e)o(xt)17 b(format)i(\(see)i Fw(http://docutils)o(.sf)n(.net/)-6 b Fv(\).)0 4346 y Ft('list)21 b(of)e(strings')41 b Fv(See)21 b(belo)n(w)-5 b(.)0 4559 y(None)20 b(of)f(the)i(string)f(v)n(alues)f (may)h(be)g(Unicode.)0 4706 y(Encoding)28 b(the)i(v)o(ersion)e (information)g(is)j(an)f(art)g(in)g(itself.)55 b(Python)28 b(packages)h(generally)g(adhere)f(to)i(the)g(v)o(ersion)f(format)g Fp(ma-)0 4806 y(jor)-9 b(.minor)r Fk([)p Fp(.patc)o(h)12 b Fk(][)p Fp(sub)g Fk(])p Fv(.)33 b(The)24 b(major)f(number)g(is)i(0)f (for)g(initial,)h(e)o(xperimental)e(releases)h(of)g(softw)o(are.)37 b(It)25 b(is)g(incremented)d(for)0 4906 y(releases)27 b(that)f(represent)g(major)g(milestones)g(in)g(a)h(package.)43 b(The)26 b(minor)f(number)g(is)i(incremented)e(when)h(important)f(ne)n (w)h(fea-)0 5005 y(tures)h(are)g(added)e(to)i(the)g(package.)44 b(The)26 b(patch)h(number)e(increments)g(when)i(b)n(ug-\002x)e (releases)i(are)g(made.)45 b(Additional)25 b(trailing)0 5105 y(v)o(ersion)h(information)e(is)k(sometimes)f(used)g(to)g (indicate)f(sub-releases.)45 b(These)27 b(are)g(\224a1,a2,...,aN\224)d (\(for)i(alpha)g(releases,)j(where)0 5204 y(functionality)22 b(and)h(API)h(may)g(change\),)f(\224b1,b2,...,bN\224)d(\(for)j(beta)h (releases,)h(which)e(only)g(\002x)i(b)n(ugs\))e(and)g (\224pr1,pr2,...,prN\224)d(\(for)0 5304 y(\002nal)g(pre-release)f (release)h(testing\).)25 b(Some)20 b(e)o(xamples:)p 0 5549 3901 4 v 0 5649 a Fs(2.8.)52 b(Additional)26 b(meta-data)2857 b(13)p eop end %%Page: 14 22 TeXDict begin 14 21 bop 0 83 a Ft(0.1.0)40 b Fv(the)20 b(\002rst,)g(e)o(xperimental)e(release)j(of)f(a)g(package)0 249 y Ft(1.0.1a2)39 b Fv(the)20 b(second)f(alpha)h(release)g(of)g(the)g (\002rst)h(patch)f(v)o(ersion)e(of)i(1.0)0 479 y Fw(classi\002ers)h Fv(are)f(speci\002ed)g(in)g(a)h(p)o(ython)d(list:)236 717 y Fn(setup\(...)505 808 y(classifiers=[)685 900 y('Development)42 b(Status)i(::)h(4)f(-)h(Beta',)685 991 y('Environment)d(::)j(Console',) 685 1082 y('Environment)d(::)j(Web)f(Environment',)685 1174 y('Intended)f(Audience)g(::)i(End)f(Users/Desktop',)685 1265 y('Intended)f(Audience)g(::)i(Developers',)685 1356 y('Intended)e(Audience)g(::)i(System)f(Administrators',)685 1448 y('License)f(::)i(OSI)f(Approved)f(::)i(Python)f(Software)f (Foundation)g(License',)685 1539 y('Operating)g(System)h(::)g(MacOS)g (::)g(MacOS)g(X',)685 1630 y('Operating)f(System)h(::)g(Microsoft)f(::) i(Windows',)685 1722 y('Operating)e(System)h(::)g(POSIX',)685 1813 y('Programming)e(Language)i(::)g(Python',)685 1904 y('Topic)f(::)i(Communications)d(::)j(Email',)685 1996 y('Topic)e(::)i(Office/Business',)685 2087 y('Topic)e(::)i(Software)e (Development)g(::)i(Bug)f(Tracking',)685 2178 y(],)505 2270 y(\))0 2556 y Fv(If)25 b(you)f(wish)h(to)g(include)f (classi\002ers)i(in)f(your)e(`)p Fw(setup)m(.p)n(y)p Fv(')g(\002le)j(and)e(also)h(wish)h(to)f(remain)f(backw)o (ards-compatible)d(with)k(Python)0 2656 y(releases)20 b(prior)f(to)h(2.2.3,)e(then)h(you)g(can)h(include)e(the)i(follo)n (wing)e(code)h(fragment)g(in)g(your)g(`)p Fw(setup)m(.p)n(y)p Fv(')f(before)h(the)g Fr(setup\(\))g Fv(call.)236 2894 y Fn(#)45 b(patch)f(distutils)f(if)i(it)f(can't)g(cope)g(with)g(the)h ("classifiers")d(or)236 2985 y(#)j("download_url")d(keywords)236 3077 y(from)i(sys)h(import)f(version)236 3168 y(if)h(version)e(<)i ('2.2.3':)416 3259 y(from)f(distutils.dist)e(import)i (DistributionMetadata)416 3351 y(DistributionMetadata.classifiers)39 b(=)45 b(None)416 3442 y(DistributionMetadata.download_url)39 b(=)44 b(None)0 3889 y Fo(2.9)121 b(Deb)n(ugging)36 b(the)e(setup)h (scr)r(ipt)0 4122 y Fv(Sometimes)20 b(things)g(go)f(wrong,)g(and)h(the) g(setup)g(script)g(doesn')o(t)f(do)g(what)i(the)f(de)n(v)o(eloper)e(w)o (ants.)0 4269 y(Distutils)25 b(catches)g(an)o(y)e(e)o(xceptions)g(when) h(running)e(the)j(setup)f(script,)h(and)f(print)g(a)h(simple)f(error)f (message)i(before)e(the)h(script)h(is)0 4368 y(terminated.)39 b(The)25 b(moti)n(v)n(ation)f(for)g(this)i(beha)n(viour)d(is)k(to)e (not)g(confuse)f(administrators)g(who)h(don')o(t)f(kno)n(w)g(much)g (about)h(Python)0 4468 y(and)f(are)g(trying)f(to)i(install)g(a)g (package.)36 b(If)24 b(the)o(y)g(get)g(a)h(big)f(long)g(traceback)f (from)g(deep)h(inside)g(the)h(guts)f(of)g(Distutils,)i(the)o(y)e(may)0 4568 y(think)c(the)g(package)f(or)i(the)f(Python)g(installation)g(is)h (brok)o(en)e(because)h(the)o(y)g(don')o(t)f(read)h(all)h(the)f(w)o(ay)h (do)n(wn)e(to)i(the)g(bottom)e(and)h(see)0 4667 y(that)g(it')-5 b(s)22 b(a)e(permission)f(problem.)0 4814 y(On)i(the)f(other)g(hand,)g (this)h(doesn')o(t)e(help)h(the)h(de)n(v)o(eloper)d(to)j(\002nd)f(the)h (cause)f(of)h(the)f(f)o(ailure.)26 b(F)o(or)20 b(this)h(purpose,)e(the) i(DISTUTILS)p 3849 4814 25 4 v 28 w(-)0 4914 y(DEB)o(UG)30 b(en)m(vironment)c(v)n(ariable)i(can)h(be)h(set)g(to)f(an)o(ything)e(e) o(xcept)i(an)g(empty)f(string,)j(and)e(distutils)h(will)g(no)n(w)e (print)h(detailed)0 5013 y(information)18 b(what)i(it)h(is)g(doing,)e (and)g(prints)h(the)g(full)g(traceback)f(in)i(case)f(an)g(e)o(xception) f(occurs.)p 0 5549 3901 4 v 0 5649 a Fs(14)2494 b(Chapter)24 b(2.)51 b(Wr)q(iting)25 b(the)f(Setup)g(Scr)q(ipt)p eop end %%Page: 15 23 TeXDict begin 15 22 bop 0 83 3901 9 v 3503 230 a Fs(CHAPTER)3495 427 y Fq(THREE)p 0 515 V 639 978 a FB(Wr)s(iting)57 b(the)g(Setup)g (Con\002gur)n(ation)g(File)0 1468 y Fv(Often,)26 b(it')-5 b(s)27 b(not)e(possible)g(to)g(write)h(do)n(wn)e(e)n(v)o(erything)f (needed)h(to)h(b)n(uild)g(a)h(distrib)n(ution)e Fp(a)i(priori)p Fv(:)36 b(you)24 b(may)h(need)g(to)g(get)h(some)0 1568 y(information)k(from)i(the)g(user)m(,)j(or)d(from)g(the)g(user')-5 b(s)33 b(system,)j(in)c(order)g(to)g(proceed.)61 b(As)33 b(long)f(as)h(that)f(information)f(is)i(f)o(airly)0 1667 y(simple\227a)20 b(list)i(of)e(directories)f(to)i(search)f(for)g(C)h (header)e(\002les)i(or)g(libraries,)e(for)h(e)o(xample\227then)e(pro)o (viding)g(a)i(con\002guration)e(\002le,)0 1767 y(`)p Fw(setup)m(.cfg)p Fv(',)f(for)h(users)h(to)g(edit)f(is)i(a)f(cheap)f (and)g(easy)g(w)o(ay)h(to)g(solicit)g(it.)25 b(Con\002guration)16 b(\002les)k(also)f(let)g(you)f(pro)o(vide)e(def)o(ault)i(v)n(alues)0 1866 y(for)25 b(an)o(y)g(command)f(option,)h(which)h(the)f(installer)h (can)g(then)f(o)o(v)o(erride)f(either)h(on)g(the)h(command-line)d(or)i (by)h(editing)f(the)g(con\002g)0 1966 y(\002le.)0 2113 y(The)e(setup)g(con\002guration)e(\002le)j(is)g(a)f(useful)g (middle-ground)d(between)i(the)h(setup)g(script\227which,)g(ideally)-5 b(,)23 b(w)o(ould)g(be)g(opaque)e(to)0 2213 y(installers)300 2182 y Fj(1)333 2213 y Fv(\227and)f(the)g(command-line)e(to)i(the)g (setup)g(script,)h(which)e(is)j(outside)d(of)h(your)f(control)g(and)h (entirely)g(up)g(to)g(the)g(installer)-5 b(.)0 2312 y(In)27 b(f)o(act,)i(`)p Fw(setup)m(.cfg)p Fv(')d(\(and)h(an)o(y)g(other)f (Distutils)j(con\002guration)c(\002les)j(present)f(on)g(the)h(tar)o (get)e(system\))i(are)f(processed)f(after)i(the)0 2412 y(contents)19 b(of)h(the)h(setup)f(script,)g(b)n(ut)g(before)f(the)h (command-line.)i(This)e(has)h(se)n(v)o(eral)e(useful)h(consequences:) 125 2625 y Fu(\017)41 b Fv(installers)20 b(can)g(o)o(v)o(erride)e(some) i(of)g(what)g(you)f(put)h(in)h(`)p Fw(setup)m(.p)n(y)p Fv(')d(by)i(editing)f(`)p Fw(setup)m(.cfg)p Fv(')125 2791 y Fu(\017)41 b Fv(you)19 b(can)h(pro)o(vide)e(non-standard)f(def)o (aults)j(for)g(options)f(that)h(are)g(not)g(easily)g(set)h(in)g(`)p Fw(setup)m(.p)n(y)p Fv(')125 2957 y Fu(\017)41 b Fv(installers)20 b(can)g(o)o(v)o(erride)e(an)o(ything)g(in)i(`)p Fw(setup)m(.cfg)p Fv(')f(using)h(the)g(command-line)d(options)j(to)g(`)p Fw(setup)m(.p)n(y)p Fv(')0 3170 y(The)g(basic)g(syntax)g(of)g(the)g (con\002guration)d(\002le)k(is)g(simple:)236 3409 y Fn([command])236 3500 y(option=value)236 3591 y(...)0 3878 y Fv(where)e Fp(command)i Fv(is)g(one)e(of)h(the)g(Distutils)h(commands)d(\(e.g.)24 b Fr(build_py)p Fv(,)19 b Fr(install)p Fv(\),)g(and)g Fp(option)g Fv(is)h(one)g(of)g(the)f(options)g(that)0 3978 y(command)e(supports.)23 b(An)o(y)18 b(number)f(of)h(options)g (can)g(be)h(supplied)f(for)g(each)g(command,)f(and)h(an)o(y)g(number)e (of)j(command)e(sections)0 4077 y(can)22 b(be)f(included)g(in)g(the)h (\002le.)31 b(Blank)21 b(lines)h(are)g(ignored,)e(as)j(are)e(comments,) g(which)g(run)g(from)g(a)h(`)p Fr(#)p Fv(')g(character)e(until)i(the)g (end)f(of)0 4177 y(the)f(line.)25 b(Long)19 b(option)g(v)n(alues)h(can) g(be)g(split)h(across)f(multiple)g(lines)g(simply)g(by)g(indenting)e (the)i(continuation)e(lines.)0 4324 y(Y)-9 b(ou)20 b(can)g(\002nd)g (out)f(the)i(list)g(of)f(options)f(supported)f(by)i(a)h(particular)e (command)f(with)i(the)g(uni)n(v)o(ersal)f Ft(--help)h Fv(option,)f(e.g.)p 0 4395 1560 4 v 90 4450 a Fi(1)120 4474 y Fm(This)d(ideal)j(probably)g(w)o(on')o(t)e(be)h(achie)n(v)o(ed)i (until)e(auto-con\002guration)j(is)c(fully)h(supported)h(by)e(the)h (Distutils.)p 0 5549 3901 4 v 3808 5649 a Fs(15)p eop end %%Page: 16 24 TeXDict begin 16 23 bop 236 174 a Fn(>)45 b(python)f(setup.py)f(--help) h(build_ext)236 266 y([...])236 357 y(Options)g(for)g('build_ext')f (command:)326 448 y(--build-lib)g(\(-b\))223 b(directory)44 b(for)g(compiled)f(extension)h(modules)326 540 y(--build-temp)f(\(-t\)) 178 b(directory)44 b(for)g(temporary)f(files)h(\(build)g(by-products\)) 326 631 y(--inplace)f(\(-i\))313 b(ignore)44 b(build-lib)f(and)i(put)f (compiled)g(extensions)f(into)h(the)1267 722 y(source)g(directory)f (alongside)h(your)g(pure)g(Python)g(modules)326 814 y(--include-dirs)e (\(-I\))89 b(list)45 b(of)f(directories)f(to)h(search)g(for)h(header)e (files)326 905 y(--define)g(\(-D\))358 b(C)45 b(preprocessor)e(macros)h (to)g(define)326 996 y(--undef)g(\(-U\))402 b(C)45 b(preprocessor)e (macros)h(to)g(undefine)326 1088 y(--swig-opts)446 b(list)45 b(of)f(SWIG)g(command)g(line)g(options)236 1179 y([...])0 1466 y Fv(Note)20 b(that)g(an)h(option)e(spelled)g Ft(--f)n(oo-bar)f Fv(on)i(the)g(command-line)e(is)j(spelled)f Fw(f)n(oo)p 2418 1466 23 4 v 25 w(bar)g Fv(in)g(con\002guration)e(\002les.)0 1613 y(F)o(or)i(e)o(xample,)f(say)i(you)f(w)o(ant)h(your)e(e)o (xtensions)h(to)g(be)h(b)n(uilt)g(\223in-place\224\227that)e(is,)i(you) f(ha)n(v)o(e)g(an)g(e)o(xtension)g Fr(pkg.ext)p Fv(,)f(and)h(you)0 1713 y(w)o(ant)k(the)f(compiled)f(e)o(xtension)g(\002le)j(\(`)p Fw(e)n(xt.so)p Fv(')d(on)j(U)t Fm(N)t(I)t(X)r Fv(,)g(say\))f(to)f(be)h (put)f(in)h(the)f(same)h(source)f(directory)f(as)i(your)e(pure)h (Python)0 1812 y(modules)c Fr(pkg.mod1)g Fv(and)h Fr(pkg.mod2)p Fv(.)k(Y)-9 b(ou)20 b(can)g(al)o(w)o(ays)g(use)h(the)f Ft(--inplace)g Fv(option)f(on)g(the)i(command-line)c(to)j(ensure)g (this:)236 1959 y Fn(python)44 b(setup.py)g(build_ext)f(--inplace)0 2246 y Fv(But)24 b(this)h(requires)e(that)g(you)g(al)o(w)o(ays)i (specify)e(the)h Fr(build_ext)e Fv(command)g(e)o(xplicitly)-5 b(,)23 b(and)h(remember)d(to)j(pro)o(vide)e Ft(--inplace)p Fv(.)0 2346 y(An)c(easier)g(w)o(ay)f(is)i(to)f(\223set)g(and)f(for)o (get\224)f(this)i(option,)f(by)g(encoding)f(it)i(in)g(`)p Fw(setup)m(.cfg)p Fv(',)e(the)i(con\002guration)d(\002le)j(for)f(this)i (distrib)n(ution:)236 2584 y Fn([build_ext])236 2675 y(inplace=1)0 2962 y Fv(This)30 b(will)h(af)n(fect)e(all)h(b)n(uilds)g (of)g(this)g(module)e(distrib)n(ution,)j(whether)e(or)h(not)f(you)g(e)o (xplicitly)g(specify)g Fr(build_ext)p Fv(.)53 b(If)29 b(you)0 3061 y(include)c(`)p Fw(setup)m(.cfg)p Fv(')f(in)j(your)d (source)i(distrib)n(ution,)f(it)i(will)g(also)f(af)n(fect)g(end-user)e (b)n(uilds\227which)h(is)i(probably)c(a)k(bad)e(idea)h(for)0 3161 y(this)e(option,)g(since)g(al)o(w)o(ays)g(b)n(uilding)e(e)o (xtensions)h(in-place)g(w)o(ould)g(break)g(installation)g(of)h(the)g (module)e(distrib)n(ution.)35 b(In)23 b(certain)0 3261 y(peculiar)j(cases,)k(though,)d(modules)g(are)g(b)n(uilt)g(right)g(in)h (their)f(installation)g(directory)-5 b(,)27 b(so)h(this)f(is)i(concei)n (v)n(ably)c(a)j(useful)e(ability)-5 b(.)0 3360 y(\(Distrib)n(uting)19 b(e)o(xtensions)g(that)h(e)o(xpect)g(to)g(be)g(b)n(uilt)g(in)h(their)f (installation)f(directory)g(is)i(almost)f(al)o(w)o(ays)h(a)f(bad)g (idea,)g(though.\))0 3507 y(Another)15 b(e)o(xample:)22 b(certain)16 b(commands)e(tak)o(e)j(a)g(lot)f(of)g(options)g(that)g (don')o(t)f(change)g(from)g(run)h(to)g(run;)h(for)f(e)o(xample,)g Fr(bdist_rpm)0 3607 y Fv(needs)h(to)h(kno)n(w)f(e)n(v)o(erything)e (required)h(to)i(generate)e(a)i(\223spec\224)g(\002le)g(for)f(creating) g(an)g(RPM)i(distrib)n(ution.)k(Some)17 b(of)h(this)g(information)0 3706 y(comes)24 b(from)e(the)i(setup)g(script,)g(and)g(some)f(is)i (automatically)d(generated)g(by)i(the)g(Distutils)g(\(such)g(as)g(the)g (list)h(of)e(\002les)i(installed\).)0 3806 y(But)20 b(some)f(of)h(it)g (has)f(to)h(be)g(supplied)e(as)i(options)f(to)g Fr(bdist_rpm)p Fv(,)g(which)g(w)o(ould)f(be)i(v)o(ery)e(tedious)h(to)h(do)f(on)g(the)g (command-line)0 3906 y(for)h(e)n(v)o(ery)e(run.)25 b(Hence,)19 b(here)h(is)h(a)f(snippet)g(from)f(the)h(Distutils')h(o)n(wn)f(`)p Fw(setup)m(.cfg)p Fv(':)236 4053 y Fn([bdist_rpm])236 4144 y(release)44 b(=)h(1)236 4235 y(packager)f(=)g(Greg)h(Ward)f ()236 4326 y(doc_files)g(=)g(CHANGES.txt)774 4418 y(README.txt)774 4509 y(USAGE.txt)774 4600 y(doc/)774 4692 y(examples/)0 4978 y Fv(Note)20 b(that)g(the)h Fw(doc)p 575 4978 V 26 w(\002les)g Fv(option)e(is)i(simply)f(a)g (whitespace-separated)e(string)i(split)h(across)f(multiple)f(lines)i (for)e(readability)-5 b(.)0 5125 y Ft(See)21 b(Also:)0 5272 y Fp(Installing)e(Python)g(Modules)0 5372 y Fh(\()p Fw(../inst/con\002g-syntax.html)l Fh(\))p 0 5549 3901 4 v 0 5649 a Fs(16)2058 b(Chapter)23 b(3.)52 b(Wr)q(iting)25 b(the)e(Setup)h(Con\002gur)o(ation)g(File)p eop end %%Page: 17 25 TeXDict begin 17 24 bop 208 83 a Fv(More)19 b(information)f(on)i(the)g (con\002guration)d(\002les)22 b(is)f(a)n(v)n(ailable)e(in)i(the)f (manual)f(for)h(system)g(administrators.)p 0 5549 3901 4 v 3808 5649 a Fs(17)p eop end %%Page: 18 26 TeXDict begin 18 25 bop 0 5549 3901 4 v 0 5649 a Fs(18)p eop end %%Page: 19 27 TeXDict begin 19 26 bop 0 83 3901 9 v 3503 230 a Fs(CHAPTER)3561 427 y Fq(FOUR)p 0 515 V 1146 978 a FB(Creating)57 b(a)g(Source)g(Distr) s(ib)l(ution)0 1468 y Fv(As)21 b(sho)n(wn)e(in)i(section)f(1.2,)f(you)g (use)i(the)f Fr(sdist)g Fv(command)e(to)i(create)g(a)h(source)e (distrib)n(ution.)24 b(In)c(the)g(simplest)h(case,)236 1706 y Fn(python)44 b(setup.py)g(sdist)0 1993 y Fv(\(assuming)22 b(you)h(ha)n(v)o(en')o(t)f(speci\002ed)h(an)o(y)g Fr(sdist)g Fv(options)f(in)i(the)f(setup)h(script)f(or)h(con\002g)e(\002le\),)j Fr(sdist)e Fv(creates)g(the)h(archi)n(v)o(e)e(of)0 2092 y(the)e(def)o(ault)g(format)f(for)h(the)h(current)e(platform.)24 b(The)c(def)o(ault)g(format)f(is)i(a)g(gzip'ed)e(tar)i(\002le)g(\(`)p Fw(.tar)l(.gz)p Fv('\))d(on)k(U)t Fm(N)t(I)t(X)r Fv(,)g(and)d(ZIP)i (\002le)g(on)0 2192 y(W)m(indo)n(ws.)0 2339 y(Y)-9 b(ou)20 b(can)g(specify)f(as)i(man)o(y)e(formats)g(as)i(you)f(lik)o(e)g(using)g (the)g Ft(--f)n(ormats)e Fv(option,)h(for)h(e)o(xample:)236 2577 y Fn(python)44 b(setup.py)g(sdist)g(--formats=gztar,zip)0 2863 y Fv(to)20 b(create)g(a)h(gzipped)d(tarball)i(and)g(a)h(zip)f (\002le.)25 b(The)20 b(a)n(v)n(ailable)g(formats)f(are:)1146 3090 y Ft(F)n(ormat)p 1459 3120 4 100 v 98 w(Description)p 2488 3120 V 626 w(Notes)p 1096 3123 1708 4 v 1146 3193 a Fr(zip)p 1459 3223 4 100 v 215 w Fv(zip)h(\002le)h(\(`)p Fw(.zip)p Fv('\))p 2488 3223 V 551 w(\(1\),\(3\))1146 3292 y Fr(gztar)p 1459 3322 V 115 w Fv(gzip'ed)e(tar)h(\002le)h(\(`)p Fw(.tar)l(.gz)p Fv('\))p 2488 3322 V 207 w(\(2\),\(4\))1146 3392 y Fr(bztar)p 1459 3422 V 115 w Fv(bzip2'ed)d(tar)j(\002le)f(\(`)p Fw(.tar)l(.bz2)p Fv('\))p 2488 3422 V 182 w(\(4\))1146 3492 y Fr(ztar)p 1459 3521 V 165 w Fv(compressed)f(tar)h(\002le)h(\(`)p Fw(.tar)l(.Z)p Fv('\))p 2488 3521 V 155 w(\(4\))1146 3591 y Fr(tar)p 1459 3621 V 215 w Fv(tar)f(\002le)h(\(`)p Fw(.tar)p Fv('\))p 2488 3621 V 631 w(\(4\))0 3815 y(Notes:)0 4028 y Ft(\(1\))40 b Fv(def)o(ault)20 b(on)g(W)m(indo)n(ws)0 4194 y Ft(\(2\))40 b Fv(def)o(ault)20 b(on)i(U)t Fm(N)t(I)t(X)0 4360 y Ft(\(3\))40 b Fv(requires)19 b(either)h(e)o(xternal)f Ft(zip)i Fv(utility)f(or)g Fr(zipfile)g Fv(module)e(\(part)i(of)g(the)g (standard)f(Python)g(library)g(since)i(Python)e(1.6\))0 4527 y Ft(\(4\))40 b Fv(requires)19 b(e)o(xternal)g(utilities:)26 b Ft(tar)20 b Fv(and)g(possibly)f(one)h(of)g Ft(gzip)p Fv(,)g Ft(bzip2)p Fv(,)g(or)g Ft(compr)o(ess)0 4854 y Fo(4.1)121 b(Specifying)33 b(the)i(\002les)e(to)h(distr)r(ib)n(ute)0 5087 y Fv(If)c(you)f(don')o(t)f(supply)h(an)h(e)o(xplicit)g(list)h(of)f (\002les)h(\(or)e(instructions)g(on)h(ho)n(w)f(to)h(generate)f(one\),)i (the)f Fr(sdist)g Fv(command)e(puts)i(a)0 5186 y(minimal)20 b(def)o(ault)f(set)i(into)f(the)g(source)g(distrib)n(ution:)125 5400 y Fu(\017)41 b Fv(all)20 b(Python)f(source)h(\002les)h(implied)e (by)h(the)g Fw(p)n(y)p 1545 5400 23 4 v 27 w(modules)f Fv(and)h Fw(pac)o(kages)f Fv(options)p 0 5549 3901 4 v 3808 5649 a Fs(19)p eop end %%Page: 20 28 TeXDict begin 20 27 bop 125 83 a Fu(\017)41 b Fv(all)29 b(C)h(source)e(\002les)i(mentioned)e(in)h(the)g Fw(e)n(xt)p 1527 83 23 4 v 26 w(modules)f Fv(or)h Fw(libr)o(ar)q(ies)e Fv(options)i(\()p Ft(**getting)d(C)k(library)f(sour)o(ces)f(curr)o (ently)208 183 y(br)o(ok)o(en\227no)19 b Fg(get_source_files\(\))f Ft(method)i(in)h(`)p Ff(b)o(uild)p 2157 183 V 25 w(c)o(lib.p)o(y)p Ft('!**)p Fv(\))125 349 y Fu(\017)41 b Fv(scripts)20 b(identi\002ed)f(by)h(the)g Fw(scr)q(ipts)h Fv(option)125 515 y Fu(\017)41 b Fv(an)o(ything)22 b(that)k(looks)e(lik)o(e)h(a)h (test)g(script:)35 b(`)p Fw(test/test*.p)n(y)p Fv(')23 b(\(currently)-5 b(,)23 b(the)i(Distutils)h(don')o(t)e(do)g(an)o (ything)f(with)i(test)h(scripts)208 614 y(e)o(xcept)20 b(include)g(them)g(in)h(source)f(distrib)n(utions,)g(b)n(ut)h(in)h(the) f(future)e(there)i(will)h(be)f(a)g(standard)f(for)g(testing)h(Python)f (module)208 714 y(distrib)n(utions\))125 880 y Fu(\017)41 b Fv(`)p Fw(README.txt)p Fv(')19 b(\(or)g(`)p Fw(README)p Fv('\),)h(`)p Fw(setup)m(.p)n(y)p Fv(')e(\(or)i(whate)n(v)o(er)e(you)i (called)g(your)f(setup)h(script\),)f(and)h(`)p Fw(setup)m(.cfg)p Fv(')0 1093 y(Sometimes)f(this)g(is)h(enough,)d(b)n(ut)j(usually)e(you) g(will)i(w)o(ant)f(to)h(specify)e(additional)g(\002les)i(to)f(distrib)n (ute.)24 b(The)19 b(typical)g(w)o(ay)g(to)g(do)g(this)0 1193 y(is)h(to)g(write)f(a)h Fp(manifest)f(template)p Fv(,)f(called)h(`)p Fw(MANIFEST)-9 b(.in)p Fv(')17 b(by)i(def)o(ault.) 24 b(The)19 b(manifest)f(template)h(is)h(just)g(a)g(list)g(of)f (instructions)f(for)0 1293 y(ho)n(w)i(to)h(generate)f(your)g(manifest)g (\002le,)h(`)p Fw(MANIFEST)p Fv(',)f(which)g(is)i(the)f(e)o(xact)f (list)i(of)f(\002les)g(to)g(include)f(in)h(your)f(source)g(distrib)n (ution.)0 1392 y(The)j Fr(sdist)f Fv(command)f(processes)i(this)g (template)g(and)f(generates)g(a)h(manifest)g(based)f(on)h(its)h (instructions)e(and)g(what)h(it)g(\002nds)g(in)0 1492 y(the)d(\002lesystem.)0 1639 y(If)k(you)f(prefer)f(to)i(roll)g(your)f (o)n(wn)g(manifest)g(\002le,)i(the)f(format)f(is)i(simple:)32 b(one)23 b(\002lename)h(per)f(line,)i(re)o(gular)d(\002les)j(\(or)e (symlinks)g(to)0 1738 y(them\))g(only)-5 b(.)35 b(If)24 b(you)f(do)h(supply)f(your)f(o)n(wn)i(`)p Fw(MANIFEST)p Fv(',)e(you)h(must)h(specify)f(e)n(v)o(erything:)30 b(the)24 b(def)o(ault)g(set)g(of)g(\002les)h(described)0 1838 y(abo)o(v)o(e)19 b(does)g(not)h(apply)g(in)g(this)h(case.)0 1985 y(The)i(manifest)f(template)h(has)g(one)g(command)e(per)h(line,)i (where)e(each)h(command)e(speci\002es)j(a)f(set)h(of)f(\002les)h(to)f (include)f(or)h(e)o(xclude)0 2084 y(from)c(the)h(source)g(distrib)n (ution.)k(F)o(or)19 b(an)h(e)o(xample,)f(again)g(we)i(turn)e(to)i(the)f (Distutils')h(o)n(wn)e(manifest)h(template:)236 2323 y Fn(include)595 2336 y(*)640 2323 y(.txt)236 2414 y(recursive-include) 42 b(examples)1447 2427 y(*)1492 2414 y(.txt)1716 2427 y(*)1761 2414 y(.py)236 2505 y(prune)i(examples/sample?/build)0 2792 y Fv(The)21 b(meanings)f(should)g(be)h(f)o(airly)g(clear:)27 b(include)20 b(all)i(\002les)g(in)f(the)g(distrib)n(ution)f(root)h (matching)e(`)p Fw(*.txt)p Fv(',)i(all)h(\002les)g(an)o(ywhere)d(under) 0 2891 y(the)g(`)p Fw(e)n(xamples)p Fv(')f(directory)f(matching)h(`)p Fw(*.txt)p Fv(')h(or)f(`)p Fw(*.p)n(y)p Fv(',)h(and)f(e)o(xclude)g(all) i(directories)e(matching)g(`)p Fw(e)n(xamples/sample?/b)o(uild)o Fv('.)h(All)0 2991 y(of)f(this)i(is)f(done)f Fp(after)h Fv(the)g(standard)e(include)h(set,)h(so)g(you)f(can)h(e)o(xclude)e (\002les)i(from)f(the)h(standard)e(set)j(with)f(e)o(xplicit)f (instructions)f(in)0 3091 y(the)i(manifest)f(template.)24 b(\(Or)m(,)18 b(you)g(can)g(use)h(the)g Ft(--no-defaults)e Fv(option)h(to)h(disable)f(the)h(standard)e(set)j(entirely)-5 b(.\))23 b(There)18 b(are)g(se)n(v)o(eral)0 3190 y(other)h(commands)g (a)n(v)n(ailable)h(in)g(the)g(manifest)g(template)f(mini-language;)f (see)j(section)f(10.2.)0 3337 y(The)g(order)e(of)i(commands)e(in)i(the) g(manifest)f(template)g(matters:)25 b(initially)-5 b(,)20 b(we)g(ha)n(v)o(e)f(the)h(list)h(of)e(def)o(ault)h(\002les)g(as)h (described)d(abo)o(v)o(e,)0 3437 y(and)e(each)h(command)d(in)j(the)g (template)f(adds)h(to)g(or)f(remo)o(v)o(es)f(from)h(that)h(list)h(of)e (\002les.)25 b(Once)16 b(we)h(ha)n(v)o(e)g(fully)f(processed)f(the)i (manifest)0 3536 y(template,)i(we)i(remo)o(v)o(e)d(\002les)j(that)g (should)e(not)h(be)g(included)f(in)h(the)g(source)g(distrib)n(ution:) 125 3750 y Fu(\017)41 b Fv(all)20 b(\002les)h(in)g(the)f(Distutils)h (\223b)n(uild\224)f(tree)g(\(def)o(ault)f(`)p Fw(b)o(uild/)p Fv('\))125 3916 y Fu(\017)41 b Fv(all)20 b(\002les)h(in)g(directories)e (named)g(`)p Fw(RCS)p Fv(',)h(`)p Fw(CVS)p Fv(',)f(`)p Fw(.svn)p Fv(',)h(`)p Fw(.hg)p Fv(',)f(`)p Fw(.git)p Fv(',)f(`)p Fw(.bzr)p Fv(',)h(or)h(`)p 2648 3916 V 27 w Fw(darcs)p Fv(')0 4129 y(No)n(w)f(we)g(ha)n(v)o(e)f(our)g(complete)f (list)j(of)f(\002les,)g(which)g(is)g(written)g(to)g(the)f(manifest)h (for)f(future)f(reference,)g(and)i(then)f(used)g(to)h(b)n(uild)g(the)0 4229 y(source)g(distrib)n(ution)g(archi)n(v)o(e\(s\).)0 4376 y(Y)-9 b(ou)16 b(can)h(disable)f(the)h(def)o(ault)f(set)i(of)e (included)g(\002les)h(with)g(the)g Ft(--no-defaults)e Fv(option,)h(and)h(you)e(can)i(disable)g(the)f(standard)g(e)o(xclude)0 4475 y(set)21 b(with)f Ft(--no-prune)p Fv(.)0 4622 y(F)o(ollo)n(wing)f (the)i(Distutils')g(o)n(wn)f(manifest)g(template,)f(let')-5 b(s)22 b(trace)e(ho)n(w)g(the)g Fr(sdist)h Fv(command)d(b)n(uilds)i (the)h(list)g(of)g(\002les)g(to)g(include)0 4722 y(in)f(the)h (Distutils)g(source)e(distrib)n(ution:)104 4935 y(1.)41 b(include)19 b(all)i(Python)e(source)h(\002les)h(in)g(the)f(`)p Fw(distutils)p Fv(')f(and)g(`)p Fw(distutils/command)p Fv(')f(subdirectories)g(\(because)i(packages)f(corre-)208 5035 y(sponding)f(to)i(those)g(tw)o(o)h(directories)e(were)h(mentioned) e(in)i(the)h Fw(pac)o(kages)e Fv(option)g(in)h(the)g(setup)g (script\227see)g(section)g(2\))104 5201 y(2.)41 b(include)19 b(`)p Fw(README.txt)p Fv(',)g(`)p Fw(setup)m(.p)n(y)p Fv(',)f(and)i(`)p Fw(setup)m(.cfg)p Fv(')f(\(standard)f(\002les\))104 5367 y(3.)41 b(include)19 b(`)p Fw(test/test*.p)n(y)p Fv(')f(\(standard)h(\002les\))p 0 5549 3901 4 v 0 5649 a Fs(20)2262 b(Chapter)23 b(4.)52 b(Creating)24 b(a)f(Source)g(Distr)q (ib)n(ution)p eop end %%Page: 21 29 TeXDict begin 21 28 bop 104 83 a Fv(4.)41 b(include)27 b(`)p Fw(*.txt)p Fv(')i(in)f(the)h(distrib)n(ution)f(root)g(\(this)h (will)g(\002nd)g(`)p Fw(README.txt)p Fv(')e(a)j(second)d(time,)k(b)n (ut)e(such)f(redundancies)f(are)208 183 y(weeded)19 b(out)h(later\))104 349 y(5.)41 b(include)19 b(an)o(ything)f(matching)h(`)p Fw(*.txt)p Fv(')g(or)h(`)p Fw(*.p)n(y)p Fv(')g(in)g(the)g(sub-tree)g (under)e(`)p Fw(e)n(xamples)p Fv(',)104 515 y(6.)41 b(e)o(xclude)25 b(all)i(\002les)g(in)g(the)f(sub-trees)g(starting)g(at)h(directories)e (matching)g(`)p Fw(e)n(xamples/sample?/b)o(uild)o Fv('\227this)c(may)26 b(e)o(xclude)208 614 y(\002les)g(included)f(by)g(the)h(pre)n(vious)e (tw)o(o)i(steps,)i(so)e(it')-5 b(s)27 b(important)e(that)h(the)f Fr(prune)h Fv(command)e(in)i(the)g(manifest)f(template)208 714 y(comes)19 b(after)h(the)g Fr(recursive-include)e Fv(command)104 880 y(7.)41 b(e)o(xclude)18 b(the)i(entire)g(`)p Fw(b)o(uild)p Fv(')e(tree,)i(and)f(an)o(y)h(`)p Fw(RCS)p Fv(',)f(`)p Fw(CVS)p Fv(',)h(`)p Fw(.svn)p Fv(',)f(`)p Fw(.hg)p Fv(',)g(`)p Fw(.git)p Fv(',)g(`)p Fw(.bzr)p Fv(',)g(or)h(`)p 2975 880 23 4 v 26 w Fw(darcs)p Fv(')g(directories)0 1093 y(Just)26 b(lik)o(e)f(in)g(the)g(setup)g(script,)h(\002le)g(and)e (directory)g(names)g(in)i(the)f(manifest)f(template)h(should)f(al)o(w)o (ays)h(be)g(slash-separated;)i(the)0 1193 y(Distutils)g(will)g(tak)o(e) g(care)f(of)g(con)m(v)o(erting)d(them)j(to)h(the)f(standard)f (representation)g(on)g(your)h(platform.)41 b(That)26 b(w)o(ay)-5 b(,)28 b(the)e(manifest)0 1293 y(template)20 b(is)h(portable)e(across)h(operating)e(systems.)0 1620 y Fo(4.2)121 b(Manif)l(est-related)35 b(options)0 1853 y Fv(The)20 b(normal)f(course)g(of)h(operations)f(for)g(the)i Fr(sdist)e Fv(command)g(is)i(as)g(follo)n(ws:)125 2066 y Fu(\017)41 b Fv(if)20 b(the)g(manifest)g(\002le,)h(`)p Fw(MANIFEST)p Fv(')d(doesn')o(t)h(e)o(xist,)h(read)g(`)p Fw(MANIFEST)-9 b(.in)p Fv(')18 b(and)h(create)h(the)g(manifest)125 2232 y Fu(\017)41 b Fv(if)20 b(neither)f(`)p Fw(MANIFEST)p Fv(')g(nor)h(`)p Fw(MANIFEST)-9 b(.in)p Fv(')17 b(e)o(xist,)j(create)g (a)h(manifest)f(with)g(just)h(the)f(def)o(ault)f(\002le)i(set)125 2398 y Fu(\017)41 b Fv(if)18 b(either)g(`)p Fw(MANIFEST)-9 b(.in)p Fv(')16 b(or)i(the)g(setup)g(script)h(\(`)p Fw(setup)m(.p)n(y)p Fv('\))d(are)i(more)f(recent)h(than)g(`)p Fw(MANIFEST)p Fv(',)e(recreate)i(`)p Fw(MANIFEST)p Fv(')208 2498 y(by)h(reading)g(`)p Fw(MANIFEST)-9 b(.in)p Fv(')125 2664 y Fu(\017)41 b Fv(use)33 b(the)g(list)h(of)f(\002les)h(no)n(w)f(in)g(`)p Fw(MANIFEST)p Fv(')f(\(either)g(just)i(generated)e(or)g(read)h(in\))g(to)g(create)g (the)g(source)g(distrib)n(ution)208 2763 y(archi)n(v)o(e\(s\))0 2977 y(There)23 b(are)i(a)f(couple)g(of)g(options)f(that)h(modify)f (this)i(beha)n(viour)-5 b(.)35 b(First,)26 b(use)f(the)f Ft(--no-defaults)f Fv(and)g Ft(--no-prune)h Fv(to)h(disable)f(the)0 3076 y(standard)19 b(\223include\224)g(and)h(\223e)o(xclude\224)e (sets.)0 3223 y(Second,)j(you)h(might)f(w)o(ant)h(to)h(force)e(the)h (manifest)f(to)i(be)f(re)o(generated\227for)c(e)o(xample,)j(if)i(you)e (ha)n(v)o(e)g(added)g(or)h(remo)o(v)o(ed)e(\002les)j(or)0 3323 y(directories)c(that)h(match)g(an)g(e)o(xisting)g(pattern)f(in)h (the)h(manifest)e(template,)h(you)f(should)g(re)o(generate)f(the)j (manifest:)236 3561 y Fn(python)44 b(setup.py)g(sdist)g (--force-manifest)0 3848 y Fv(Or)m(,)20 b(you)f(might)h(just)g(w)o(ant) h(to)f(\(re\)generate)e(the)i(manifest,)f(b)n(ut)i(not)e(create)h(a)h (source)e(distrib)n(ution:)236 4086 y Fn(python)44 b(setup.py)g(sdist)g (--manifest-only)0 4373 y Ft(--manifest-only)18 b Fv(implies)j Ft(--f)n(or)o(ce-manifest)p Fv(.)h Ft(-o)d Fv(is)j(a)e(shortcut)f(for)h Ft(--manifest-only)p Fv(,)e(and)i Ft(-f)g Fv(for)f Ft(--f)n(or)o (ce-manifest)p Fv(.)p 0 5549 3901 4 v 0 5649 a Fs(4.2.)52 b(Manif)n(est-related)24 b(options)2735 b(21)p eop end %%Page: 22 30 TeXDict begin 22 29 bop 0 5549 3901 4 v 0 5649 a Fs(22)p eop end %%Page: 23 31 TeXDict begin 23 30 bop 0 83 3901 9 v 3503 230 a Fs(CHAPTER)3634 427 y Fq(FIVE)p 0 515 V 1468 978 a FB(Creating)57 b(Built)g(Distr)s(ib) l(utions)0 1468 y Fv(A)25 b(\223b)n(uilt)f(distrib)n(ution\224)f(is)i (what)f(you')l(re)f(probably)f(used)i(to)g(thinking)f(of)h(either)g(as) h(a)g(\223binary)d(package\224)h(or)h(an)g(\223installer\224)g(\(de-)0 1568 y(pending)d(on)i(your)f(background\).)30 b(It')-5 b(s)24 b(not)f(necessarily)g(binary)-5 b(,)22 b(though,)g(because)g(it) i(might)f(contain)f(only)h(Python)f(source)g(code)0 1667 y(and/or)e(byte-code;)h(and)g(we)h(don')o(t)e(call)i(it)g(a)g(package,) f(because)g(that)g(w)o(ord)g(is)i(already)d(spok)o(en)h(for)g(in)h (Python.)28 b(\(And)21 b(\223installer\224)0 1767 y(is)g(a)g(term)f (speci\002c)g(to)g(the)h(w)o(orld)e(of)h(mainstream)f(desktop)g (systems.\))0 1914 y(A)31 b(b)n(uilt)f(distrib)n(ution)f(is)j(ho)n(w)d (you)h(mak)o(e)f(life)i(as)g(easy)f(as)h(possible)f(for)g(installers)h (of)f(your)f(module)g(distrib)n(ution:)44 b(for)29 b(users)0 2013 y(of)d(RPM-based)f(Linux)g(systems,)j(it')-5 b(s)27 b(a)f(binary)f(RPM;)i(for)e(W)m(indo)n(ws)h(users,)h(it')-5 b(s)27 b(an)f(e)o(x)o(ecutable)e(installer;)29 b(for)d(Debian-based)0 2113 y(Linux)e(users,)i(it')-5 b(s)26 b(a)f(Debian)g(package;)h(and)e (so)h(forth.)39 b(Ob)o(viously)-5 b(,)23 b(no)i(one)f(person)g(will)i (be)f(able)g(to)g(create)f(b)n(uilt)h(distrib)n(utions)0 2213 y(for)h(e)n(v)o(ery)f(platform)g(under)g(the)h(sun,)i(so)f(the)f (Distutils)i(are)e(designed)f(to)i(enable)e(module)g(de)n(v)o(elopers)g (to)h(concentrate)f(on)h(their)0 2312 y(specialty\227writing)18 b(code)h(and)g(creating)f(source)h(distrib)n(utions\227while)f(an)h (intermediary)e(species)j(called)f Fp(pac)n(ka)o(g)o(er)o(s)g Fv(springs)g(up)0 2412 y(to)h(turn)g(source)f(distrib)n(utions)h(into)g (b)n(uilt)g(distrib)n(utions)f(for)h(as)h(man)o(y)e(platforms)g(as)h (there)g(are)g(packagers.)0 2559 y(Of)j(course,)f(the)h(module)f(de)n (v)o(eloper)e(could)i(be)h(his)g(o)n(wn)f(packager;)h(or)f(the)h (packager)e(could)h(be)h(a)g(v)n(olunteer)f(\223out)g(there\224)g (some-)0 2658 y(where)16 b(who)f(has)i(access)g(to)f(a)h(platform)e (which)g(the)i(original)e(de)n(v)o(eloper)f(does)i(not;)h(or)f(it)h (could)e(be)i(softw)o(are)e(periodically)g(grabbing)0 2758 y(ne)n(w)21 b(source)f(distrib)n(utions)f(and)i(turning)e(them)h (into)h(b)n(uilt)f(distrib)n(utions)g(for)g(as)i(man)o(y)d(platforms)h (as)h(the)g(softw)o(are)f(has)h(access)h(to.)0 2858 y(Re)o(gardless)e (of)h(who)g(the)o(y)f(are,)h(a)h(packager)d(uses)j(the)f(setup)g (script)g(and)g(the)g Fr(bdist)f Fv(command)g(f)o(amily)g(to)h (generate)f(b)n(uilt)i(distri-)0 2957 y(b)n(utions.)0 3104 y(As)f(a)g(simple)f(e)o(xample,)e(if)j(I)f(run)g(the)g(follo)n (wing)e(command)h(in)h(the)g(Distutils)h(source)f(tree:)236 3342 y Fn(python)44 b(setup.py)g(bdist)0 3629 y Fv(then)26 b(the)g(Distutils)h(b)n(uilds)g(my)f(module)f(distrib)n(ution)g(\(the)h (Distutils)h(itself)g(in)f(this)h(case\),)h(does)e(a)g(\223f)o(ak)o (e\224)g(installation)g(\(also)g(in)0 3728 y(the)f(`)p Fw(b)o(uild)p Fv(')d(directory\),)i(and)h(creates)g(the)g(def)o(ault)f (type)g(of)h(b)n(uilt)g(distrib)n(ution)f(for)h(my)f(platform.)38 b(The)25 b(def)o(ault)f(format)g(for)g(b)n(uilt)0 3828 y(distrib)n(utions)d(is)i(a)f(\223dumb\224)f(tar)h(\002le)g(on)i(U)t Fm(N)t(I)t(X)r Fv(,)f(and)e(a)i(simple)e(e)o(x)o(ecutable)f(installer)i (on)g(W)m(indo)n(ws.)30 b(\(That)21 b(tar)h(\002le)g(is)h(considered)0 3928 y(\223dumb\224)c(because)g(it)i(has)f(to)h(be)f(unpack)o(ed)e(in)i (a)h(speci\002c)f(location)g(to)g(w)o(ork.\))0 4074 y(Thus,)26 b(the)g(abo)o(v)o(e)e(command)f(on)i(a)j(U)t Fm(N)t(I)t(X)h Fv(system)c(creates)h(`)p Fw(Distutils-1.0.)p Fe(plat)7 b Fw(.tar)l(.g)o(z)p Fv(';)23 b(unpacking)g(this)j(tarball)f(from)g (the)g(right)0 4174 y(place)e(installs)i(the)e(Distutils)i(just)f(as)g (though)e(you)h(had)f(do)n(wnloaded)f(the)j(source)f(distrib)n(ution)f (and)h(run)g Fr(python)48 b(setup.py)0 4274 y(install)p Fv(.)23 b(\(The)18 b(\223right)f(place\224)h(is)h(either)e(the)h(root)g (of)g(the)g(\002lesystem)g(or)g(Python')-5 b(s)17 b Fe(pre\002x)25 b Fv(directory)-5 b(,)16 b(depending)g(on)h(the)i(options)0 4373 y(gi)n(v)o(en)g(to)h(the)g Fr(bdist_dumb)f Fv(command;)g(the)h (def)o(ault)f(is)i(to)g(mak)o(e)f(dumb)e(distrib)n(utions)i(relati)n(v) o(e)f(to)h Fe(pre\002x)7 b Fv(.\))0 4520 y(Ob)o(viously)-5 b(,)17 b(for)i(pure)g(Python)f(distrib)n(utions,)h(this)h(isn')o(t)f (an)o(y)g(simpler)h(than)f(just)h(running)d Fr(python)49 b(setup.py)f(install)p Fv(\227)0 4620 y(b)n(ut)25 b(for)f(non-pure)e (distrib)n(utions,)i(which)g(include)g(e)o(xtensions)f(that)i(w)o(ould) f(need)g(to)h(be)f(compiled,)g(it)i(can)e(mean)g(the)h(dif)n(ference)0 4719 y(between)c(someone)f(being)g(able)i(to)f(use)h(your)e(e)o (xtensions)g(or)i(not.)28 b(And)21 b(creating)f(\223smart\224)i(b)n (uilt)f(distrib)n(utions,)g(such)g(as)h(an)g(RPM)0 4819 y(package)28 b(or)g(an)h(e)o(x)o(ecutable)e(installer)i(for)g(W)m(indo) n(ws,)h(is)g(f)o(ar)f(more)f(con)m(v)o(enient)f(for)h(users)h(e)n(v)o (en)f(if)h(your)f(distrib)n(ution)g(doesn')o(t)0 4919 y(include)19 b(an)o(y)h(e)o(xtensions.)0 5066 y(The)g Fr(bdist)h Fv(command)e(has)i(a)g Ft(--f)n(ormats)e Fv(option,)h (similar)h(to)g(the)g Fr(sdist)f Fv(command,)f(which)h(you)g(can)g(use) i(to)f(select)g(the)g(types)0 5165 y(of)f(b)n(uilt)g(distrib)n(ution)f (to)i(generate:)j(for)19 b(e)o(xample,)p 0 5549 3901 4 v 3808 5649 a Fs(23)p eop end %%Page: 24 32 TeXDict begin 24 31 bop 236 174 a Fn(python)44 b(setup.py)g(bdist)g (--format=zip)0 461 y Fv(w)o(ould,)26 b(when)f(run)g(on)h(a)i(U)t Fm(N)t(I)t(X)h Fv(system,)e(create)e(`)p Fw(Distutils-1.0.)p Fe(plat)7 b Fw(.zip)p Fv('\227ag)o(ain)o(,)22 b(this)k(archi)n(v)o(e)e (w)o(ould)i(be)f(unpack)o(ed)f(from)h(the)0 560 y(root)20 b(directory)e(to)i(install)h(the)f(Distutils.)0 707 y(The)g(a)n(v)n (ailable)g(formats)f(for)h(b)n(uilt)g(distrib)n(utions)f(are:)968 903 y Ft(F)n(ormat)p 1365 933 4 100 v 181 w(Description)p 2666 933 V 899 w(Notes)p 918 936 2064 4 v 968 1006 a Fr(gztar)p 1365 1036 4 100 v 198 w Fv(gzipped)g(tar)h(\002le)h(\(`)p Fw(.tar)l(.gz)p Fv('\))p 2666 1036 V 466 w(\(1\),\(3\))968 1106 y Fr(ztar)p 1365 1136 V 248 w Fv(compressed)e(tar)h(\002le)h(\(`)p Fw(.tar)l(.Z)p Fv('\))p 2666 1136 V 428 w(\(3\))968 1205 y Fr(tar)p 1365 1235 V 298 w Fv(tar)g(\002le)g(\(`)p Fw(.tar)p Fv('\))p 2666 1235 V 903 w(\(3\))968 1305 y Fr(zip)p 1365 1335 V 298 w Fv(zip)g(\002le)f(\(`)p Fw(.zip)p Fv('\))p 2666 1335 V 882 w(\(4\))968 1405 y Fr(rpm)p 1365 1434 V 298 w Fv(RPM)p 2666 1434 V 1185 w(\(5\))968 1504 y Fr(pkgtool)p 1365 1534 V 98 w Fv(Solaris)h Ft(pkgtool)p 2666 1534 V 968 1604 a Fr(sdux)p 1365 1634 V 248 w Fv(HP-UX)g Ft(swinstall)p 2666 1634 V 968 1703 a Fr(rpm)p 1365 1733 V 298 w Fv(RPM)p 2666 1733 V 1185 w(\(5\))968 1803 y Fr(wininst)p 1365 1833 V 98 w Fv(self-e)o(xtracting)d(ZIP)j(\002le)g (for)e(W)m(indo)n(ws)p 2666 1833 V 99 w(\(2\),\(4\))0 2013 y(Notes:)0 2216 y Ft(\(1\))40 b Fv(def)o(ault)20 b(on)i(U)t Fm(N)t(I)t(X)0 2376 y Ft(\(2\))40 b Fv(def)o(ault)20 b(on)g(W)m(indo)n(ws)f Ft(**to-do!**)0 2537 y(\(3\))40 b Fv(requires)19 b(e)o(xternal)g(utilities:)26 b Ft(tar)20 b Fv(and)g(possibly)f(one)h(of)g Ft(gzip)p Fv(,)g Ft(bzip2)p Fv(,)g(or)g Ft(compr)o(ess)0 2697 y(\(4\))40 b Fv(requires)19 b(either)h(e)o(xternal)f Ft(zip)i Fv(utility)f(or)g Fr(zipfile)g Fv(module)e(\(part)i(of)g(the)g(standard)f(Python)g(library)g(since)i (Python)e(1.6\))0 2858 y Ft(\(5\))40 b Fv(requires)19 b(e)o(xternal)g Ft(r)o(pm)j Fv(utility)-5 b(,)19 b(v)o(ersion)g(3.0.4)g (or)h(better)f(\(use)i Fr(rpm)49 b(--version)19 b Fv(to)h(\002nd)g(out) g(which)g(v)o(ersion)f(you)g(ha)n(v)o(e\))0 3060 y(Y)-9 b(ou)24 b(don')o(t)f(ha)n(v)o(e)h(to)h(use)f(the)h Fr(bdist)f Fv(command)f(with)i(the)f Ft(--f)n(ormats)f Fv(option;)j(you)d(can)i (also)g(use)g(the)f(command)f(that)h(directly)0 3160 y(implements)c(the)h(format)f(you')l(re)f(interested)h(in.)28 b(Some)20 b(of)h(these)g Fr(bdist)g Fv(\223sub-commands\224)d(actually) i(generate)g(se)n(v)o(eral)g(similar)0 3259 y(formats;)27 b(for)d(instance,)i(the)f Fr(bdist_dumb)e Fv(command)g(generates)h(all) i(the)f(\223dumb\224)e(archi)n(v)o(e)h(formats)g(\()p Fr(tar)p Fv(,)h Fr(ztar)p Fv(,)h Fr(gztar)p Fv(,)0 3359 y(and)e Fr(zip)p Fv(\),)i(and)e Fr(bdist_rpm)g Fv(generates)g(both)g (binary)g(and)g(source)g(RPMs.)41 b(The)24 b Fr(bdist)h Fv(sub-commands,)e(and)h(the)h(formats)0 3459 y(generated)18 b(by)i(each,)g(are:)1279 3671 y Ft(Command)p 1975 3701 V 374 w(F)n(ormats)p 1230 3704 1441 4 v 1279 3774 a Fr(bdist_dumb)p 1975 3804 4 100 v 248 w Fv(tar)m(,)f(ztar)m(,)h(gztar)m(,)f(zip)1279 3874 y Fr(bdist_rpm)p 1975 3904 V 298 w Fv(rpm,)g(srpm)1279 3973 y Fr(bdist_wininst)p 1975 4003 V 98 w Fv(wininst)0 4185 y(The)h(follo)n(wing)e(sections)j(gi)n(v)o(e)e(details)i(on)e(the) i(indi)n(vidual)d Fr(bdist_)2059 4200 y(*)2128 4185 y Fv(commands.)0 4510 y Fo(5.1)121 b(Creating)35 b(dumb)f(b)n(uilt)f (distr)r(ib)n(utions)0 4743 y Ft(**Need)20 b(to)g(document)g(absolute)g (vs.)25 b(pr)o(e\002x-r)o(elati)o(v)o(e)18 b(packages)h(her)o(e,)h(b)n (ut)h(\002rst)g(I)g(ha)n(v)o(e)f(to)g(implement)h(it!**)0 5068 y Fo(5.2)121 b(Creating)35 b(RPM)e(pac)n(kages)0 5300 y Fv(The)16 b(RPM)h(format)e(is)j(used)e(by)g(man)o(y)f(popular)f (Linux)h(distrib)n(utions,)h(including)f(Red)h(Hat,)i(SuSE,)e(and)g (Mandrak)o(e.)21 b(If)c(one)e(of)h(these)0 5400 y(\(or)h(an)o(y)f(of)i (the)f(other)g(RPM-based)g(Linux)f(distrib)n(utions\))g(is)j(your)d (usual)h(en)m(vironment,)e(creating)h(RPM)j(packages)d(for)h(other)f (users)p 0 5549 3901 4 v 0 5649 a Fs(24)2391 b(Chapter)23 b(5.)52 b(Creating)24 b(Built)h(Distr)q(ib)n(utions)p eop end %%Page: 25 33 TeXDict begin 25 32 bop 0 83 a Fv(of)20 b(that)h(same)g(distrib)n (ution)f(is)h(tri)n(vial.)26 b(Depending)19 b(on)h(the)h(comple)o(xity) e(of)h(your)f(module)h(distrib)n(ution)f(and)h(dif)n(ferences)f (between)0 183 y(Linux)g(distrib)n(utions,)g(you)g(may)h(also)h(be)f (able)g(to)g(create)g(RPMs)h(that)g(w)o(ork)e(on)h(dif)n(ferent)f (RPM-based)g(distrib)n(utions.)0 330 y(The)h(usual)g(w)o(ay)g(to)g (create)g(an)h(RPM)g(of)f(your)e(module)h(distrib)n(ution)g(is)i(to)g (run)e(the)h Fr(bdist_rpm)f Fv(command:)236 568 y Fn(python)44 b(setup.py)g(bdist_rpm)0 855 y Fv(or)20 b(the)g Fr(bdist)g Fv(command)e(with)i(the)h Ft(--f)n(ormat)d Fv(option:)236 1093 y Fn(python)44 b(setup.py)g(bdist)g(--formats=rpm)0 1380 y Fv(The)19 b(former)e(allo)n(ws)i(you)g(to)g(specify)f (RPM-speci\002c)h(options;)g(the)g(latter)g(allo)n(ws)g(you)g(to)g (easily)g(specify)f(multiple)h(formats)f(in)h(one)0 1479 y(run.)24 b(If)c(you)f(need)h(to)g(do)g(both,)f(you)h(can)g(e)o (xplicitly)f(specify)g(multiple)h Fr(bdist_)2407 1494 y(*)2476 1479 y Fv(commands)f(and)g(their)h(options:)236 1717 y Fn(python)44 b(setup.py)g(bdist_rpm)f(--packager="John)f(Doe)i (")e(\\)954 1809 y(bdist_wininst)g (--target_version="2.0")0 2095 y Fv(Creating)21 b(RPM)i(packages)e(is)i (dri)n(v)o(en)d(by)h(a)i(`)p Fw(.spec)p Fv(')e(\002le,)i(much)d(as)j (using)e(the)h(Distutils)h(is)g(dri)n(v)o(en)d(by)h(the)h(setup)g (script.)30 b(T)-7 b(o)22 b(mak)o(e)0 2195 y(your)c(life)i(easier)m(,)g (the)f Fr(bdist_rpm)g Fv(command)f(normally)g(creates)h(a)h(`)p Fw(.spec)p Fv(')g(\002le)g(based)f(on)g(the)h(information)d(you)i (supply)g(in)h(the)0 2294 y(setup)h(script,)f(on)h(the)f(command)f (line,)i(and)f(in)h(an)o(y)f(Distutils)i(con\002guration)c(\002les.)28 b(V)-9 b(arious)20 b(options)f(and)i(sections)f(in)h(the)g(`)p Fw(.spec)p Fv(')0 2394 y(\002le)g(are)f(deri)n(v)o(ed)e(from)i(options) f(in)h(the)g(setup)g(script)h(as)g(follo)n(ws:)771 2620 y Ft(RPM)g(`)p Ff(.spec)p Ft(')d(\002le)j(option)f(or)g(section)p 2013 2650 4 100 v 99 w(Distutils)h(setup)g(script)f(option)p 721 2654 2458 4 v 771 2723 a Fv(Name)p 2013 2753 4 100 v 1095 w Fw(name)771 2823 y Fv(Summary)f(\(in)h(preamble\))p 2013 2853 V 498 w Fw(descr)q(iption)771 2923 y Fv(V)-9 b(ersion)p 2013 2952 V 1039 w Fw(v)n(ersion)771 3022 y Fv(V)g(endor)p 2013 3052 V 1052 w Fw(author)18 b Fv(and)i Fw(author)p 2656 3022 23 4 v 25 w(email)p Fv(,)f(or)p 2013 3152 4 100 v 2065 3122 a Fw(maintainer)e Fv(and)j Fw(maintainer)p 2931 3122 23 4 v 24 w(email)771 3221 y Fv(Cop)o(yright)p 2013 3251 4 100 v 956 w Fw(licence)771 3321 y Fv(Url)p 2013 3351 V 1183 w Fw(ur)q(l)771 3421 y Fv(\045description)f(\(section\))p 2013 3451 V 543 w Fw(long)p 2212 3421 23 4 v 25 w(descr)q(iption)0 3646 y Fv(Additionally)-5 b(,)18 b(there)h(are)h(man)o(y)f(options)g(in)h(`) p Fw(.spec)p Fv(')f(\002les)i(that)g(don')o(t)d(ha)n(v)o(e)h (corresponding)e(options)i(in)h(the)g(setup)g(script.)25 b(Most)20 b(of)0 3745 y(these)g(are)g(handled)f(through)f(options)h(to) i(the)f Fr(bdist_rpm)f Fv(command)f(as)j(follo)n(ws:)485 3972 y Ft(RPM)g(`)p Ff(.spec)p Ft(')d(\002le)j(option)f(or)g(section)p 1728 4002 4 100 v 99 w Fg(bdist_rpm)f Ft(option)p 2523 4002 V 99 w(default)h(v)o(alue)p 436 4005 3029 4 v 485 4075 a Fv(Release)p 1728 4104 4 100 v 1036 w Fw(release)p 2523 4104 V 548 w Fv(\2231\224)485 4174 y(Group)p 1728 4204 V 1080 w Fw(g)o(roup)p 2523 4204 V 603 w Fv(\223De)n(v)o (elopment/Libraries\224)485 4274 y(V)-9 b(endor)p 1728 4304 V 1052 w Fw(v)n(endor)p 2523 4304 V 567 w Fv(\(see)20 b(abo)o(v)o(e\))485 4373 y(P)o(ackager)p 1728 4403 V 989 w Fw(pac)o(kager)p 2523 4403 V 487 w Fv(\(none\))485 4473 y(Pro)o(vides)p 1728 4503 V 1003 w Fw(pro)o(vides)p 2523 4503 V 512 w Fv(\(none\))485 4573 y(Requires)p 1728 4603 V 998 w Fw(requires)p 2523 4603 V 523 w Fv(\(none\))485 4672 y(Con\003icts)p 1728 4702 V 994 w Fw(con\003icts)p 2523 4702 V 525 w Fv(\(none\))485 4772 y(Obsoletes)p 1728 4802 V 966 w Fw(obsoletes)p 2523 4802 V 473 w Fv(\(none\))485 4872 y(Distrib)n(ution)p 1728 4901 V 893 w Fw(distr)q(ib)o(ution)p 2148 4872 23 4 v 23 w(name)p 2523 4901 4 100 v 219 w Fv(\(none\))485 4971 y(BuildRequires)p 1728 5001 V 813 w Fw(b)o(uild)p 1942 4971 23 4 v 24 w(requires)p 2523 5001 4 100 v 340 w Fv(\(none\))485 5071 y(Icon)p 1728 5101 V 1145 w Fw(icon)p 2523 5101 V 657 w Fv(\(none\))0 5296 y(Ob)o(viously)-5 b(,)14 b(supplying)g(e)n(v)o(en)h(a)h(fe)n(w)f (of)h(these)g(options)e(on)i(the)f(command-line)e(w)o(ould)i(be)h (tedious)f(and)g(error)n(-prone,)e(so)j(it')-5 b(s)17 b(usually)0 5396 y(best)23 b(to)f(put)h(them)f(in)g(the)h(setup)f (con\002guration)e(\002le,)j(`)p Fw(setup)m(.cfg)p Fv('\227see)e (section)h(3.)32 b(If)23 b(you)e(distrib)n(ute)h(or)g(package)f(man)o (y)h(Python)p 0 5549 3901 4 v 0 5649 a Fs(5.2.)52 b(Creating)24 b(RPM)f(pac)n(kages)2720 b(25)p eop end %%Page: 26 34 TeXDict begin 26 33 bop 0 83 a Fv(module)21 b(distrib)n(utions,)g(you)g (might)h(w)o(ant)g(to)g(put)g(options)f(that)h(apply)g(to)g(all)h(of)e (them)h(in)g(your)f(personal)g(Distutils)i(con\002guration)0 183 y(\002le)e(\(`)p Fw(\230/.p)n(ydistutils)o(.cfg)p Fv('\).)0 330 y(There)e(are)h(three)g(steps)h(to)f(b)n(uilding)f(a)i (binary)e(RPM)i(package,)d(all)j(of)f(which)g(are)g(handled)e (automatically)h(by)h(the)g(Distutils:)104 539 y(1.)41 b(create)24 b(a)g(`)p Fw(.spec)p Fv(')g(\002le,)i(which)e(describes)g (the)g(package)f(\(analogous)f(to)j(the)f(Distutils)h(setup)g(script;)h (in)f(f)o(act,)g(much)e(of)i(the)208 638 y(information)17 b(in)k(the)f(setup)g(script)g(winds)g(up)g(in)g(the)h(`)p Fw(.spec)p Fv(')e(\002le\))104 796 y(2.)41 b(create)19 b(the)i(source)e(RPM)104 954 y(3.)41 b(create)30 b(the)h (\223binary\224)f(RPM)i(\(which)e(may)g(or)h(may)g(not)f(contain)h (binary)e(code,)k(depending)c(on)h(whether)g(your)g(module)208 1054 y(distrib)n(ution)19 b(contains)g(Python)g(e)o(xtensions\))0 1263 y(Normally)-5 b(,)23 b(RPM)h(b)n(undles)f(the)h(last)h(tw)o(o)f (steps)g(together;)g(when)g(you)e(use)i(the)g(Distutils,)i(all)e(three) f(steps)i(are)e(typically)g(b)n(undled)0 1362 y(together)-5 b(.)0 1509 y(If)22 b(you)f(wish,)h(you)f(can)h(separate)g(these)g (three)f(steps.)31 b(Y)-9 b(ou)21 b(can)h(use)g(the)g Ft(--spec-only)f Fv(option)g(to)h(mak)o(e)g Fr(bdist_rpm)e Fv(just)j(create)0 1609 y(the)17 b(`)p Fw(.spec)p Fv(')g(\002le)h(and)e (e)o(xit;)i(in)g(this)f(case,)h(the)f(`)p Fw(.spec)p Fv(')g(\002le)h(will)g(be)f(written)g(to)g(the)g(\223distrib)n(ution)f (directory\224\227normally)d(`)p Fw(dist/)p Fv(',)k(b)n(ut)0 1708 y(customizable)k(with)i(the)g Ft(--dist-dir)f Fv(option.)32 b(\(Normally)-5 b(,)21 b(the)i(`)p Fw(.spec)p Fv(')f(\002le)h(winds)g (up)f(deep)g(in)h(the)f(\223b)n(uild)h(tree,)-6 b(\224)23 b(in)g(a)g(temporary)0 1808 y(directory)18 b(created)i(by)g Fr(bdist_rpm)p Fv(.\))0 2132 y Fo(5.3)121 b(Creating)35 b(Windo)n(ws)f(Installers)0 2365 y Fv(Ex)o(ecutable)22 b(installers)j(are)f(the)g(natural)f(format)g(for)g(binary)g(distrib)n (utions)g(on)h(W)m(indo)n(ws.)36 b(The)o(y)23 b(display)h(a)g(nice)g (graphical)f(user)0 2464 y(interf)o(ace,)d(display)g(some)g (information)e(about)i(the)g(module)f(distrib)n(ution)h(to)g(be)h (installed)f(tak)o(en)h(from)e(the)i(metadata)e(in)i(the)g(setup)0 2564 y(script,)f(let)h(the)f(user)g(select)h(a)f(fe)n(w)h(options,)e (and)g(start)i(or)f(cancel)g(the)g(installation.)0 2711 y(Since)g(the)g(metadata)g(is)h(tak)o(en)f(from)f(the)h(setup)g (script,)g(creating)f(W)m(indo)n(ws)h(installers)g(is)i(usually)d(as)i (easy)f(as)h(running:)236 2858 y Fn(python)44 b(setup.py)g (bdist_wininst)0 3145 y Fv(or)20 b(the)g Fr(bdist)g Fv(command)e(with)i (the)h Ft(--f)n(ormats)d Fv(option:)236 3383 y Fn(python)44 b(setup.py)g(bdist)g(--formats=wininst)0 3669 y Fv(If)26 b(you)f(ha)n(v)o(e)h(a)h(pure)e(module)g(distrib)n(ution)g(\(only)g (containing)f(pure)h(Python)g(modules)g(and)h(packages\),)g(the)g (resulting)g(installer)0 3769 y(will)e(be)e(v)o(ersion)g(independent)e (and)i(ha)n(v)o(e)h(a)g(name)f(lik)o(e)h(`)p Fw(f)n(oo-1.0.win32.e)n(x) n(e)p Fv('.)k(These)c(installers)g(can)f(e)n(v)o(en)g(be)h(created)f (on)j(U)t Fm(N)t(I)t(X)0 3869 y Fv(or)20 b(Mac)g(OS)h(platforms.)0 4016 y(If)k(you)g(ha)n(v)o(e)f(a)i(non-pure)d(distrib)n(ution,)i(the)g (e)o(xtensions)f(can)h(only)g(be)g(created)g(on)f(a)i(W)m(indo)n(ws)f (platform,)g(and)f(will)i(be)g(Python)0 4115 y(v)o(ersion)21 b(dependent.)31 b(The)22 b(installer)h(\002lename)f(will)i(re\003ect)e (this)i(and)e(no)n(w)g(has)h(the)g(form)e(`)p Fw(f)n(oo-1.0.win32-p)n (y2.0.)o(e)n(x)n(e)o Fv('.)27 b(Y)-9 b(ou)22 b(ha)n(v)o(e)0 4215 y(to)e(create)g(a)h(separate)f(installer)g(for)f(e)n(v)o(ery)g (Python)g(v)o(ersion)g(you)h(w)o(ant)g(to)g(support.)0 4362 y(The)30 b(installer)g(will)g(try)g(to)g(compile)f(pure)g(modules) g(into)h(bytecode)e(after)h(installation)h(on)f(the)h(tar)o(get)f (system)h(in)g(normal)f(and)0 4461 y(optimizing)24 b(mode.)40 b(If)25 b(you)g(don')o(t)f(w)o(ant)h(this)h(to)g(happen)e(for)h(some)g (reason,)h(you)e(can)i(run)e(the)i Fr(bdist_wininst)e Fv(command)0 4561 y(with)c(the)h Ft(--no-tar)o(get-compile)16 b Fv(and/or)j(the)i Ft(--no-tar)o(get-optimize)16 b Fv(option.)0 4708 y(By)21 b(def)o(ault)f(the)g(installer)g(will)i(display)d(the)i (cool)f(\223Python)f(Po)n(wered\224)g(logo)h(when)g(it)h(is)g(run,)f(b) n(ut)g(you)g(can)g(also)h(supply)e(your)g(o)n(wn)0 4807 y(bitmap)g(which)h(must)g(be)g(a)h(W)m(indo)n(ws)f(`)p Fw(.bmp)p Fv(')f(\002le)i(with)f(the)g Ft(--bitmap)g Fv(option.)0 4954 y(The)26 b(installer)h(will)g(also)g(display)f(a)h (lar)o(ge)e(title)j(on)e(the)g(desktop)g(background)d(windo)n(w)i(when) h(it)h(is)h(run,)f(which)f(is)h(constructed)0 5054 y(from)c(the)h(name) g(of)g(your)f(distrib)n(ution)g(and)g(the)h(v)o(ersion)f(number)-5 b(.)36 b(This)24 b(can)g(be)g(changed)f(to)h(another)f(te)o(xt)h(by)g (using)f(the)h Ft(--title)0 5154 y Fv(option.)0 5300 y(The)18 b(installer)h(\002le)h(will)f(be)g(written)f(to)h(the)g (\223distrib)n(ution)e(directory\224)g(\227)i(normally)e(`)p Fw(dist/)p Fv(',)h(b)n(ut)h(customizable)e(with)i(the)g Ft(--dist-dir)0 5400 y Fv(option.)p 0 5549 3901 4 v 0 5649 a Fs(26)2391 b(Chapter)23 b(5.)52 b(Creating)24 b(Built)h(Distr)q(ib)n(utions)p eop end %%Page: 27 35 TeXDict begin 27 34 bop 0 83 a Fl(5.3.1)100 b(The)29 b(P)-5 b(ostinstallation)29 b(scr)q(ipt)0 286 y Fv(Starting)20 b(with)h(Python)f(2.3,)g(a)h(postinstallation)e(script)i(can)g(be)f (speci\002ed)h(which)f(the)h Ft(--install-script)f Fv(option.)25 b(The)20 b(basename)g(of)0 386 y(the)g(script)g(must)h(be)f (speci\002ed,)f(and)h(the)g(script)h(\002lename)e(must)h(also)h(be)f (listed)h(in)f(the)g(scripts)h(ar)o(gument)d(to)i(the)g(setup)g (function.)0 532 y(This)h(script)g(will)h(be)f(run)f(at)i(installation) f(time)g(on)g(the)g(tar)o(get)f(system)h(after)g(all)g(the)g(\002les)h (ha)n(v)o(e)f(been)f(copied,)g(with)h Fr(argv[1])g Fv(set)0 632 y(to)f Ft(-install)p Fv(,)g(and)g(again)f(at)i(uninstallation)e (time)h(before)f(the)h(\002les)h(are)f(remo)o(v)o(ed)e(with)i Fr(argv[1])g Fv(set)h(to)f Ft(-r)o(emo)o(v)o(e)p Fv(.)0 779 y(The)h(installation)g(script)g(runs)g(embedded)e(in)j(the)f(windo) n(ws)g(installer)m(,)g(e)n(v)o(ery)f(output)g(\()p Fr(sys.stdout)p Fv(,)f Fr(sys.stderr)p Fv(\))h(is)i(redi-)0 879 y(rected)e(into)g(a)g (b)n(uf)n(fer)f(and)h(will)h(be)f(displayed)f(in)h(the)g(GUI)g(after)g (the)h(script)f(has)g(\002nished.)0 1025 y(Some)g(functions)f (especially)g(useful)h(in)g(this)h(conte)o(xt)e(are)h(a)n(v)n(ailable)g (as)h(additional)e(b)n(uilt-in)g(functions)g(in)h(the)h(installation)e (script.)0 1172 y Fg(directory_created)p Fr(\()p Fp(path)p Fr(\))0 1272 y Fg(file_created)p Fr(\()p Fp(path)p Fr(\))208 1372 y Fv(These)i(functions)e(should)i(be)g(called)g(when)g(a)g (directory)f(or)h(\002le)h(is)g(created)e(by)h(the)h(postinstall)f (script)g(at)h(installation)f(time.)208 1471 y(It)j(will)i(re)o(gister) e Fp(path)f Fv(with)i(the)g(uninstaller)m(,)f(so)h(that)g(it)g(will)g (be)g(remo)o(v)o(ed)d(when)i(the)h(distrib)n(ution)e(is)j(uninstalled.) 37 b(T)-7 b(o)25 b(be)208 1571 y(safe,)20 b(directories)f(are)h(only)f (remo)o(v)o(ed)f(if)j(the)o(y)e(are)h(empty)-5 b(.)0 1718 y Fg(get_special_folder_path)p Fr(\()p Fp(csidl)p 1362 1718 25 4 v 25 w(string)p Fr(\))208 1817 y Fv(This)19 b(function)f(can)i(be)f(used)h(to)f(retrie)n(v)o(e)g(special)g(folder)g (locations)g(on)g(W)m(indo)n(ws)g(lik)o(e)h(the)f(Start)h(Menu)f(or)h (the)f(Desktop.)24 b(It)208 1917 y(returns)19 b(the)h(full)g(path)g(to) g(the)g(folder)-5 b(.)25 b Fp(csidl)p 1491 1917 V 29 w(string)c Fv(must)f(be)g(one)g(of)g(the)g(follo)n(wing)e(strings:)444 2141 y Fn("CSIDL_APPDATA")444 2324 y("CSIDL_COMMON_STARTMENU")444 2415 y("CSIDL_STARTMENU")444 2598 y("CSIDL_COMMON_DESKTOPDIRECTORY")444 2689 y("CSIDL_DESKTOPDIRECTORY")444 2872 y("CSIDL_COMMON_STARTUP")444 2963 y("CSIDL_STARTUP")444 3146 y("CSIDL_COMMON_PROGRAMS")444 3237 y("CSIDL_PROGRAMS")444 3420 y("CSIDL_FONTS")208 3609 y Fv(If)i(the)g(folder)f(cannot)g(be)h(retrie)n(v)o(ed,)e Fr(OSError)i Fv(is)h(raised.)208 3742 y(Which)k(folders)g(are)g(a)n(v)n (ailable)g(depends)f(on)h(the)h(e)o(xact)f(W)m(indo)n(ws)g(v)o(ersion,) g(and)g(probably)e(also)j(the)g(con\002guration.)38 b(F)o(or)208 3842 y(details)20 b(refer)f(to)i(Microsoft')-5 b(s)19 b(documentation)f(of)i(the)g Fr(SHGetSpecialFolderPath\(\))c Fv(function.)0 3988 y Fg(create_shortcut)p Fr(\()p Fp(tar)m(g)o(et,)h (description,)i(\002lename)p Fk([)p Fp(,)g(ar)m(guments)p Fk([)p Fp(,)f(workdir)r Fk([)p Fp(,)j(iconpath)p Fk([)p Fp(,)c(iconinde)n(x)12 b Fk(])g(])g(])g(])p Fr(\))208 4088 y Fv(This)24 b(function)f(creates)i(a)f(shortcut.)37 b Fp(tar)m(g)o(et)26 b Fv(is)g(the)e(path)g(to)h(the)g(program)d(to)j (be)f(started)g(by)h(the)f(shortcut.)37 b Fp(description)24 b Fv(is)208 4188 y(the)h(description)f(of)i(the)g(shortcut.)40 b Fp(\002lename)24 b Fv(is)j(the)f(title)g(of)g(the)f(shortcut)g(that)h (the)f(user)h(will)g(see.)42 b Fp(ar)m(guments)25 b Fv(speci\002es)208 4287 y(the)j(command)e(line)j(ar)o(guments,)f(if)h(an)o(y)-5 b(.)48 b Fp(workdir)31 b Fv(is)f(the)e(w)o(orking)f(directory)g(for)h (the)g(program.)47 b Fp(iconpath)27 b Fv(is)i(the)g(\002le)208 4387 y(containing)17 b(the)h(icon)h(for)f(the)h(shortcut,)f(and)g Fp(iconinde)n(x)g Fv(is)i(the)f(inde)o(x)f(of)g(the)h(icon)g(in)g(the)g (\002le)g Fp(iconpath)p Fv(.)k(Again,)18 b(for)g(details)208 4487 y(consult)h(the)h(Microsoft)g(documentation)d(for)i(the)i Fr(IShellLink)d Fv(interf)o(ace.)p 0 5549 3901 4 v 0 5649 a Fs(5.3.)52 b(Creating)24 b(Windo)o(ws)f(Installers)2591 b(27)p eop end %%Page: 28 36 TeXDict begin 28 35 bop 0 5549 3901 4 v 0 5649 a Fs(28)p eop end %%Page: 29 37 TeXDict begin 29 36 bop 0 83 3901 9 v 3503 230 a Fs(CHAPTER)3707 427 y Fq(SIX)p 0 515 V 678 978 a FB(Register)s(ing)57 b(with)h(the)f(P)-8 b(ac)l(kage)57 b(Inde)-6 b(x)0 1468 y Fv(The)32 b(Python)f(P)o(ackage)f(Inde)o(x)h(\(PyPI\))g(holds)h (meta-data)f(describing)f(distrib)n(utions)h(packaged)f(with)i (distutils.)61 b(The)32 b(distutils)0 1568 y(command)18 b Fr(register)h Fv(is)j(used)e(to)g(submit)g(your)f(distrib)n(ution')-5 b(s)19 b(meta-data)g(to)h(the)h(inde)o(x.)i(It)e(is)g(in)m(v)n(ok)o(ed) d(as)j(follo)n(ws:)236 1806 y Fn(python)44 b(setup.py)g(register)0 2092 y Fv(Distutils)21 b(will)g(respond)e(with)h(the)g(follo)n(wing)f (prompt:)236 2330 y Fn(running)44 b(register)236 2422 y(We)h(need)f(to)g(know)h(who)f(you)g(are,)g(so)h(please)f(choose)f (either:)281 2513 y(1.)i(use)f(your)g(existing)g(login,)281 2604 y(2.)h(register)e(as)i(a)f(new)h(user,)281 2696 y(3.)g(have)f(the)g(server)g(generate)f(a)i(new)f(password)g(for)g(you) g(\(and)h(email)f(it)g(to)h(you\),)f(or)281 2787 y(4.)h(quit)236 2878 y(Your)f(selection)g([default)f(1]:)0 3165 y Fv(Note:)25 b(if)c(your)e(username)g(and)g(passw)o(ord)h(are)g(sa)n(v)o(ed)g (locally)-5 b(,)19 b(you)g(will)i(not)f(see)h(this)f(menu.)0 3312 y(If)25 b(you)f(ha)n(v)o(e)g(not)g(re)o(gistered)g(with)h(PyPI,)g (then)f(you)g(will)i(need)e(to)h(do)f(so)i(no)n(w)-5 b(.)38 b(Y)-9 b(ou)24 b(should)g(choose)g(option)f(2,)j(and)e(enter)h (your)0 3411 y(details)e(as)h(required.)31 b(Soon)23 b(after)f(submitting)g(your)g(details,)i(you)e(will)h(recei)n(v)o(e)f (an)h(email)g(which)g(will)g(be)g(used)g(to)g(con\002rm)f(your)0 3511 y(re)o(gistration.)0 3658 y(Once)e(you)g(are)g(re)o(gistered,)f (you)g(may)h(choose)g(option)f(1)h(from)g(the)g(menu.)k(Y)-9 b(ou)20 b(will)h(be)g(prompted)d(for)i(your)f(PyPI)h(username)f(and)0 3758 y(passw)o(ord,)g(and)h Fr(register)f Fv(will)i(then)f(submit)g (your)f(meta-data)g(to)h(the)g(inde)o(x.)0 3904 y(Y)-9 b(ou)23 b(may)h(submit)f(an)o(y)g(number)f(of)i(v)o(ersions)e(of)i (your)e(distrib)n(ution)h(to)h(the)g(inde)o(x.)34 b(If)24 b(you)f(alter)h(the)g(meta-data)e(for)i(a)g(particular)0 4004 y(v)o(ersion,)19 b(you)g(may)h(submit)g(it)g(again)g(and)f(the)h (inde)o(x)f(will)i(be)f(updated.)0 4151 y(PyPI)i(holds)e(a)i(record)e (for)h(each)g(\(name,)g(v)o(ersion\))f(combination)f(submitted.)28 b(The)21 b(\002rst)h(user)f(to)h(submit)f(information)e(for)i(a)h(gi)n (v)o(en)0 4250 y(name)e(is)i(designated)d(the)i(Owner)f(of)h(that)g (name.)26 b(The)o(y)20 b(may)g(submit)g(changes)g(through)f(the)i Fr(register)e Fv(command)g(or)i(through)0 4350 y(the)h(web)g(interf)o (ace.)29 b(The)o(y)20 b(may)i(also)g(designate)f(other)g(users)h(as)h (Owners)e(or)h(Maintainers.)29 b(Maintainers)21 b(may)g(edit)h(the)g (package)0 4450 y(information,)c(b)n(ut)i(not)g(designate)f(other)g (Owners)h(or)g(Maintainers.)0 4597 y(By)j(def)o(ault)f(PyPI)g(will)i (list)f(all)h(v)o(ersions)d(of)h(a)h(gi)n(v)o(en)f(package.)30 b(T)-7 b(o)23 b(hide)f(certain)g(v)o(ersions,)g(the)h(Hidden)e (property)g(should)g(be)i(set)0 4696 y(to)d(yes.)26 b(This)20 b(must)g(be)g(edited)g(through)e(the)i(web)g(interf)o(ace.)0 5024 y Fo(6.1)121 b(The)34 b(.p)l(ypirc)g(\002le)0 5256 y Fv(The)20 b(format)f(of)h(the)g(`)p Fw(.p)n(ypirc)p Fv(')f(\002le)i(is)g(formated)d(as)j(follo)n(ws:)p 0 5549 3901 4 v 3808 5649 a Fs(29)p eop end %%Page: 30 38 TeXDict begin 30 37 bop 236 174 a Fn([server-login])236 266 y(repository:)43 b()236 357 y(username:)h ()236 448 y(password:)g()0 735 y Fp(r)m(epository)20 b Fv(can)g(be)g(ommitted)f(and)h(def)o(aults)g(to)g Fr(http://www.python.org/pypi)p Fv(.)p 0 5549 3901 4 v 0 5649 a Fs(30)2074 b(Chapter)23 b(6.)52 b(Register)q(ing)24 b(with)g(the)f(P)m(ac)n(kage)g(Inde)n(x)p eop end %%Page: 31 39 TeXDict begin 31 38 bop 0 83 3901 9 v 3503 230 a Fs(CHAPTER)3495 427 y Fq(SEVEN)p 0 515 V 39 978 a FB(Uploading)56 b(P)-8 b(ac)l(kages)57 b(to)h(the)f(P)-8 b(ac)l(kage)57 b(Inde)-6 b(x)0 1468 y Fv(Ne)n(w)20 b(in)h(v)o(ersion)e(2.5.)0 1615 y(The)29 b(Python)f(P)o(ackage)g(Inde)o(x)f(\(PyPI\))i(not)f(only) h(stores)g(the)g(package)f(info,)i(b)n(ut)f(also)h(the)f(package)e (data)i(if)h(the)f(author)f(of)h(the)0 1714 y(package)19 b(wishes)h(to.)26 b(The)19 b(distutils)i(command)d Fr(upload)i Fv(pushes)g(the)g(distrib)n(ution)f(\002les)i(to)f(PyPI.)0 1861 y(The)g(command)e(is)j(in)m(v)n(ok)o(ed)e(immediately)f(after)i(b) n(uilding)f(one)h(or)g(more)f(distrib)n(ution)g(\002les.)26 b(F)o(or)20 b(e)o(xample,)e(the)j(command)236 2099 y Fn(python)44 b(setup.py)g(sdist)g(bdist_wininst)e(upload)0 2386 y Fv(will)22 b(cause)g(the)g(source)f(distrib)n(ution)f(and)h(the) h(W)m(indo)n(ws)f(installer)h(to)g(be)f(uploaded)f(to)i(PyPI.)f(Note)h (that)g(these)g(will)g(be)g(uploaded)0 2486 y(e)n(v)o(en)e(if)i(the)o (y)e(are)i(b)n(uilt)f(using)g(an)g(earlier)g(in)m(v)n(ocation)e(of)i(`) p Fw(setup)m(.p)n(y)p Fv(',)f(b)n(ut)i(that)f(only)f(distrib)n(utions)h (named)f(on)h(the)g(command)e(line)0 2585 y(for)h(the)g(in)m(v)n (ocation)e(including)g(the)j Fr(upload)e Fv(command)f(are)j(uploaded.)0 2732 y(The)26 b Fr(upload)g Fv(command)f(uses)i(the)f(username,)h (passw)o(ord,)g(and)f(repository)f(URL)i(from)e(the)i(`)p Fw($HOME/.p)n(ypirc)p Fv(')d(\002le)k(\(see)e(sec-)0 2832 y(tion)20 b(6.1)f(for)h(more)f(on)h(this)h(\002le\).)0 2979 y(Y)-9 b(ou)22 b(can)h(use)g(the)g Ft(--sign)f Fv(option)g(to)h (tell)g Fr(upload)g Fv(to)f(sign)h(each)g(uploaded)d(\002le)k(using)e (GPG)i(\(GNU)e(Pri)n(v)n(ac)o(y)g(Guard\).)31 b(The)23 b Ft(gpg)0 3078 y Fv(program)17 b(must)i(be)g(a)n(v)n(ailable)f(for)g (e)o(x)o(ecution)f(on)i(the)g(system)g(P)-8 b(A)f(TH.)19 b(Y)-9 b(ou)18 b(can)h(also)g(specify)g(which)f(k)o(e)o(y)g(to)i(use)f (for)f(signing)g(using)0 3178 y(the)i Ft(--identity=)p Fd(name)f Fv(option.)0 3325 y(Other)65 b Fr(upload)g Fv(options)f(include)g Ft(--r)o(epository=)p Fd(url)h Fv(\(which)f(lets)i(you)f(o)o(v)o(erride)e(the)i(repository)e(setting)j (from)0 3424 y(`)p Fw($HOME/.p)n(ypirc)p Fv('\),)17 b(and)h Ft(--sho)o(w-r)o(esponse)g Fv(\(which)g(displays)g(the)h(full)g (response)f(te)o(xt)g(from)g(the)h(PyPI)g(serv)o(er)f(for)g(help)g(in)h (deb)n(ug-)0 3524 y(ging)g(upload)g(problems\).)p 0 5549 3901 4 v 3808 5649 a Fs(31)p eop end %%Page: 32 40 TeXDict begin 32 39 bop 0 5549 3901 4 v 0 5649 a Fs(32)p eop end %%Page: 33 41 TeXDict begin 33 40 bop 0 83 3901 9 v 3503 230 a Fs(CHAPTER)3535 427 y Fq(EIGHT)p 0 515 V 2993 978 a FB(Examples)0 1465 y Fv(This)17 b(chapter)f(pro)o(vides)g(a)h(number)e(of)i(basic)h(e)o (xamples)e(to)h(help)g(get)g(started)g(with)g(distutils.)24 b(Additional)16 b(information)f(about)h(using)0 1565 y(distutils)21 b(can)f(be)g(found)e(in)j(the)f(Distutils)h(Cookbook.)0 1712 y Ft(See)g(Also:)0 1858 y Fv(Distutils)g(Cookbook)208 1958 y(Collection)e(of)h(recipes)g(sho)n(wing)f(ho)n(w)h(to)g(achie)n (v)o(e)f(more)g(control)g(o)o(v)o(er)g(distutils.)0 2285 y Fo(8.1)121 b(Pure)33 b(Python)i(distr)r(ib)n(ution)f(\(b)n(y)e (module\))0 2518 y Fv(If)25 b(you')l(re)e(just)j(distrib)n(uting)e(a)h (couple)f(of)h(modules,)g(especially)g(if)g(the)o(y)g(don')o(t)e(li)n (v)o(e)i(in)g(a)h(particular)d(package,)i(you)f(can)h(specify)0 2618 y(them)20 b(indi)n(vidually)e(using)h(the)i Fw(p)n(y)p 1011 2618 23 4 v 26 w(modules)e Fv(option)g(in)i(the)f(setup)g(script.) 0 2765 y(In)26 b(the)h(simplest)f(case,)j(you')o(ll)c(ha)n(v)o(e)h(tw)o (o)h(\002les)g(to)g(w)o(orry)e(about:)37 b(a)27 b(setup)f(script)h(and) f(the)g(single)g(module)f(you')l(re)g(distrib)n(uting,)0 2864 y(`)p Fw(f)n(oo)m(.p)n(y)p Fv(')18 b(in)i(this)h(e)o(xample:)236 3103 y Fn(/)595 3194 y(setup.py)595 3285 y(foo.py)0 3524 y Fv(\(In)16 b(all)h(diagrams)e(in)h(this)h(section,)g Fr()f Fv(will)h(refer)e(to)i(the)f(distrib)n(ution)f(root)h (directory)-5 b(.\))21 b(A)c(minimal)e(setup)i(script)f(to)g(describe)0 3624 y(this)21 b(situation)e(w)o(ould)h(be:)236 3862 y Fn(from)44 b(distutils.core)f(import)h(setup)236 3954 y(setup\(name='foo',)505 4045 y(version='1.0',)505 4136 y(py_modules=['foo'],)505 4228 y(\))0 4467 y Fv(Note)21 b(that)f(the)h(name)f(of)g(the)h(distrib)n(ution)e(is)j(speci\002ed)e (independently)e(with)j(the)f Fw(name)h Fv(option,)e(and)h(there')-5 b(s)20 b(no)h(rule)f(that)h(says)g(it)0 4566 y(has)c(to)g(be)f(the)h (same)g(as)g(the)g(name)f(of)g(the)h(sole)g(module)e(in)i(the)f (distrib)n(ution)g(\(although)e(that')-5 b(s)17 b(probably)d(a)k(good)d (con)m(v)o(ention)e(to)k(fol-)0 4666 y(lo)n(w\).)27 b(Ho)n(we)n(v)o(er) m(,)18 b(the)j(distrib)n(ution)f(name)g(is)i(used)e(to)h(generate)f (\002lenames,)h(so)g(you)f(should)f(stick)j(to)f(letters,)g(digits,)g (underscores,)0 4766 y(and)f(hyphens.)0 4913 y(Since)25 b Fw(p)n(y)p 291 4913 V 27 w(modules)f Fv(is)i(a)f(list,)i(you)d(can)h (of)g(course)f(specify)g(multiple)h(modules,)g(e)o(g.)39 b(if)25 b(you')l(re)e(distrib)n(uting)h(modules)g Fr(foo)h Fv(and)0 5012 y Fr(bar)p Fv(,)20 b(your)f(setup)h(might)f(look)h(lik)o (e)g(this:)p 0 5549 3901 4 v 3808 5649 a Fs(33)p eop end %%Page: 34 42 TeXDict begin 34 41 bop 236 83 a Fn(/)595 174 y(setup.py)595 266 y(foo.py)595 357 y(bar.py)0 596 y Fv(and)20 b(the)g(setup)g(script) g(might)g(be)236 743 y Fn(from)44 b(distutils.core)f(import)h(setup)236 834 y(setup\(name='foobar',)505 926 y(version='1.0',)505 1017 y(py_modules=['foo',)e('bar'],)505 1108 y(\))0 1395 y Fv(Y)-9 b(ou)19 b(can)h(put)f(module)f(source)h(\002les)i(into)e (another)f(directory)-5 b(,)18 b(b)n(ut)h(if)h(you)f(ha)n(v)o(e)g (enough)f(modules)h(to)g(do)h(that,)f(it')-5 b(s)21 b(probably)c (easier)0 1495 y(to)j(specify)g(modules)f(by)h(package)e(rather)i(than) g(listing)g(them)g(indi)n(vidually)-5 b(.)0 1822 y Fo(8.2)121 b(Pure)33 b(Python)i(distr)r(ib)n(ution)f(\(b)n(y)e(pac)n(kage\))0 2055 y Fv(If)17 b(you)g(ha)n(v)o(e)g(more)g(than)g(a)h(couple)f(of)g (modules)f(to)i(distrib)n(ute,)g(especially)f(if)h(the)o(y)e(are)i(in)g (multiple)f(packages,)f(it')-5 b(s)19 b(probably)c(easier)0 2154 y(to)20 b(specify)g(whole)g(packages)f(rather)g(than)h(indi)n (vidual)e(modules.)24 b(This)c(w)o(orks)g(e)n(v)o(en)f(if)i(your)e (modules)g(are)h(not)g(in)g(a)h(package;)d(you)0 2254 y(can)26 b(just)h(tell)g(the)g(Distutils)g(to)g(process)f(modules)g (from)f(the)h(root)g(package,)h(and)f(that)g(w)o(orks)g(the)h(same)f (as)i(an)o(y)d(other)h(package)0 2354 y(\(e)o(xcept)19 b(that)h(you)f(don')o(t)g(ha)n(v)o(e)h(to)g(ha)n(v)o(e)f(an)i(`)p 1315 2354 23 4 v 1342 2354 V 53 w Fw(init)p 1465 2354 V 1491 2354 V 52 w(.p)n(y)p Fv(')f(\002le\).)0 2501 y(The)g(setup)g (script)g(from)f(the)h(last)i(e)o(xample)c(could)i(also)g(be)g(written) g(as)236 2647 y Fn(from)44 b(distutils.core)f(import)h(setup)236 2739 y(setup\(name='foobar',)505 2830 y(version='1.0',)505 2921 y(packages=[''],)505 3013 y(\))0 3252 y Fv(\(The)20 b(empty)f(string)h(stands)g(for)g(the)g(root)f(package.\))0 3399 y(If)h(those)g(tw)o(o)h(\002les)g(are)f(mo)o(v)o(ed)e(into)i(a)h (subdirectory)-5 b(,)17 b(b)n(ut)j(remain)f(in)i(the)f(root)f(package,) g(e.g.:)236 3546 y Fn(/)595 3637 y(setup.py)595 3728 y(src/)268 b(foo.py)1043 3820 y(bar.py)0 4059 y Fv(then)21 b(you)g(w)o(ould)g(still)i(specify)e(the)g(root)g(package,)g (b)n(ut)g(you)g(ha)n(v)o(e)g(to)h(tell)h(the)e(Distutils)i(where)e (source)g(\002les)i(in)e(the)h(root)f(package)0 4159 y(li)n(v)o(e:)236 4305 y Fn(from)44 b(distutils.core)f(import)h(setup) 236 4397 y(setup\(name='foobar',)505 4488 y(version='1.0',)505 4579 y(package_dir={'':)e('src'},)505 4671 y(packages=[''],)505 4762 y(\))0 5049 y Fv(More)23 b(typically)-5 b(,)24 b(though,)f(you)g (will)i(w)o(ant)f(to)h(distrib)n(ute)e(multiple)h(modules)f(in)h(the)g (same)g(package)f(\(or)h(in)g(sub-packages\).)34 b(F)o(or)0 5148 y(e)o(xample,)19 b(if)h(the)g Fr(foo)g Fv(and)g Fr(bar)g Fv(modules)f(belong)g(in)h(package)f Fr(foobar)p Fv(,)h(one)f(w)o(ay)h(to)h(layout)e(your)g(source)g(tree)i(is)p 0 5549 3901 4 v 0 5649 a Fs(34)3004 b(Chapter)24 b(8.)52 b(Examples)p eop end %%Page: 35 43 TeXDict begin 35 42 bop 236 83 a Fn(/)595 174 y(setup.py)595 266 y(foobar/)998 357 y(__init__.py)998 448 y(foo.py)998 540 y(bar.py)0 779 y Fv(This)21 b(is)h(in)f(f)o(act)h(the)f(def)o(ault) f(layout)g(e)o(xpected)f(by)i(the)g(Distutils,)h(and)e(the)i(one)e (that)h(requires)f(the)h(least)h(w)o(ork)e(to)h(describe)g(in)g(your)0 879 y(setup)f(script:)236 1025 y Fn(from)44 b(distutils.core)f(import)h (setup)236 1117 y(setup\(name='foobar',)505 1208 y(version='1.0',)505 1299 y(packages=['foobar'],)505 1391 y(\))0 1677 y Fv(If)25 b(you)g(w)o(ant)g(to)h(put)f(modules)f(in)h(directories)g(not)g(named)f (for)h(their)g(package,)g(then)g(you)f(need)h(to)g(use)h(the)f Fw(pac)o(kage)p 3558 1677 23 4 v 25 w(dir)g Fv(option)0 1777 y(again.)f(F)o(or)c(e)o(xample,)e(if)j(the)f(`)p Fw(src)p Fv(')h(directory)d(holds)i(modules)f(in)h(the)g Fr(foobar)g Fv(package:)236 2015 y Fn(/)595 2106 y(setup.py)595 2198 y(src/)998 2289 y(__init__.py)998 2380 y(foo.py)998 2472 y(bar.py)0 2711 y Fv(an)g(appropriate)e(setup)i (script)g(w)o(ould)g(be)236 2949 y Fn(from)44 b(distutils.core)f (import)h(setup)236 3040 y(setup\(name='foobar',)505 3132 y(version='1.0',)505 3223 y(package_dir={'foobar':)d('src'},)505 3314 y(packages=['foobar'],)505 3406 y(\))0 3692 y Fv(Or)m(,)20 b(you)f(might)h(put)f(modules)h(from)f(your)g(main)g(package)g(right)h (in)g(the)g(distrib)n(ution)f(root:)236 3930 y Fn(/)595 4022 y(setup.py)595 4113 y(__init__.py)595 4204 y(foo.py)595 4296 y(bar.py)0 4535 y Fv(in)h(which)g(case)h(your)e(setup)h(script)g (w)o(ould)f(be)236 4773 y Fn(from)44 b(distutils.core)f(import)h(setup) 236 4865 y(setup\(name='foobar',)505 4956 y(version='1.0',)505 5047 y(package_dir={'foobar':)d(''},)505 5139 y(packages=['foobar'],) 505 5230 y(\))p 0 5549 3901 4 v 0 5649 a Fs(8.2.)52 b(Pure)24 b(Python)f(distr)q(ib)n(ution)i(\(b)n(y)e(pac)n(kage\))2237 b(35)p eop end %%Page: 36 44 TeXDict begin 36 43 bop 0 83 a Fv(\(The)20 b(empty)f(string)h(also)g (stands)g(for)g(the)g(current)f(directory)-5 b(.\))0 230 y(If)28 b(you)g(ha)n(v)o(e)g(sub-packages,)g(the)o(y)g(must)g(be)h (e)o(xplicitly)e(listed)i(in)g Fw(pac)o(kages)p Fv(,)g(b)n(ut)f(an)o(y) g(entries)g(in)h Fw(pac)o(kage)p 3315 230 23 4 v 25 w(dir)f Fv(automatically)0 330 y(e)o(xtend)h(to)i(sub-packages.)53 b(\(In)30 b(other)g(w)o(ords,)i(the)e(Distutils)i(does)e Fp(not)g Fv(scan)h(your)e(source)h(tree,)i(trying)e(to)g(\002gure)g (out)g(which)0 429 y(directories)24 b(correspond)e(to)j(Python)e (packages)g(by)i(looking)e(for)h(`)p 1991 429 V 2018 429 V 53 w Fw(init)p 2141 429 V 2167 429 V 52 w(.p)n(y)p Fv(')h(\002les.\))39 b(Thus,)25 b(if)g(the)f(def)o(ault)g(layout)g(gro) n(ws)g(a)h(sub-)0 529 y(package:)236 767 y Fn(/)595 858 y(setup.py)595 950 y(foobar/)998 1041 y(__init__.py)998 1132 y(foo.py)998 1224 y(bar.py)998 1315 y(subfoo/)1447 1406 y(__init__.py)1447 1498 y(blah.py)0 1737 y Fv(then)20 b(the)g(corresponding)d(setup)j(script)g(w)o(ould)f(be)236 1975 y Fn(from)44 b(distutils.core)f(import)h(setup)236 2066 y(setup\(name='foobar',)505 2158 y(version='1.0',)505 2249 y(packages=['foobar',)e('foobar.subfoo'],)505 2340 y(\))0 2580 y Fv(\(Again,)19 b(the)h(empty)f(string)h(in)g Fw(pac)o(kage)p 1204 2580 V 25 w(dir)g Fv(stands)g(for)g(the)g(current) f(directory)-5 b(.\))0 2907 y Fo(8.3)121 b(Single)33 b(e)l(xtension)j(module)0 3140 y Fv(Extension)22 b(modules)h(are)h (speci\002ed)g(using)f(the)h Fw(e)n(xt)p 1540 3140 V 26 w(modules)f Fv(option.)34 b Fw(pac)o(kage)p 2425 3140 V 25 w(dir)24 b Fv(has)g(no)f(ef)n(fect)g(on)h(where)f(e)o(xtension)f (source)0 3239 y(\002les)h(are)f(found;)f(it)h(only)f(af)n(fects)h(the) g(source)f(for)g(pure)g(Python)g(modules.)29 b(The)21 b(simplest)i(case,)f(a)g(single)g(e)o(xtension)f(module)f(in)i(a)0 3339 y(single)e(C)h(source)f(\002le,)g(is:)236 3577 y Fn(/)595 3669 y(setup.py)595 3760 y(foo.c)0 3999 y Fv(If)g(the)g Fr(foo)g Fv(e)o(xtension)f(belongs)g(in)i(the)f(root)f (package,)g(the)h(setup)g(script)g(for)g(this)g(could)g(be)236 4237 y Fn(from)44 b(distutils.core)f(import)h(setup)236 4329 y(from)g(distutils.extension)e(import)i(Extension)236 4420 y(setup\(name='foobar',)505 4511 y(version='1.0',)505 4603 y(ext_modules=[Extension\('foo',)c(['foo.c']\)],)505 4694 y(\))0 4981 y Fv(If)20 b(the)g(e)o(xtension)f(actually)h(belongs)f (in)h(a)h(package,)d(say)i Fr(foopkg)p Fv(,)g(then)0 5127 y(W)m(ith)k(e)o(xactly)f(the)i(same)f(source)f(tree)h(layout,)g (this)h(e)o(xtension)d(can)i(be)g(put)g(in)g(the)g Fr(foopkg)g Fv(package)e(simply)i(by)g(changing)e(the)0 5227 y(name)e(of)f(the)i(e) o(xtension:)p 0 5549 3901 4 v 0 5649 a Fs(36)3004 b(Chapter)24 b(8.)52 b(Examples)p eop end %%Page: 37 45 TeXDict begin 37 44 bop 236 174 a Fn(from)44 b(distutils.core)f(import) h(setup)236 266 y(from)g(distutils.extension)e(import)i(Extension)236 357 y(setup\(name='foobar',)505 448 y(version='1.0',)505 540 y(ext_modules=[Extension\('foopkg.foo',)39 b(['foo.c']\)],)505 631 y(\))p 0 5549 3901 4 v 0 5649 a Fs(8.3.)52 b(Single)25 b(e)n(xtension)e(module)2717 b(37)p eop end %%Page: 38 46 TeXDict begin 38 45 bop 0 5549 3901 4 v 0 5649 a Fs(38)p eop end %%Page: 39 47 TeXDict begin 39 46 bop 0 83 3901 9 v 3503 230 a Fs(CHAPTER)3614 427 y Fq(NINE)p 0 515 V 2144 978 a FB(Extending)57 b(Distutils)0 1468 y Fv(Distutils)31 b(can)e(be)h(e)o(xtended)e(in)i(v)n(arious)e(w)o (ays.)54 b(Most)30 b(e)o(xtensions)f(tak)o(e)h(the)g(form)e(of)i(ne)n (w)f(commands)f(or)i(replacements)e(for)0 1568 y(e)o(xisting)16 b(commands.)22 b(Ne)n(w)17 b(commands)e(may)h(be)g(written)h(to)g (support)e(ne)n(w)h(types)h(of)f(platform-speci\002c)e(packaging,)h (for)h(e)o(xample,)0 1667 y(while)h(replacements)e(for)h(e)o(xisting)g (commands)e(may)j(be)f(made)g(to)h(modify)e(details)i(of)f(ho)n(w)g (the)h(command)d(operates)i(on)g(a)h(package.)0 1814 y(Most)30 b(e)o(xtensions)e(of)h(the)h(distutils)g(are)f(made)g(within) h(`)p Fw(setup)m(.p)n(y)p Fv(')e(scripts)i(that)f(w)o(ant)h(to)f (modify)f(e)o(xisting)h(commands;)k(man)o(y)0 1914 y(simply)20 b(add)f(a)i(fe)n(w)f(\002le)h(e)o(xtensions)e(that)h(should)g(be)g (copied)f(into)h(packages)f(in)h(addition)f(to)h(`)p Fw(.p)n(y)p Fv(')g(\002les)h(as)g(a)f(con)m(v)o(enience.)0 2061 y(Most)i(distutils)h(command)d(implementations)g(are)i(subclasses) g(of)g(the)g Fr(Command)g Fv(class)h(from)e Fr(distutils.cmd)p Fv(.)28 b(Ne)n(w)22 b(com-)0 2160 y(mands)e(may)h(directly)f(inherit)g (from)g Fr(Command)p Fv(,)g(while)h(replacements)f(often)g(deri)n(v)o (e)g(from)f Fr(Command)i Fv(indirectly)-5 b(,)19 b(directly)h(sub-)0 2260 y(classing)g(the)g(command)f(the)o(y)g(are)h(replacing.)k (Commands)19 b(are)h(required)e(to)j(deri)n(v)o(e)d(from)i Fr(Command)p Fv(.)0 2587 y Fo(9.1)121 b(Integ)o(r)o(ating)35 b(ne)n(w)g(commands)0 2820 y Fv(There)22 b(are)h(dif)n(ferent)e(w)o (ays)j(to)f(inte)o(grate)e(ne)n(w)i(command)e(implementations)g(into)i (distutils.)34 b(The)22 b(most)h(dif)n(\002cult)g(is)g(to)h(lobby)d (for)0 2920 y(the)26 b(inclusion)e(of)h(the)h(ne)n(w)f(features)g(in)h (distutils)g(itself,)h(and)e(w)o(ait)h(for)f(\(and)g(require\))e(a)j(v) o(ersion)f(of)g(Python)f(that)i(pro)o(vides)d(that)0 3019 y(support.)h(This)c(is)h(really)f(hard)f(for)h(man)o(y)f(reasons.) 0 3166 y(The)g(most)h(common,)d(and)i(possibly)g(the)g(most)h (reasonable)e(for)g(most)i(needs,)f(is)h(to)g(include)e(the)i(ne)n(w)f (implementations)e(with)j(your)0 3266 y(`)p Fw(setup)m(.p)n(y)p Fv(')f(script,)h(and)f(cause)h(the)h Fr(distutils.core.setup\(\))16 b Fv(function)j(use)h(them:)236 3504 y Fn(from)44 b (distutils.command.build_py)d(import)j(build_py)f(as)i(_build_py)236 3595 y(from)f(distutils.core)f(import)h(setup)236 3778 y(class)g(build_py\(_build_py\):)416 3869 y("""Specialized)e(Python)i (source)g(builder.""")416 4052 y(#)g(implement)g(whatever)f(needs)h(to) h(be)f(different...)236 4235 y(setup\(cmdclass={'build_py':)d (build_py},)505 4326 y(...\))0 4612 y Fv(This)29 b(approach)d(is)j (most)g(v)n(aluable)e(if)i(the)f(ne)n(w)h(implementations)d(must)j(be)f (used)h(to)f(use)h(a)g(particular)e(package,)i(as)g(e)n(v)o(eryone)0 4712 y(interested)20 b(in)g(the)g(package)f(will)i(need)e(to)i(ha)n(v)o (e)e(the)h(ne)n(w)g(command)f(implementation.)0 4859 y(Be)o(ginning)30 b(with)h(Python)g(2.4,)i(a)f(third)f(option)f(is)i(a) n(v)n(ailable,)i(intended)c(to)h(allo)n(w)h(ne)n(w)f(commands)f(to)h (be)h(added)e(which)h(can)0 4959 y(support)f(e)o(xisting)h(`)p Fw(setup)m(.p)n(y)p Fv(')f(scripts)i(without)f(requiring)e (modi\002cations)h(to)i(the)f(Python)g(installation.)58 b(This)32 b(is)h(e)o(xpected)c(to)0 5058 y(allo)n(w)i(third-party)e(e)o (xtensions)i(to)g(pro)o(vide)e(support)h(for)h(additional)f(packaging)f (systems,)35 b(b)n(ut)c(the)h(commands)d(can)j(be)f(used)0 5158 y(for)26 b(an)o(ything)f(distutils)j(commands)d(can)i(be)g(used)g (for)-5 b(.)46 b(A)27 b(ne)n(w)g(con\002guration)e(option,)i Fw(command)p 3025 5158 23 4 v 26 w(pac)o(kages)f Fv(\(command-line)0 5257 y(option)21 b Ft(--command-packages)p Fv(\),)g(can)h(be)g(used)h (to)f(specify)g(additional)f(packages)h(to)g(be)h(searched)e(for)h (modules)g(implementing)0 5357 y(commands.)i(Lik)o(e)d(all)g(distutils) g(options,)e(this)i(can)g(be)f(speci\002ed)g(on)g(the)h(command)d(line) j(or)f(in)h(a)g(con\002guration)d(\002le.)26 b(This)21 b(option)p 0 5549 3901 4 v 3808 5649 a Fs(39)p eop end %%Page: 40 48 TeXDict begin 40 47 bop 0 83 a Fv(can)19 b(only)g(be)g(set)i(in)e(the)h Fr([global])e Fv(section)i(of)f(a)h(con\002guration)d(\002le,)j(or)f (before)f(an)o(y)h(commands)f(on)h(the)g(command)f(line.)24 b(If)c(set)0 183 y(in)h(a)g(con\002guration)d(\002le,)k(it)g(can)e(be)h (o)o(v)o(erridden)d(from)h(the)i(command)e(line;)j(setting)e(it)i(to)f (an)g(empty)f(string)g(on)h(the)g(command)d(line)0 282 y(causes)i(the)h(def)o(ault)e(to)h(be)h(used.)j(This)d(should)e(ne)n(v) o(er)g(be)h(set)h(in)f(a)h(con\002guration)c(\002le)k(pro)o(vided)d (with)i(a)h(package.)0 429 y(This)40 b(ne)n(w)g(option)f(can)h(be)g (used)g(to)g(add)g(an)o(y)f(number)f(of)i(packages)f(to)h(the)g(list)h (of)f(packages)f(searched)g(for)h(command)0 529 y(implementations;)k (multiple)36 b(package)g(names)h(should)f(be)h(separated)f(by)h (commas.)75 b(When)37 b(not)g(speci\002ed,)k(the)c(search)g(is)0 628 y(only)e(performed)e(in)j(the)g Fr(distutils.command)d Fv(package.)70 b(When)36 b(`)p Fw(setup)m(.p)n(y)p Fv(')e(is)j(run)e (with)h(the)g(option)f Ft(--command-)0 728 y(packages)f(distcmds,b)n (uildcmds)p Fv(,)40 b(ho)n(we)n(v)o(er)m(,)c(the)f(packages)e Fr(distutils.command)p Fv(,)j Fr(distcmds)p Fv(,)h(and)d Fr(buildcmds)0 828 y Fv(will)h(be)g(searched)f(in)h(that)f(order)-5 b(.)68 b(Ne)n(w)35 b(commands)e(are)h(e)o(xpected)g(to)g(be)h (implemented)e(in)i(modules)e(of)i(the)f(same)h(name)0 927 y(as)g(the)g(command)e(by)h(classes)i(sharing)e(the)g(same)h(name.) 68 b(Gi)n(v)o(en)34 b(the)h(e)o(xample)e(command)g(line)i(option)e(abo) o(v)o(e,)k(the)d(com-)0 1027 y(mand)28 b Fr(bdist_openpkg)e Fv(could)i(be)g(implemented)f(by)h(the)g(class)i Fr (distcmds.bdist_openpkg.bdist_openp)o(kg)0 1127 y Fv(or)20 b Fr(buildcmds.bdist_openpkg.bdist_openp)o(kg)p Fv(.)0 1454 y Fo(9.2)121 b(Adding)34 b(ne)n(w)g(distr)r(ib)n(ution)g(types)0 1687 y Fv(Commands)k(that)i(create)f(distrib)n(utions)g(\(\002les)h(in) g(the)f(`)p Fw(dist/)p Fv(')f(directory\))g(need)h(to)g(add)g Fr(\()p Fp(command)r Fr(,)48 b Fp(\002lename)p Fr(\))38 b Fv(pairs)h(to)0 1786 y Fr(self.distribution.dist_files)23 b Fv(so)28 b(that)f Fr(upload)g Fv(can)g(upload)f(it)i(to)g(PyPI.)f (The)g Fp(\002lename)f Fv(in)i(the)f(pair)g(contains)0 1886 y(no)e(path)f(information,)g(only)g(the)i(name)e(of)h(the)g (\002le)h(itself.)40 b(In)25 b(dry-run)e(mode,)i(pairs)g(should)f (still)i(be)f(added)f(to)i(represent)e(what)0 1986 y(w)o(ould)19 b(ha)n(v)o(e)h(been)g(created.)p 0 5549 3901 4 v 0 5649 a Fs(40)2663 b(Chapter)23 b(9.)52 b(Extending)24 b(Distutils)p eop end %%Page: 41 49 TeXDict begin 41 48 bop 0 83 3901 9 v 3503 230 a Fs(CHAPTER)3661 427 y Fq(TEN)p 0 515 V 1943 978 a FB(Command)57 b(Ref)-6 b(erence)0 1506 y Fo(10.1)121 b(Installing)34 b(modules:)42 b(the)35 b Fc(install)c Fo(command)j(f)l(amily)0 1739 y Fv(The)16 b(install)g(command)e(ensures)i(that)g(the)g(b)n(uild)f (commands)f(ha)n(v)o(e)i(been)f(run)g(and)h(then)f(runs)h(the)g (subcommands)d Fr(install_lib)p Fv(,)0 1839 y Fr(install_data)19 b Fv(and)g Fr(install_scripts)p Fv(.)0 2121 y Fl(10.1.1)101 b Fb(install_data)0 2324 y Fv(This)20 b(command)f(installs)i(all)f (data)g(\002les)i(pro)o(vided)17 b(with)k(the)f(distrib)n(ution.)0 2607 y Fl(10.1.2)101 b Fb(install_scripts)0 2810 y Fv(This)20 b(command)f(installs)i(all)f(\(Python\))f(scripts)h(in)h(the)f(distrib) n(ution.)0 3134 y Fo(10.2)121 b(Creating)35 b(a)f(source)g(distr)r(ib)n (ution:)42 b(the)34 b Fc(sdist)e Fo(command)0 3367 y Ft(**fragment)18 b(mo)o(v)o(ed)i(do)o(wn)h(fr)o(om)f(abo)o(v)o(e:)k (needs)d(context!**)0 3514 y Fv(The)f(manifest)g(template)f(commands)g (are:)98 3727 y Ft(Command)1315 b(Description)p 48 3760 3804 4 v 98 3829 a Fr(include)49 b Fp(pat1)f(pat2)g Fr(...)746 b Fv(include)19 b(all)i(\002les)g(matching)e(an)o(y)g(of)h(the)h (listed)f(patterns)98 3929 y Fr(exclude)49 b Fp(pat1)f(pat2)g Fr(...)746 b Fv(e)o(xclude)19 b(all)i(\002les)g(matching)e(an)o(y)g(of) h(the)g(listed)h(patterns)98 4029 y Fr(recursive-include)47 b Fp(dir)k(pat1)e(pat2)f Fr(...)99 b Fv(include)19 b(all)i(\002les)g (under)e Fp(dir)k Fv(matching)18 b(an)o(y)i(of)g(the)g(listed)h (patterns)98 4128 y Fr(recursive-exclude)47 b Fp(dir)k(pat1)e(pat2)f Fr(...)99 b Fv(e)o(xclude)19 b(all)i(\002les)g(under)e Fp(dir)j Fv(matching)d(an)o(y)g(of)h(the)g(listed)h(patterns)98 4228 y Fr(global-include)47 b Fp(pat1)i(pat2)f Fr(...)397 b Fv(include)19 b(all)i(\002les)g(an)o(ywhere)e(in)h(the)g(source)g (tree)g(matching)1787 4328 y(an)o(y)g(of)g(the)g(listed)g(patterns)98 4427 y Fr(global-exclude)47 b Fp(pat1)i(pat2)f Fr(...)397 b Fv(e)o(xclude)19 b(all)i(\002les)g(an)o(ywhere)d(in)i(the)h(source)e (tree)h(matching)1787 4527 y(an)o(y)g(of)g(the)g(listed)g(patterns)98 4627 y Fr(prune)49 b Fp(dir)1293 b Fv(e)o(xclude)19 b(all)i(\002les)g (under)e Fp(dir)98 4726 y Fr(graft)49 b Fp(dir)1293 b Fv(include)19 b(all)i(\002les)g(under)e Fp(dir)0 4937 y Fv(The)i(patterns)g(here)g(are)i(U)t Fm(N)t(I)t(X)r Fv(-style)f(\223glob\224)e(patterns:)1682 4952 y Fr(*)1754 4937 y Fv(matches)h(an)o(y)f(sequence)h(of)g(re)o(gular)f(\002lename)g (characters,)h Fr(?)29 b Fv(matches)0 5037 y(an)o(y)i(single)g(re)o (gular)e(\002lename)i(character)m(,)i(and)d Fr([)p Fp(r)o(ang)o(e)p Fr(])g Fv(matches)h(an)o(y)g(of)g(the)g(characters)g(in)g Fp(r)o(ang)o(e)g Fv(\(e.g.,)i Fr(a-z)p Fv(,)g Fr(a-zA-Z)p Fv(,)0 5137 y Fr(a-f0-9_.)p Fv(\).)24 b(The)19 b(de\002nition)g(of)h (\223re)o(gular)f(\002lename)g(character\224)g(is)i (platform-speci\002c:)i(on)f(U)t Fm(N)t(I)t(X)h Fv(it)e(is)g(an)o (ything)d(e)o(xcept)h(slash;)0 5236 y(on)h(W)m(indo)n(ws)f(an)o(ything) f(e)o(xcept)i(backslash)f(or)h(colon;)f(on)h(Mac)g(OS)h(9)g(an)o (ything)d(e)o(xcept)h(colon.)0 5383 y Ft(**W)o(indo)o(ws)h(support)g (not)g(ther)o(e)g(y)o(et**)p 0 5549 3901 4 v 3808 5649 a Fs(41)p eop end %%Page: 42 50 TeXDict begin 42 49 bop 0 5549 3901 4 v 0 5649 a Fs(42)p eop end %%Page: 43 51 TeXDict begin 43 50 bop 0 83 3901 9 v 3503 230 a Fs(CHAPTER)3422 427 y Fq(ELEVEN)p 0 515 V 2506 978 a FB(API)57 b(Ref)-6 b(erence)0 1506 y Fo(11.1)121 b Fc(distutils.core)30 b Fo(\227)i(Core)j(Distutils)d(functionality)0 1739 y Fv(The)27 b Fr(distutils.core)e Fv(module)h(is)i(the)f(only)f(module)g (that)h(needs)g(to)g(be)g(installed)g(to)h(use)f(the)g(Distutils.)47 b(It)27 b(pro)o(vides)f(the)0 1839 y Fr(setup\(\))i Fv(\(which)g(is)h (called)f(from)g(the)h(setup)f(script\).)50 b(Indirectly)27 b(pro)o(vides)f(the)j Fr(distutils.dist.Distribution)0 1939 y Fv(and)20 b Fr(distutils.cmd.Command)c Fv(class.)0 2085 y Fg(setup)p Fr(\()p Fp(ar)m(guments)p Fr(\))208 2185 y Fv(The)i(basic)h(do-e)n(v)o(erything)c(function)j(that)h(does)f (most)h(e)n(v)o(erything)e(you)h(could)g(e)n(v)o(er)g(ask)h(for)g(from) f(a)h(Distutils)h(method.)j(See)208 2285 y(XXXXX)208 2417 y(The)c(setup)h(function)f(tak)o(es)h(a)h(lar)o(ge)e(number)g(of)h (ar)o(guments.)i(These)e(are)h(laid)f(out)g(in)g(the)g(follo)n(wing)f (table.)262 2628 y Ft(ar)o(gument)h(name)p 875 2658 4 100 v 104 w(v)o(alue)p 3353 2658 V 2290 w(type)p 208 2662 6492 4 v 452 2731 a Fv(name)p 875 2761 4 100 v 293 w(The)g(name)g(of)g(the)g(package)p 3353 2761 V 1642 w(a)g(string)421 2831 y(v)o(ersion)p 875 2861 V 260 w(The)g(v)o(ersion) f(number)g(of)h(the)g(package)p 3353 2861 V 1304 w(See)g Fr(distutils.version)358 2931 y Fv(description)p 875 2960 V 197 w(A)h(single)f(line)h(describing)d(the)i(package)p 3353 2960 V 1271 w(a)g(string)269 3030 y(long)p 423 3030 25 4 v 28 w(description)p 875 3060 4 100 v 109 w(Longer)f(description)g (of)h(the)g(package)p 3353 3060 V 1342 w(a)g(string)436 3130 y(author)p 875 3160 V 276 w(The)g(name)g(of)g(the)g(package)f (author)p 3353 3160 V 1409 w(a)h(string)329 3229 y(author)p 548 3229 25 4 v 28 w(email)p 875 3259 4 100 v 170 w(The)g(email)h (address)e(of)h(the)g(package)f(author)p 3353 3259 V 1135 w(a)h(string)365 3329 y(maintainer)p 875 3359 V 204 w(The)g(name)g(of)g(the)g(current)f(maintainer)m(,)f(if)j(dif)n (ferent)d(from)h(the)h(author)p 3353 3359 V 373 w(a)g(string)257 3429 y(maintainer)p 619 3429 25 4 v 28 w(email)p 875 3459 4 100 v 99 w(The)g(email)h(address)e(of)h(the)g(current)f (maintainer)m(,)g(if)h(dif)n(ferent)f(from)g(the)h(author)p 3353 3459 V 496 3528 a(url)p 875 3558 V 337 w(A)h(URL)g(for)e(the)i (package)d(\(homepage\))p 3353 3558 V 1279 w(a)i(URL)318 3628 y(do)n(wnload)p 651 3628 25 4 v 28 w(url)p 875 3658 4 100 v 159 w(A)h(URL)g(to)f(do)n(wnload)e(the)j(package)p 3353 3658 V 1383 w(a)f(URL)390 3728 y(packages)p 875 3757 V 230 w(A)h(list)g(of)f(Python)f(packages)g(that)i(distutils)f (will)h(manipulate)p 3353 3757 V 655 w(a)f(list)i(of)d(strings)345 3827 y(p)o(y)p 433 3827 25 4 v 29 w(modules)p 875 3857 4 100 v 186 w(A)i(list)g(of)f(Python)f(modules)g(that)i(distutils)g (will)f(manipulate)p 3353 3857 V 678 w(a)g(list)i(of)d(strings)434 3927 y(scripts)p 875 3957 V 275 w(A)i(list)g(of)f(standalone)f(script)h (\002les)i(to)e(be)g(b)n(uilt)g(and)g(installed)p 3353 3957 V 667 w(a)g(list)i(of)d(strings)336 4026 y(e)o(xt)p 442 4026 25 4 v 29 w(modules)p 875 4056 4 100 v 177 w(A)i(list)g(of)f (Python)f(e)o(xtensions)g(to)i(be)f(b)n(uilt)p 3353 4056 V 1224 w(A)g(list)i(of)e(instances)g(of)g Fr(distutils.core.Extension) 378 4126 y Fv(classi\002ers)p 875 4156 V 221 w(A)h(list)g(of)f(cate)o (gories)f(for)h(the)g(package)p 3353 4156 V 1316 w(The)f(list)j(of)e(a) n(v)n(ailable)f(cate)o(gorizations)g(is)i(at)f Fw(http://cheeseshop)m (.p)n(ython.org)o(/p)m(ypi?)o(:acti)o(on)o(=li)o(st)p 6283 4126 23 4 v 21 w(classi\002ers)p Fv(.)401 4226 y(distclass)p 875 4256 4 100 v 244 w(the)h Fr(Distribution)d Fv(class)j(to)g(use)p 3353 4256 V 1359 w(A)f(subclass)h(of)f Fr(distutils.core.Distribution) 345 4325 y Fv(script)p 535 4325 25 4 v 29 w(name)p 875 4355 4 100 v 186 w(The)g(name)g(of)g(the)g(setup.p)o(y)f(script)h(-)h (def)o(aults)e(to)i Fr(sys.argv[0])p 3353 4355 V 445 w Fv(a)f(string)366 4425 y(script)p 556 4425 25 4 v 30 w(ar)o(gs)p 875 4455 4 100 v 207 w(Ar)o(guments)f(to)h(supply)f(to)i (the)f(setup)g(script)p 3353 4455 V 1174 w(a)g(list)i(of)d(strings)420 4525 y(options)p 875 4554 V 260 w(def)o(ault)h(options)f(for)h(the)g (setup)g(script)p 3353 4554 V 1342 w(a)g(string)427 4624 y(license)p 875 4654 V 268 w(The)g(license)h(for)e(the)h(package)p 3353 4654 V 382 4724 a(k)o(e)o(yw)o(ords)p 875 4754 V 222 w(Descripti)n(v)o(e)g(meta-data.)j(See)e(PEP)g(314)p 3353 4754 V 383 4823 a(platforms)p 875 4853 V 3353 4853 V 390 4923 a(cmdclass)p 875 4953 V 231 w(A)g(mapping)d(of)i(command)f (names)g(to)i Fr(Command)e Fv(subclasses)p 3353 4953 V 615 w(a)h(dictionary)0 5088 y Fg(run_setup)p Fr(\()p Fp(script)p 694 5088 25 4 v 28 w(name)p Fk([)p Fp(,)f(script)p 1172 5088 V 30 w(ar)m(gs=)p Fa(None)p Fp(,)h(stop)p 1783 5088 V 29 w(after=)p Fa('run')12 b Fk(])p Fr(\))208 5188 y Fv(Run)135 b(a)h(setup)g(script)g(in)g(a)g(some)n(what)f(controlled)f (en)m(vironment,)161 b(and)135 b(return)g(the)208 5288 y Fr(distutils.dist.Distribution)40 b Fv(instance)k(that)h(dri)n(v)o (es)e(things.)98 b(This)45 b(is)g(useful)g(if)f(you)g(need)g(to)h (\002nd)208 5387 y(out)22 b(the)g(distrib)n(ution)g(meta-data)f (\(passed)i(as)g(k)o(e)o(yw)o(ord)e(ar)o(gs)h(from)f Fp(script)k Fv(to)e Fr(setup\(\))p Fv(\),)f(or)g(the)h(contents)e(of)i (the)f(con\002g)p 0 5549 3901 4 v 3808 5649 a Fs(43)p eop end %%Page: 44 52 TeXDict begin 44 51 bop 208 83 a Fv(\002les)21 b(or)f(command-line.)208 209 y Fp(script)p 402 209 25 4 v 30 w(name)k Fv(is)i(a)f(\002le)h(that) f(will)g(be)g(run)g(with)g Fr(execfile\(\))e(sys.argv[0])h Fv(will)h(be)g(replaced)f(with)h Fp(script)i Fv(for)e(the)208 309 y(duration)17 b(of)i(the)g(call.)25 b Fp(script)p 1074 309 V 30 w(ar)m(gs)20 b Fv(is)g(a)f(list)i(of)d(strings;)i(if)g (supplied,)e Fr(sys.argv[1:])23 b Fv(will)d(be)f(replaced)f(by)g Fp(script)p 3730 309 V 30 w(ar)m(gs)208 409 y Fv(for)h(the)h(duration)f (of)h(the)g(call.)208 535 y Fp(stop)p 352 535 V 29 w(after)i Fv(tells)f Fr(setup\(\))f Fv(when)g(to)g(stop)g(processing;)f(possible) h(v)n(alues:)257 739 y Ft(v)o(alue)p 494 769 4 100 v 99 w(description)p 208 773 4919 4 v 494 872 4 100 v 545 842 a Fv(Stop)g(after)g(the)g Fr(Distribution)f Fv(instance)h(has)g (been)g(created)f(and)h(populated)e(with)i(the)g(k)o(e)o(yw)o(ord)f(ar) o(guments)f(to)i Fr(setup\(\))p 494 972 V 545 942 a Fv(Stop)g(after)g (con\002g)f(\002les)j(ha)n(v)o(e)d(been)h(parsed)f(\(and)g(their)h (data)g(stored)g(in)g(the)h Fr(Distribution)d Fv(instance\))p 494 1071 V 545 1042 a(Stop)i(after)g(the)g(command-line)e(\()p Fr(sys.argv[1:])23 b Fv(or)d Fp(script)p 2449 1042 25 4 v 30 w(ar)m(gs)p Fv(\))g(ha)n(v)o(e)f(been)h(parsed)f(\(and)h(the)g (data)g(stored)f(in)i(the)f Fr(Distribution)f Fv(instance.\))p 494 1171 4 100 v 545 1141 a(Stop)h(after)g(all)h(commands)d(ha)n(v)o(e) i(been)g(run)f(\(the)h(same)g(as)h(if)g Fr(setup\(\))e Fv(had)h(been)f(called)h(in)g(the)h(usual)f(w)o(ay\).)k(This)d(is)g (the)f(def)o(ault)g(v)n(alue.)0 1283 y(In)g(addition,)f(the)h Fr(distutils.core)e Fv(module)h(e)o(xposed)f(a)j(number)d(of)i(classes) i(that)e(li)n(v)o(e)g(else)n(where.)125 1481 y Fu(\017)41 b Fr(Extension)19 b Fv(from)g Fr(distutils.extension)125 1634 y Fu(\017)41 b Fr(Command)19 b Fv(from)g Fr(distutils.cmd)125 1787 y Fu(\017)41 b Fr(Distribution)18 b Fv(from)h Fr(distutils.dist)0 1984 y Fv(A)i(short)e(description)g(of)h(each)g(of)g(these)g(follo)n (ws,)g(b)n(ut)g(see)h(the)f(rele)n(v)n(ant)f(module)g(for)g(the)i(full) f(reference.)0 2131 y Ft(class)h Fg(Extension)208 2231 y Fv(The)26 b(Extension)g(class)i(describes)e(a)i(single)f(C)g(or)g(C) 1774 2224 y(++)1868 2231 y(e)o(xtension)f(module)f(in)i(a)h(setup)f (script.)45 b(It)27 b(accepts)g(the)g(follo)n(wing)208 2330 y(k)o(e)o(yw)o(ord)18 b(ar)o(guments)g(in)i(its)i(constructor)310 2535 y Ft(ar)o(gument)d(name)p 969 2565 V 152 w(v)o(alue)p 11043 2565 V 9884 w(type)p 208 2568 12144 4 v 499 2638 a Fv(name)p 969 2668 4 100 v 341 w(the)h(full)g(name)g(of)g(the)g(e)o (xtension,)e(including)h(an)o(y)g(packages)g(\227)i(ie.)k Fp(not)20 b Fv(a)h(\002lename)f(or)f(pathname,)g(b)n(ut)h(Python)f (dotted)g(name)p 11043 2668 V 6299 w(string)465 2737 y(sources)p 969 2767 V 306 w(list)i(of)f(source)g(\002lenames,)f (relati)n(v)o(e)h(to)g(the)g(distrib)n(ution)f(root)h(\(where)f(the)h (setup)g(script)g(li)n(v)o(es\),)g(in)i(U)t Fm(N)t(I)t(X)i Fv(form)19 b(\(slash-separated\))f(for)i(portability)-5 b(.)23 b(Source)c(\002les)i(may)f(be)g(C,)h(C)6254 2730 y(++)6348 2737 y(,)f(SWIG)h(\(.i\),)f(platform-speci\002c)e(resource)h (\002les,)i(or)f(whate)n(v)o(er)e(else)j(is)g(recognized)d(by)i(the)g Fr(build_ext)f Fv(command)f(as)j(source)f(for)f(a)i(Python)e(e)o (xtension.)p 11043 2767 V 97 w(string)390 2837 y(include)p 641 2837 25 4 v 28 w(dirs)p 969 2867 4 100 v 232 w(list)i(of)f (directories)f(to)i(search)e(for)h(C/C)2173 2830 y(++)2288 2837 y(header)f(\002les)i(\(in)h(U)t Fm(N)t(I)t(X)i Fv(form)19 b(for)g(portability\))p 11043 2867 V 7401 w(string)353 2937 y(de\002ne)p 562 2937 25 4 v 29 w(macros)p 969 2967 4 100 v 194 w(list)i(of)f(macros)g(to)g(de\002ne;)g(each)g(macro)f(is)i (de\002ned)e(using)h(a)g(2-tuple,)f(where)h(')l(v)n(alue')e(is)j (either)f(the)g(string)g(to)h(de\002ne)e(it)i(to)g(or)e Fr(None)h Fv(to)h(de\002ne)f(it)g(without)g(a)h(particular)d(v)n(alue)i (\(equi)n(v)n(alent)e(of)i Fr(#define)48 b(FOO)21 b Fv(in)f(source)f (or)h Ft(-DFOO)g Fv(on)h(U)t Fm(N)t(I)t(X)j Fv(C)d(compiler)e(command)f (line\))p 11043 2967 V 1921 w(\(string,string\))g(tuple)i(or)g(\(name,) p Fr(None)p Fv(\))360 3036 y(undef)p 556 3036 25 4 v 28 w(macros)p 969 3066 4 100 v 201 w(list)h(of)f(macros)g(to)g (unde\002ne)f(e)o(xplicitly)p 11043 3066 V 8894 w(string)401 3136 y(library)p 629 3136 25 4 v 29 w(dirs)p 969 3166 4 100 v 243 w(list)i(of)f(directories)f(to)i(search)e(for)h(C/C)2173 3129 y(++)2288 3136 y(libraries)g(at)h(link)f(time)p 11043 3166 V 8134 w(string)453 3236 y(libraries)p 969 3265 V 295 w(list)h(of)f(library)f(names)h(\(not)g(\002lenames)g(or)f (paths\))h(to)g(link)g(against)p 11043 3265 V 8108 w(string)257 3335 y(runtime)p 522 3335 25 4 v 29 w(library)p 774 3335 V 28 w(dirs)p 969 3365 4 100 v 99 w(list)h(of)f(directories)f(to)i (search)e(for)h(C/C)2173 3328 y(++)2288 3335 y(libraries)g(at)h(run)e (time)i(\(for)e(shared)g(e)o(xtensions,)g(this)i(is)g(when)e(the)i(e)o (xtension)d(is)j(loaded\))p 11043 3365 V 6155 w(string)374 3435 y(e)o(xtra)p 545 3435 25 4 v 29 w(objects)p 969 3465 4 100 v 216 w(list)g(of)f(e)o(xtra)g(\002les)h(to)f(link)g(with)g (\(e)o(g.)25 b(object)19 b(\002les)i(not)f(implied)g(by)g(')-5 b(sources',)19 b(static)i(library)e(that)h(must)g(be)h(e)o(xplicitly)e (speci\002ed,)g(binary)g(resource)g(\002les,)i(etc.\))p 11043 3465 V 5337 w(string)275 3534 y(e)o(xtra)p 446 3534 25 4 v 29 w(compile)p 744 3534 V 28 w(ar)o(gs)p 969 3564 4 100 v 116 w(an)o(y)e(e)o(xtra)h(platform-)e(and)i(compiler)n (-speci\002c)e(information)g(to)i(use)h(when)e(compiling)g(the)h (source)g(\002les)h(in)f(')-5 b(sources'.)24 b(F)o(or)c(platforms)f (and)h(compilers)f(where)g(a)i(command)d(line)j(mak)o(es)f(sense,)g (this)h(is)g(typically)e(a)i(list)g(of)f(command-line)d(ar)o(guments,)h (b)n(ut)i(for)g(other)f(platforms)g(it)i(could)e(be)h(an)o(ything.)p 11043 3564 V 1208 w(string)344 3634 y(e)o(xtra)p 515 3634 25 4 v 29 w(link)p 674 3634 V 29 w(ar)o(gs)p 969 3664 4 100 v 185 w(an)o(y)f(e)o(xtra)h(platform-)e(and)i(compiler)n (-speci\002c)e(information)g(to)i(use)h(when)e(linking)g(object)h (\002les)h(together)e(to)h(create)g(the)h(e)o(xtension)d(\(or)i(to)g (create)g(a)h(ne)n(w)f(static)h(Python)e(interpreter\).)k(Similar)d (interpretation)e(as)j(for)e('e)o(xtra)p 7590 3634 25 4 v 29 w(compile)p 7888 3634 V 28 w(ar)o(gs'.)p 11043 3664 4 100 v 2996 w(string)331 3734 y(e)o(xport)p 549 3734 25 4 v 27 w(symbols)p 969 3764 4 100 v 172 w(list)i(of)f(symbols)g (to)g(be)g(e)o(xported)e(from)h(a)i(shared)e(e)o(xtension.)24 b(Not)c(used)g(on)g(all)h(platforms,)d(and)i(not)g(generally)e (necessary)i(for)g(Python)f(e)o(xtensions,)f(which)i(typically)f(e)o (xport)g(e)o(xactly)g(one)h(symbol:)k Fr(init)c Fv(+)h(e)o(xtension)p 7528 3734 25 4 v 28 w(name.)p 11043 3764 4 100 v 3341 w(string)453 3833 y(depends)p 969 3863 V 294 w(list)g(of)f(\002les)h (that)g(the)f(e)o(xtension)e(depends)h(on)p 11043 3863 V 8720 w(string)439 3933 y(language)p 969 3963 V 280 w(e)o(xtension)g(language)f(\(i.e.)25 b Fr('c')p Fv(,)20 b Fr('c++')p Fv(,)f Fr('objc')p Fv(\).)24 b(W)m(ill)e(be)e(detected)f (from)g(the)h(source)g(e)o(xtensions)f(if)h(not)g(pro)o(vided.)p 11043 3963 V 6416 w(string)0 4074 y Ft(class)h Fg(Distribution)208 4174 y Fv(A)f Fr(Distribution)f Fv(describes)g(ho)n(w)h(to)g(b)n(uild,) g(install)h(and)e(package)g(up)h(a)g(Python)g(softw)o(are)f(package.) 208 4300 y(See)g(the)g Fr(setup\(\))f Fv(function)f(for)h(a)h(list)h (of)f(k)o(e)o(yw)o(ord)e(ar)o(guments)f(accepted)i(by)g(the)h(Distrib)n (ution)f(constructor)-5 b(.)23 b Fr(setup\(\))208 4400 y Fv(creates)d(a)g(Distrib)n(ution)g(instance.)0 4547 y Ft(class)h Fg(Command)208 4646 y Fv(A)f Fr(Command)g Fv(class)h(\(or)e(rather)m(,)g(an)h(instance)g(of)g(one)g(of)g(its)h (subclasses\))f(implement)f(a)i(single)f(distutils)g(command.)0 4968 y Fo(11.2)121 b Fc(distutils.ccompiler)28 b Fo(\227)33 b(CCompiler)h(base)g(class)0 5201 y Fv(This)24 b(module)f(pro)o(vides)f (the)i(abstract)g(base)g(class)h(for)e(the)h Fr(CCompiler)f Fv(classes.)37 b(A)24 b Fr(CCompiler)f Fv(instance)h(can)g(be)g(used)f (for)0 5300 y(all)c(the)g(compile)f(and)h(link)f(steps)i(needed)d(to)i (b)n(uild)g(a)g(single)g(project.)k(Methods)18 b(are)h(pro)o(vided)e (to)i(set)g(options)f(for)h(the)f(compiler)g(\227)0 5400 y(macro)h(de\002nitions,)g(include)h(directories,)e(link)i(path,)g (libraries)g(and)f(the)i(lik)o(e.)p 0 5549 3901 4 v 0 5649 a Fs(44)2762 b(Chapter)23 b(11.)53 b(API)23 b(Ref)n(erence)p eop end %%Page: 45 53 TeXDict begin 45 52 bop 0 83 a Fv(This)20 b(module)f(pro)o(vides)g(the) h(follo)n(wing)e(functions.)0 230 y Fg(gen_lib_options)p Fr(\()p Fp(compiler)-9 b(,)16 b(libr)o(ary)p 1359 230 25 4 v 30 w(dir)o(s,)21 b(runtime)p 1818 230 V 29 w(libr)o(ary)p 2077 230 V 29 w(dir)o(s,)g(libr)o(aries)p Fr(\))208 330 y Fv(Generate)28 b(link)o(er)h(options)f(for)h(searching)f(library)g (directories)g(and)h(linking)f(with)i(speci\002c)f(libraries.)52 b Fp(libr)o(aries)29 b Fv(and)g Fp(li-)208 429 y(br)o(ary)p 397 429 V 29 w(dir)o(s)h Fv(are,)i(respecti)n(v)o(ely)-5 b(,)29 b(lists)i(of)e(library)g(names)g(\(not)g(\002lenames!\))52 b(and)29 b(search)g(directories.)52 b(Returns)29 b(a)h(list)h(of)208 529 y(command-line)17 b(options)i(suitable)h(for)g(use)g(with)h(some)f (compiler)e(\(depending)g(on)i(the)g(tw)o(o)g(format)f(strings)h (passed)h(in\).)0 676 y Fg(gen_preprocess_options)p Fr(\()p Fp(macr)l(os,)16 b(include)p 1679 676 V 28 w(dir)o(s)p Fr(\))208 775 y Fv(Generate)28 b(C)i(pre-processor)d(options)h(\()p Ft(-D)p Fv(,)h Ft(-U)p Fv(,)h Ft(-I)p Fv(\))f(as)h(used)f(by)g(at)h (least)g(tw)o(o)g(types)f(of)g(compilers:)42 b(the)30 b(typical)h(U)t Fm(N)t(I)t(X)208 875 y Fv(compiler)23 b(and)h(V)-5 b(isual)24 b(C)964 868 y(++)1058 875 y(.)39 b Fp(macr)l(os)25 b Fv(is)g(the)f(usual)h(thing,)f(a)h(list)h(of)e(1-)g (or)g(2-tuples,)h(where)f Fr(\()p Fp(name)p Fr(,\))g Fv(means)g(unde\002ne)208 975 y(\()p Ft(-U)p Fv(\))h(macro)g Fp(name)p Fv(,)h(and)f Fr(\()p Fp(name)p Fr(,)49 b Fp(value)p Fr(\))25 b Fv(means)g(de\002ne)h(\()p Ft(-D)p Fv(\))f(macro)g Fp(name)g Fv(to)h Fp(value)p Fv(.)41 b Fp(include)p 3233 975 V 29 w(dir)o(s)26 b Fv(is)h(just)g(a)f(list)h(of)208 1074 y(directory)20 b(names)i(to)g(be)g(added)f(to)h(the)g(header)f (\002le)h(search)g(path)g(\()p Ft(-I)p Fv(\).)f(Returns)h(a)h(list)g (of)e(command-line)f(options)h(suitable)208 1174 y(for)e(either)j(U)t Fm(N)t(I)t(X)h Fv(compilers)c(or)h(V)-5 b(isual)21 b(C)1476 1167 y(++)1570 1174 y(.)0 1321 y Fg(get_default_compiler)p Fr(\()p Fp(osname)o(,)15 b(platform)p Fr(\))208 1420 y Fv(Determine)k(the)h(def)o(ault)f(compiler)g(to)i(use)f(for)g(the)g (gi)n(v)o(en)f(platform.)208 1551 y Fp(osname)h Fv(should)g(be)h(one)f (of)h(the)g(standard)f(Python)f(OS)j(names)f(\(i.e.)f(the)h(ones)g (returned)e(by)i Fr(os.name)p Fv(\))f(and)g Fp(platform)h Fv(the)208 1651 y(common)d(v)n(alue)h(returned)g(by)h Fr(sys.platform)e Fv(for)i(the)g(platform)f(in)h(question.)208 1782 y(The)f(def)o(ault)h(v)n(alues)g(are)g Fr(os.name)f Fv(and)h Fr(sys.platform)e Fv(in)j(case)f(the)h(parameters)e(are)h(not) g(gi)n(v)o(en.)0 1929 y Fg(new_compiler)p Fr(\()p Fp(plat=)p Fa(None)p Fp(,)d(compiler=)p Fa(None)p Fp(,)h(verbose=)p Fa(0)p Fp(,)i(dry)p 2187 1929 V 30 w(run=)p Fa(0)p Fp(,)f(for)m(ce=)p Fa(0)p Fr(\))208 2029 y Fv(F)o(actory)d(function)h(to)h(generate)e(an)i (instance)f(of)h(some)g(CCompiler)f(subclass)h(for)g(the)f(supplied)g (platform/compiler)e(combi-)208 2128 y(nation.)23 b Fp(plat)d Fv(def)o(aults)f(to)g Fr(os.name)f Fv(\(e)o(g.)24 b Fr('posix')p Fv(,)18 b Fr('nt')p Fv(\),)h(and)f Fp(compiler)j Fv(def)o(aults)d(to)h (the)g(def)o(ault)f(compiler)g(for)g(that)208 2228 y(platform.)33 b(Currently)22 b(only)h Fr('posix')g Fv(and)g Fr('nt')g Fv(are)h(supported,)e(and)h(the)g(def)o(ault)g(compilers)g(are)g (\223traditional)i(U)t Fm(N)t(I)t(X)208 2327 y Fv(interf)o(ace\224)19 b(\()p Fr(UnixCCompiler)e Fv(class\))k(and)e(V)-5 b(isual)21 b(C)1888 2320 y(++)1982 2327 y(\()p Fr(MSVCCompiler)d Fv(class\).)25 b(Note)20 b(that)g(it')-5 b(s)21 b(perfectly)e(possible) 208 2427 y(to)f(ask)h(for)f(a)i(U)t Fm(N)t(I)t(X)i Fv(compiler)17 b(object)h(under)f(W)m(indo)n(ws,)h(and)g(a)g(Microsoft)g(compiler)f (object)h(under)h(U)t Fm(N)t(I)t(X)r Fv(\227if)g(you)f(supply)208 2527 y(a)i(v)n(alue)g(for)f Fp(compiler)r Fv(,)h Fp(plat)h Fv(is)g(ignored.)0 2674 y Fg(show_compilers)p Fr(\(\))208 2773 y Fv(Print)c(list)h(of)e(a)n(v)n(ailable)h(compilers)f(\(used)g (by)h(the)g Ft(--help-compiler)f Fv(options)g(to)h Fr(build)p Fv(,)g Fr(build_ext)p Fv(,)f Fr(build_clib)p Fv(\).)0 2920 y Ft(class)21 b Fg(CCompiler)p Fr(\()p Fk([)p Fp(verbose=)p Fa(0)p Fp(,)c(dry)p 1246 2920 V 30 w(run=)p Fa(0)p Fp(,)j(for)m(ce=)p Fa(0)12 b Fk(])p Fr(\))208 3020 y Fv(The)23 b(abstract)h(base)g(class)h Fr(CCompiler)e Fv(de\002nes)h(the)g(interf)o(ace)g(that)g(must)g(be)g (implemented)e(by)i(real)g(compiler)f(classes.)208 3119 y(The)c(class)j(also)e(has)g(some)g(utility)h(methods)e(used)h(by)f(se) n(v)o(eral)h(compiler)f(classes.)208 3250 y(The)28 b(basic)g(idea)g (behind)f(a)i(compiler)e(abstraction)g(class)i(is)h(that)e(each)g (instance)g(can)g(be)g(used)g(for)g(all)h(the)f(compile/link)208 3350 y(steps)f(in)g(b)n(uilding)f(a)h(single)g(project.)44 b(Thus,)27 b(attrib)n(utes)g(common)e(to)i(all)h(of)e(those)h(compile)f (and)g(link)h(steps)g(\227)h(include)208 3450 y(directories,)23 b(macros)g(to)g(de\002ne,)h(libraries)f(to)h(link)f(against,)h(etc.)35 b(\227)24 b(are)g(attrib)n(utes)f(of)g(the)h(compiler)e(instance.)35 b(T)-7 b(o)24 b(allo)n(w)208 3549 y(for)19 b(v)n(ariability)g(in)h(ho)n (w)g(indi)n(vidual)e(\002les)j(are)f(treated,)g(most)g(of)g(those)f (attrib)n(utes)h(may)g(be)g(v)n(aried)f(on)h(a)g(per)n(-compilation)e (or)208 3649 y(per)n(-link)g(basis.)208 3780 y(The)k(constructor)e(for) i(each)g(subclass)h(creates)f(an)h(instance)f(of)g(the)h(Compiler)e (object.)32 b(Flags)23 b(are)f Fp(verbose)g Fv(\(sho)n(w)g(v)o(erbose) 208 3880 y(output\),)j Fp(dry)p 612 3880 V 29 w(run)h Fv(\(don')o(t)e(actually)h(e)o(x)o(ecute)f(the)i(steps\))g(and)f Fp(for)m(ce)h Fv(\(reb)n(uild)e(e)n(v)o(erything,)h(re)o(gardless)f(of) h(dependencies\).)208 3979 y(All)d(of)f(these)g(\003ags)h(def)o(ault)e (to)i Fr(0)f Fv(\(of)n(f\).)27 b(Note)21 b(that)h(you)e(probably)f (don')o(t)h(w)o(ant)h(to)h(instantiate)f Fr(CCompiler)f Fv(or)h(one)g(of)g(its)208 4079 y(subclasses)f(directly)g(-)g(use)g (the)h Fr(distutils.CCompiler.new_compiler\()o(\))15 b Fv(f)o(actory)k(function)f(instead.)208 4210 y(The)h(follo)n(wing)g (methods)g(allo)n(w)h(you)g(to)g(manually)f(alter)h(compiler)f(options) g(for)h(the)g(instance)g(of)g(the)g(Compiler)f(class.)208 4341 y Fg(add_include_dir)p Fr(\()p Fp(dir)r Fr(\))390 4441 y Fv(Add)h Fp(dir)i Fv(to)f(the)f(list)h(of)f(directories)f(that)h (will)h(be)f(searched)f(for)g(header)g(\002les.)26 b(The)20 b(compiler)f(is)i(instructed)e(to)h(search)390 4540 y(directories)f(in) i(the)f(order)f(in)h(which)g(the)o(y)f(are)h(supplied)g(by)f(successi)n (v)o(e)h(calls)h(to)g Fr(add_include_dir\(\))p Fv(.)208 4671 y Fg(set_include_dirs)p Fr(\()p Fp(dir)o(s)p Fr(\))390 4771 y Fv(Set)k(the)e(list)i(of)e(directories)g(that)h(will)g(be)g (searched)e(to)i Fp(dir)o(s)h Fv(\(a)e(list)i(of)e(strings\).)35 b(Ov)o(errides)23 b(an)o(y)f(preceding)g(calls)i(to)390 4870 y Fr(add_include_dir\(\))p Fv(;)h(subsequent)f(calls)i(to)f Fr(add_include_dir\(\))d Fv(add)j(to)g(the)g(list)i(passed)e(to)g Fr(set_-)390 4970 y(include_dirs\(\))p Fv(.)37 b(This)25 b(does)f(not)h(af)n(fect)f(an)o(y)g(list)i(of)f(standard)e(include)h (directories)g(that)h(the)g(compiler)e(may)390 5070 y(search)d(by)g (def)o(ault.)208 5201 y Fg(add_library)p Fr(\()p Fp(libname)p Fr(\))390 5300 y Fv(Add)j Fp(libname)g Fv(to)h(the)f(list)i(of)f (libraries)f(that)h(will)g(be)f(included)g(in)g(all)i(links)e(dri)n(v)o (en)f(by)h(this)i(compiler)d(object.)35 b(Note)390 5400 y(that)28 b Fp(libname)f Fv(should)g(*not*)g(be)h(the)g(name)f(of)h(a)g (\002le)h(containing)d(a)j(library)-5 b(,)28 b(b)n(ut)g(the)g(name)f (of)h(the)g(library)f(itself:)p 0 5549 3901 4 v 0 5649 a Fs(11.2.)52 b Fr(distutils.ccompiler)20 b Fs(\227)j(CCompiler)h(base) f(class)1688 b(45)p eop end %%Page: 46 54 TeXDict begin 46 53 bop 390 83 a Fv(the)27 b(actual)f(\002lename)f (will)j(be)e(inferred)e(by)i(the)h(link)o(er)m(,)f(the)h(compiler)m(,)f (or)g(the)g(compiler)f(class)i(\(depending)d(on)i(the)390 183 y(platform\).)390 296 y(The)19 b(link)o(er)f(will)i(be)f (instructed)f(to)i(link)f(against)f(libraries)h(in)g(the)g(order)f(the) o(y)g(were)h(supplied)f(to)h Fr(add_library\(\))390 395 y Fv(and/or)h Fr(set_libraries\(\))p Fv(.)25 b(It)d(is)g(perfectly)d(v) n(alid)i(to)g(duplicate)f(library)g(names;)h(the)g(link)o(er)g(will)h (be)f(instructed)390 495 y(to)g(link)e(against)h(libraries)g(as)h(man)o (y)e(times)h(as)h(the)o(y)f(are)g(mentioned.)208 625 y Fg(set_libraries)p Fr(\()p Fp(libnames)p Fr(\))390 724 y Fv(Set)31 b(the)f(list)h(of)f(libraries)g(to)g(be)g(included)e (in)i(all)h(links)f(dri)n(v)o(en)f(by)g(this)i(compiler)d(object)i(to)g Fp(libnames)g Fv(\(a)g(list)h(of)390 824 y(strings\).)25 b(This)20 b(does)g(not)g(af)n(fect)g(an)o(y)f(standard)g(system)h (libraries)g(that)g(the)h(link)o(er)e(may)h(include)f(by)h(def)o(ault.) 208 954 y Fg(add_library_dir)p Fr(\()p Fp(dir)r Fr(\))390 1053 y Fv(Add)28 b Fp(dir)j Fv(to)d(the)h(list)g(of)f(directories)f (that)i(will)g(be)f(searched)f(for)h(libraries)g(speci\002ed)g(to)h Fr(add_library\(\))d Fv(and)390 1153 y Fr(set_libraries\(\))p Fv(.)33 b(The)23 b(link)o(er)g(will)i(be)e(instructed)g(to)g(search)h (for)e(libraries)i(in)f(the)h(order)e(the)o(y)h(are)h(supplied)390 1253 y(to)d Fr(add_library_dir\(\))c Fv(and/or)i Fr (set_library_dirs\(\))p Fv(.)208 1382 y Fg(set_library_dirs)p Fr(\()p Fp(dir)o(s)p Fr(\))390 1482 y Fv(Set)k(the)f(list)h(of)e (library)g(search)h(directories)f(to)h Fp(dir)o(s)h Fv(\(a)f(list)h(of) e(strings\).)30 b(This)22 b(does)g(not)f(af)n(fect)h(an)o(y)f(standard) g(library)390 1582 y(search)f(path)g(that)g(the)g(link)o(er)g(may)g (search)f(by)h(def)o(ault.)208 1711 y Fg(add_runtime_library_dir)p Fr(\()p Fp(dir)r Fr(\))390 1811 y Fv(Add)g Fp(dir)i Fv(to)f(the)f(list) h(of)f(directories)f(that)i(will)g(be)f(searched)f(for)g(shared)h (libraries)g(at)g(runtime.)208 1941 y Fg(set_runtime_library_dirs)p Fr(\()p Fp(dir)o(s)p Fr(\))390 2040 y Fv(Set)25 b(the)e(list)i(of)e (directories)g(to)h(search)f(for)g(shared)g(libraries)h(at)g(runtime)e (to)i Fp(dir)o(s)h Fv(\(a)e(list)i(of)f(strings\).)35 b(This)23 b(does)h(not)390 2140 y(af)n(fect)c(an)o(y)f(standard)g (search)h(path)g(that)g(the)g(runtime)f(link)o(er)h(may)g(search)f(by)h (def)o(ault.)208 2270 y Fg(define_macro)p Fr(\()p Fp(name)p Fk([)p Fp(,)c(value=)p Fa(None)c Fk(])p Fr(\))390 2369 y Fv(De\002ne)24 b(a)f(preprocessor)f(macro)g(for)h(all)h(compilations) e(dri)n(v)o(en)g(by)h(this)h(compiler)e(object.)34 b(The)23 b(optional)f(parameter)390 2469 y Fp(value)f Fv(should)f(be)i(a)f (string;)h(if)g(it)g(is)g(not)f(supplied,)f(then)h(the)h(macro)e(will)i (be)f(de\002ned)g(without)f(an)i(e)o(xplicit)e(v)n(alue)h(and)390 2569 y(the)f(e)o(xact)g(outcome)f(depends)g(on)g(the)i(compiler)d(used) i(\(XXX)h(true?)j(does)c(ANSI)h(say)f(an)o(ything)e(about)h(this?\))208 2698 y Fg(undefine_macro)p Fr(\()p Fp(name)p Fr(\))390 2798 y Fv(Unde\002ne)k(a)i(preprocessor)d(macro)h(for)g(all)i (compilations)d(dri)n(v)o(en)h(by)h(this)g(compiler)f(object.)36 b(If)24 b(the)g(same)g(macro)g(is)390 2898 y(de\002ned)g(by)g Fr(define_macro\(\))f Fv(and)h(unde\002ned)f(by)h Fr (undefine_macro\(\))e Fv(the)j(last)g(call)h(tak)o(es)f(precedence)390 2997 y(\(including)13 b(multiple)i(rede\002nitions)f(or)h (unde\002nitions\).)21 b(If)15 b(the)g(macro)f(is)j (rede\002ned/unde\002ned)11 b(on)k(a)g(per)n(-compilation)390 3097 y(basis)21 b(\(ie.)k(in)20 b(the)h(call)f(to)h Fr(compile\(\))p Fv(\),)d(then)i(that)g(tak)o(es)h(precedence.)208 3227 y Fg(add_link_object)p Fr(\()p Fp(object)q Fr(\))390 3326 y Fv(Add)j Fp(object)h Fv(to)f(the)g(list)h(of)f(object)f(\002les) i(\(or)f(analogues,)f(such)h(as)g(e)o(xplicitly)f(named)g(library)g (\002les)i(or)f(the)g(output)f(of)390 3426 y(\223resource)c (compilers\224\))g(to)h(be)g(included)f(in)h(e)n(v)o(ery)f(link)h(dri)n (v)o(en)f(by)g(this)i(compiler)e(object.)208 3556 y Fg (set_link_objects)p Fr(\()p Fp(objects)p Fr(\))390 3655 y Fv(Set)25 b(the)e(list)i(of)f(object)f(\002les)i(\(or)e(analogues\))f (to)i(be)f(included)f(in)i(e)n(v)o(ery)f(link)g(to)h Fp(objects)p Fv(.)35 b(This)24 b(does)g(not)f(af)n(fect)g(an)o(y)390 3755 y(standard)c(object)h(\002les)h(that)f(the)h(link)o(er)e(may)h (include)f(by)h(def)o(ault)f(\(such)h(as)h(system)f(libraries\).)208 3885 y(The)e(follo)n(wing)f(methods)g(implement)g(methods)h(for)g (autodetection)e(of)j(compiler)e(options,)h(pro)o(viding)d(some)k (functionality)208 3984 y(similar)h(to)g(GNU)h Ft(autoconf)p Fv(.)208 4114 y Fg(detect_language)p Fr(\()p Fp(sour)m(ces)p Fr(\))390 4214 y Fv(Detect)g(the)f(language)e(of)i(a)h(gi)n(v)o(en)e (\002le,)h(or)g(list)h(of)f(\002les.)26 b(Uses)21 b(the)g(instance)e (attrib)n(utes)h Fr(language_map)f Fv(\(a)h(dictio-)390 4313 y(nary\),)f(and)h Fr(language_order)e Fv(\(a)i(list\))h(to)f(do)g (the)g(job)m(.)208 4443 y Fg(find_library_file)p Fr(\()p Fp(dir)o(s,)d(lib)p Fk([)p Fp(,)j(deb)n(ug=)p Fa(0)12 b Fk(])p Fr(\))390 4543 y Fv(Search)24 b(the)f(speci\002ed)h(list)h(of) f(directories)f(for)g(a)h(static)h(or)f(shared)f(library)g(\002le)h Fp(lib)g Fv(and)g(return)e(the)i(full)g(path)f(to)h(that)390 4642 y(\002le.)38 b(If)24 b Fp(deb)n(ug)f Fv(is)i(true,)g(look)e(for)h (a)h(deb)n(ugging)c(v)o(ersion)i(\(if)i(that)f(mak)o(es)g(sense)h(on)f (the)g(current)f(platform\).)35 b(Return)390 4742 y Fr(None)20 b Fv(if)h Fp(lib)f Fv(w)o(asn')o(t)g(found)e(in)j(an)o(y)e(of)h(the)g (speci\002ed)g(directories.)208 4872 y Fg(has_function)p Fr(\()p Fp(funcname)c Fk([)p Fp(,)k(includes=)p Fa(None)p Fp(,)f(include)p 2105 4872 25 4 v 28 w(dir)o(s=)p Fa(None)p Fp(,)h(libr)o(aries=)p Fa(None)p Fp(,)g(libr)o(ary)p 3370 4872 V 29 w(dir)o(s=)p Fa(None)12 b Fk(])p Fr(\))390 4971 y Fv(Return)25 b(a)h(boolean)e(indicating)g(whether)g Fp(funcname)g Fv(is)i(supported)d(on)i(the)g(current)f(platform.)39 b(The)25 b(optional)f(ar)o(gu-)390 5071 y(ments)19 b(can)f(be)g(used)h (to)f(augment)f(the)i(compilation)d(en)m(vironment)g(by)i(pro)o(viding) e(additional)h(include)g(\002les)j(and)e(paths)390 5171 y(and)i(libraries)g(and)f(paths.)208 5300 y Fg(library_dir_option)p Fr(\()p Fp(dir)r Fr(\))390 5400 y Fv(Return)h(the)g(compiler)f(option)g (to)h(add)g Fp(dir)j Fv(to)d(the)g(list)h(of)f(directories)f(searched)h (for)f(libraries.)p 0 5549 3901 4 v 0 5649 a Fs(46)2762 b(Chapter)23 b(11.)53 b(API)23 b(Ref)n(erence)p eop end %%Page: 47 55 TeXDict begin 47 54 bop 208 83 a Fg(library_option)p Fr(\()p Fp(lib)p Fr(\))390 183 y Fv(Return)20 b(the)g(compiler)f (option)g(to)h(add)g Fp(dir)j Fv(to)d(the)g(list)h(of)f(libraries)g (link)o(ed)g(into)g(the)g(shared)f(library)g(or)h(e)o(x)o(ecutable.)208 310 y Fg(runtime_library_dir_option)p Fr(\()p Fp(dir)r Fr(\))390 410 y Fv(Return)g(the)g(compiler)f(option)g(to)h(add)g Fp(dir)j Fv(to)d(the)g(list)h(of)f(directories)f(searched)h(for)f (runtime)g(libraries.)208 537 y Fg(set_executables)p Fr(\()p Fp(**ar)m(gs)p Fr(\))390 637 y Fv(De\002ne)f(the)g(e)o(x)o (ecutables)e(\(and)h(options)f(for)i(them\))f(that)h(will)g(be)g(run)f (to)h(perform)d(the)j(v)n(arious)f(stages)h(of)g(compilation.)390 736 y(The)f(e)o(xact)f(set)h(of)g(e)o(x)o(ecutables)e(that)h(may)h(be)f (speci\002ed)h(here)f(depends)f(on)h(the)h(compiler)e(class)j(\(via)e (the)h('e)o(x)o(ecutables')390 836 y(class)k(attrib)n(ute\),)f(b)n(ut)g (most)g(will)h(ha)n(v)o(e:)1129 940 y Ft(attrib)n(ute)p 1513 970 4 100 v 122 w(description)p 1079 973 2132 4 v 1129 1043 a Fv(compiler)p 1513 1072 4 100 v 138 w(the)f(C/C)1819 1036 y(++)1935 1043 y(compiler)1129 1142 y(link)o(er)p 1328 1142 25 4 v 29 w(so)p 1513 1172 4 100 v 138 w(link)o(er)g(used)g (to)g(create)g(shared)f(objects)h(and)g(libraries)1129 1242 y(link)o(er)p 1328 1242 25 4 v 29 w(e)o(x)o(e)p 1513 1272 4 100 v 98 w(link)o(er)g(used)g(to)g(create)g(binary)f(e)o(x) o(ecutables)1129 1341 y(archi)n(v)o(er)p 1513 1371 V 164 w(static)i(library)e(creator)390 1447 y(On)30 b(platforms)e(with)h (a)h(command-line)d(\()r(U)t Fm(N)t(I)t(X)r Fv(,)32 b(DOS/W)m(indo)n (ws\),)f(each)e(of)g(these)h(is)g(a)g(string)f(that)g(will)i(be)e (split)390 1547 y(into)k(e)o(x)o(ecutable)f(name)h(and)g(\(optional\))f (list)i(of)g(ar)o(guments.)62 b(\(Splitting)33 b(the)h(string)f(is)i (done)d(similarly)h(to)h(ho)n(w)392 1647 y(U)t Fm(N)t(I)t(X)c Fv(shells)d(operate:)37 b(w)o(ords)26 b(are)h(delimited)f(by)g(spaces,) i(b)n(ut)f(quotes)f(and)g(backslashes)g(can)g(o)o(v)o(erride)e(this.)45 b(See)390 1746 y Fr(distutils.util.split_quoted\(\))p Fv(.\))208 1874 y(The)19 b(follo)n(wing)g(methods)g(in)m(v)n(ok)o(e)g (stages)i(in)f(the)g(b)n(uild)g(process.)208 2001 y Fg(compile)p Fr(\()p Fp(sour)m(ces)p Fk([)p Fp(,)14 b(output)p 1153 2001 25 4 v 28 w(dir=)p Fa(None)p Fp(,)i(macr)l(os=)p Fa(None)p Fp(,)f(include)p 2350 2001 V 29 w(dir)o(s=)p Fa(None)p Fp(,)h(deb)n(ug=)p Fa(0)p Fp(,)f(e)n(xtr)o(a)p 3313 2001 V 29 w(pr)m(ear)m(gs=)p Fa(None)p Fp(,)g(e)n(xtr)o(a)p 4055 2001 V 30 w(-)608 2101 y(postar)m(gs=)p Fa(None)p Fp(,)i(depends=)p Fa(None)12 b Fk(])p Fr(\))390 2184 y Fv(Compile)20 b(one)g(or)g(more)f(source)g(\002les.)26 b(Generates)20 b(object)g(\002les)h(\(e.g.)j(transforms)19 b(a)h(`)p Fw(.c)p Fv(')h(\002le)f(to)h(a)f(`)p Fw(.o)p Fv(')g(\002le.\))390 2295 y Fp(sour)m(ces)f Fv(must)g(be)f(a)h(list)h (of)e(\002lenames,)h(most)f(lik)o(ely)h(C/C)2083 2288 y(++)2177 2295 y(\002les,)h(b)n(ut)f(in)f(reality)h(an)o(ything)d(that) j(can)f(be)h(handled)e(by)h(a)390 2394 y(particular)f(compiler)f(and)h (compiler)g(class)h(\(e)o(g.)24 b Fr(MSVCCompiler)16 b Fv(can)h(handle)g(resource)g(\002les)h(in)g Fp(sour)m(ces)p Fv(\).)24 b(Return)390 2494 y(a)h(list)h(of)e(object)g(\002lenames,)h (one)f(per)g(source)g(\002lename)f(in)i Fp(sour)m(ces)p Fv(.)38 b(Depending)22 b(on)i(the)h(implementation,)e(not)h(all)390 2594 y(source)c(\002les)h(will)g(necessarily)e(be)h(compiled,)f(b)n(ut) h(all)h(corresponding)c(object)i(\002lenames)h(will)h(be)f(returned.) 390 2704 y(If)h Fp(output)p 686 2704 V 28 w(dir)i Fv(is)f(gi)n(v)o(en,) d(object)i(\002les)h(will)f(be)g(put)f(under)g(it,)h(while)g(retaining) f(their)g(original)g(path)g(component.)25 b(That)390 2804 y(is,)e(`)p Fw(f)n(oo/bar)l(.c)p Fv(')18 b(normally)i(compiles)h (to)g(`)p Fw(f)n(oo/bar)l(.o)p Fv(')d(\(for)j(a)i(U)t Fm(N)t(I)t(X)i Fv(implementation\);)19 b(if)j Fp(output)p 3254 2804 V 28 w(dir)i Fv(is)e Fp(b)n(uild)r Fv(,)f(then)g(it)390 2904 y(w)o(ould)f(compile)f(to)h(`)p Fw(b)o(uild/f)n(oo/bar)l(.o)p Fv('.)390 3014 y Fp(macr)l(os)p Fv(,)e(if)f(gi)n(v)o(en,)f(must)i(be)f (a)g(list)h(of)f(macro)f(de\002nitions.)23 b(A)18 b(macro)e (de\002nition)g(is)i(either)f(a)g Fr(\()p Fp(name)p Fr(,)49 b Fp(value)p Fr(\))16 b Fv(2-tuple)390 3114 y(or)26 b(a)g Fr(\()p Fp(name)p Fr(,\))f Fv(1-tuple.)41 b(The)25 b(former)f (de\002nes)h(a)h(macro;)i(if)e(the)g(v)n(alue)f(is)h Fr(None)p Fv(,)h(the)e(macro)g(is)i(de\002ned)d(without)390 3214 y(an)j(e)o(xplicit)f(v)n(alue.)44 b(The)26 b(1-tuple)g(case)h (unde\002nes)e(a)j(macro.)43 b(Later)27 b (de\002nitions/rede\002nitions/unde\002nitions)22 b(tak)o(e)390 3313 y(precedence.)390 3424 y Fp(include)p 641 3424 V 29 w(dir)o(s)p Fv(,)f(if)g(gi)n(v)o(en,)f(must)h(be)f(a)i(list)f(of)g (strings,)g(the)f(directories)g(to)h(add)f(to)h(the)g(def)o(ault)f (include)g(\002le)i(search)e(path)390 3524 y(for)g(this)g(compilation)f (only)-5 b(.)390 3634 y Fp(deb)n(ug)22 b Fv(is)j(a)f(boolean;)f(if)h (true,)g(the)f(compiler)f(will)j(be)e(instructed)f(to)i(output)e(deb)n (ug)g(symbols)h(in)h(\(or)f(alongside\))f(the)390 3734 y(object)e(\002le\(s\).)390 3845 y Fp(e)n(xtr)o(a)p 563 3845 V 30 w(pr)m(ear)m(gs)25 b Fv(and)g Fp(e)n(xtr)o(a)p 1185 3845 V 30 w(postar)m(gs)g Fv(are)g(implementation-dependent.)36 b(On)26 b(platforms)e(that)i(ha)n(v)o(e)f(the)g(notion)g(of)g(a)390 3944 y(command-line)16 b(\(e.g.)25 b(U)t Fm(N)t(I)t(X)r Fv(,)20 b(DOS/W)m(indo)n(ws\),)d(the)o(y)h(are)g(most)h(lik)o(ely)f (lists)i(of)e(strings:)24 b(e)o(xtra)18 b(command-line)d(ar)o(gu-)390 4044 y(ments)23 b(to)f(prepend/append)c(to)23 b(the)f(compiler)g (command)e(line.)32 b(On)22 b(other)g(platforms,)f(consult)h(the)h (implementation)390 4144 y(class)30 b(documentation.)48 b(In)29 b(an)o(y)f(e)n(v)o(ent,)i(the)o(y)e(are)g(intended)g(as)h(an)g (escape)g(hatch)f(for)g(those)h(occasions)f(when)h(the)390 4243 y(abstract)20 b(compiler)f(frame)n(w)o(ork)f(doesn')o(t)h(cut)h (the)g(mustard.)390 4354 y Fp(depends)p Fv(,)j(if)g(gi)n(v)o(en,)g(is)h (a)g(list)h(of)e(\002lenames)g(that)g(all)h(tar)o(gets)f(depend)f(on.) 34 b(If)23 b(a)h(source)e(\002le)i(is)g(older)f(than)g(an)o(y)f(\002le) i(in)390 4453 y(depends,)d(then)h(the)f(source)h(\002le)g(will)h(be)f (recompiled.)28 b(This)22 b(supports)f(dependenc)o(y)e(tracking,)i(b)n (ut)h(only)f(at)i(a)f(coarse)390 4553 y(granularity)-5 b(.)390 4664 y(Raises)22 b Fr(CompileError)c Fv(on)i(f)o(ailure.)208 4791 y Fg(create_static_lib)p Fr(\()p Fp(objects,)c(output)p 1600 4791 V 28 w(libname)p Fk([)p Fp(,)j(output)p 2191 4791 V 28 w(dir=)p Fa(None)p Fp(,)h(deb)n(ug=)p Fa(0)p Fp(,)e(tar)m(g)o(et)p 3156 4791 V 30 w(lang=)p Fa(None)12 b Fk(])p Fr(\))390 4891 y Fv(Link)27 b(a)g(b)n(unch)f(of)g(stuf)n(f)h (together)e(to)j(create)e(a)i(static)f(library)f(\002le.)46 b(The)27 b(\223b)n(unch)e(of)i(stuf)n(f)5 b(\224)26 b(consists)h(of)g (the)g(list)h(of)390 4990 y(object)22 b(\002les)i(supplied)d(as)i Fp(objects)p Fv(,)g(the)f(e)o(xtra)g(object)g(\002les)i(supplied)d(to)i Fr(add_link_object\(\))d Fv(and/or)h Fr(set_-)390 5090 y(link_objects\(\))p Fv(,)i(the)h(libraries)g(supplied)f(to)h Fr(add_library\(\))e Fv(and/or)h Fr(set_libraries\(\))p Fv(,)f(and)i(the)390 5190 y(libraries)c(supplied)f(as)i Fp(libr)o(aries)g Fv(\(if)f(an)o(y\).)390 5300 y Fp(output)p 609 5300 V 28 w(libname)26 b Fv(should)h(be)g(a)g(library)f(name,)i (not)f(a)g(\002lename;)j(the)e(\002lename)e(will)i(be)f(inferred)e (from)i(the)g(library)390 5400 y(name.)e Fp(output)p 836 5400 V 28 w(dir)d Fv(is)f(the)f(directory)f(where)h(the)g(library)f (\002le)i(will)g(be)f(put.)k(XXX)d(def)o(aults)f(to)g(what?)p 0 5549 3901 4 v 0 5649 a Fs(11.2.)52 b Fr(distutils.ccompiler)20 b Fs(\227)j(CCompiler)h(base)f(class)1688 b(47)p eop end %%Page: 48 56 TeXDict begin 48 55 bop 390 83 a Fp(deb)n(ug)31 b Fv(is)j(a)e(boolean;) 37 b(if)c(true,)i(deb)n(ugging)29 b(information)h(will)j(be)g(included) e(in)h(the)g(library)g(\(note)f(that)i(on)f(most)390 183 y(platforms,)19 b(it)i(is)g(the)f(compile)f(step)i(where)f(this)g (matters:)25 b(the)c Fp(deb)n(ug)e Fv(\003ag)h(is)h(included)e(here)g (just)i(for)f(consistenc)o(y\).)390 298 y Fp(tar)m(g)o(et)p 590 298 25 4 v 30 w(lang)26 b Fv(is)j(the)f(tar)o(get)f(language)f(for) h(which)g(the)h(gi)n(v)o(en)e(objects)i(are)g(being)e(compiled.)46 b(This)28 b(allo)n(ws)g(speci\002c)390 397 y(linkage)19 b(time)i(treatment)e(of)h(certain)g(languages.)390 513 y(Raises)i Fr(LibError)d Fv(on)h(f)o(ailure.)208 644 y Fg(link)p Fr(\()p Fp(tar)m(g)o(et)p 658 644 V 28 w(desc,)35 b(objects,)h(output)p 1397 644 V 28 w(\002lename)p Fk([)p Fp(,)e(output)p 2017 644 V 28 w(dir=)p Fa(None)p Fp(,)h(libr)o(aries=)p Fa(None)p Fp(,)g(libr)o(ary)p 3281 644 V 29 w(dir)o(s=)p Fa(None)p Fp(,)h(runtime)p 4010 644 V 29 w(li-)458 744 y(br)o(ary)p 647 744 V 28 w(dir)o(s=)p Fa(None)p Fp(,)42 b(e)n(xport)p 1333 744 V 29 w(symbols=)p Fa(None)p Fp(,)f(deb)n(ug=)p Fa(0)p Fp(,)g(e)n(xtr)o(a)p 2487 744 V 29 w(pr)m(ear)m(gs=)p Fa(None)p Fp(,)g(e)n(xtr)o(a)p 3255 744 V 29 w(postar)m(gs=)p Fa(None)p Fp(,)g(b)n(uild)p 4056 744 V 29 w(-)458 844 y(temp=)p Fa(None)p Fp(,)18 b(tar)m(g)o(et)p 1115 844 V 29 w(lang=)p Fa(None)12 b Fk(])p Fr(\))390 927 y Fv(Link)20 b(a)g(b)n(unch)f(of)h(stuf)n(f)g(together)f(to)h(create)g(an)g(e)o(x)o (ecutable)f(or)h(shared)f(library)g(\002le.)390 1042 y(The)29 b(\223b)n(unch)g(of)g(stuf)n(f)5 b(\224)29 b(consists)h(of)f (the)h(list)h(of)e(object)g(\002les)i(supplied)d(as)j Fp(objects)p Fv(.)52 b Fp(output)p 3235 1042 V 29 w(\002lename)28 b Fv(should)h(be)390 1142 y(a)g(\002lename.)51 b(If)28 b Fp(output)p 1118 1142 V 28 w(dir)j Fv(is)f(supplied,)g Fp(output)p 1907 1142 V 28 w(\002lename)e Fv(is)h(relati)n(v)o(e)f(to)h (it)h(\(i.e.)50 b Fp(output)p 3169 1142 V 28 w(\002lename)28 b Fv(can)h(pro)o(vide)390 1241 y(directory)19 b(components)f(if)i (needed\).)390 1357 y Fp(libr)o(aries)26 b Fv(is)g(a)f(list)h(of)f (libraries)g(to)g(link)g(against.)38 b(These)25 b(are)g(library)f (names,)i(not)f(\002lenames,)g(since)h(the)o(y')l(re)d(trans-)390 1456 y(lated)34 b(into)g(\002lenames)g(in)g(a)h(platform-speci\002c)c (w)o(ay)j(\(e)o(g.)66 b Fp(foo)34 b Fv(becomes)f(`)p Fw(libf)n(oo)m(.a)p Fv(')e(on)k(U)t Fm(N)t(I)t(X)i Fv(and)d(`)p Fw(f)n(oo)m(.lib)p Fv(')d(on)390 1556 y(DOS/W)m(indo)n(ws\).)54 b(Ho)n(we)n(v)o(er)m(,)31 b(the)o(y)e(can)h(include)f(a)i(directory)d (component,)i(which)g(means)g(the)g(link)o(er)f(will)i(look)390 1655 y(in)21 b(that)f(speci\002c)g(directory)f(rather)g(than)h (searching)f(all)h(the)h(normal)e(locations.)390 1771 y Fp(libr)o(ary)p 625 1771 V 29 w(dir)o(s)p Fv(,)28 b(if)f(supplied,)f (should)e(be)i(a)h(list)g(of)e(directories)g(to)h(search)f(for)h (libraries)f(that)h(were)g(speci\002ed)g(as)g(bare)390 1870 y(library)g(names)g(\(ie.)45 b(no)26 b(directory)f(component\).)41 b(These)27 b(are)g(on)f(top)g(of)h(the)f(system)h(def)o(ault)f(and)g (those)h(supplied)390 1970 y(to)19 b Fr(add_library_dir\(\))d Fv(and/or)i Fr(set_library_dirs\(\))p Fv(.)j Fp(runtime)p 2778 1970 V 29 w(libr)o(ary)p 3037 1970 V 30 w(dir)o(s)e Fv(is)h(a)f(list)h(of)f(directories)390 2069 y(that)f(will)h(be)f (embedded)e(into)i(the)h(shared)e(library)g(and)h(used)g(to)g(search)g (for)f(other)h(shared)f(libraries)h(that)g(*it*)g(depends)390 2169 y(on)i(at)h(run-time.)i(\(This)d(may)g(only)f(be)h(rele)n(v)n(ant) f(on)j(U)t Fm(N)t(I)t(X)r Fv(.\))390 2284 y Fp(e)n(xport)p 606 2284 V 30 w(symbols)d Fv(is)i(a)f(list)h(of)f(symbols)f(that)h(the) g(shared)f(library)f(will)j(e)o(xport.)i(\(This)d(appears)f(to)h(be)f (rele)n(v)n(ant)g(only)g(on)390 2384 y(W)m(indo)n(ws.\))390 2499 y Fp(deb)n(ug)24 b Fv(is)i(as)g(for)e Fr(compile\(\))g Fv(and)h Fr(create_static_lib\(\))p Fv(,)e(with)i(the)g(slight)g (distinction)f(that)h(it)h(actually)390 2599 y(matters)17 b(on)g(most)g(platforms)f(\(as)h(opposed)e(to)i Fr (create_static_lib\(\))p Fv(,)e(which)h(includes)h(a)g Fp(deb)n(ug)f Fv(\003ag)h(mostly)390 2698 y(for)j(form')-5 b(s)19 b(sak)o(e\).)390 2813 y Fp(e)n(xtr)o(a)p 563 2813 V 30 w(pr)m(ear)m(gs)f Fv(and)g Fp(e)n(xtr)o(a)p 1171 2813 V 30 w(postar)m(gs)g Fv(are)g(as)h(for)f Fr(compile\(\))f Fv(\(e)o(xcept)h(of)g(course)g(that)g(the)o(y)g(supply)f(command-line) 390 2913 y(ar)o(guments)h(for)i(the)g(particular)f(link)o(er)h(being)f (used\).)390 3028 y Fp(tar)m(g)o(et)p 590 3028 V 30 w(lang)26 b Fv(is)j(the)f(tar)o(get)f(language)f(for)h(which)g(the)h(gi)n(v)o(en) e(objects)i(are)g(being)e(compiled.)46 b(This)28 b(allo)n(ws)g (speci\002c)390 3128 y(linkage)19 b(time)i(treatment)e(of)h(certain)g (languages.)390 3243 y(Raises)i Fr(LinkError)d Fv(on)h(f)o(ailure.)208 3375 y Fg(link_executable)p Fr(\()p Fp(objects,)41 b(output)p 1525 3375 V 29 w(pr)l(o)o(gname)p Fk([)p Fp(,)i(output)p 2206 3375 V 28 w(dir=)p Fa(None)p Fp(,)i(libr)o(aries=)p Fa(None)p Fp(,)g(libr)o(ary)p 3490 3375 V 29 w(dir)o(s=)p Fa(None)p Fp(,)h(run-)1008 3474 y(time)p 1156 3474 V 26 w(libr)o(ary)p 1412 3474 V 30 w(dir)o(s=)p Fa(None)p Fp(,)k(deb)n(ug=)p Fa(0)p Fp(,)f(e)n(xtr)o(a)p 2444 3474 V 30 w(pr)m(ear)m(gs=)p Fa(None)p Fp(,)g(e)n(xtr)o(a)p 3221 3474 V 30 w(postar)m(gs=)p Fa(None)p Fp(,)g(tar)m(g)o(et)p 4056 3474 V 29 w(-)1008 3574 y(lang=)p Fa(None)12 b Fk(])p Fr(\))390 3658 y Fv(Link)22 b(an)h(e)o(x)o(ecutable.)31 b Fp(output)p 1298 3658 V 28 w(pr)l(o)o(gname)22 b Fv(is)i(the)e(name)h (of)f(the)h(\002le)h(e)o(x)o(ecutable,)d(while)i Fp(objects)g Fv(are)f(a)i(list)g(of)e(object)390 3757 y(\002lenames)e(to)h(link)e (in.)26 b(Other)19 b(ar)o(guments)f(are)j(as)f(for)g(the)g Fr(link)g Fv(method.)208 3889 y Fg(link_shared_lib)p Fr(\()p Fp(objects,)54 b(output)p 1538 3889 V 28 w(libname)p Fk([)p Fp(,)j(output)p 2167 3889 V 29 w(dir=)p Fa(None)p Fp(,)g(libr)o(aries=)p Fa(None)p Fp(,)h(libr)o(ary)p 3477 3889 V 29 w(dir)o(s=)p Fa(None)p Fp(,)h(run-)1008 3989 y(time)p 1156 3989 V 26 w(libr)o(ary)p 1412 3989 V 30 w(dir)o(s=)p Fa(None)p Fp(,)50 b(e)n(xport)p 2108 3989 V 29 w(symbols=)p Fa(None)p Fp(,)g(deb)n(ug=)p Fa(0)p Fp(,)f(e)n(xtr)o(a)p 3279 3989 V 29 w(pr)m(ear)m(gs=)p Fa(None)p Fp(,)g(e)n(xtr)o(a)p 4055 3989 V 30 w(-)1008 4088 y(postar)m(gs=)p Fa(None)p Fp(,)15 b(b)n(uild)p 1759 4088 V 29 w(temp=)p Fa(None)p Fp(,)k(tar)m(g)o(et)p 2441 4088 V 30 w(lang=)p Fa(None)12 b Fk(])p Fr(\))390 4172 y Fv(Link)26 b(a)i(shared)e(library)-5 b(.)43 b Fp(output)p 1384 4172 V 28 w(libname)26 b Fv(is)h(the)g(name)f(of)h (the)f(output)g(library)-5 b(,)27 b(while)f Fp(objects)h Fv(is)h(a)f(list)h(of)e(object)390 4272 y(\002lenames)20 b(to)h(link)e(in.)26 b(Other)19 b(ar)o(guments)f(are)j(as)f(for)g(the)g Fr(link)g Fv(method.)208 4403 y Fg(link_shared_object)p Fr(\()p Fp(objects,)h(output)p 1655 4403 V 28 w(\002lename)p Fk([)p Fp(,)j(output)p 2265 4403 V 28 w(dir=)p Fa(None)p Fp(,)i(libr)o(aries=)p Fa(None)p Fp(,)f(libr)o(ary)p 3510 4403 V 29 w(dir)o(s=)p Fa(None)p Fp(,)h(run-)1158 4503 y(time)p 1306 4503 V 26 w(libr)o(ary)p 1562 4503 V 29 w(dir)o(s=)p Fa(None)p Fp(,)44 b(e)n(xport)p 2251 4503 V 30 w(symbols=)p Fa(None)p Fp(,)f(deb)n(ug=)p Fa(0)p Fp(,)g(e)n(xtr)o(a)p 3410 4503 V 30 w(pr)m(ear)m(gs=)p Fa(None)p Fp(,)g(e)n(x-)1158 4603 y(tr)o(a)p 1259 4603 V 26 w(postar)m(gs=)p Fa(None)p Fp(,)18 b(b)n(uild)p 2034 4603 V 29 w(temp=)p Fa(None)p Fp(,)h(tar)m(g)o(et)p 2716 4603 V 30 w(lang=)p Fa(None)12 b Fk(])p Fr(\))390 4686 y Fv(Link)19 b(a)g(shared)f(object.)24 b Fp(output)p 1327 4686 V 28 w(\002lename)18 b Fv(is)i(the)f(name)f(of)h(the)g (shared)f(object)h(that)g(will)h(be)f(created,)f(while)h Fp(objects)g Fv(is)390 4786 y(a)i(list)g(of)f(object)g(\002lenames)g (to)g(link)g(in.)25 b(Other)20 b(ar)o(guments)e(are)i(as)h(for)f(the)g Fr(link)g Fv(method.)208 4918 y Fg(preprocess)p Fr(\()p Fp(sour)m(ce)p Fk([)p Fp(,)58 b(output)p 1315 4918 V 28 w(\002le=)p Fa(None)p Fp(,)i(macr)l(os=)p Fa(None)p Fp(,)g(include)p 2606 4918 V 28 w(dir)o(s=)p Fa(None)p Fp(,)h(e)n(xtr)o(a)p 3268 4918 V 30 w(pr)m(ear)m(gs=)p Fa(None)p Fp(,)e(e)n(xtr)o(a)p 4055 4918 V 30 w(-)758 5017 y(postar)m(gs=)p Fa(None)12 b Fk(])p Fr(\))390 5101 y Fv(Preprocess)22 b(a)i(single)f(C/C)1189 5094 y(++)1307 5101 y(source)f(\002le,)i(named)e(in)i Fp(sour)m(ce)p Fv(.)33 b(Output)22 b(will)i(be)f(written)g(to)g(\002le)h(named)e Fp(output)p 3755 5101 V 28 w(\002le)p Fv(,)390 5201 y(or)h Fp(stdout)g Fv(if)g Fp(output)p 1003 5201 V 28 w(\002le)g Fv(not)f(supplied.)31 b Fp(macr)l(os)23 b Fv(is)h(a)f(list)h(of)e (macro)g(de\002nitions)f(as)j(for)e Fr(compile\(\))p Fv(,)g(which)g(will)390 5300 y(augment)j(the)i(macros)f(set)h(with)f Fr(define_macro\(\))f Fv(and)h Fr(undefine_macro\(\))p Fv(.)41 b Fp(include)p 3377 5300 V 29 w(dir)o(s)27 b Fv(is)g(a)g(list)h(of)390 5400 y(directory)19 b(names)h(that)g(will)h (be)f(added)f(to)h(the)g(def)o(ault)g(list,)h(in)f(the)h(same)f(w)o(ay) g(as)h Fr(add_include_dir\(\))p Fv(.)p 0 5549 3901 4 v 0 5649 a Fs(48)2762 b(Chapter)23 b(11.)53 b(API)23 b(Ref)n(erence)p eop end %%Page: 49 57 TeXDict begin 49 56 bop 390 83 a Fv(Raises)22 b Fr(PreprocessError)c Fv(on)h(f)o(ailure.)208 213 y(The)g(follo)n(wing)e(utility)j(methods)e (are)i(de\002ned)e(by)h(the)g Fr(CCompiler)g Fv(class,)h(for)f(use)g (by)g(the)h(v)n(arious)e(concrete)g(subclasses.)208 342 y Fg(executable_filename)p Fr(\()p Fp(basename)p Fk([)p Fp(,)c(strip)p 1774 342 25 4 v 30 w(dir=)p Fa(0)p Fp(,)21 b(output)p 2263 342 V 28 w(dir=)p Fa('')12 b Fk(])p Fr(\))390 442 y Fv(Returns)20 b(the)h(\002lename)e(of)h(the)h(e)o(x)o(ecutable)d (for)i(the)g(gi)n(v)o(en)f Fp(basename)p Fv(.)24 b(T)-7 b(ypically)19 b(for)h(non-W)m(indo)n(ws)e(platforms)h(this)390 541 y(is)i(the)g(same)f(as)h(the)f(basename,)f(while)h(W)m(indo)n(ws)g (will)h(get)f(a)g(`)p Fw(.e)n(x)n(e)p Fv(')f(added.)208 671 y Fg(library_filename)p Fr(\()p Fp(libname)p Fk([)p Fp(,)c(lib)p 1496 671 V 30 w(type=)p Fa('static')p Fp(,)j(strip)p 2312 671 V 30 w(dir=)p Fa(0)p Fp(,)j(output)p 2801 671 V 28 w(dir=)p Fa('')12 b Fk(])p Fr(\))390 770 y Fv(Returns)22 b(the)h(\002lename)f(for)g(the)g(gi)n(v)o(en)f(library)g(name)h(on)g (the)h(current)e(platform.)30 b(On)24 b(U)t Fm(N)t(I)t(X)h Fv(a)e(library)f(with)g Fp(lib)p 3737 770 V 30 w(type)390 870 y Fv(of)f Fr('static')f Fv(will)i(typically)e(be)h(of)g(the)g(form) f(`)p Fw(lib)o(libname)o(.a)p Fv(',)15 b(while)22 b(a)f Fp(lib)p 2712 870 V 30 w(type)f Fv(of)h Fr('dynamic')f Fv(will)i(be)f(of)g(the)390 970 y(form)e(`)p Fw(lib)o(libname)o(.so)p Fv('.)208 1099 y Fg(object_filenames)p Fr(\()p Fp(sour)m(ce)p 1282 1099 V 26 w(\002lenames)p Fk([)p Fp(,)f(strip)p 1854 1099 V 31 w(dir=)p Fa(0)p Fp(,)i(output)p 2343 1099 V 28 w(dir=)p Fa('')12 b Fk(])p Fr(\))390 1199 y Fv(Returns)j(the)h (name)f(of)g(the)g(object)g(\002les)h(for)f(the)g(gi)n(v)o(en)f(source) h(\002les.)24 b Fp(sour)m(ce)p 2620 1199 V 29 w(\002lenames)15 b Fv(should)f(be)i(a)f(list)i(of)e(\002lenames.)208 1328 y Fg(shared_object_filename)p Fr(\()p Fp(basena)o(me)p Fk([)p Fp(,)g(strip)p 1924 1328 V 30 w(dir=)p Fa(0)p Fp(,)20 b(output)p 2412 1328 V 28 w(dir=)p Fa('')12 b Fk(])p Fr(\))390 1428 y Fv(Returns)20 b(the)g(name)g(of)g(a)h(shared)e (object)h(\002le)h(for)e(the)h(gi)n(v)o(en)f(\002le)i(name)f Fp(basename)p Fv(.)208 1557 y Fg(execute)p Fr(\()p Fp(func,)e(ar)m(gs)p Fk([)p Fp(,)h(msg=)p Fa(None)p Fp(,)h(le)o(vel=)p Fa(1)12 b Fk(])p Fr(\))390 1657 y Fv(In)m(v)n(ok)o(es)24 b Fr (distutils.util.execute\(\))e Fv(This)j(method)f(in)m(v)n(ok)o(es)h(a)h (Python)e(function)g Fp(func)h Fv(with)g(the)h(gi)n(v)o(en)390 1757 y(ar)o(guments)18 b Fp(ar)m(gs)p Fv(,)i(after)g(logging)f(and)g (taking)h(into)g(account)f(the)h Fp(dry)p 2425 1757 V 29 w(run)g Fv(\003ag.)25 b(XXX)c(see)g(also.)208 1886 y Fg(spawn)p Fr(\()p Fp(cmd)r Fr(\))390 1986 y Fv(In)m(v)n(ok)o(es)27 b Fr(distutils.util.spawn\(\))p Fv(.)45 b(This)28 b(in)m(v)n(ok)o(es)g (an)g(e)o(xternal)f(process)g(to)h(run)g(the)g(gi)n(v)o(en)f(command.) 390 2085 y(XXX)21 b(see)g(also.)208 2215 y Fg(mkpath)p Fr(\()p Fp(name)p Fk([)p Fp(,)c(mode=)p Fa(511)12 b Fk(])p Fr(\))390 2314 y Fv(In)m(v)n(ok)o(es)18 b Fr (distutils.dir_util.mkpath\(\))p Fv(.)i(This)g(creates)f(a)h(directory) e(and)h(an)o(y)f(missing)i(ancestor)e(direc-)390 2414 y(tories.)25 b(XXX)c(see)g(also.)208 2543 y Fg(move_file)p Fr(\()p Fp(sr)m(c,)e(dst)q Fr(\))390 2643 y Fv(In)m(v)n(ok)o(es)g Fr(distutils.file_util.move_file\(\))p Fv(.)h(Renames)g Fp(sr)m(c)h Fv(to)f Fp(dst)q Fv(.)26 b(XXX)21 b(see)g(also.)208 2773 y Fg(announce)p Fr(\()p Fp(msg)p Fk([)p Fp(,)d(le)o(vel=)p Fa(1)12 b Fk(])p Fr(\))390 2872 y Fv(Write)21 b(a)g(message)f(using)f Fr(distutils.log.debug\(\))p Fv(.)j(XXX)e(see)h(also.)208 3002 y Fg(warn)p Fr(\()p Fp(msg)p Fr(\))390 3101 y Fv(Write)g(a)g(w)o (arning)e(message)h Fp(msg)g Fv(to)g(standard)g(error)-5 b(.)208 3231 y Fg(debug_print)p Fr(\()p Fp(msg)p Fr(\))390 3330 y Fv(If)20 b(the)g Fp(deb)n(ug)f Fv(\003ag)i(is)g(set)g(on)f(this) g Fr(CCompiler)f Fv(instance,)h(print)g Fp(msg)g Fv(to)g(standard)f (output,)g(otherwise)h(do)g(nothing.)0 3655 y Fo(11.3)121 b Fc(distutils.unixccompiler)27 b Fo(\227)33 b(Unix)g(C)h(Compiler)0 3888 y Fv(This)26 b(module)f(pro)o(vides)f(the)i Fr(UnixCCompiler)e Fv(class,)k(a)e(subclass)g(of)g Fr(CCompiler)f Fv(that)h(handles)f(the) h(typical)h(U)t Fm(N)t(I)t(X)r Fv(-style)0 3987 y(command-line)17 b(C)k(compiler:)125 4200 y Fu(\017)41 b Fv(macros)19 b(de\002ned)g(with)i Ft(-D)p Fd(name)p Fk([)p Ft(=v)o(alue)12 b Fk(])125 4360 y Fu(\017)41 b Fv(macros)19 b(unde\002ned)f(with)j Ft(-U)p Fd(name)125 4519 y Fu(\017)41 b Fv(include)19 b(search)h(directories)f(speci\002ed)h(with)g Ft(-I)p Fd(dir)125 4678 y Fu(\017)41 b Fv(libraries)19 b(speci\002ed)h(with)h Ft(-l)p Fd(lib)125 4838 y Fu(\017)41 b Fv(library)19 b(search)g(directories)h(speci\002ed)g(with)g Ft(-L)p Fd(dir)125 4997 y Fu(\017)41 b Fv(compile)19 b(handled)f(by)i Ft(cc)h Fv(\(or)e(similar\))h(e)o(x)o(ecutable)f(with)h Ft(-c)g Fv(option:)k(compiles)c(`)p Fw(.c)p Fv(')g(to)g(`)p Fw(.o)p Fv(')125 5156 y Fu(\017)41 b Fv(link)19 b(static)j(library)d (handled)f(by)i Ft(ar)g Fv(command)e(\(possibly)h(with)i Ft(ranlib)p Fv(\))125 5316 y Fu(\017)41 b Fv(link)19 b(shared)h(library)f(handled)g(by)g Ft(cc)i(-shar)o(ed)p 0 5549 3901 4 v 0 5649 a Fs(11.3.)52 b Fr(distutils.unixccompiler)19 b Fs(\227)k(Unix)g(C)g(Compiler)1694 b(49)p eop end %%Page: 50 58 TeXDict begin 50 57 bop 0 88 a Fo(11.4)121 b Fc(distutils.msvccompiler) 28 b Fo(\227)k(Microsoft)h(Compiler)0 321 y Fv(This)25 b(module)e(pro)o(vides)f Fr(MSVCCompiler)p Fv(,)i(an)g(implementation)e (of)j(the)f(abstract)g Fr(CCompiler)g Fv(class)h(for)f(Microsoft)f(V)-5 b(isual)0 421 y(Studio.)34 b(T)-7 b(ypically)i(,)23 b(e)o(xtension)f (modules)g(need)h(to)h(be)f(compiled)f(with)i(the)f(same)h(compiler)e (that)h(w)o(as)i(used)e(to)g(compile)g(Python.)0 520 y(F)o(or)h(Python)e(2.3)i(and)f(earlier)m(,)h(the)g(compiler)e(w)o(as)j (V)-5 b(isual)24 b(Studio)g(6.)36 b(F)o(or)23 b(Python)g(2.4)g(and)h (2.5,)g(the)f(compiler)g(is)i(V)-5 b(isual)24 b(Studio)0 620 y(.NET)c(2003.)j(The)d(AMD64)g(and)f(Itanium)g(binaries)h(are)g (created)g(using)f(the)h(Platform)g(SDK.)0 767 y Fr(MSVCCompiler)j Fv(will)i(normally)e(choose)g(the)h(right)g(compiler)m(,)g(link)o(er)f (etc.)38 b(on)24 b(its)i(o)n(wn.)36 b(T)-7 b(o)25 b(o)o(v)o(erride)d (this)j(choice,)f(the)h(en)m(vi-)0 866 y(ronment)19 b(v)n(ariables)g Fp(DISTUTILS)p 1019 866 25 4 v 29 w(USE)p 1201 866 V 29 w(SDK)25 b Fv(and)20 b Fp(MSSdk)h Fv(must)f(be)h(both)e(set.)27 b Fp(MSSdk)21 b Fv(indicates)f(that)g(the)h(current)e(en)m(vironment)0 966 y(has)26 b(been)g(setup)g(by)f(the)i(SDK')-5 b(s)27 b Fr(SetEnv.Cmd)d Fv(script,)k(or)e(that)g(the)g(en)m(vironment)d(v)n (ariables)i(had)h(been)f(re)o(gistered)g(when)h(the)0 1066 y(SDK)21 b(w)o(as)g(installed;)g Fp(DISTUTILS)p 1065 1066 V 28 w(USE)p 1246 1066 V 29 w(SDK)26 b Fv(indicates)20 b(that)g(the)h(distutils)g(user)f(has)g(made)g(an)h(e)o(xplicit)e (choice)h(to)g(o)o(v)o(erride)f(the)0 1165 y(compiler)g(selection)h(by) g Fr(MSVCCompiler)p Fv(.)0 1493 y Fo(11.5)121 b Fc (distutils.bcppcompiler)28 b Fo(\227)k(Bor)r(land)i(Compiler)0 1725 y Fv(This)28 b(module)d(pro)o(vides)h Fr(BorlandCCompiler)p Fv(,)h(an)g(subclass)g(of)h(the)f(abstract)g Fr(CCompiler)f Fv(class)j(for)d(the)i(Borland)e(C)3806 1718 y(++)0 1825 y(compiler)-5 b(.)0 2152 y Fo(11.6)121 b Fc(distutils.cygwincompiler)27 b Fo(\227)33 b(Cygwin)h(Compiler)0 2385 y Fv(This)20 b(module)e(pro)o(vides)g(the)h Fr(CygwinCCompiler)e Fv(class,)k(a)f (subclass)g(of)f Fr(UnixCCompiler)e Fv(that)j(handles)f(the)g(Cygwin)g (port)0 2485 y(of)i(the)g(GNU)h(C)g(compiler)e(to)i(W)m(indo)n(ws.)28 b(It)21 b(also)h(contains)f(the)g(Mingw32CCompiler)e(class)j(which)f (handles)f(the)i(mingw32)d(port)0 2585 y(of)h(GCC)h(\(same)f(as)h(c)o (ygwin)e(in)i(no-c)o(ygwin)c(mode\).)0 2912 y Fo(11.7)121 b Fc(distutils.emxccompiler)28 b Fo(\227)k(OS/2)i(EMX)e(Compiler)0 3145 y Fv(This)23 b(module)f(pro)o(vides)g(the)h(EMXCCompiler)g(class,) h(a)g(subclass)g(of)f Fr(UnixCCompiler)e Fv(that)j(handles)e(the)i(EMX) f(port)g(of)g(the)0 3244 y(GNU)e(C)g(compiler)e(to)h(OS/2.)0 3572 y Fo(11.8)121 b Fc(distutils.mwerkscompiler)40 b Fo(\227)45 b(Metro)n(w)o(er)r(ks)h(CodeW)-5 b(arr)r(ior)47 b(sup-)352 3721 y(por)5 b(t)0 3954 y Fv(Contains)18 b Fr(MWerksCompiler)p Fv(,)e(an)i(implementation)e(of)i(the)g(abstract)g Fr(CCompiler)f Fv(class)i(for)e(MetroW)-7 b(erks)18 b(CodeW)-7 b(arrior)17 b(on)0 4054 y(the)j(pre-Mac)f(OS)i(X)g(Macintosh.)j(Needs)c (w)o(ork)f(to)i(support)e(CW)i(on)f(W)m(indo)n(ws)g(or)f(Mac)i(OS)g(X.) 0 4381 y Fo(11.9)121 b Fc(distutils.archive_util)28 b Fo(\227)k(Archiving)h(utilities)0 4614 y Fv(This)20 b(module)f(pro)o (vides)g(a)h(fe)n(w)g(functions)f(for)h(creating)f(archi)n(v)o(e)g (\002les,)i(such)e(as)i(tarballs)g(or)e(zip\002les.)0 4761 y Fg(make_archive)p Fr(\()p Fp(base)p 808 4761 V 27 w(name)o(,)g(format)q Fk([)p Fp(,)h(r)l(oot)p 1494 4761 V 30 w(dir=)p Fa(None)p Fp(,)g(base)p 2071 4761 V 29 w(dir=)p Fa(None)p Fp(,)f(verbose=)p Fa(0)p Fp(,)h(dry)p 3010 4761 V 29 w(run=)p Fa(0)12 b Fk(])p Fr(\))208 4860 y Fv(Create)21 b(an)g(archi)n(v)o(e)f(\002le)h(\(e)o(g.)27 b Fr(zip)21 b Fv(or)g Fr(tar)p Fv(\).)28 b Fp(base)p 1737 4860 V 29 w(name)20 b Fv(is)i(the)f(name)g(of)g(the)g(\002le)g(to) h(create,)e(minus)h(an)o(y)f(format-speci\002c)208 4960 y(e)o(xtension;)f Fp(format)j Fv(is)f(the)g(archi)n(v)o(e)e(format:)25 b(one)20 b(of)g Fr(zip)p Fv(,)g Fr(tar)p Fv(,)g Fr(ztar)p Fv(,)h(or)f Fr(gztar)p Fv(.)25 b Fp(r)l(oot)p 2926 4960 V 30 w(dir)e Fv(is)e(a)g(directory)e(that)h(will)i(be)208 5060 y(the)h(root)g(directory)f(of)h(the)g(archi)n(v)o(e;)h(ie.)36 b(we)24 b(typically)e Fr(chdir)h Fv(into)h Fp(r)l(oot)p 2442 5060 V 29 w(dir)i Fv(before)c(creating)h(the)g(archi)n(v)o(e.)34 b Fp(base)p 3698 5060 V 29 w(dir)26 b Fv(is)208 5159 y(the)d(directory)e(where)h(we)i(start)f(archi)n(ving)e(from;)j(ie.)34 b Fp(base)p 1987 5159 V 29 w(dir)25 b Fv(will)f(be)f(the)g(common)e (pre\002x)i(of)f(all)i(\002les)g(and)f(directories)208 5259 y(in)d(the)g(archi)n(v)o(e.)k Fp(r)l(oot)p 843 5259 V 29 w(dir)f Fv(and)c Fp(base)p 1285 5259 V 29 w(dir)k Fv(both)c(def)o(ault)h(to)g(the)g(current)f(directory)-5 b(.)23 b(Returns)d(the)g(name)g(of)g(the)g(archi)n(v)o(e)f(\002le.)208 5392 y Ft(W)-5 b(ar)o(ning:)24 b Fv(This)c(should)f(be)h(changed)f(to)h (support)f(bz2)g(\002les)p 0 5549 3901 4 v 0 5649 a Fs(50)2762 b(Chapter)23 b(11.)53 b(API)23 b(Ref)n(erence)p eop end %%Page: 51 59 TeXDict begin 51 58 bop 0 83 a Fg(make_tarball)p Fr(\()p Fp(base)p 808 83 25 4 v 27 w(name)o(,)19 b(base)p 1208 83 V 29 w(dir)r Fk([)p Fp(,)h(compr)m(ess=)p Fa('gzip')p Fp(,)f(verbose=)p Fa(0)p Fp(,)h(dry)p 2641 83 V 29 w(run=)p Fa(0)12 b Fk(])p Fr(\))208 183 y Fv('Create)26 b(an)g(\(optional)f (compressed\))f(archi)n(v)o(e)h(as)i(a)g(tar)f(\002le)h(from)f(all)h (\002les)g(in)f(and)g(under)f Fp(base)p 3108 183 V 29 w(dir)r Fv(.)44 b Fp(compr)m(ess)26 b Fv(must)h(be)208 282 y Fr('gzip')e Fv(\(the)h(def)o(ault\),)h Fr('compress')p Fv(,)f Fr('bzip2')p Fv(,)h(or)f Fr(None)p Fv(.)43 b(Both)26 b Ft(tar)g Fv(and)g(the)g(compression)f(utility)h(named)f(by)208 382 y Fp(compr)m(ess)19 b Fv(must)h(be)f(on)g(the)g(def)o(ault)g (program)f(search)h(path,)f(so)i(this)g(is)h(probably)e(U)t Fm(N)t(I)t(X)r Fv(-speci\002c.)25 b(The)19 b(output)f(tar)i(\002le)g (will)208 482 y(be)i(named)f(`)p Fp(base)p 739 482 V 28 w(dir)r Fs(.tar)p Fv(',)i(possibly)e(plus)h(the)g(appropriate)e (compression)g(e)o(xtension)h(\(`)p Fw(.gz)p Fv(',)g(`)p Fw(.bz2)p Fv(')g(or)h(`)p Fw(.Z)p Fv('\).)f(Return)h(the)208 581 y(output)d(\002lename.)208 714 y Ft(W)-5 b(ar)o(ning:)24 b Fv(This)c(should)f(be)h(replaced)f(with)i(calls)g(to)f(the)g Fr(tarfile)g Fv(module.)0 861 y Fg(make_zipfile)p Fr(\()p Fp(base)p 808 861 V 27 w(name)o(,)f(base)p 1208 861 V 29 w(dir)r Fk([)p Fp(,)h(verbose=)p Fa(0)p Fp(,)g(dry)p 1934 861 V 29 w(run=)p Fa(0)12 b Fk(])p Fr(\))208 960 y Fv(Create)23 b(a)g(zip)g(\002le)h(from)e(all)h(\002les)h(in)f(and)f (under)g Fp(base)p 1818 960 V 29 w(dir)r Fv(.)33 b(The)23 b(output)f(zip)h(\002le)g(will)h(be)f(named)f Fp(base)p 3296 960 V 29 w(dir)j Fv(+)e(`)p Fw(.zip)p Fv('.)33 b(Uses)208 1060 y(either)15 b(the)h Fr(zipfile)f Fv(Python)g(module)g(\(if)g(a)n (v)n(ailable\))g(or)h(the)g(InfoZIP)e(`)p Fw(zip)p Fv(')i(utility)g (\(if)f(installed)h(and)g(found)e(on)h(the)h(def)o(ault)208 1160 y(search)22 b(path\).)32 b(If)23 b(neither)f(tool)g(is)i(a)n(v)n (ailable,)f(raises)g Fr(DistutilsExecError)p Fv(.)30 b(Returns)23 b(the)f(name)h(of)f(the)h(output)f(zip)208 1259 y(\002le.)0 1587 y Fo(11.10)122 b Fc(distutils.dep_util)28 b Fo(\227)33 b(Dependency)j(chec)n(king)0 1820 y Fv(This)20 b(module)e(pro)o(vides)f(functions)h(for)h(performing)e(simple,)i (timestamp-based)f(dependenc)o(y)e(of)j(\002les)i(and)e(groups)f(of)h (\002les;)h(also,)0 1919 y(functions)f(based)h(entirely)f(on)h(such)g (timestamp)f(dependenc)o(y)e(analysis.)0 2066 y Fg(newer)p Fr(\()p Fp(sour)m(ce)o(,)i(tar)m(g)o(et)q Fr(\))208 2166 y Fv(Return)27 b(true)g(if)h Fp(sour)m(ce)f Fv(e)o(xists)h(and)f(is)h (more)f(recently)f(modi\002ed)h(than)g Fp(tar)m(g)o(et)q Fv(,)i(or)e(if)h Fp(sour)m(ce)f Fv(e)o(xists)h(and)f Fp(tar)m(g)o(et)i Fv(doesn')o(t.)208 2265 y(Return)22 b(f)o(alse)i(if)f(both)g(e)o(xist)g(and)g Fp(tar)m(g)o(et)h Fv(is)g(the)g(same)f(age)g(or)g(ne)n(wer)f(than)h Fp(sour)m(ce)p Fv(.)34 b(Raise)24 b Fr(DistutilsFileError)c Fv(if)208 2365 y Fp(sour)m(ce)g Fv(does)g(not)f(e)o(xist.)0 2512 y Fg(newer_pairwise)p Fr(\()p Fp(sour)m(ces,)e(tar)m(g)o(ets)p Fr(\))208 2611 y Fv(W)-7 b(alk)19 b(tw)o(o)h(\002lename)e(lists)j(in)e (parallel,)f(testing)h(if)h(each)f(source)f(is)i(ne)n(wer)e(than)h(its) h(corresponding)15 b(tar)o(get.)24 b(Return)19 b(a)g(pair)g(of)208 2711 y(lists)i(\()p Fp(sour)m(ces)p Fv(,)f Fp(tar)m(g)o(ets)p Fv(\))g(where)g(source)f(is)i(ne)n(wer)f(than)f(tar)o(get,)g(according) g(to)h(the)g(semantics)g(of)g Fr(newer\(\))0 2858 y Fg(newer_group)p Fr(\()p Fp(sour)m(ces,)e(tar)m(g)o(et)q Fk([)p Fp(,)i(missing=)p Fa('error')12 b Fk(])p Fr(\))208 2958 y Fv(Return)23 b(true)g(if)h Fp(tar)m(g)o(et)h Fv(is)f(out-of-date)d(with)j(respect)f (to)h(an)o(y)e(\002le)i(listed)g(in)g Fp(sour)m(ces)g Fv(In)f(other)g(w)o(ords,)g(if)h Fp(tar)m(g)o(et)h Fv(e)o(xists)f(and) 208 3057 y(is)29 b(ne)n(wer)e(than)h(e)n(v)o(ery)e(\002le)j(in)f Fp(sour)m(ces)p Fv(,)i(return)d(f)o(alse;)33 b(otherwise)27 b(return)g(true.)49 b Fp(missing)28 b Fv(controls)f(what)h(we)h(do)f (when)f(a)208 3157 y(source)22 b(\002le)i(is)g(missing;)g(the)f(def)o (ault)f(\()p Fr('error')p Fv(\))g(is)i(to)f(blo)n(w)g(up)g(with)g(an)g Fr(OSError)f Fv(from)g(inside)h Fr(os.stat\(\))p Fv(;)g(if)h(it)208 3256 y(is)h Fr('ignore')p Fv(,)g(we)g(silently)g(drop)f(an)o(y)g (missing)h(source)f(\002les;)k(if)d(it)h(is)g Fr('newer')p Fv(,)f(an)o(y)f(missing)h(source)f(\002les)i(mak)o(e)e(us)208 3356 y(assume)17 b(that)g Fp(tar)m(g)o(et)i Fv(is)g(out-of-date)c (\(this)i(is)i(handy)c(in)j(\223dry-run\224)d(mode:)23 b(it')o(ll)18 b(mak)o(e)f(you)f(pretend)g(to)i(carry)e(out)h(commands) 208 3456 y(that)j(w)o(ouldn')o(t)f(w)o(ork)h(because)g(inputs)g(are)h (missing,)g(b)n(ut)f(that)h(doesn')o(t)e(matter)i(because)f(you')l(re)f (not)h(actually)g(going)f(to)i(run)208 3555 y(the)f(commands\).)0 3883 y Fo(11.11)122 b Fc(distutils.dir_util)28 b Fo(\227)33 b(Director)t(y)g(tree)h(oper)o(ations)0 4116 y Fv(This)20 b(module)f(pro)o(vides)g(functions)f(for)i(operating)e(on)i (directories)f(and)h(trees)g(of)g(directories.)0 4262 y Fg(mkpath)p Fr(\()p Fp(name)p Fk([)p Fp(,)e(mode=)p Fa(0777)p Fp(,)g(verbose=)p Fa(0)p Fp(,)i(dry)p 1608 4262 V 30 w(run=)p Fa(0)12 b Fk(])p Fr(\))208 4362 y Fv(Create)41 b(a)i(directory)c(and)j(an)o(y)e(missing)i(ancestor)f (directories.)88 b(If)41 b(the)h(directory)e(already)h(e)o(xists)h (\(or)f(if)h Fp(name)f Fv(is)208 4462 y(the)g(empty)g(string,)46 b(which)c(means)f(the)g(current)g(directory)-5 b(,)44 b(which)e(of)f(course)g(e)o(xists\),)47 b(then)41 b(do)g(nothing.)88 b(Raise)208 4561 y Fr(DistutilsFileError)27 b Fv(if)k(unable)e(to)i (create)f(some)h(directory)d(along)i(the)g(w)o(ay)h(\(e)o(g.)55 b(some)30 b(sub-path)f(e)o(xists,)34 b(b)n(ut)208 4661 y(is)21 b(a)f(\002le)h(rather)e(than)h(a)g(directory\).)j(If)d Fp(verbose)g Fv(is)h(true,)e(print)h(a)g(one-line)f(summary)g(of)h (each)f(mkdir)g(to)h(stdout.)25 b(Return)20 b(the)208 4761 y(list)h(of)f(directories)f(actually)h(created.)0 4907 y Fg(create_tree)p Fr(\()p Fp(base)p 758 4907 V 27 w(dir)-9 b(,)20 b(\002les)p Fk([)p Fp(,)g(mode=)p Fa(0777)p Fp(,)f(verbose=)p Fa(0)p Fp(,)g(dry)p 2122 4907 V 30 w(run=)p Fa(0)12 b Fk(])p Fr(\))208 5007 y Fv(Create)17 b(all)g(the)g(empty)f(directories)g(under)g Fp(base)p 1619 5007 V 29 w(dir)j Fv(needed)d(to)h(put)f Fp(\002les)i Fv(there.)23 b Fp(base)p 2738 5007 V 29 w(dir)c Fv(is)f(just)g(the)f(a)g(name)f(of)h(a)g(directory)208 5107 y(which)22 b(doesn')o(t)g(necessarily)h(e)o(xist)g(yet;)i Fp(\002les)e Fv(is)h(a)g(list)g(of)f(\002lenames)g(to)h(be)f (interpreted)e(relati)n(v)o(e)i(to)g Fp(base)p 3370 5107 V 29 w(dir)r Fv(.)35 b Fp(base)p 3707 5107 V 29 w(dir)25 b Fv(+)208 5206 y(the)d(directory)f(portion)h(of)g(e)n(v)o(ery)g (\002le)h(in)g Fp(\002les)g Fv(will)h(be)e(created)g(if)h(it)h(doesn')o (t)d(already)h(e)o(xist.)33 b Fp(mode)p Fv(,)22 b Fp(verbose)h Fv(and)f Fp(dry)p 3760 5206 V 30 w(run)208 5306 y Fv(\003ags)e(are)g (as)h(for)f Fr(mkpath\(\))p Fv(.)p 0 5549 3901 4 v 0 5649 a Fs(11.10.)52 b Fr(distutils.dep_util)20 b Fs(\227)j(Dependency)g (chec)n(king)1685 b(51)p eop end %%Page: 52 60 TeXDict begin 52 59 bop 0 83 a Fg(copy_tree)p Fr(\()p Fp(sr)m(c,)45 b(dst)q Fk([)p Fp(pr)m(eserve)p 1090 83 25 4 v 30 w(mode=)p Fa(1)p Fp(,)g(pr)m(eserve)p 1756 83 V 30 w(times=)p Fa(1)p Fp(,)h(pr)m(eserve)p 2417 83 V 30 w(symlinks=)p Fa(0)p Fp(,)g(update=)p Fa(0)p Fp(,)e(verbose=)p Fa(0)p Fp(,)i(dry)p 3848 83 V 29 w(-)500 183 y(run=)p Fa(0)12 b Fk(])p Fr(\))208 266 y Fv(Cop)o(y)27 b(an)h(entire)g (directory)e(tree)i Fp(sr)m(c)h Fv(to)f(a)g(ne)n(w)g(location)f Fp(dst)q Fv(.)49 b(Both)28 b Fp(sr)m(c)h Fv(and)e Fp(dst)j Fv(must)e(be)g(directory)e(names.)48 b(If)28 b Fp(sr)m(c)h Fv(is)208 366 y(not)23 b(a)h(directory)-5 b(,)22 b(raise)i Fr(DistutilsFileError)p Fv(.)33 b(If)24 b Fp(dst)i Fv(does)d(not)g(e)o (xist,)i(it)f(is)h(created)e(with)h Fr(mkpath\(\))p Fv(.)35 b(The)23 b(end)208 466 y(result)d(of)g(the)g(cop)o(y)f(is)i(that)g(e)n (v)o(ery)d(\002le)j(in)g Fp(sr)m(c)g Fv(is)g(copied)e(to)h Fp(dst)q Fv(,)h(and)f(directories)f(under)g Fp(sr)m(c)i Fv(are)f(recursi)n(v)o(ely)e(copied)i(to)g Fp(dst)q Fv(.)208 565 y(Return)g(the)g(list)i(of)e(\002les)i(that)e(were)h(copied)e(or)h (might)g(ha)n(v)o(e)g(been)g(copied,)f(using)h(their)h(output)e(name.) 25 b(The)20 b(return)g(v)n(alue)g(is)208 665 y(unaf)n(fected)g(by)i Fp(update)e Fv(or)i Fp(dry)p 1141 665 V 30 w(run)p Fv(:)29 b(it)23 b(is)h(simply)e(the)g(list)h(of)f(all)h(\002les)h(under)c Fp(sr)m(c)p Fv(,)k(with)e(the)h(names)f(changed)e(to)j(be)f(under)208 765 y Fp(dst)q Fv(.)208 897 y Fp(pr)m(eserve)p 496 897 V 29 w(mode)i Fv(and)g Fp(pr)m(eserve)p 1158 897 V 30 w(times)h Fv(are)f(the)h(same)g(as)g(for)f Fr(copy_file)f Fv(in)i Fr(distutils.file_util)p Fv(;)e(note)h(that)208 997 y(the)o(y)30 b(only)f(apply)h(to)h(re)o(gular)e(\002les,)34 b(not)c(to)h(directories.)56 b(If)30 b Fp(pr)m(eserve)p 2365 997 V 30 w(symlinks)h Fv(is)g(true,)i(symlinks)d(will)i(be)e (copied)g(as)208 1097 y(symlinks)h(\(on)h(platforms)f(that)i(support)e (them!\);)37 b(otherwise)32 b(\(the)g(def)o(ault\),)i(the)f (destination)e(of)h(the)h(symlink)e(will)j(be)208 1196 y(copied.)23 b Fp(update)c Fv(and)h Fp(verbose)g Fv(are)g(the)g(same)g (as)h(for)f Fr(copy_file\(\))p Fv(.)0 1343 y Fg(remove_tree)p Fr(\()p Fp(dir)m(ectory)p Fk([)p Fp(verbose=)p Fa(0)p Fp(,)c(dry)p 1460 1343 V 30 w(run=)p Fa(0)c Fk(])p Fr(\))208 1443 y Fv(Recursi)n(v)o(ely)27 b(remo)o(v)o(e)g Fp(dir)m(ectory)h Fv(and)g(all)h(\002les)h(and)e(directories)f(underneath)f(it.)51 b(An)o(y)28 b(errors)g(are)g(ignored)f(\(apart)h(from)208 1542 y(being)19 b(reported)f(to)j Fr(sys.stdout)d Fv(if)j Fp(verbose)f Fv(is)h(true\).)0 1689 y Ft(**Some)e(of)h(this)h(could)g (be)g(r)o(eplaced)e(with)i(the)f(shutil)h(module?**)0 2017 y Fo(11.12)122 b Fc(distutils.file_util)28 b Fo(\227)33 b(Single)g(\002le)g(oper)o(ations)0 2250 y Fv(This)20 b(module)f(contains)h(some)g(utility)g(functions)f(for)g(operating)f (on)i(indi)n(vidual)f(\002les.)0 2396 y Fg(copy_file)p Fr(\()p Fp(sr)m(c,)g(dst)q Fk([)p Fp(pr)m(eserve)p 1064 2396 V 30 w(mode=)p Fa(1)p Fp(,)g(pr)m(eserve)p 1704 2396 V 30 w(times=)p Fa(1)p Fp(,)h(update=)p Fa(0)p Fp(,)f(link=)p Fa(None)p Fp(,)g(verbose=)p Fa(0)p Fp(,)h(dry)p 3368 2396 V 29 w(run=)p Fa(0)12 b Fk(])p Fr(\))208 2496 y Fv(Cop)o(y)24 b(\002le)h Fp(sr)m(c)g Fv(to)f Fp(dst)q Fv(.)39 b(If)24 b Fp(dst)i Fv(is)g(a)f(directory)-5 b(,)23 b(then)h Fp(sr)m(c)h Fv(is)g(copied)e(there)h(with)h(the)f(same)h (name;)h(otherwise,)e(it)h(must)g(be)f(a)208 2596 y(\002lename.)f(\(If) 18 b(the)g(\002le)g(e)o(xists,)h(it)g(will)f(be)g(ruthlessly)g (clobbered.\))j(If)d Fp(pr)m(eserve)p 2526 2596 V 30 w(mode)f Fv(is)i(true)f(\(the)f(def)o(ault\),)h(the)g(\002le')-5 b(s)19 b(mode)208 2695 y(\(type)h(and)g(permission)h(bits,)g(or)g (whate)n(v)o(er)f(is)i(analogous)d(on)i(the)g(current)f(platform\))f (is)j(copied.)27 b(If)21 b Fp(pr)m(eserve)p 3472 2695 V 30 w(times)h Fv(is)g(true)208 2795 y(\(the)c(def)o(ault\),)g(the)h (last-modi\002ed)e(and)h(last-access)i(times)f(are)g(copied)e(as)j (well.)25 b(If)18 b Fp(update)g Fv(is)h(true,)g Fp(sr)m(c)g Fv(will)h(only)e(be)h(copied)208 2895 y(if)h Fp(dst)i Fv(does)e(not)g(e)o(xist,)g(or)g(if)g Fp(dst)j Fv(does)d(e)o(xist)g(b)n (ut)g(is)h(older)f(than)f Fp(sr)m(c)p Fv(.)208 3027 y Fp(link)i Fv(allo)n(ws)f(you)g(to)g(mak)o(e)f(hard)h(links)g(\(using)f Fr(os.link)p Fv(\))g(or)h(symbolic)f(links)h(\(using)f Fr(os.symlink)p Fv(\))f(instead)i(of)g(cop)o(y-)208 3127 y(ing:)j(set)c(it)g(to)g Fr('hard')e Fv(or)h Fr('sym')p Fv(;)h(if)f(it)h(is)g Fr(None)f Fv(\(the)g(def)o(ault\),)f(\002les)i (are)f(copied.)23 b(Don')o(t)17 b(set)i Fp(link)h Fv(on)d(systems)i (that)f(don')o(t)208 3227 y(support)25 b(it:)40 b Fr(copy_file\(\))26 b Fv(doesn')o(t)g(check)g(if)h(hard)g(or)f(symbolic)h(linking)f(is)i(a) n(v)n(ailable.)45 b(It)28 b(uses)f Fr(_copy_file_-)208 3326 y(contents\(\))18 b Fv(to)j(cop)o(y)e(\002le)i(contents.)208 3459 y(Return)d(a)i(tuple)f(`)p Fr(\(dest_name,)47 b(copied\))p Fv(':)24 b Fp(dest)p 1885 3459 V 30 w(name)18 b Fv(is)i(the)g(actual)f (name)f(of)h(the)h(output)e(\002le,)i(and)e Fp(copied)j Fv(is)f(true)208 3559 y(if)g(the)g(\002le)h(w)o(as)g(copied)e(\(or)h(w) o(ould)f(ha)n(v)o(e)h(been)f(copied,)g(if)i Fp(dry)p 2067 3559 V 29 w(run)f Fv(true\).)0 3706 y Fg(move_file)p Fr(\()p Fp(sr)m(c,)f(dst)q Fk([)p Fp(verbose)o(,)h(dry)p 1191 3706 V 30 w(run)12 b Fk(])p Fr(\))208 3805 y Fv(Mo)o(v)o(e)18 b(\002le)j Fp(sr)m(c)g Fv(to)f Fp(dst)q Fv(.)26 b(If)20 b Fp(dst)i Fv(is)e(a)h(directory)-5 b(,)18 b(the)i(\002le)g(will)h(be)f (mo)o(v)o(ed)e(into)i(it)g(with)g(the)g(same)h(name;)e(otherwise,)g Fp(sr)m(c)i Fv(is)g(just)208 3905 y(renamed)g(to)j Fp(dst)q Fv(.)35 b(Returns)24 b(the)f(ne)n(w)g(full)h(name)e(of)h(the)h(\002le.) 35 b Ft(W)-5 b(ar)o(ning:)31 b Fv(Handles)23 b(cross-de)n(vice)e(mo)o (v)o(es)i(on)i(U)t Fm(N)t(I)t(X)h Fv(using)208 4004 y Fr(copy_file\(\))p Fv(.)d(What)e(about)e(other)g(systems???)0 4151 y Fg(write_file)p Fr(\()p Fp(\002lename)o(,)e(contents)p Fr(\))208 4251 y Fv(Create)j(a)h(\002le)f(called)g Fp(\002lename)g Fv(and)f(write)i Fp(contents)e Fv(\(a)h(sequence)f(of)h(strings)g (without)g(line)g(terminators\))f(to)h(it.)0 4578 y Fo(11.13)122 b Fc(distutils.util)29 b Fo(\227)k(Miscellaneous)h(other)g(utility)f (functions)0 4811 y Fv(This)20 b(module)f(contains)h(other)f(assorted)h (bits)h(and)e(pieces)h(that)h(don')o(t)d(\002t)j(into)f(an)o(y)g(other) f(utility)h(module.)0 4958 y Fg(get_platform)p Fr(\(\))208 5058 y Fv(Return)25 b(a)i(string)f(that)g(identi\002es)g(the)g(current) f(platform.)41 b(This)26 b(is)h(used)f(mainly)g(to)g(distinguish)f (platform-speci\002c)f(b)n(uild)208 5157 y(directories)c(and)h (platform-speci\002c)e(b)n(uilt)j(distrib)n(utions.)28 b(T)-7 b(ypically)20 b(includes)h(the)h(OS)g(name)f(and)g(v)o(ersion)f (and)h(the)g(archi-)208 5257 y(tecture)e(\(as)i(supplied)e(by)g ('os.uname\(\)'\),)e(although)h(the)i(e)o(xact)g(information)d (included)i(depends)g(on)g(the)i(OS;)f(e)o(g.)25 b(for)19 b(IRIX)p 0 5549 3901 4 v 0 5649 a Fs(52)2762 b(Chapter)23 b(11.)53 b(API)23 b(Ref)n(erence)p eop end %%Page: 53 61 TeXDict begin 53 60 bop 208 83 a Fv(the)20 b(architecture)f(isn')o(t)h (particularly)e(important)h(\(IRIX)h(only)g(runs)g(on)g(SGI)g(hardw)o (are\),)f(b)n(ut)h(for)g(Linux)f(the)h(k)o(ernel)g(v)o(ersion)208 183 y(isn')o(t)f(particularly)g(important.)208 315 y(Examples)g(of)h (returned)e(v)n(alues:)349 482 y Fu(\017)o Fr(linux-i586)349 614 y Fu(\017)o Fr(linux-alpha)349 747 y Fu(\017)o Fr (solaris-2.6-sun4u)349 880 y Fu(\017)o Fr(irix-5.3)349 1013 y Fu(\017)o Fr(irix64-6.2)208 1179 y Fv(F)o(or)h(non-POSIX)g (platforms,)g(currently)f(just)j(returns)e Fr(sys.platform)p Fv(.)0 1326 y Fg(convert_path)p Fr(\()p Fp(pathname)p Fr(\))208 1425 y Fv(Return)i('pathname')f(as)j(a)f(name)g(that)g(will)h (w)o(ork)e(on)h(the)g(nati)n(v)o(e)f(\002lesystem,)i(i.e.)30 b(split)23 b(it)g(on)f('/')g(and)f(put)h(it)h(back)e(together)208 1525 y(again)e(using)h(the)g(current)f(directory)g(separator)-5 b(.)24 b(Needed)c(because)g(\002lenames)g(in)g(the)h(setup)f(script)g (are)g(al)o(w)o(ays)h(supplied)e(in)210 1625 y(U)t Fm(N)t(I)t(X)k Fv(style,)e(and)f(ha)n(v)o(e)g(to)h(be)f(con)m(v)o(erted)e(to)j(the)g (local)f(con)m(v)o(ention)e(before)h(we)i(can)f(actually)g(use)h(them)f (in)h(the)g(\002lesystem.)208 1724 y(Raises)g Fr(ValueError)e Fv(on)h(non-)r(U)t Fm(N)t(I)t(X)r Fv(-ish)f(systems)h(if)h Fp(pathname)d Fv(either)i(starts)h(or)f(ends)g(with)g(a)h(slash.)0 1871 y Fg(change_root)p Fr(\()p Fp(ne)o(w)p 738 1871 25 4 v 27 w(r)l(oot,)f(pathname)p Fr(\))208 1971 y Fv(Return)74 b Fp(pathname)g Fv(with)h Fp(ne)o(w)p 1274 1971 V 30 w(r)l(oot)i Fv(prepended.)188 b(If)75 b Fp(pathname)e Fv(is)j(relati)n(v)o(e,)89 b(this)75 b(is)i(equi)n(v)n(alent)c(to)208 2070 y(`)p Fr(os.path.join\(new_root,pathname\))o Fv(')60 b(Otherwise,)77 b(it)66 b(requires)f(making)f Fp(pathname)g Fv(relati)n(v)o(e)h(and)208 2170 y(then)19 b(joining)g(the)i(tw)o(o,)f (which)f(is)j(trick)o(y)d(on)g(DOS/W)m(indo)n(ws.)0 2317 y Fg(check_environ)p Fr(\(\))208 2417 y Fv(Ensure)33 b(that)h('os.en)m(viron')d(has)k(all)f(the)h(en)m(vironment)c(v)n (ariables)i(we)i(guarantee)d(that)i(users)h(can)f(use)g(in)h(con\002g)e (\002les,)208 2516 y(command-line)17 b(options,)i(etc.)25 b(Currently)19 b(this)i(includes:)349 2682 y Fu(\017)o Fv(HOME)f(-)h(user')-5 b(s)20 b(home)f(directory)g(\()r(U)t Fm(N)t(I)t(X)k Fv(only\))349 2815 y Fu(\017)o Fv(PLA)-9 b(T)20 b(-)h(description)d(of)i(the)h(current)d(platform,)h(including)f (hardw)o(are)h(and)h(OS)g(\(see)h Fr(get_platform\(\))p Fv(\))0 2962 y Fg(subst_vars)p Fr(\()p Fp(s,)e(local)p 794 2962 V 29 w(var)o(s)p Fr(\))208 3062 y Fv(Perform)26 b(shell/Perl-style)h(v)n(ariable)g(substitution)g(on)g Fp(s)p Fv(.)49 b(Ev)o(ery)26 b(occurrence)g(of)h Fr($)h Fv(follo)n(wed)f(by)g(a)h(name)g(is)g(considered)208 3161 y(a)f(v)n(ariable,)h(and)e(v)n(ariable)g(is)i(substituted)f(by)g (the)g(v)n(alue)f(found)g(in)h(the)g Fp(local)p 2559 3161 V 29 w(var)o(s)h Fv(dictionary)-5 b(,)26 b(or)h(in)g Fr(os.environ)f Fv(if)208 3261 y(it')-5 b(s)30 b(not)e(in)h Fp(local)p 740 3261 V 29 w(var)o(s)p Fv(.)52 b Fp(os.en)m(vir)l(on)27 b Fv(is)j(\002rst)g(check)o(ed/augmented)25 b(to)k(guarantee)e(that)i (it)g(contains)f(certain)h(v)n(alues:)42 b(see)208 3360 y Fr(check_environ\(\))p Fv(.)22 b(Raise)f Fr(ValueError)d Fv(for)i(an)o(y)e(v)n(ariables)h(not)h(found)e(in)i(either)f Fp(local)p 3105 3360 V 29 w(var)o(s)i Fv(or)e Fr(os.environ)p Fv(.)208 3493 y(Note)f(that)g(this)h(is)g(not)f(a)g(fully-\003edged)e (string)i(interpolation)e(function.)22 b(A)d(v)n(alid)e Fr($variable)g Fv(can)h(consist)h(only)e(of)h(upper)208 3593 y(and)h(lo)n(wer)h(case)h(letters,)f(numbers)f(and)g(an)h (underscore.)j(No)d Fu(f)h(g)f Fv(or)41 b(style)20 b(quoting)f(is)i(a)n (v)n(ailable.)0 3749 y Fg(grok_environment_error)p Fr(\()p Fp(e)n(xc)p Fk([)p Fp(,)16 b(pr)m(e\002x=`)p Fa('error:)97 b(')p Fp(')12 b Fk(])p Fr(\))208 3849 y Fv(Generate)24 b(a)h(useful)g(error)e(message)i(from)f(an)h Fr(EnvironmentError)e Fv(\()p Fr(IOError)h Fv(or)g Fr(OSError)p Fv(\))g(e)o(xception)f (object.)208 3948 y(Handles)31 b(Python)g(1.5.1)f(and)i(later)g (styles,)j(and)c(does)h(what)g(it)h(can)e(to)h(deal)g(with)g(e)o (xception)e(objects)i(that)g(don')o(t)e(ha)n(v)o(e)208 4048 y(a)g(\002lename)f(\(which)g(happens)g(when)g(the)h(error)f(is)h (due)g(to)g(a)g(tw)o(o-\002le)g(operation,)g(such)g(as)g Fr(rename\(\))f Fv(or)h Fr(link\(\))p Fv(\).)208 4148 y(Returns)20 b(the)g(error)f(message)h(as)h(a)f(string)g(pre\002x)o(ed) f(with)h Fp(pr)m(e\002x)p Fv(.)0 4294 y Fg(split_quoted)p Fr(\()p Fp(s)p Fr(\))208 4394 y Fv(Split)25 b(a)f(string)h(up)f (according)e(to)27 b(U)t Fm(N)t(I)t(X)g Fv(shell-lik)o(e)e(rules)f(for) g(quotes)g(and)g(backslashes.)37 b(In)24 b(short:)34 b(w)o(ords)24 b(are)g(delimited)208 4494 y(by)d(spaces,)i(as)g(long)e (as)i(those)e(spaces)i(are)f(not)f(escaped)h(by)f(a)i(backslash,)f(or)f (inside)h(a)h(quoted)d(string.)31 b(Single)22 b(and)f(double)208 4593 y(quotes)i(are)h(equi)n(v)n(alent,)g(and)g(the)g(quote)f (characters)h(can)g(be)g(backslash-escaped.)35 b(The)24 b(backslash)g(is)h(stripped)e(from)g(an)o(y)208 4693 y(tw)o(o-character)c(escape)i(sequence,)g(lea)n(ving)g(only)f(the)i (escaped)f(character)-5 b(.)28 b(The)21 b(quote)f(characters)h(are)g (stripped)g(from)f(an)o(y)208 4793 y(quoted)e(string.)25 b(Returns)20 b(a)h(list)g(of)f(w)o(ords.)0 4939 y Fg(execute)p Fr(\()p Fp(func,)e(ar)m(gs)p Fk([)p Fp(,)i(msg=)p Fa(None)p Fp(,)f(verbose=)p Fa(0)p Fp(,)h(dry)p 1761 4939 V 30 w(run=)p Fa(0)12 b Fk(])p Fr(\))208 5039 y Fv(Perform)25 b(some)h(action)g(that)h(af)n(fects)f(the)h(outside)f(w)o(orld)g(\(for) f(instance,)j(writing)e(to)h(the)f(\002lesystem\).)44 b(Such)26 b(actions)h(are)208 5139 y(special)19 b(because)f(the)o(y)h (are)g(disabled)g(by)f(the)i Fp(dry)p 1660 5139 V 29 w(run)f Fv(\003ag.)25 b(This)20 b(method)d(tak)o(es)j(care)f(of)g(all)h (that)f(b)n(ureaucrac)o(y)e(for)h(you;)h(all)208 5238 y(you)f(ha)n(v)o(e)h(to)g(do)g(is)i(supply)d(the)i(function)d(to)j (call)g(and)e(an)i(ar)o(gument)d(tuple)i(for)g(it)h(\(to)f(embody)e (the)j(\223e)o(xternal)e(action\224)h(being)208 5338 y(performed\),)d(and)k(an)g(optional)f(message)h(to)h(print.)p 0 5549 3901 4 v 0 5649 a Fs(11.13.)52 b Fr(distutils.util)21 b Fs(\227)i(Miscellaneous)h(other)f(utility)i(functions)1393 b(53)p eop end %%Page: 54 62 TeXDict begin 54 61 bop 0 83 a Fg(strtobool)p Fr(\()p Fp(val)p Fr(\))208 183 y Fv(Con)m(v)o(ert)18 b(a)j(string)f (representation)e(of)i(truth)f(to)i(true)e(\(1\))h(or)g(f)o(alse)h (\(0\).)208 314 y(T)m(rue)14 b(v)n(alues)h(are)g Fr(y)p Fv(,)i Fr(yes)p Fv(,)f Fr(t)p Fv(,)g Fr(true)p Fv(,)g Fr(on)f Fv(and)g Fr(1)p Fv(;)i(f)o(alse)f(v)n(alues)f(are)g Fr(n)p Fv(,)h Fr(no)p Fv(,)h Fr(f)p Fv(,)f Fr(false)p Fv(,)g Fr(off)f Fv(and)g Fr(0)p Fv(.)23 b(Raises)17 b Fr(ValueError)208 414 y Fv(if)j Fp(val)g Fv(is)h(an)o(ything)e(else.)0 560 y Fg(byte_compile)p Fr(\()p Fp(py)p 734 560 25 4 v 27 w(\002les)p Fk([)p Fp(,)52 b(optimize=)p Fa(0)p Fp(,)g(for)m(ce=)p Fa(0)p Fp(,)g(pr)m(e\002x=)p Fa(None)p Fp(,)f(base)p 2484 560 V 29 w(dir=)p Fa(None)p Fp(,)h(verbose=)p Fa(1)p Fp(,)g(dry)p 3488 560 V 30 w(run=)p Fa(0)p Fp(,)g(di-)650 660 y(r)m(ect=)p Fa(None)12 b Fk(])p Fr(\))208 744 y Fv(Byte-compile)25 b(a)i(collection)e(of)h(Python)g(source)g(\002les)h (to)g(either)f(`)p Fw(.p)n(yc)p Fv(')g(or)h(`)p Fw(.p)n(y)o(o)p Fv(')e(\002les)i(in)g(the)f(same)h(directory)-5 b(.)42 b Fp(py)p 3742 744 V 29 w(\002les)208 843 y Fv(is)27 b(a)f(list)h(of)f(\002les)h(to)g(compile;)h(an)o(y)d(\002les)i(that)f (don')o(t)f(end)g(in)i(`)p Fw(.p)n(y)p Fv(')e(are)h(silently)g (skipped.)42 b Fp(optimize)26 b Fv(must)g(be)g(one)g(of)g(the)208 943 y(follo)n(wing:)349 1106 y Fu(\017)o Fr(0)21 b Fv(-)f(don')o(t)f (optimize)g(\(generate)g(`)p Fw(.p)n(yc)p Fv('\))349 1236 y Fu(\017)o Fr(1)i Fv(-)f(normal)f(optimization)g(\(lik)o(e)h(`)p Fr(python)48 b(-O)p Fv('\))349 1365 y Fu(\017)o Fr(2)21 b Fv(-)f(e)o(xtra)g(optimization)e(\(lik)o(e)i(`)p Fr(python)49 b(-OO)p Fv('\))208 1528 y(If)20 b Fp(for)m(ce)g Fv(is)h(true,)f(all)g (\002les)i(are)e(recompiled)e(re)o(gardless)h(of)h(timestamps.)208 1659 y(The)k(source)f(\002lename)h(encoded)f(in)h(each)g(bytecode)f (\002le)i(def)o(aults)f(to)g(the)h(\002lenames)f(listed)h(in)f Fp(py)p 3162 1659 V 30 w(\002les)p Fv(;)i(you)e(can)g(modify)208 1759 y(these)d(with)g Fp(pr)m(e\002x)f Fv(and)g Fp(basedir)r Fv(.)27 b Fp(pr)m(e\002x)20 b Fv(is)i(a)f(string)g(that)g(will)g(be)g (stripped)f(of)n(f)g(of)g(each)h(source)f(\002lename,)g(and)g Fp(base)p 3700 1759 V 29 w(dir)k Fv(is)208 1859 y(a)f(directory)e(name) i(that)g(will)h(be)f(prepended)d(\(after)j Fp(pr)m(e\002x)g Fv(is)h(stripped\).)32 b(Y)-9 b(ou)23 b(can)g(supply)f(either)g(or)h (both)g(\(or)f(neither\))g(of)208 1958 y Fp(pr)m(e\002x)e Fv(and)f Fp(base)p 713 1958 V 29 w(dir)r Fv(,)i(as)f(you)g(wish.)208 2090 y(If)g Fp(dry)p 400 2090 V 29 w(run)g Fv(is)h(true,)f(doesn')o(t)f (actually)g(do)h(an)o(ything)e(that)i(w)o(ould)g(af)n(fect)g(the)g (\002lesystem.)208 2221 y(Byte-compilation)e(is)23 b(either)d(done)h (directly)f(in)h(this)h(interpreter)e(process)g(with)i(the)f(standard)f Fr(py_compile)g Fv(module,)g(or)208 2320 y(indirectly)h(by)g(writing)h (a)h(temporary)d(script)i(and)f(e)o(x)o(ecuting)f(it.)32 b(Normally)-5 b(,)21 b(you)g(should)g(let)i Fr(byte_compile\(\))d Fv(\002gure)208 2420 y(out)f(to)g(use)h(direct)f(compilation)f(or)h (not)g(\(see)h(the)g(source)e(for)h(details\).)25 b(The)19 b Fp(dir)m(ect)i Fv(\003ag)f(is)g(used)f(by)h(the)f(script)h(generated) d(in)208 2520 y(indirect)i(mode;)g(unless)i(you)e(kno)n(w)g(what)h (you')l(re)e(doing,)h(lea)n(v)o(e)h(it)h(set)g(to)f Fr(None)p Fv(.)0 2667 y Fg(rfc822_escape)p Fr(\()p Fp(header)r Fr(\))208 2766 y Fv(Return)k(a)h(v)o(ersion)e(of)h Fp(header)i Fv(escaped)e(for)g(inclusion)f(in)i(an)g(RFC)h(822)d(header)m(,)h(by)g (ensuring)g(there)g(are)g(8)h(spaces)g(space)208 2866 y(after)19 b(each)h(ne)n(wline.)25 b(Note)20 b(that)g(it)h(does)f(no)g (other)f(modi\002cation)f(of)i(the)h(string.)0 3192 y Fo(11.14)122 b Fc(distutils.dist)29 b Fo(\227)k(The)h(Distr)r(ib)n (ution)g(class)0 3425 y Fv(This)78 b(module)f(pro)o(vides)g(the)h Fr(Distribution)f Fv(class,)93 b(which)78 b(represents)f(the)i(module)d (distrib)n(ution)i(being)0 3524 y(b)n(uilt/installed/distrib)n(uted.)0 3850 y Fo(11.15)122 b Fc(distutils.extension)28 b Fo(\227)33 b(The)h(Extension)g(class)0 4083 y Fv(This)20 b(module)f(pro)o(vides)g (the)h Fr(Extension)f Fv(class,)i(used)f(to)g(describe)f(C/C)2226 4076 y(++)2342 4083 y(e)o(xtension)f(modules)i(in)g(setup)g(scripts.)0 4409 y Fo(11.16)122 b Fc(distutils.debug)29 b Fo(\227)k(Distutils)f (deb)n(ug)k(mode)0 4642 y Fv(This)20 b(module)f(pro)o(vides)g(the)h (DEB)o(UG)h(\003ag.)0 4968 y Fo(11.17)122 b Fc(distutils.errors)29 b Fo(\227)j(Distutils)h(e)l(xceptions)0 5201 y Fv(Pro)o(vides)28 b(e)o(xceptions)f(used)h(by)g(the)h(Distutils)h(modules.)49 b(Note)29 b(that)g(Distutils)h(modules)d(may)h(raise)h(standard)f(e)o (xceptions;)j(in)0 5300 y(particular)m(,)j(SystemExit)d(is)j(usually)d (raised)i(for)e(errors)h(that)g(are)h(ob)o(viously)d(the)i(end-user')-5 b(s)31 b(f)o(ault)i(\(e)o(g.)61 b(bad)31 b(command-line)0 5400 y(ar)o(guments\).)p 0 5549 3901 4 v 0 5649 a Fs(54)2762 b(Chapter)23 b(11.)53 b(API)23 b(Ref)n(erence)p eop end %%Page: 55 63 TeXDict begin 55 62 bop 0 83 a Fv(This)30 b(module)e(is)i(safe)g(to)g (use)g(in)f(`)p Fr(from)49 b(...)99 b(import)1911 98 y(*)1961 83 y Fv(')29 b(mode;)34 b(it)c(only)f(e)o(xports)f(symbols)h (whose)g(names)g(start)h(with)0 183 y Fr(Distutils)19 b Fv(and)h(end)f(with)i Fr(Error)p Fv(.)0 510 y Fo(11.18)122 b Fc(distutils.fancy_getopt)58 b Fo(\227)65 b(Wr)o(apper)g(around)i (the)f(standard)419 660 y(getopt)35 b(module)0 892 y Fv(This)20 b(module)e(pro)o(vides)f(a)j(wrapper)e(around)f(the)j (standard)e Fr(getopt)h Fv(module)f(that)h(pro)o(vides)f(the)h(follo)n (wing)f(additional)g(features:)125 1122 y Fu(\017)41 b Fv(short)19 b(and)h(long)f(options)h(are)g(tied)g(together)125 1288 y Fu(\017)41 b Fv(options)19 b(ha)n(v)o(e)g(help)h(strings,)g(so)h Fr(fancy_getopt)d Fv(could)h(potentially)g(create)h(a)h(complete)e (usage)h(summary)125 1454 y Fu(\017)41 b Fv(options)19 b(set)i(attrib)n(utes)f(of)g(a)g(passed-in)g(object)125 1620 y Fu(\017)41 b Fv(boolean)22 b(options)g(can)i(ha)n(v)o(e)f (\223ne)o(gati)n(v)o(e)e(aliases\224)k(\227)f(e)o(g.)35 b(if)24 b Ft(--quiet)f Fv(is)i(the)e(\223ne)o(gati)n(v)o(e)f(alias\224) i(of)f Ft(--v)o(erbose)p Fv(,)h(then)f Ft(--quiet)208 1720 y Fv(on)c(the)i(command)d(line)i(sets)h Fp(verbose)f Fv(to)h(f)o(alse.)0 1950 y Ft(**Should)f(be)h(r)o(eplaced)e(with)i Fg(optik)f Ft(\(which)g(is)i(also)e(no)o(w)g(kno)o(wn)h(as)g Fg(optparse)e Ft(in)i(Python)e(2.3)h(and)g(later\).**)0 2097 y Fg(fancy_getopt)p Fr(\()p Fp(options,)d(ne)m(gative)p 1219 2097 25 4 v 27 w(opt,)j(object,)f(ar)m(gs)p Fr(\))208 2196 y Fv(Wrapper)i(function.)29 b Fp(options)21 b Fv(is)i(a)f(list)h (of)f(`)p Fr(\(long_option,)47 b(short_option,)h(help_string\))p Fv(')20 b(3-tuples)h(as)208 2296 y(described)k(in)h(the)g(constructor)e (for)i Fr(FancyGetopt)p Fv(.)42 b Fp(ne)m(gative)p 2194 2296 V 28 w(opt)27 b Fv(should)e(be)h(a)h(dictionary)d(mapping)h (option)g(names)208 2396 y(to)h(option)f(names,)i(both)f(the)g(k)o(e)o (y)g(and)f(v)n(alue)h(should)f(be)h(in)h(the)f Fp(options)f Fv(list.)45 b Fp(object)27 b Fv(is)g(an)f(object)g(which)g(will)h(be)f (used)208 2495 y(to)e(store)h(v)n(alues)f(\(see)h(the)f Fr(getopt\(\))g Fv(method)f(of)h(the)h Fr(FancyGetopt)e Fv(class\).)39 b Fp(ar)m(gs)24 b Fv(is)i(the)f(ar)o(gument)d(list.)39 b(W)m(ill)25 b(use)208 2595 y Fr(sys.argv[1:])e Fv(if)e(you)e(pass)i Fr(None)f Fv(as)g Fp(ar)m(gs)p Fv(.)0 2742 y Fg(wrap_text)p Fr(\()p Fp(te)n(xt,)f(width)p Fr(\))208 2841 y Fv(Wraps)h Fp(te)n(xt)i Fv(to)f(less)g(than)f Fp(width)g Fv(wide.)208 2974 y Ft(W)-5 b(ar)o(ning:)24 b Fv(Should)19 b(be)h(replaced)f(with)h Fr(textwrap)f Fv(\(which)h(is)h(a)n(v)n(ailable)f(in)g(Python)f(2.3)g (and)h(later\).)0 3121 y Ft(class)h Fg(FancyGetopt)p Fr(\()p Fk([)p Fp(option)p 1046 3121 V 25 w(table=)p Fa(None)12 b Fk(])p Fr(\))208 3221 y Fv(The)19 b(option)p 576 3221 V 28 w(table)i(is)g(a)f(list)i(of)e(3-tuples:)k(`)p Fr(\(long_option,)47 b(short_option,)g(help_string\))p Fv(')208 3354 y(If)20 b(an)h(option)f(tak)o(es)h(an)f(ar)o(gument,)f (its)j Fp(long)p 1517 3354 V 28 w(option)e Fv(should)f(ha)n(v)o(e)i Fr('=')g Fv(appended;)d Fp(short)p 2901 3354 V 30 w(option)i Fv(should)f(just)j(be)e(a)i(single)208 3453 y(character)m(,)28 b(no)f Fr(':')41 b Fv(in)29 b(an)o(y)e(case.)49 b Fp(short)p 1492 3453 V 29 w(option)27 b Fv(should)g(be)h Fr(None)g Fv(if)h(a)f Fp(long)p 2641 3453 V 29 w(option)e Fv(doesn')o(t)h(ha)n(v) o(e)h(a)g(corresponding)208 3553 y Fp(short)p 384 3553 V 29 w(option)p Fv(.)c(All)d(option)e(tuples)h(must)g(ha)n(v)o(e)g (long)f(options.)0 3700 y(The)h Fr(FancyGetopt)f Fv(class)i(pro)o (vides)d(the)i(follo)n(wing)f(methods:)0 3847 y Fg(getopt)p Fr(\()p Fk([)p Fp(ar)m(gs=)p Fa(None)p Fp(,)f(object=)p Fa(None)12 b Fk(])p Fr(\))208 3946 y Fv(P)o(arse)20 b(command-line)d (options)j(in)g(ar)o(gs.)k(Store)c(as)h(attrib)n(utes)f(on)g Fp(object)q Fv(.)208 4079 y(If)31 b Fp(ar)m(gs)g Fv(is)h Fr(None)f Fv(or)g(not)g(supplied,)h(uses)g Fr(sys.argv[1:])p Fv(.)56 b(If)31 b Fp(object)h Fv(is)h Fr(None)e Fv(or)f(not)h (supplied,)i(creates)e(a)h(ne)n(w)208 4179 y Fr(OptionDummy)27 b Fv(instance,)j(stores)f(option)f(v)n(alues)g(there,)i(and)e(returns)g (a)h(tuple)g(`)p Fr(\(args,)48 b(object\))p Fv('.)h(If)29 b Fp(object)h Fv(is)208 4278 y(supplied,)19 b(it)i(is)g(modi\002ed)e (in)i(place)f(and)g Fr(getopt\(\))g Fv(just)h(returns)e Fp(ar)m(gs)p Fv(;)i(in)f(both)g(cases,)h(the)f(returned)f Fp(ar)m(gs)i Fv(is)g(a)g(modi\002ed)208 4378 y(cop)o(y)e(of)h(the)g (passed-in)f Fp(ar)m(gs)i Fv(list,)g(which)e(is)i(left)g(untouched.)0 4525 y Fg(get_option_order)p Fr(\(\))208 4624 y Fv(Returns)43 b(the)g(list)h(of)f(`)p Fr(\(option,)48 b(value\))p Fv(')43 b(tuples)g(processed)f(by)h(the)h(pre)n(vious)d(run)i(of)g Fr(getopt\(\))f Fv(Raises)208 4724 y Fr(RuntimeError)18 b Fv(if)j Fr(getopt\(\))e Fv(hasn')o(t)g(been)g(called)h(yet.)0 4871 y Fg(generate_help)p Fr(\()p Fk([)p Fp(header=)p Fa(None)12 b Fk(])p Fr(\))208 4970 y Fv(Generate)43 b(help)g(te)o(xt)h (\(a)g(list)i(of)d(strings,)50 b(one)44 b(per)f(suggested)g(line)h(of)g (output\))f(from)g(the)h(option)f(table)h(for)f(this)208 5070 y Fr(FancyGetopt)18 b Fv(object.)208 5203 y(If)i(supplied,)e (prints)i(the)h(supplied)e Fp(header)i Fv(at)g(the)f(top)g(of)g(the)g (help.)p 0 5549 3901 4 v 0 5649 a Fs(11.18.)52 b Fr (distutils.fancy_getopt)19 b Fs(\227)24 b(Wr)o(apper)f(around)h(the)f (standard)g(getopt)h(module)669 b(55)p eop end %%Page: 56 64 TeXDict begin 56 63 bop 0 86 a Fo(11.19)122 b Fc(distutils.filelist)28 b Fo(\227)33 b(The)h(FileList)f(class)0 319 y Fv(This)20 b(module)f(pro)o(vides)g(the)h Fr(FileList)f Fv(class,)i(used)f(for)f (poking)g(about)g(the)h(\002lesystem)h(and)e(b)n(uilding)g(lists)j(of)e (\002les.)0 647 y Fo(11.20)122 b Fc(distutils.log)29 b Fo(\227)k(Simple)g(PEP)f(282-style)i(logging)0 879 y Ft(W)-5 b(ar)o(ning:)24 b Fv(Should)19 b(be)h(replaced)f(with)i (standard)e Fr(logging)g Fv(module.)0 1207 y Fo(11.21)122 b Fc(distutils.spawn)29 b Fo(\227)k(Spa)n(wn)h(a)g(sub-process)0 1440 y Fv(This)19 b(module)e(pro)o(vides)g(the)i Fr(spawn\(\))e Fv(function,)g(a)i(front-end)e(to)h(v)n(arious)g(platform-speci\002c)e (functions)h(for)h(launching)f(another)0 1539 y(program)h(in)i(a)h (sub-process.)i(Also)e(pro)o(vides)d Fr(find_executable\(\))g Fv(to)i(search)g(the)g(path)g(for)g(a)g(gi)n(v)o(en)f(e)o(x)o(ecutable) f(name.)0 1867 y Fo(11.22)122 b Fc(distutils.sysconfig)28 b Fo(\227)33 b(System)f(con\002gur)o(ation)k(inf)l(or)s(mation)0 2100 y Fv(The)24 b Fr(distutils.sysconfig)e Fv(module)h(pro)o(vides)g (access)j(to)f(Python')-5 b(s)24 b(lo)n(w-le)n(v)o(el)f (con\002guration)f(information.)36 b(The)25 b(spe-)0 2199 y(ci\002c)18 b(con\002guration)e(v)n(ariables)h(a)n(v)n(ailable)g (depend)f(hea)n(vily)h(on)h(the)g(platform)e(and)h(con\002guration.)22 b(The)17 b(speci\002c)h(v)n(ariables)f(depend)0 2299 y(on)24 b(the)g(b)n(uild)f(process)h(for)f(the)h(speci\002c)g(v)o (ersion)f(of)g(Python)g(being)g(run;)i(the)f(v)n(ariables)g(are)f (those)h(found)f(in)h(the)g(`)p Fw(Mak)o(e\002le)p Fv(')e(and)0 2398 y(con\002guration)d(header)i(that)h(are)g(installed)f(with)h (Python)f(on)i(U)t Fm(N)t(I)t(X)i Fv(systems.)31 b(The)21 b(con\002guration)e(header)i(is)i(called)e(`)p Fw(p)n(ycon\002g.h)p Fv(')0 2498 y(for)f(Python)f(v)o(ersions)g(starting)h(with)g(2.2,)f (and)h(`)p Fw(con\002g.h)p Fv(')f(for)g(earlier)h(v)o(ersions)f(of)h (Python.)0 2645 y(Some)g(additional)e(functions)h(are)h(pro)o(vided)d (which)j(perform)d(some)j(useful)g(manipulations)e(for)h(other)g(parts) h(of)g(the)g Fr(distutils)0 2745 y Fv(package.)0 2891 y Fg(PREFIX)208 2991 y Fv(The)f(result)i(of)f Fr (os.path.normpath\(sys.prefix\))p Fv(.)0 3138 y Fg(EXEC_PREFIX)208 3238 y Fv(The)f(result)i(of)f Fr(os.path.normpath\(sys.exec_prefix\))o Fv(.)0 3384 y Fg(get_config_var)p Fr(\()p Fp(name)p Fr(\))208 3484 y Fv(Return)f(the)i(v)n(alue)e(of)h(a)h(single)f(v)n(ariable.)j (This)e(is)g(equi)n(v)n(alent)d(to)j Fr(get_config_vars\(\).get\()p Fp(name)p Fr(\))p Fv(.)0 3631 y Fg(get_config_vars)p Fr(\()p Fp(...)p Fr(\))208 3731 y Fv(Return)30 b(a)h(set)h(of)f(v)n (ariable)f(de\002nitions.)56 b(If)31 b(there)f(are)h(no)g(ar)o (guments,)g(this)h(returns)e(a)h(dictionary)e(mapping)g(names)i(of)208 3830 y(con\002guration)17 b(v)n(ariables)i(to)h(v)n(alues.)k(If)c(ar)o (guments)e(are)h(pro)o(vided,)f(the)o(y)h(should)g(be)g(strings,)h(and) f(the)h(return)f(v)n(alue)g(will)i(be)208 3930 y(a)k(sequence)g(gi)n (ving)f(the)h(associated)h(v)n(alues.)40 b(If)25 b(a)h(gi)n(v)o(en)e (name)h(does)g(not)h(ha)n(v)o(e)e(a)i(corresponding)c(v)n(alue,)k Fr(None)f Fv(will)i(be)208 4029 y(included)18 b(for)i(that)g(v)n (ariable.)0 4176 y Fg(get_config_h_filename)p Fr(\(\))208 4276 y Fv(Return)h(the)h(full)g(path)f(name)h(of)f(the)h (con\002guration)e(header)-5 b(.)29 b(F)o(or)24 b(U)t Fm(N)t(I)t(X)r Fv(,)f(this)g(will)f(be)g(the)g(header)f(generated)f(by) i(the)g Ft(con-)208 4376 y(\002gur)o(e)f Fv(script;)h(for)g(other)e (platforms)h(the)h(header)e(will)j(ha)n(v)o(e)e(been)g(supplied)g (directly)f(by)i(the)f(Python)g(source)g(distrib)n(ution.)208 4475 y(The)e(\002le)i(is)g(a)g(platform-speci\002c)d(te)o(xt)i(\002le.) 0 4622 y Fg(get_makefile_filename)p Fr(\(\))208 4722 y Fv(Return)h(the)g(full)h(path)f(name)g(of)h(the)f(`)p Fw(Mak)o(e\002le)p Fv(')g(used)g(to)h(b)n(uild)f(Python.)28 b(F)o(or)c(U)t Fm(N)t(I)t(X)r Fv(,)f(this)f(will)g(be)g(a)g(\002le)g (generated)e(by)i(the)208 4821 y Ft(con\002gur)o(e)g Fv(script;)j(the)e(meaning)f(for)g(other)h(platforms)f(will)i(v)n(ary) -5 b(.)32 b(The)23 b(\002le)h(is)g(a)g(platform-speci\002c)d(te)o(xt)i (\002le,)h(if)f(it)h(e)o(xists.)208 4921 y(This)c(function)e(is)k(only) d(useful)h(on)f(POSIX)i(platforms.)0 5068 y Fg(get_python_inc)p Fr(\()p Fk([)p Fp(plat)p 925 5068 25 4 v 26 w(speci\002c)p Fk([)p Fp(,)e(pr)m(e\002x)12 b Fk(])g(])p Fr(\))208 5167 y Fv(Return)27 b(the)h(directory)f(for)g(either)h(the)g(general)f(or)h (platform-dependent)23 b(C)29 b(include)e(\002les.)49 b(If)28 b Fp(plat)p 3232 5167 V 29 w(speci\002c)g Fv(is)h(true,)h(the) 208 5267 y(platform-dependent)19 b(include)k(directory)f(is)i (returned;)g(if)h(f)o(alse)f(or)f(omitted,)h(the)g (platform-independent)19 b(directory)j(is)j(re-)208 5367 y(turned.)49 b(If)29 b Fp(pr)m(e\002x)g Fv(is)h(gi)n(v)o(en,)f(it)h(is) g(used)f(as)g(either)g(the)g(pre\002x)f(instead)h(of)f Fr(PREFIX)p Fv(,)g(or)h(as)h(the)f(e)o(x)o(ec-pre\002x)d(instead)j(of)p 0 5549 3901 4 v 0 5649 a Fs(56)2762 b(Chapter)23 b(11.)53 b(API)23 b(Ref)n(erence)p eop end %%Page: 57 65 TeXDict begin 57 64 bop 208 83 a Fr(EXEC_PREFIX)18 b Fv(if)j Fp(plat)p 983 83 25 4 v 29 w(speci\002c)f Fv(is)h(true.)0 230 y Fg(get_python_lib)p Fr(\()p Fk([)p Fp(plat)p 925 230 V 26 w(speci\002c)p Fk([)p Fp(,)e(standar)m(d)p 1575 230 V 28 w(lib)p Fk([)p Fp(,)h(pr)m(e\002x)12 b Fk(])g(])g(])p Fr(\))208 330 y Fv(Return)28 b(the)g(directory)f(for)h(either)g(the)h (general)e(or)i(platform-dependent)24 b(library)j(installation.)50 b(If)28 b Fp(plat)p 3363 330 V 29 w(speci\002c)h Fv(is)g(true,)208 429 y(the)23 b(platform-dependent)18 b(include)k(directory)g(is)i (returned;)f(if)g(f)o(alse)h(or)f(omitted,)g(the)g (platform-independent)18 b(directory)k(is)208 529 y(returned.)40 b(If)26 b Fp(pr)m(e\002x)g Fv(is)h(gi)n(v)o(en,)f(it)h(is)g(used)e(as)i (either)f(the)g(pre\002x)f(instead)h(of)g Fr(PREFIX)p Fv(,)f(or)h(as)g(the)h(e)o(x)o(ec-pre\002x)c(instead)j(of)208 628 y Fr(EXEC_PREFIX)20 b Fv(if)j Fp(plat)p 987 628 V 29 w(speci\002c)f Fv(is)h(true.)31 b(If)22 b Fp(standar)m(d)p 1920 628 V 29 w(lib)g Fv(is)h(true,)g(the)f(directory)f(for)g(the)i (standard)e(library)g(is)i(returned)208 728 y(rather)c(than)h(the)g (directory)e(for)i(the)g(installation)g(of)g(third-party)e(e)o (xtensions.)0 875 y(The)i(follo)n(wing)e(function)h(is)i(only)e (intended)g(for)h(use)g(within)g(the)g Fr(distutils)f Fv(package.)0 1022 y Fg(customize_compiler)p Fr(\()p Fp(compiler)r Fr(\))208 1121 y Fv(Do)h(an)o(y)f(platform-speci\002c)f (customization)h(of)h(a)g Fr(distutils.ccompiler.CCompiler)c Fv(instance.)208 1254 y(This)34 b(function)f(is)j(only)e(needed)f(on)j (U)t Fm(N)t(I)t(X)i Fv(at)d(this)g(time,)j(b)n(ut)d(should)f(be)g (called)h(consistently)e(to)i(support)e(forw)o(ard-)208 1354 y(compatibility)-5 b(.)45 b(It)28 b(inserts)f(the)h(information)d (that)j(v)n(aries)f(across)j(U)t Fm(N)t(I)t(X)g Fv(\003a)n(v)n(ors)e (and)f(is)i(stored)e(in)g(Python')-5 b(s)27 b(`)p Fw(Mak)o(e\002le)p Fv('.)208 1453 y(This)i(information)d(includes)i(the)h(selected)g (compiler)m(,)g(compiler)f(and)g(link)o(er)h(options,)h(and)e(the)h(e)o (xtension)e(used)i(by)g(the)208 1553 y(link)o(er)19 b(for)h(shared)f (objects.)0 1700 y(This)h(function)f(is)i(e)n(v)o(en)e(more)h (special-purpose,)d(and)j(should)f(only)g(be)h(used)g(from)f(Python')-5 b(s)20 b(o)n(wn)g(b)n(uild)f(procedures.)0 1847 y Fg(set_python_build)p Fr(\(\))208 1946 y Fv(Inform)26 b(the)i Fr(distutils.sysconfig)e Fv(module)h(that)h(it)h(is)g(being)f(used)g(as)h(part)f(of)g(the)g(b)n (uild)g(process)g(for)g(Python.)208 2046 y(This)23 b(changes)e(a)j(lot) f(of)f(relati)n(v)o(e)g(locations)h(for)f(\002les,)i(allo)n(wing)e (them)g(to)h(be)g(located)f(in)h(the)g(b)n(uild)g(area)f(rather)g(than) h(in)g(an)208 2146 y(installed)d(Python.)0 2473 y Fo(11.23)122 b Fc(distutils.text_file)28 b Fo(\227)33 b(The)h(T)-14 b(e)l(xtFile)33 b(class)0 2706 y Fv(This)22 b(module)e(pro)o(vides)g (the)h Fr(TextFile)g Fv(class,)i(which)e(gi)n(v)o(es)g(an)g(interf)o (ace)g(to)h(te)o(xt)f(\002les)h(that)g(\(optionally\))d(tak)o(es)j (care)f(of)h(strip-)0 2806 y(ping)d(comments,)g(ignoring)f(blank)i (lines,)g(and)f(joining)h(lines)g(with)g(backslashes.)0 2952 y Ft(class)h Fg(TextFile)p Fr(\()p Fk([)p Fp(\002lename=)p Fa(None)p Fp(,)16 b(\002le=)p Fa(None)p Fp(,)j(**options)12 b Fk(])p Fr(\))208 3052 y Fv(This)17 b(class)h(pro)o(vides)d(a)j (\002le-lik)o(e)f(object)f(that)h(tak)o(es)h(care)f(of)g(all)g(the)g (things)g(you)f(commonly)f(w)o(ant)i(to)g(do)g(when)f(processing)g(a) 208 3152 y(te)o(xt)k(\002le)h(that)f(has)h(some)f(line-by-line)e (syntax:)25 b(strip)20 b(comments)g(\(as)g(long)g(as)h Fr(#)g Fv(is)g(your)e(comment)g(character\),)f(skip)j(blank)208 3251 y(lines,)30 b(join)e(adjacent)g(lines)h(by)f(escaping)g(the)g(ne)n (wline)g(\(ie.)50 b(backslash)28 b(at)h(end)f(of)g(line\),)i(strip)f (leading)e(and/or)g(trailing)208 3351 y(whitespace.)d(All)d(of)f(these) g(are)g(optional)f(and)h(independently)d(controllable.)208 3484 y(The)k(class)i(pro)o(vides)d(a)i Fr(warn\(\))f Fv(method)g(so)h(you)f(can)h(generate)e(w)o(arning)h(messages)h(that)g (report)e(physical)h(line)h(number)m(,)208 3583 y(e)n(v)o(en)j(if)i (the)f(logical)g(line)h(in)f(question)g(spans)g(multiple)g(physical)f (lines.)44 b(Also)27 b(pro)o(vides)e Fr(unreadline\(\))f Fv(for)i(imple-)208 3683 y(menting)18 b(line-at-a-time)h(lookahead.)208 3816 y Fr(TextFile)f Fv(instances)h(are)g(create)g(with)g(either)f Fp(\002lename)p Fv(,)g Fp(\002le)p Fv(,)h(or)g(both.)24 b Fr(RuntimeError)17 b Fv(is)j(raised)f(if)h(both)e(are)h Fr(None)p Fv(.)208 3916 y Fp(\002lename)28 b Fv(should)g(be)h(a)h (string,)h(and)d Fp(\002le)h Fv(a)h(\002le)g(object)f(\(or)f(something) g(that)h(pro)o(vides)f Fr(readline\(\))g Fv(and)g Fr(close\(\))208 4015 y Fv(methods\).)39 b(It)26 b(is)h(recommended)c(that)i(you)g (supply)g(at)h(least)g Fp(\002lename)p Fv(,)g(so)g(that)g Fr(TextFile)e Fv(can)i(include)f(it)h(in)g(w)o(arning)208 4115 y(messages.)f(If)20 b Fp(\002le)g Fv(is)h(not)f(supplied,)f Fr(TextFile)g Fv(creates)h(its)h(o)n(wn)f(using)g(the)g Fr(open\(\))g Fv(b)n(uilt-in)f(function.)208 4248 y(The)g(options)h (are)g(all)h(boolean,)d(and)i(af)n(fect)f(the)h(v)n(alues)g(returned)f (by)g Fr(readline\(\))297 4458 y Ft(option)g(name)p 824 4488 4 100 v 139 w(description)p 9488 4488 V 8266 w(default)p 208 4492 9631 4 v 257 4561 a Fv(strip)p 410 4561 25 4 v 30 w(comments)p 824 4591 4 100 v 98 w(strip)h(from)f(`)p Fr(#)p Fv(')h(to)h(end-of-line,)c(as)k(well)g(as)f(an)o(y)g(whitespace) f(leading)h(up)f(to)i(the)f(`)p Fr(#)p Fv('\227unless)f(it)i(is)g (escaped)f(by)g(a)g(backslash)p 9488 4591 V 4914 w(true)370 4661 y(lstrip)p 546 4661 25 4 v 30 w(ws)p 824 4691 4 100 v 213 w(strip)g(leading)f(whitespace)h(from)f(each)h(line)g(before) f(returning)f(it)p 9488 4691 V 6736 w(f)o(alse)368 4761 y(rstrip)p 549 4761 25 4 v 29 w(ws)p 824 4791 4 100 v 211 w(strip)i(trailing)g(whitespace)f(\(including)f(line)j (terminator!\))i(from)c(each)h(line)g(before)f(returning)f(it.)p 9488 4791 V 5785 w(true)324 4860 y(skip)p 468 4860 25 4 v 30 w(blanks)p 824 4890 4 100 v 165 w(skip)i(lines)h(that)f(are)g (empty)f(*after*)g(stripping)g(comments)g(and)h(whitespace.)k(\(If)c (both)f(lstrip)p 3646 4860 25 4 v 30 w(ws)i(and)e(rstrip)p 4105 4860 V 30 w(ws)i(are)f(f)o(alse,)g(then)g(some)g(lines)g(may)g (consist)h(of)e(solely)i(whitespace:)j(these)d(will)f(*not*)f(be)h (skipped,)f(e)n(v)o(en)g(if)i Fp(skip)p 7576 4860 V 30 w(blanks)e Fv(is)i(true.\))p 9488 4890 4 100 v 1446 w(true)359 4960 y(join)p 494 4960 25 4 v 29 w(lines)p 824 4990 4 100 v 201 w(if)f(a)h(backslash)e(is)j(the)e(last)h(non-ne)n(wline)d (character)g(on)i(a)h(line)f(after)g(stripping)f(comments)g(and)h (whitespace,)f(join)h(the)g(follo)n(wing)f(line)h(to)g(it)h(to)g(form)e (one)g(logical)h(line;)h(if)f(N)h(consecuti)n(v)o(e)d(lines)j(end)e (with)i(a)f(backslash,)g(then)f(N+1)h(physical)f(lines)i(will)g(be)f (joined)f(to)i(form)e(one)g(logical)h(line.)p 9488 4990 V 99 w(f)o(alse)301 5060 y(collapse)p 579 5060 25 4 v 29 w(join)p 824 5089 4 100 v 143 w(strip)g(leading)f(whitespace)h(from) f(lines)i(that)f(are)g(joined)f(to)i(their)f(predecessor;)e(only)i (matters)g(if)g(`)p Fr(\(join_lines)48 b(and)h(not)g(lstrip_ws\))p Fv(')p 9488 5089 V 4234 w(f)o(alse)208 5188 y(Note)22 b(that)h(since)g Fp(r)o(strip)p 922 5188 25 4 v 30 w(ws)h Fv(can)f(strip)g(the)f(trailing)g(ne)n(wline,)h(the)f(semantics)h(of)f Fr(readline\(\))g Fv(must)h(dif)n(fer)e(from)h(those)208 5287 y(of)c(the)h(b)n(uiltin)g(\002le)h(object')-5 b(s)19 b Fr(readline\(\))f Fv(method!)23 b(In)18 b(particular)m(,)g Fr(readline\(\))g Fv(returns)g Fr(None)h Fv(for)f(end-of-\002le:)23 b(an)208 5387 y(empty)c(string)h(might)f(just)i(be)f(a)h(blank)e(line)h (\(or)g(an)g(all-whitespace)f(line\),)h(if)g Fp(r)o(strip)p 2678 5387 V 31 w(ws)h Fv(is)h(true)d(b)n(ut)i Fp(skip)p 3303 5387 V 29 w(blanks)f Fv(is)h(not.)p 0 5549 3901 4 v 0 5649 a Fs(11.23.)52 b Fr(distutils.text_file)20 b Fs(\227)j(The)g(T)-10 b(e)n(xtFile)23 b(class)1788 b(57)p eop end %%Page: 58 66 TeXDict begin 58 65 bop 208 83 a Fg(open)p Fr(\()p Fp(\002lename)p Fr(\))390 183 y Fv(Open)20 b(a)g(ne)n(w)g(\002le)h Fp(\002lename)p Fv(.)j(This)c(o)o(v)o(errides)f(an)o(y)g Fp(\002le)h Fv(or)g Fp(\002lename)f Fv(constructor)f(ar)o(guments.)208 315 y Fg(close)p Fr(\(\))390 415 y Fv(Close)23 b(the)g(current)e (\002le)i(and)f(for)o(get)e(e)n(v)o(erything)g(we)j(kno)n(w)e(about)h (it)h(\(including)d(the)i(\002lename)g(and)g(the)g(current)f(line)390 515 y(number\).)208 648 y Fg(warn)p Fr(\()p Fp(msg)p Fk([)p Fp(,line=)p Fa(None)12 b Fk(])p Fr(\))390 747 y Fv(Print)22 b(\(to)f(stderr\))g(a)h(w)o(arning)e(message)i(tied)f(to) h(the)g(current)e(logical)h(line)h(in)f(the)h(current)e(\002le.)30 b(If)21 b(the)h(current)e(logical)390 847 y(line)30 b(in)f(the)h (\002le)g(spans)f(multiple)g(physical)f(lines,)k(the)e(w)o(arning)e (refers)h(to)g(the)h(whole)f(range,)h(such)f(as)h(`)p Fr("lines)390 946 y(3-5")p Fv('.)25 b(If)20 b Fp(line)h Fv(is)g(supplied,)e(it)i(o)o(v)o(errides)e(the)h(current)f(line)h (number;)f(it)i(may)f(be)g(a)h(list)h(or)e(tuple)g(to)g(indicate)g(a)h (range)390 1046 y(of)f(physical)f(lines,)i(or)e(an)i(inte)o(ger)e(for)g (a)i(single)f(physical)f(line.)208 1179 y Fg(readline)p Fr(\(\))390 1279 y Fv(Read)e(and)g(return)e(a)j(single)f(logical)f (line)h(from)f(the)h(current)e(\002le)j(\(or)e(from)g(an)h(internal)f (b)n(uf)n(fer)g(if)h(lines)g(ha)n(v)o(e)g(pre)n(viously)390 1378 y(been)22 b(\223unread\224)f(with)i Fr(unreadline\(\))p Fv(\).)31 b(If)23 b(the)g Fp(join)p 2083 1378 25 4 v 29 w(lines)g Fv(option)e(is)j(true,)f(this)g(may)g(in)m(v)n(olv)o(e)e (reading)g(multiple)390 1478 y(physical)e(lines)i(concatenated)c(into)j (a)h(single)f(string.)k(Updates)c(the)g(current)f(line)h(number)m(,)d (so)k(calling)e Fr(warn\(\))h Fv(after)390 1577 y Fr(readline\(\))k Fv(emits)j(a)f(w)o(arning)e(about)h(the)g(physical)g(line\(s\))g(just)h (read.)41 b(Returns)25 b Fr(None)h Fv(on)f(end-of-\002le,)f(since)390 1677 y(the)c(empty)g(string)g(can)g(occur)f(if)h Fp(r)o(strip)p 1551 1677 V 31 w(ws)h Fv(is)g(true)f(b)n(ut)g Fp(strip)p 2193 1677 V 31 w(blanks)f Fv(is)i(not.)208 1810 y Fg(readlines)p Fr(\(\))390 1910 y Fv(Read)29 b(and)g(return)f(the)h(list)h(of)f(all)h (logical)e(lines)i(remaining)d(in)i(the)g(current)f(\002le.)52 b(This)29 b(updates)g(the)g(current)e(line)390 2009 y(number)19 b(to)h(the)g(last)h(line)f(of)g(the)h(\002le.)208 2142 y Fg(unreadline)p Fr(\()p Fp(line)p Fr(\))390 2242 y Fv(Push)h Fp(line)g Fv(\(a)g(string\))f(onto)g(an)h(internal)f(b)n(uf)n (fer)g(that)h(will)g(be)g(check)o(ed)f(by)g(future)g Fr(readline\(\))g Fv(calls.)30 b(Handy)21 b(for)390 2341 y(implementing)15 b(a)i(parser)f(with)h(line-at-a-time)f(lookahead.)21 b(Note)c(that)g(lines)g(that)g(are)g(\223unread\224)e(with)i Fr(unreadline)390 2441 y Fv(are)22 b(not)g(subsequently)f(re-cleansed)g (\(whitespace)g(stripped,)h(or)g(whate)n(v)o(er\))e(when)i(read)f(with) i Fr(readline)p Fv(.)30 b(If)22 b(mul-)390 2540 y(tiple)f(calls)h(are)e (made)g(to)h Fr(unreadline)f Fv(before)f(a)i(call)g(to)g Fr(readline)p Fv(,)f(the)h(lines)g(will)g(be)g(returned)e(most)i(in)g (most)390 2640 y(recent)f(\002rst)h(order)-5 b(.)0 2968 y Fo(11.24)122 b Fc(distutils.version)28 b Fo(\227)33 b(V)-10 b(ersion)34 b(n)o(umber)g(classes)0 3250 y(11.25)122 b Fc(distutils.cmd)29 b Fo(\227)k(Abstr)o(act)h(base)g(class)f(f)l(or)h (Distutils)f(commands)0 3483 y Fv(This)20 b(module)f(supplies)h(the)g (abstract)g(base)h(class)g Fr(Command)p Fv(.)0 3630 y Ft(class)g Fg(Command)p Fr(\()p Fp(dist)q Fr(\))208 3729 y Fv(Abstract)d(base)h(class)g(for)f(de\002ning)g(command)e(classes,)k (the)f(\223w)o(ork)o(er)e(bees\224)i(of)f(the)h(Distutils.)25 b(A)19 b(useful)f(analogy)f(for)h(com-)208 3829 y(mand)i(classes)j(is)g (to)f(think)f(of)g(them)g(as)i(subroutines)d(with)i(local)f(v)n (ariables)g(called)h Fp(options)p Fv(.)28 b(The)22 b(options)e(are)i (declared)e(in)208 3929 y Fr(initialize_options\(\))12 b Fv(and)k(de\002ned)f(\(gi)n(v)o(en)g(their)g(\002nal)i(v)n(alues\))e (in)h Fr(finalize_options\(\))p Fv(,)e(both)h(of)h(which)208 4028 y(must)23 b(be)g(de\002ned)f(by)h(e)n(v)o(ery)e(command)h(class.) 34 b(The)23 b(distinction)f(between)h(the)g(tw)o(o)g(is)h(necessary)f (because)f(option)g(v)n(alues)208 4128 y(might)d(come)h(from)f(the)i (outside)e(w)o(orld)h(\(command)e(line,)i(con\002g)g(\002le,)h(...\),)e (and)h(an)o(y)g(options)f(dependent)f(on)i(other)g(options)208 4228 y(must)f(be)g(computed)f(after)h(these)g(outside)g(in\003uences)g (ha)n(v)o(e)g(been)f(processed)h(\227)g(hence)g Fr (finalize_options\(\))p Fv(.)j(The)208 4327 y(body)15 b(of)j(the)f(subroutine,)f(where)g(it)i(does)f(all)h(its)h(w)o(ork)d (based)h(on)g(the)g(v)n(alues)g(of)g(its)i(options,)d(is)j(the)e Fr(run\(\))g Fv(method,)f(which)208 4427 y(must)k(also)g(be)g (implemented)f(by)g(e)n(v)o(ery)g(command)g(class.)208 4560 y(The)g(class)j(constructor)c(tak)o(es)i(a)h(single)f(ar)o(gument) e Fp(dist)q Fv(,)j(a)f Fr(Distribution)f Fv(instance.)p 0 5549 3901 4 v 0 5649 a Fs(58)2762 b(Chapter)23 b(11.)53 b(API)23 b(Ref)n(erence)p eop end %%Page: 59 67 TeXDict begin 59 66 bop 0 86 a Fo(11.26)122 b Fc(distutils.command)28 b Fo(\227)33 b(Individual)h(Distutils)f(commands)0 369 y(11.27)122 b Fc(distutils.command.bdist)27 b Fo(\227)32 b(Build)h(a)h(binar)t(y)g(installer)0 652 y(11.28)122 b Fc(distutils.command.bdist)o(_pac)o(kage)o(r)117 b Fo(\227)123 b(Abstr)o(act)h(base)419 801 y(class)32 b(f)l(or)i(pac)n (kagers)0 1084 y(11.29)122 b Fc(distutils.command.bdist)o(_dum)o(b)27 b Fo(\227)33 b(Build)g(a)h(\223dumb\224)g(installer)0 1366 y(11.30)122 b Fc(distutils.command.bdist)o(_msi)31 b Fo(\227)38 b(Build)f(a)i(Microsoft)e(Installer)419 1516 y(binar)t(y)c(pac)n(kage)0 1798 y(11.31)122 b Fc (distutils.command.bdist)o(_rpm)31 b Fo(\227)36 b(Build)h(a)h(binar)t (y)g(distr)r(ib)n(ution)419 1948 y(as)33 b(a)h(Redhat)i(RPM)c(and)j (SRPM)0 2230 y(11.32)122 b Fc(distutils.command.bdist)o(_win)o(inst)31 b Fo(\227)38 b(Build)g(a)g(Windo)n(ws)h(in-)419 2380 y(staller)0 2662 y(11.33)122 b Fc(distutils.command.sdist)27 b Fo(\227)32 b(Build)h(a)h(source)g(distr)r(ib)n(ution)0 2945 y(11.34)122 b Fc(distutils.command.build)27 b Fo(\227)32 b(Build)h(all)g(\002les)g(of)h(a)g(pac)n(kage)0 3228 y(11.35)122 b Fc(distutils.command.build)o(_cli)o(b)27 b Fo(\227)33 b(Build)g(an)n(y)h(C)f(libr)o(ar)r(ies)f(in)i(a)419 3377 y(pac)n(kage)0 3660 y(11.36)122 b Fc(distutils.command.build)o (_ext)34 b Fo(\227)39 b(Build)h(an)n(y)h(e)l(xtensions)h(in)f(a)419 3809 y(pac)n(kage)0 4092 y(11.37)122 b Fc(distutils.command.build)o (_py)34 b Fo(\227)40 b(Build)g(the)h(.p)l(y/.p)l(yc)h(\002les)e(of)h(a) 419 4241 y(pac)n(kage)0 4524 y(11.38)122 b Fc(distutils.command.build)o (_scr)o(ipts)25 b Fo(\227)32 b(Build)g(the)h(scr)r(ipts)f(of)h(a)419 4673 y(pac)n(kage)0 4956 y(11.39)122 b Fc(distutils.command.clean)27 b Fo(\227)32 b(Clean)j(a)f(pac)n(kage)g(b)n(uild)g(area)0 5238 y(11.40)122 b Fc(distutils.command.confi)o(g)55 b Fo(\227)60 b(P)-6 b(erf)l(or)s(m)61 b(pac)n(kage)h(con\002gur)o(a-) 419 5388 y(tion)0 5670 y(11.41)122 b Fc(distutils.command.insta)o(ll)27 b Fo(\227)33 b(Install)g(a)h(pac)n(kage)0 5953 y(11.42)122 b Fc(distutils.command.insta)o(ll_d)o(ata)36 b Fo(\227)42 b(Install)h(data)i(\002les)d(from)419 6103 y(a)33 b(pac)n(kage)0 6385 y(11.43)122 b Fc(distutils.command.insta)o(ll_h)o(eade)o(rs)106 b Fo(\227)112 b(Install)g(C/C)3759 6374 y(++)419 6535 y(header)35 b(\002les)e(from)g(a)h(pac)n(kage)0 6817 y(11.44)122 b Fc(distutils.command.insta)o(ll_l)o(ib)32 b Fo(\227)37 b(Install)i(libr)o(ar)t(y)d(\002les)i(from)419 6967 y(a)33 b(pac)n(kage)0 7249 y(11.45)122 b Fc (distutils.command.insta)o(ll_s)o(crip)o(ts)39 b Fo(\227)46 b(Install)f(scr)r(ipt)g(\002les)419 7399 y(from)33 b(a)h(pac)n(kage)0 7681 y(11.46)122 b Fc(distutils.command.regis)o(ter)29 b Fo(\227)36 b(Register)h(a)f(module)h(with)f(the)419 7831 y(Python)e(P)-5 b(ac)n(kage)34 b(Inde)l(x)0 8064 y Fv(The)23 b Fr(register)f Fv(command)g(re)o(gisters)h(the)g(package)f (with)i(the)f(Python)f(P)o(ackage)g(Inde)o(x.)33 b(This)24 b(is)g(described)e(in)i(more)e(detail)h(in)0 8163 y(PEP)e(301.)p 0 5549 3901 4 v 0 5649 a Fs(11.26.)52 b Fr(distutils.command)20 b Fs(\227)j(Individual)i(Distutils)f(commands)1456 b(59)p eop end %%Page: 60 68 TeXDict begin 60 67 bop 0 88 a Fo(11.47)122 b(Creating)35 b(a)e(ne)n(w)h(Distutils)f(command)0 321 y Fv(This)20 b(section)g(outlines)g(the)g(steps)h(to)f(create)g(a)h(ne)n(w)f (Distutils)h(command.)0 468 y(A)32 b(ne)n(w)f(command)e(li)n(v)o(es)j (in)f(a)h(module)e(in)i(the)f Fr(distutils.command)e Fv(package.)57 b(There)31 b(is)h(a)g(sample)f(template)g(in)g(that)0 567 y(directory)17 b(called)h(`)p Fw(command)p 897 567 23 4 v 25 w(template)p Fv('.)k(Cop)o(y)c(this)h(\002le)g(to)g(a)f(ne)n (w)h(module)e(with)h(the)g(same)h(name)f(as)h(the)f(ne)n(w)g(command)e (you')l(re)0 667 y(implementing.)25 b(This)c(module)e(should)h (implement)f(a)j(class)f(with)g(the)g(same)g(name)f(as)i(the)f(module)e (\(and)h(the)h(command\).)j(So,)d(for)0 767 y(instance,)h(to)g(create)g (the)g(command)e Fr(peel_banana)h Fv(\(so)h(that)g(users)g(can)g(run)f (`)p Fr(setup.py)48 b(peel_banana)p Fv('\),)20 b(you')l(d)g(cop)o(y)0 866 y(`)p Fw(command)p 361 866 V 26 w(template)p Fv(')h(to)j(`)p Fw(distutils/command/peel)p 1607 866 V 21 w(banana.p)n(y)p Fv(',)e(then)h(edit)h(it)g(so)g(that)g(it')-5 b(s)25 b(implementing)d(the)h(class)i Fr(peel_-)0 966 y(banana)p Fv(,)19 b(a)i(subclass)f(of)g Fr(distutils.cmd.Command)p Fv(.)0 1113 y(Subclasses)g(of)g Fr(Command)g Fv(must)g(de\002ne)g(the)g (follo)n(wing)e(methods.)0 1260 y Fg(initialize_options\(\))p Fr(\()p Fp(S)q Fr(\))208 1359 y Fv(et)28 b(def)o(ault)e(v)n(alues)h (for)g(all)h(the)g(options)e(that)i(this)g(command)d(supports.)46 b(Note)27 b(that)h(these)f(def)o(aults)g(may)g(be)h(o)o(v)o(erridden) 208 1459 y(by)22 b(other)g(commands,)f(by)i(the)g(setup)f(script,)i(by) e(con\002g)g(\002les,)i(or)f(by)f(the)h(command-line.)30 b(Thus,)23 b(this)g(is)h(not)e(the)h(place)f(to)208 1559 y(code)d(dependencies)g(between)g(options;)h(generally)-5 b(,)19 b Fr(initialize_options\(\))e Fv(implementations)h(are)j(just)g (a)g(b)n(unch)208 1658 y(of)e(`)p Fr(self.foo)48 b(=)i(None)p Fv(')20 b(assignments.)0 1805 y Fg(finalize_options)p Fr(\(\))208 1905 y Fv(Set)g(\002nal)g(v)n(alues)f(for)g(all)h(the)g (options)f(that)g(this)h(command)e(supports.)24 b(This)c(is)g(al)o(w)o (ays)g(called)g(as)g(late)g(as)g(possible,)g(ie.)25 b(after)208 2004 y(an)o(y)17 b(option)f(assignments)i(from)f(the)g(command-line)f (or)h(from)g(other)g(commands)f(ha)n(v)o(e)i(been)f(done.)23 b(Thus,)18 b(this)g(is)h(the)f(place)208 2104 y(to)j(to)g(code)g (option)f(dependencies:)k(if)e Fp(foo)f Fv(depends)e(on)i Fp(bar)r Fv(,)g(then)g(it)h(is)g(safe)f(to)g(set)h Fp(foo)f Fv(from)f Fp(bar)j Fv(as)f(long)e(as)i Fp(foo)f Fv(still)h(has)208 2204 y(the)e(same)g(v)n(alue)g(it)h(w)o(as)g(assigned)e(in)i Fr(initialize_options\(\))p Fv(.)0 2350 y Fg(run)p Fr(\(\))208 2450 y Fv(A)28 b(command')-5 b(s)26 b(raison)i(d'etre:)40 b(carry)27 b(out)h(the)g(action)f(it)i(e)o(xists)f(to)g(perform,)g (controlled)e(by)i(the)g(options)f(initialized)g(in)208 2550 y Fr(initialize_options\(\))p Fv(,)19 b(customized)i(by)g(other)h (commands,)e(the)j(setup)f(script,)g(the)g(command-line,)e(and)h (con\002g)208 2649 y(\002les,)g(and)f(\002nalized)f(in)i Fr(finalize_options\(\))p Fv(.)i(All)e(terminal)e(output)g(and)h (\002lesystem)h(interaction)e(should)g(be)i(done)208 2749 y(by)e Fr(run\(\))p Fv(.)0 2896 y Fp(sub)p 121 2896 25 4 v 29 w(commands)25 b Fv(formalizes)g(the)h(notion)e(of)i(a)g (\223f)o(amily\224)g(of)f(commands,)h(e)o(g.)41 b Fr(install)26 b Fv(as)g(the)g(parent)f(with)h(sub-commands)0 2995 y Fr(install_lib)p Fv(,)d Fr(install_headers)p Fv(,)f(etc.)36 b(The)24 b(parent)f(of)g(a)i(f)o(amily)e(of)g(commands)g(de\002nes)g Fp(sub)p 3180 2995 V 29 w(commands)g Fv(as)h(a)h(class)0 3095 y(attrib)n(ute;)34 b(it')-5 b(s)30 b(a)g(list)h(of)e(2-tuples)g(`) p Fr(\(command_name,)46 b(predicate\))p Fv(',)30 b(with)g Fp(command)p 2921 3095 V 28 w(name)f Fv(a)g(string)h(and)f Fp(pr)m(edicate)0 3195 y Fv(an)g(unbound)c(method,)30 b(a)f(string)f(or)h(None.)49 b Fp(pr)m(edicate)28 b Fv(is)i(a)f(method) e(of)h(the)h(parent)f(command)f(that)h(determines)g(whether)g(the)0 3294 y(corresponding)16 b(command)i(is)j(applicable)e(in)h(the)g (current)e(situation.)24 b(\(Eg.)h(we)20 b Fr(install_headers)e Fv(is)i(only)f(applicable)g(if)h(we)0 3394 y(ha)n(v)o(e)g(an)o(y)f(C)i (header)e(\002les)i(to)g(install.\))k(If)20 b Fp(pr)m(edicate)f Fv(is)i(None,)f(that)g(command)e(is)j(al)o(w)o(ays)g(applicable.)0 3541 y Fp(sub)p 121 3541 V 29 w(commands)i Fv(is)i(usually)e(de\002ned) g(at)i(the)f(*end*)f(of)g(a)i(class,)g(because)f(predicates)f(can)h(be) g(unbound)d(methods,)j(so)g(the)o(y)g(must)0 3640 y(already)19 b(ha)n(v)o(e)h(been)f(de\002ned.)24 b(The)c(canonical)f(e)o(xample)g (is)i(the)f Fr(install)f Fv(command.)p 0 5549 3901 4 v 0 5649 a Fs(60)2762 b(Chapter)23 b(11.)53 b(API)23 b(Ref)n(erence)p eop end %%Page: 61 69 TeXDict begin 61 68 bop 2328 567 a FB(MODULE)57 b(INDEX)0 1321 y Fo(D)0 1445 y Fr(distutils.archive_util)p Fv(,)16 b(50)0 1544 y Fr(distutils.bcppcompiler)p Fv(,)g(50)0 1644 y Fr(distutils.ccompiler)p Fv(,)h(44)0 1743 y Fr(distutils.cmd)p Fv(,)h(58)0 1843 y Fr(distutils.command)p Fv(,)f(59)0 1943 y Fr(distutils.command.bdist)p Fv(,)f(59)0 2042 y Fr(distutils.command.bdist_dumb)p Fv(,)f(59)0 2142 y Fr(distutils.command.bdist_msi)p Fv(,)g(59)0 2242 y Fr(distutils.command.bdist_packager)p Fv(,)g(59)0 2341 y Fr(distutils.command.bdist_rpm)p Fv(,)g(59)0 2441 y Fr(distutils.command.bdist_wininst)p Fv(,)g(59)0 2540 y Fr(distutils.command.build)p Fv(,)h(59)0 2640 y Fr (distutils.command.build_clib)p Fv(,)f(59)0 2740 y Fr (distutils.command.build_ext)p Fv(,)g(59)0 2839 y Fr (distutils.command.build_py)p Fv(,)h(59)0 2939 y Fr (distutils.command.build_scripts)p Fv(,)f(59)0 3039 y Fr(distutils.command.clean)p Fv(,)h(59)0 3138 y Fr (distutils.command.config)p Fv(,)g(59)0 3238 y Fr (distutils.command.install)p Fv(,)g(59)0 3337 y Fr (distutils.command.install_data)p Fv(,)f(59)0 3437 y Fr(distutils.command.install_headers)p Fv(,)f(59)0 3537 y Fr(distutils.command.install_lib)p Fv(,)h(59)0 3636 y Fr(distutils.command.install_scripts)p Fv(,)f(59)0 3736 y Fr(distutils.command.register)p Fv(,)i(59)0 3836 y Fr(distutils.command.sdist)p Fv(,)g(59)0 3935 y Fr(distutils.core)p Fv(,)i(43)0 4035 y Fr(distutils.cygwinccompiler)p Fv(,)e(50)0 4134 y Fr(distutils.debug)p Fv(,)i(54)0 4234 y Fr(distutils.dep_util)p Fv(,)f(51)0 4334 y Fr(distutils.dir_util)p Fv(,)g(51)0 4433 y Fr(distutils.dist)p Fv(,)h(54)0 4533 y Fr (distutils.emxccompiler)p Fv(,)e(50)0 4633 y Fr(distutils.errors)p Fv(,)i(54)0 4732 y Fr(distutils.extension)p Fv(,)f(54)0 4832 y Fr(distutils.fancy_getopt)p Fv(,)f(55)0 4931 y Fr(distutils.file_util)p Fv(,)h(52)0 5031 y Fr(distutils.filelist)p Fv(,)g(56)0 5131 y Fr(distutils.log)p Fv(,)h(56)0 5230 y Fr(distutils.msvccompiler)p Fv(,)e(50)0 5330 y Fr (distutils.mwerkscompiler)p Fv(,)g(50)1992 1318 y Fr(distutils.spawn)p Fv(,)h(56)1992 1418 y Fr(distutils.sysconfig)p Fv(,)f(56)1992 1517 y Fr(distutils.text_file)p Fv(,)g(57)1992 1617 y Fr(distutils.unixccompiler)p Fv(,)g(49)1992 1716 y Fr(distutils.util)p Fv(,)h(52)1992 1816 y Fr(distutils.version)p Fv(,)g(58)p 0 5549 3901 4 v 3808 5649 a Fs(61)p eop end %%Page: 62 70 TeXDict begin 62 69 bop 0 5549 3901 4 v 0 5649 a Fs(62)p eop end %%Page: 63 71 TeXDict begin 63 70 bop 3269 564 a FB(INDEX)0 1315 y Fo(A)0 1438 y Fr(add_include_dir\(\))18 b Fv(\(CCompiler)h(method\),)f (45)0 1538 y Fr(add_library\(\))g Fv(\(CCompiler)i(method\),)e(45)0 1637 y Fr(add_library_dir\(\))g Fv(\(CCompiler)h(method\),)f(46)0 1737 y Fr(add_link_object\(\))g Fv(\(CCompiler)h(method\),)f(46)0 1837 y Fr(add_runtime_library_dir\(\))262 b Fv(\(CCompiler)332 1936 y(method\),)18 b(46)0 2036 y Fr(announce\(\))h Fv(\(CCompiler)g (method\),)g(49)0 2232 y Fo(B)0 2355 y Fr(byte_compile\(\))f Fv(\(in)i(module)f(distutils.util\),)h(54)0 2549 y Fo(C)0 2672 y Fr(CCompiler)f Fv(\(class)i(in)f(distutils.ccompiler\),)e(45)0 2772 y Fr(change_root\(\))g Fv(\(in)i(module)f(distutils.util\),)h(53)0 2871 y Fr(check_environ\(\))e Fv(\(in)i(module)f(distutils.util\),)g (53)0 2971 y Fr(close\(\))g Fv(\(T)-6 b(e)o(xtFile)20 b(method\),)e(58)0 3071 y Fr(Command)166 3170 y Fv(class)j(in)g (distutils.cmd,)e(58)166 3270 y(class)i(in)g(distutils.core,)e(44)0 3370 y Fr(compile\(\))g Fv(\(CCompiler)h(method\),)e(47)0 3469 y Fr(convert_path\(\))g Fv(\(in)i(module)f(distutils.util\),)h(53) 0 3569 y Fr(copy_file\(\))f Fv(\(in)h(module)f(distutils.\002le)p 1347 3569 25 4 v 29 w(util\),)h(52)0 3669 y Fr(copy_tree\(\))f Fv(\(in)h(module)f(distutils.dir)p 1334 3669 V 28 w(util\),)h(52)0 3768 y Fr(create_shortcut\(\))e Fv(\(in)i(module)e(\),)j(27)0 3868 y Fr(create_static_lib\(\))c Fv(\(CCompiler)j(method\),)e(47)0 3967 y Fr(create_tree\(\))g Fv(\(in)i(module)f(distutils.dir)p 1433 3967 V 29 w(util\),)h(51)0 4067 y Fr(customize_compiler\(\))124 b Fv(\(in)i(module)f(distu-)332 4167 y(tils.syscon\002g\),)19 b(57)0 4362 y Fo(D)0 4486 y Fr(debug_print\(\))f Fv(\(CCompiler)i (method\),)e(49)0 4585 y Fr(define_macro\(\))g Fv(\(CCompiler)i (method\),)e(46)0 4685 y Fr(detect_language\(\))g Fv(\(CCompiler)h (method\),)f(46)0 4784 y Fr(directory_created\(\))f Fv(\(in)j(module)f (\),)h(27)0 4884 y Fr(Distribution)f Fv(\(class)h(in)h (distutils.core\),)d(44)0 4984 y Fr(distutils.archive_util)f Fv(\(standard)h(module\),)h Ft(50)0 5083 y Fr(distutils.bcppcompiler)e Fv(\(standard)h(module\),)h Ft(50)0 5183 y Fr(distutils.ccompiler)e Fv(\(standard)i(module\),)f Ft(44)0 5283 y Fr(distutils.cmd)g Fv(\(standard)h(module\),)f Ft(58)0 5382 y Fr(distutils.command)g Fv(\(standard)g(module\),)g Ft(59)1992 1312 y Fr (distutils.command.bdist)e Fv(\(standard)j(module\),)f Ft(59)1992 1411 y Fr(distutils.command.bdist_dumb)199 b Fv(\(standard)2324 1511 y(module\),)18 b Ft(59)1992 1610 y Fr(distutils.command.bdist_msi)34 b Fv(\(standard)k(mod-)2324 1710 y(ule\),)19 b Ft(59)1992 1810 y Fr (distutils.command.bdist_packager)119 b Fv(\(stan-)2324 1909 y(dard)19 b(module\),)f Ft(59)1992 2009 y Fr (distutils.command.bdist_rpm)34 b Fv(\(standard)k(mod-)2324 2109 y(ule\),)19 b Ft(59)1992 2208 y Fr (distutils.command.bdist_wininst)49 b Fv(\(standard)2324 2308 y(module\),)18 b Ft(59)1992 2407 y Fr(distutils.command.build)e Fv(\(standard)j(module\),)f Ft(59)1992 2507 y Fr (distutils.command.build_clib)199 b Fv(\(standard)2324 2607 y(module\),)18 b Ft(59)1992 2706 y Fr(distutils.command.build_ext) 34 b Fv(\(standard)k(mod-)2324 2806 y(ule\),)19 b Ft(59)1992 2906 y Fr(distutils.command.build_py)59 b Fv(\(standard)k(mod-)2324 3005 y(ule\),)19 b Ft(59)1992 3105 y Fr (distutils.command.build_scripts)49 b Fv(\(standard)2324 3204 y(module\),)18 b Ft(59)1992 3304 y Fr(distutils.command.clean)e Fv(\(standard)j(module\),)f Ft(59)1992 3404 y Fr (distutils.command.config)48 b Fv(\(standard)k(module\),)2324 3503 y Ft(59)1992 3603 y Fr(distutils.command.install)23 b Fv(\(standard)k(module\),)2324 3703 y Ft(59)1992 3802 y Fr(distutils.command.install_data)99 b Fv(\(standard)2324 3902 y(module\),)18 b Ft(59)1992 4001 y Fr (distutils.command.install_headers)69 b Fv(\(stan-)2324 4101 y(dard)19 b(module\),)f Ft(59)1992 4201 y Fr (distutils.command.install_lib)149 b Fv(\(standard)2324 4300 y(module\),)18 b Ft(59)1992 4400 y Fr (distutils.command.install_scripts)69 b Fv(\(stan-)2324 4500 y(dard)19 b(module\),)f Ft(59)1992 4599 y Fr (distutils.command.register)59 b Fv(\(standard)k(mod-)2324 4699 y(ule\),)19 b Ft(59)1992 4798 y Fr(distutils.command.sdist)d Fv(\(standard)j(module\),)f Ft(59)1992 4898 y Fr(distutils.core)g Fv(\(standard)g(module\),)h Ft(43)1992 4998 y Fr (distutils.cygwinccompiler)k Fv(\(standard)k(module\),)2324 5097 y Ft(50)1992 5197 y Fr(distutils.debug)17 b Fv(\(standard)i (module\),)f Ft(54)1992 5297 y Fr(distutils.dep_util)f Fv(\(standard)i(module\),)f Ft(51)1992 5396 y Fr(distutils.dir_util)f Fv(\(standard)i(module\),)f Ft(51)p 0 5549 3901 4 v 3808 5649 a Fs(63)p eop end %%Page: 64 72 TeXDict begin 64 71 bop 0 83 a Fr(distutils.dist)18 b Fv(\(standard)h(module\),)f Ft(54)0 183 y Fr(distutils.emxccompiler)f Fv(\(standard)h(module\),)h Ft(50)0 282 y Fr(distutils.errors)f Fv(\(standard)g(module\),)h Ft(54)0 382 y Fr(distutils.extension)e Fv(\(standard)i(module\),)f Ft(54)0 482 y Fr(distutils.fancy_getopt)f Fv(\(standard)h(module\),)h Ft(55)0 581 y Fr(distutils.file_util)e Fv(\(standard)i(module\),)f Ft(52)0 681 y Fr(distutils.filelist)f Fv(\(standard)i(module\),)f Ft(56)0 780 y Fr(distutils.log)g Fv(\(standard)h(module\),)f Ft(56)0 880 y Fr(distutils.msvccompiler)f Fv(\(standard)h(module\),)h Ft(50)0 980 y Fr(distutils.mwerkscompiler) 49 b Fv(\(standard)i(module\),)332 1079 y Ft(50)0 1179 y Fr(distutils.spawn)18 b Fv(\(standard)h(module\),)f Ft(56)0 1279 y Fr(distutils.sysconfig)f Fv(\(standard)i(module\),)f Ft(56)0 1378 y Fr(distutils.text_file)f Fv(\(standard)i(module\),)f Ft(57)0 1478 y Fr(distutils.unixccompiler)e Fv(\(standard)j(module\),)f Ft(49)0 1577 y Fr(distutils.util)g Fv(\(standard)h(module\),)f Ft(52)0 1677 y Fr(distutils.version)g Fv(\(standard)g(module\),)g Ft(58)0 1863 y Fo(E)0 1987 y Fv(en)m(vironment)f(v)n(ariables)166 2086 y(HOME,)j(53)166 2186 y(P)-8 b(A)f(TH,)20 b(31)166 2285 y(PLA)-9 b(T,)20 b(53)0 2385 y Fr(EXEC_PREFIX)f Fv(\(data)g(in)i(distutils.syscon\002g\),)d(56)0 2485 y Fr(executable_filename\(\))f Fv(\(CCompiler)i(method\),)f(49)0 2584 y Fr(execute\(\))166 2684 y Fv(CCompiler)i(method,)e(49)166 2784 y(in)i(module)f(distutils.util,)h(53)0 2883 y Fr(Extension)f Fv(\(class)i(in)f(distutils.core\),)f(44)0 3069 y Fo(F)0 3193 y Fr(fancy_getopt\(\))37 b Fv(\(in)h(module)g(distutils.f)o(anc)o (y)p 1630 3193 25 4 v 28 w(getopt\),)332 3292 y(55)0 3392 y Fr(FancyGetopt)19 b Fv(\(class)h(in)h(distutils.f)o(anc)o(y)p 1337 3392 V 28 w(getopt\),)e(55)0 3492 y Fr(file_created\(\))f Fv(\(in)i(module)f(\),)h(27)0 3591 y Fr(finalize_options\(\))d Fv(\()k(method\),)d(60)0 3691 y Fr(find_library_file\(\))f Fv(\(CCompiler)j(method\),)e(46)0 3882 y Fo(G)0 4005 y Fr(gen_lib_options\(\))e Fv(\(in)i(module)e(distutils.ccompiler\),) 332 4105 y(45)0 4204 y Fr(gen_preprocess_options\(\))56 b Fv(\(in)k(module)f(distu-)332 4304 y(tils.ccompiler\),)19 b(45)0 4404 y Fr(generate_help\(\))f Fv(\(F)o(anc)o(yGetopt)g (method\),)g(55)0 4503 y Fr(get_config_h_filename\(\))73 b Fv(\(in)k(module)e(distu-)332 4603 y(tils.syscon\002g\),)19 b(56)0 4703 y Fr(get_config_var\(\))38 b Fv(\(in)j(module)f (distutils.syscon\002g\),)332 4802 y(56)0 4902 y Fr (get_config_vars\(\))22 b Fv(\(in)i(module)f(distutils.syscon\002g\),) 332 5001 y(56)0 5101 y Fr(get_default_compiler\(\))90 b Fv(\(in)j(module)f(distu-)332 5201 y(tils.ccompiler\),)19 b(45)0 5300 y Fr(get_makefile_filename\(\))73 b Fv(\(in)k(module)e (distu-)332 5400 y(tils.syscon\002g\),)19 b(56)1992 83 y Fr(get_option_order\(\))e Fv(\(F)o(anc)o(yGetopt)h(method\),)g(55) 1992 183 y Fr(get_platform\(\))g Fv(\(in)i(module)e(distutils.util\),)i (52)1992 282 y Fr(get_python_inc\(\))38 b Fv(\(in)j(module)e (distutils.syscon\002g\),)2324 382 y(56)1992 482 y Fr (get_python_lib\(\))f Fv(\(in)j(module)e(distutils.syscon\002g\),)2324 581 y(57)1992 681 y Fr(get_special_folder_path\(\))16 b Fv(\(in)k(module)e(\),)j(27)1992 780 y Fr(getopt\(\))e Fv(\(F)o(anc)o(yGetopt)f(method\),)g(55)1992 880 y Fr (grok_environment_error\(\))56 b Fv(\(in)k(module)f(distu-)2324 980 y(tils.util\),)20 b(53)1992 1172 y Fo(H)1992 1295 y Fr(has_function\(\))e Fv(\(CCompiler)h(method\),)f(46)1992 1395 y(HOME,)h(53)1992 1578 y Fo(I)1992 1701 y Fr (initialize_options\(\)\(\))d Fv(\()21 b(method\),)d(60)1992 1893 y Fo(L)1992 2017 y Fr(library_dir_option\(\))f Fv(\(CCompiler)i (method\),)f(46)1992 2116 y Fr(library_filename\(\))f Fv(\(CCompiler)i(method\),)g(49)1992 2216 y Fr(library_option\(\))e Fv(\(CCompiler)j(method\),)e(47)1992 2315 y Fr(link\(\))h Fv(\(CCompiler)h(method\),)e(48)1992 2415 y Fr(link_executable\(\))f Fv(\(CCompiler)j(method\),)e(48)1992 2515 y Fr(link_shared_lib\(\))f Fv(\(CCompiler)j(method\),)e(48)1992 2614 y Fr(link_shared_object\(\))f Fv(\(CCompiler)i(method\),)f(48)1992 2810 y Fo(M)1992 2933 y Fr(make_archive\(\))d Fv(\(in)i(module)g(distutils.archi)n(v)o (e)p 3617 2933 V 27 w(util\),)h(50)1992 3033 y Fr(make_tarball\(\))d Fv(\(in)i(module)g(distutils.archi)n(v)o(e)p 3617 3033 V 27 w(util\),)h(51)1992 3132 y Fr(make_zipfile\(\))d Fv(\(in)i(module)g(distutils.archi)n(v)o(e)p 3617 3132 V 27 w(util\),)h(51)1992 3232 y Fr(mkpath\(\))2158 3332 y Fv(CCompiler)h(method,)g(49)2158 3431 y(in)h(module)f(distutils.dir)p 2895 3431 V 29 w(util,)h(51)1992 3531 y Fr(move_file\(\))2158 3631 y Fv(CCompiler)f(method,)g(49)2158 3730 y(in)h(module)f (distutils.\002le)p 2908 3730 V 29 w(util,)i(52)1992 3913 y Fo(N)1992 4036 y Fr(new_compiler\(\))d Fv(\(in)i(module)e (distutils.ccompiler\),)g(45)1992 4136 y Fr(newer\(\))h Fv(\(in)h(module)f(distutils.dep)p 3154 4136 V 28 w(util\),)h(51)1992 4235 y Fr(newer_group\(\))e Fv(\(in)i(module)f(distutils.dep)p 3453 4235 V 28 w(util\),)h(51)1992 4335 y Fr(newer_pairwise\(\))d Fv(\(in)j(module)f(distutils.dep)p 3602 4335 V 29 w(util\),)h(51)1992 4532 y Fo(O)1992 4656 y Fr(object_filenames\(\))d Fv(\(CCompiler)i (method\),)g(49)1992 4755 y Fr(open\(\))g Fv(\(T)-6 b(e)o(xtFile)20 b(method\),)e(58)1992 4948 y Fo(P)1992 5071 y Fv(P)-8 b(A)f(TH,)20 b(31)1992 5171 y(PLA)-9 b(T)j(,)19 b(53)1992 5270 y Fr(PREFIX)g Fv(\(data)h(in)g(distutils.syscon\002g\),)f(56)1992 5370 y Fr(preprocess\(\))f Fv(\(CCompiler)h(method\),)g(48)p 0 5549 3901 4 v 0 5649 a Fs(64)3607 b(Inde)n(x)p eop end %%Page: 65 73 TeXDict begin 65 72 bop 0 83 a Fv(Python)19 b(Enhancement)f(Proposals) 166 183 y(PEP)j(301,)e(59)166 282 y(PEP)i(314,)e(43)0 465 y Fo(R)0 588 y Fr(readline\(\))g Fv(\(T)-6 b(e)o(xtFile)20 b(method\),)e(58)0 688 y Fr(readlines\(\))h Fv(\(T)-6 b(e)o(xtFile)19 b(method\),)g(58)0 787 y Fr(remove_tree\(\))f Fv(\(in)i(module)f(distutils.dir)p 1433 787 25 4 v 29 w(util\),)h(52)0 887 y(RFC)166 987 y(RFC)i(822,)d(54)0 1086 y Fr(rfc822_escape\(\))f Fv(\(in)i(module)f(distutils.util\),)g (54)0 1186 y Fr(run\(\))h Fv(\()g(method\),)e(60)0 1286 y Fr(run_setup\(\))h Fv(\(in)h(module)f(distutils.core\),)f(43)0 1385 y Fr(runtime_library_dir_option\(\))112 b Fv(\(CCompiler)332 1485 y(method\),)18 b(47)0 1679 y Fo(S)0 1802 y Fr(set_executables\(\)) g Fv(\(CCompiler)h(method\),)f(47)0 1902 y Fr(set_include_dirs\(\))f Fv(\(CCompiler)j(method\),)e(45)0 2001 y Fr(set_libraries\(\))g Fv(\(CCompiler)h(method\),)g(46)0 2101 y Fr(set_library_dirs\(\))e Fv(\(CCompiler)j(method\),)e(46)0 2201 y Fr(set_link_objects\(\))f Fv(\(CCompiler)j(method\),)e(46)0 2300 y Fr(set_python_build\(\))157 b Fv(\(in)j(module)e(distu-)332 2400 y(tils.syscon\002g\),)19 b(57)0 2500 y Fr(set_runtime_library_dirs\(\))212 b Fv(\(CCompiler)332 2599 y(method\),)18 b(46)0 2699 y Fr(setup\(\))h Fv(\(in)h(module)f (distutils.core\),)g(43)0 2798 y Fr(shared_object_filename\(\))312 b Fv(\(CCompiler)332 2898 y(method\),)18 b(49)0 2998 y Fr(show_compilers\(\))32 b Fv(\(in)j(module)e(distutils.ccompiler\),) 332 3097 y(45)0 3197 y Fr(spawn\(\))19 b Fv(\(CCompiler)h(method\),)e (49)0 3297 y Fr(split_quoted\(\))g Fv(\(in)i(module)f (distutils.util\),)h(53)0 3396 y Fr(strtobool\(\))f Fv(\(in)h(module)f (distutils.util\),)g(54)0 3496 y Fr(subst_vars\(\))g Fv(\(in)h(module)e(distutils.util\),)i(53)0 3688 y Fo(T)0 3812 y Fr(TextFile)f Fv(\(class)i(in)f(distutils.te)o(xt)p 1127 3812 V 29 w(\002le\),)h(57)0 4004 y Fo(U)0 4127 y Fr(undefine_macro\(\))d Fv(\(CCompiler)h(method\),)f(46)0 4227 y Fr(unreadline\(\))h Fv(\(T)-6 b(e)o(xtFile)19 b(method\),)f(58)0 4419 y Fo(W)0 4543 y Fr(warn\(\))166 4642 y Fv(CCompiler)i(method,)e(49)166 4742 y(T)-6 b(e)o(xtFile)20 b(method,)f(58)0 4841 y Fr(wrap_text\(\))g Fv(\(in)h(module)f (distutils.f)o(anc)o(y)p 1425 4841 V 27 w(getopt\),)g(55)0 4941 y Fr(write_file\(\))g Fv(\(in)h(module)e(distutils.\002le)p 1396 4941 V 30 w(util\),)i(52)p 0 5549 3901 4 v 0 5649 a Fs(Inde)n(x)3607 b(65)p eop end %%Trailer userdict /end-hook known{end-hook}if %%EOF .