@@ -93,9 +93,10 @@ \section{A Simple Example}
9393
9494\begin {verbatim }
9595from distutils.core import setup
96- setup(name="foo",
97- version="1.0",
98- py_modules=["foo"])
96+ setup(name='foo',
97+ version='1.0',
98+ py_modules=['foo'],
99+ )
99100\end {verbatim }
100101
101102Some observations:
@@ -270,12 +271,12 @@ \chapter{Writing the Setup Script}
270271
271272from distutils.core import setup
272273
273- setup(name=" Distutils" ,
274- version=" 1.0" ,
275- description=" Python Distribution Utilities" ,
276- author=" Greg Ward" ,
277- 278- url=" http://www.python.org/sigs/distutils-sig/" ,
274+ setup(name=' Distutils' ,
275+ version=' 1.0' ,
276+ description=' Python Distribution Utilities' ,
277+ author=' Greg Ward' ,
278+ 279+ url=' http://www.python.org/sigs/distutils-sig/' ,
279280 packages=['distutils', 'distutils.command'],
280281 )
281282\end {verbatim }
@@ -409,7 +410,7 @@ \subsection{Describing extension modules}
409410this extension is quite simple:
410411
411412\begin {verbatim }
412- uExtension(" foo" , [" foo.c" ])
413+ Extension(' foo' , [' foo.c' ])
413414\end {verbatim }
414415
415416The \class {Extension} class can be imported from
@@ -419,8 +420,10 @@ \subsection{Describing extension modules}
419420
420421\begin {verbatim }
421422from distutils.core import setup, Extension
422- setup(name="foo", version="1.0",
423- ext_modules=[Extension("foo", ["foo.c"])])
423+ setup(name='foo',
424+ version='1.0',
425+ ext_modules=[Extension('foo', ['foo.c'])],
426+ )
424427\end {verbatim }
425428
426429The \class {Extension} class (actually, the underlying extension-building
@@ -435,13 +438,13 @@ \subsubsection{Extension names and packages}
435438name of the extension, including any package names. For example,
436439
437440\begin {verbatim }
438- Extension(" foo" , [" src/foo1.c", " src/foo2.c" ])
441+ Extension(' foo' , [' src/foo1.c', ' src/foo2.c' ])
439442\end {verbatim }
440443
441444describes an extension that lives in the root package, while
442445
443446\begin {verbatim }
444- Extension(" pkg.foo" , [" src/foo1.c", " src/foo2.c" ])
447+ Extension(' pkg.foo' , [' src/foo1.c', ' src/foo2.c' ])
445448\end {verbatim }
446449
447450describes the same extension in the \module {pkg} package. The source
@@ -455,9 +458,9 @@ \subsubsection{Extension names and packages}
455458
456459\begin {verbatim }
457460setup(...
458- ext_package=" pkg" ,
459- ext_modules=[Extension(" foo" , [" foo.c" ]),
460- Extension(" subpkg.bar" , [" bar.c" ])]
461+ ext_package=' pkg' ,
462+ ext_modules=[Extension(' foo' , [' foo.c' ]),
463+ Extension(' subpkg.bar' , [' bar.c' ])],
461464 )
462465\end {verbatim }
463466
@@ -502,15 +505,15 @@ \subsubsection{Preprocessor options}
502505\code {include\_ dirs} option:
503506
504507\begin {verbatim }
505- Extension(" foo" , [" foo.c" ], include_dirs=[" include" ])
508+ Extension(' foo' , [' foo.c' ], include_dirs=[' include' ])
506509\end {verbatim }
507510
508511You can specify absolute directories there; if you know that your
509512extension will only be built on \UNIX {} systems with X11R6 installed to
510513\file {/usr}, you can get away with
511514
512515\begin {verbatim }
513- Extension(" foo" , [" foo.c" ], include_dirs=[" /usr/include/X11" ])
516+ Extension(' foo' , [' foo.c' ], include_dirs=[' /usr/include/X11' ])
514517\end {verbatim }
515518
516519You should avoid this sort of non-portable usage if you plan to
@@ -534,13 +537,14 @@ \subsubsection{Preprocessor options}
534537\end {verbatim }
535538If you must put the \file {Numerical} include directory right into your
536539header search path, though, you can find that directory using the
537- Distutils \module { sysconfig} module:
540+ Distutils \refmodule {distutils. sysconfig} module:
538541
539542\begin {verbatim }
540543from distutils.sysconfig import get_python_inc
541- incdir = os.path.join(get_python_inc(plat_specific=1), " Numerical" )
544+ incdir = os.path.join(get_python_inc(plat_specific=1), ' Numerical' )
542545setup(...,
543- Extension(..., include_dirs=[incdir]))
546+ Extension(..., include_dirs=[incdir]),
547+ )
544548\end {verbatim }
545549
546550Even though this is quite portable---it will work on any Python
@@ -590,16 +594,16 @@ \subsubsection{Library options}
590594
591595\begin {verbatim }
592596Extension(...,
593- libraries=[" gdbm", " readline" ])
597+ libraries=[' gdbm', ' readline' ])
594598\end {verbatim }
595599
596600If you need to link with libraries in a non-standard location, you'll
597601have to include the location in \code {library\_ dirs}:
598602
599603\begin {verbatim }
600604Extension(...,
601- library_dirs=[" /usr/X11R6/lib" ],
602- libraries=[" X11", "Xt" ])
605+ library_dirs=[' /usr/X11R6/lib' ],
606+ libraries=[' X11', 'Xt' ])
603607\end {verbatim }
604608
605609(Again, this sort of non-portable construct should be avoided if you
@@ -641,8 +645,8 @@ \subsection{Installing Scripts}
641645in this way. From the PyXML setup script:
642646
643647\begin {verbatim }
644- setup (...
645- scripts = ['scripts/xmlproc_parse', 'scripts/xmlproc_val']
648+ setup(...
649+ scripts= ['scripts/xmlproc_parse', 'scripts/xmlproc_val']
646650 )
647651\end {verbatim }
648652
@@ -727,10 +731,10 @@ \subsection{Additional meta-data}
727731 compatible with Python versions prior to 2.2.3 or 2.3. The list is
728732 available from the \ulink {PyPI website}{http://www.python.org/pypi}.
729733
730- \item [" short string" ] A single line of text, not more than 200 characters.
731- \item [" long string" ] Multiple lines of plain text in ReStructuredText
734+ \item [' short string' ] A single line of text, not more than 200 characters.
735+ \item [' long string' ] Multiple lines of plain text in reStructuredText
732736 format (see \url {http://docutils.sf.net/}).
733- \item [" list of strings" ] See below.
737+ \item [' list of strings' ] See below.
734738\end {description }
735739
736740None of the string values may be Unicode.
@@ -758,7 +762,7 @@ \subsection{Additional meta-data}
758762
759763\begin {verbatim }
760764setup(...
761- classifiers = [
765+ classifiers= [
762766 'Development Status :: 4 - Beta',
763767 'Environment :: Console',
764768 'Environment :: Web Environment',
@@ -780,7 +784,7 @@ \subsection{Additional meta-data}
780784If you wish to include classifiers in your \file {setup.py} file and also
781785wish to remain backwards-compatible with Python releases prior to 2.2.3,
782786then you can include the following code fragment in your \file {setup.py}
783- before the \code {setup()} call.
787+ before the \function {setup()} call.
784788
785789\begin {verbatim }
786790# patch distutils if it can't cope with the "classifiers" or
@@ -1044,9 +1048,9 @@ \subsection{Specifying the files to distribute}
10441048\end {verbatim }
10451049
10461050The meanings should be fairly clear: include all files in the
1047- distribution root matching \code {*.txt}, all files anywhere under the
1048- \file {examples} directory matching \code {*.txt} or \code {*.py}, and
1049- exclude all directories matching \code {examples/sample?/build}. All of
1051+ distribution root matching \file {*.txt}, all files anywhere under the
1052+ \file {examples} directory matching \file {*.txt} or \file {*.py}, and
1053+ exclude all directories matching \file {examples/sample?/build}. All of
10501054this is done \emph {after } the standard include set, so you can exclude
10511055files from the standard set with explicit instructions in the manifest
10521056template. (Or, you can use the \longprogramopt {no-defaults} option to
@@ -1307,7 +1311,7 @@ \subsection{Creating RPM packages}
13071311and their options:
13081312
13091313\begin {verbatim }
1310- python setup.py bdist_rpm --packager="John Doe <jdoe@python.net >" \
1314+ python setup.py bdist_rpm --packager="John Doe <jdoe@example.org >" \
13111315 bdist_wininst --target_version="2.0"
13121316\end {verbatim }
13131317
@@ -1608,8 +1612,10 @@ \section{Pure Python distribution (by module)}
16081612situation would be:
16091613\begin {verbatim }
16101614from distutils.core import setup
1611- setup(name = "foo", version = "1.0",
1612- py_modules = ["foo"])
1615+ setup(name='foo',
1616+ version='1.0',
1617+ py_modules=['foo'],
1618+ )
16131619\end {verbatim }
16141620Note that the name of the distribution is specified independently with
16151621the \option {name} option, and there's no rule that says it has to be the
@@ -1630,8 +1636,10 @@ \section{Pure Python distribution (by module)}
16301636and the setup script might be
16311637\begin {verbatim }
16321638from distutils.core import setup
1633- setup(name = "foobar", version = "1.0",
1634- py_modules = ["foo", "bar"])
1639+ setup(name='foobar',
1640+ version='1.0',
1641+ py_modules=['foo', 'bar'],
1642+ )
16351643\end {verbatim }
16361644
16371645You can put module source files into another directory, but if you have
@@ -1653,8 +1661,10 @@ \section{Pure Python distribution (by package)}
16531661The setup script from the last example could also be written as
16541662\begin {verbatim }
16551663from distutils.core import setup
1656- setup(name = "foobar", version = "1.0",
1657- packages = [""])
1664+ setup(name='foobar',
1665+ version='1.0',
1666+ packages=[''],
1667+ )
16581668\end {verbatim }
16591669(The empty string stands for the root package.)
16601670
@@ -1670,9 +1680,11 @@ \section{Pure Python distribution (by package)}
16701680Distutils where source files in the root package live:
16711681\begin {verbatim }
16721682from distutils.core import setup
1673- setup(name = "foobar", version = "1.0",
1674- package_dir = {"": "src"},
1675- packages = [""])
1683+ setup(name='foobar',
1684+ version='1.0',
1685+ package_dir={'': 'src'},
1686+ packages=[''],
1687+ )
16761688\end {verbatim }
16771689
16781690More typically, though, you will want to distribute multiple modules in
@@ -1691,8 +1703,10 @@ \section{Pure Python distribution (by package)}
16911703one that requires the least work to describe in your setup script:
16921704\begin {verbatim }
16931705from distutils.core import setup
1694- setup(name = "foobar", version = "1.0",
1695- packages = ["foobar"])
1706+ setup(name='foobar',
1707+ version='1.0',
1708+ packages=['foobar'],
1709+ )
16961710\end {verbatim }
16971711
16981712If you want to put modules in directories not named for their package,
@@ -1710,9 +1724,11 @@ \section{Pure Python distribution (by package)}
17101724an appropriate setup script would be
17111725\begin {verbatim }
17121726from distutils.core import setup
1713- setup(name = "foobar", version = "1.0",
1714- package_dir = {"foobar" : "src"},
1715- packages = ["foobar"])
1727+ setup(name='foobar',
1728+ version='1.0',
1729+ package_dir={'foobar': 'src'},
1730+ packages=['foobar'],
1731+ )
17161732\end {verbatim }
17171733
17181734Or, you might put modules from your main package right in the
@@ -1727,9 +1743,11 @@ \section{Pure Python distribution (by package)}
17271743in which case your setup script would be
17281744\begin {verbatim }
17291745from distutils.core import setup
1730- setup(name = "foobar", version = "1.0",
1731- package_dir = {"foobar" : ""},
1732- packages = ["foobar"])
1746+ setup(name='foobar',
1747+ version='1.0',
1748+ package_dir={'foobar': ''},
1749+ packages=['foobar'],
1750+ )
17331751\end {verbatim }
17341752(The empty string also stands for the current directory.)
17351753
@@ -1754,8 +1772,10 @@ \section{Pure Python distribution (by package)}
17541772then the corresponding setup script would be
17551773\begin {verbatim }
17561774from distutils.core import setup
1757- setup(name = "foobar", version = "1.0",
1758- packages = ["foobar", "foobar.subfoo"])
1775+ setup(name='foobar',
1776+ version='1.0',
1777+ packages=['foobar', 'foobar.subfoo'],
1778+ )
17591779\end {verbatim }
17601780(Again, the empty string in \option {package\_ dir} stands for the current
17611781directory.)
@@ -1777,8 +1797,10 @@ \section{Single extension module}
17771797script for this could be
17781798\begin {verbatim }
17791799from distutils.core import setup
1780- setup(name = "foobar", version = "1.0",
1781- ext_modules = [Extension("foo", ["foo.c"])])
1800+ setup(name='foobar',
1801+ version='1.0',
1802+ ext_modules=[Extension('foo', ['foo.c'])],
1803+ )
17821804\end {verbatim }
17831805
17841806If the extension actually belongs in a package, say \module {foopkg},
@@ -1789,8 +1811,10 @@ \section{Single extension module}
17891811extension:
17901812\begin {verbatim }
17911813from distutils.core import setup
1792- setup(name = "foobar", version = "1.0",
1793- ext_modules = [Extension("foopkg.foo", ["foo.c"])])
1814+ setup(name='foobar',
1815+ version='1.0',
1816+ ext_modules=[Extension('foopkg.foo', ['foo.c'])],
1817+ )
17941818\end {verbatim }
17951819
17961820
0 commit comments