PLD-Guide python.xml,1.10,1.11

Artur Wróblewski wrobell w tldp.org
Śro, 3 Lip 2002, 19:13:15 CEST


Module name:    PLD-Guide
Changes by:     wrobell

Changed RCS file: /cvsroot/LDP/guide/docbook/PLD-Guide/devel/python.xml,v
----------------------------
revision 1.11
date: 2002/07/03 17:13:01;  author: wrobell;  state: Exp;  lines: +45 -23
- description of installation routine when manual byte compilation must be
  performed
- assign rpm.package and rpm.macro roles to rpm package and macro terms
- assign rpm.package and lib roles to rpm and python modules literals
- some minor changes
 

Index: python.xml
===================================================================
RCS file: /cvsroot/LDP/guide/docbook/PLD-Guide/devel/python.xml,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- python.xml	2 Jul 2002 14:37:13 -0000	1.10
+++ python.xml	3 Jul 2002 17:13:01 -0000	1.11
@@ -56,7 +56,7 @@
         <para>
             Package with Python library contains some basic modules. The modules are required
             to use the library with applications embedding simple Python code.
-            Some people could complain, that there is no <literal>sys</literal> module,
+            Some people could complain, that there is no <literal role="lib">sys</literal> module,
             which seems to be basic for most of us. The word &apos;basic&apos; means &apos;is required&apos;,
             so simple Python code embedding works. Consider following listing.
             <programlisting>
@@ -76,12 +76,12 @@
         </para>
         <para>
             One can easily note, that sources of standard Python modules are distributed
-            in <literal>python-devel-src</literal> package. It is an exception to the rule,
+            in <literal role="rpm.package">python-devel-src</literal> package. It is an exception to the rule,
             that we do not distribute sources of modules for Python language.
         </para>
         <variablelist>
             <varlistentry>
-                <term>python</term>
+                <term role="rpm.package">python</term>
                 <listitem>
                     <para>
                         Python command line utility and its manual.
@@ -89,7 +89,7 @@
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>python-modules</term>
+                <term role="rpm.package">python-modules</term>
                 <listitem>
                     <para>
                         Standard Python modules.
@@ -97,7 +97,7 @@
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>python-libs</term>
+                <term role="rpm.package">python-libs</term>
                 <listitem>
                     <para>
                         Python library and basic modules.
@@ -105,7 +105,7 @@
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>python-pydoc</term>
+                <term role="rpm.package">python-pydoc</term>
                 <listitem>
                     <para>
                         PyDoc module and command line utility.
@@ -113,7 +113,7 @@
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>python-devel</term>
+                <term role="rpm.package">python-devel</term>
                 <listitem>
                     <para>
                         Development files, i.e. header and Python config files.
@@ -121,7 +121,7 @@
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>python-devel-src</term>
+                <term role="rpm.package">python-devel-src</term>
                 <listitem>
                     <para>
                         Sources of all standard Python modules.
@@ -129,7 +129,7 @@
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>python-static</term>
+                <term role="rpm.package">python-static</term>
                 <listitem>
                     <para>
                         Python static library.
@@ -137,7 +137,7 @@
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>python-examples</term>
+                <term role="rpm.package">python-examples</term>
                 <listitem>
                     <para>
                         All examples and tools which come with standard Python distribution.
@@ -145,7 +145,7 @@
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>python-doc</term>
+                <term role="rpm.package">python-doc</term>
                 <listitem>
                     <para>
                         Python documentation in HTML format. It contains tutorial, global module index, library and
@@ -154,7 +154,7 @@
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>tkinter</term>
+                <term role="rpm.package">tkinter</term>
                 <listitem>
                     <para>
                         Standard Python interface to the Tk GUI toolkit.
@@ -162,7 +162,7 @@
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>python-old</term>
+                <term role="rpm.package">python-old</term>
                 <listitem>
                     <para>
                         Obsoleted Python modules.
@@ -221,7 +221,7 @@
                 <example>
                     <title>
                         Installing Python modules in <application>RPM</application> install section
-                        with <literal role='lib'>distutils</literal>
+                        with <literal role='lib'>distutils</literal>.
                     </title>
                     <screen>python setup.py install --optimize=2 --root=$RPM_BUILD_ROOT</screen>
                 </example>
@@ -232,6 +232,28 @@
                 <literal>$RPM_BUILD_ROOT%{py_sitedir}</literal> value
                 before module installation.
             </para>
+            <para>
+                There can be much more other methods of installing Python modules.
+                For example, you can be forced to install them manually. There are
+                two macros <literal role="rpm.macro">py_comp</literal> and <literal role="rpm.macro">py_ocomp</literal>,
+                which help with installation. This macros use Python <literal role="lib">compileall</literal>
+                module which scans given directory and its subdirectories for Python modules and compiles
+                them into bytecode.
+                <example>
+                    <title>
+                        Compiling Python modules into bytecode.
+                    </title>
+                    <screen>%install
+...
+%py_comp $RPM_BUILD_ROOT%{py_sitedir}
+%py_ocomp $RPM_BUILD_ROOT%{py_sitedir}</screen>
+                </example>
+                Please note, that compilation must be performed after module source files installation, because
+                the directory path, where module source files reside, is put into binary files
+                during byte compilation.
+                Information about correct directory path in compiled modules is useful, due to
+                thrown exceptions which display it.
+            </para>
         </section>
         <section id='python.modules.groups'>
             <title><application>RPM</application> groups</title>
@@ -265,7 +287,7 @@
             Following macros are defined to make Python packages developers&apos; life better.
             <variablelist>
                 <varlistentry>
-                    <term>py_ver</term>
+                    <term role="rpm.macro">py_ver</term>
                     <listitem>
                         <para>
                             Python main version. For example, Python 2.2, 2.2.1 and 2.2.2
@@ -275,7 +297,7 @@
                 </varlistentry>
 
                 <varlistentry>
-                    <term>py_prefix</term>
+                    <term role="rpm.macro">py_prefix</term>
                     <listitem>
                         <para>
                             Directory prefix, where Python is installed. It points to <filename>/usr</filename>, usually.
@@ -284,7 +306,7 @@
                 </varlistentry>
 
                 <varlistentry>
-                    <term>py_libdir</term>
+                    <term role="rpm.macro">py_libdir</term>
                     <listitem>
                         <para>
                             Directory, where Python is installed. It is created from prefix and Python main version,
@@ -294,7 +316,7 @@
                 </varlistentry>
 
                 <varlistentry>
-                    <term>py_incdir</term>
+                    <term role="rpm.macro">py_incdir</term>
                     <listitem>
                         <para>
                             Directory, where Python header files are installed, i.e. <filename>/usr/include/python2.2</filename>. Yes, main version is used to build it.
@@ -303,7 +325,7 @@
                 </varlistentry>
 
                 <varlistentry>
-                    <term>py_sitedir</term>
+                    <term role="rpm.macro">py_sitedir</term>
                     <listitem>
                         <para>
                             Directory, where all non-standard, site specific Python modules are installed. It is created from
@@ -313,7 +335,7 @@
                 </varlistentry>
 
                 <varlistentry>
-                    <term>py_dyndir</term>
+                    <term role="rpm.macro">py_dyndir</term>
                     <listitem>
                         <para>
                             Directory, where all shared modules are installed. It is created
@@ -323,7 +345,7 @@
                 </varlistentry>
 
                 <varlistentry>
-                    <term>py_comp</term>
+                    <term role="rpm.macro">py_comp</term>
                     <listitem>
                         <para>
                             Finds recursively all Python source files in
@@ -334,7 +356,7 @@
                 </varlistentry>
 
                 <varlistentry>
-                    <term>py_ocomp</term>
+                    <term role="rpm.macro">py_ocomp</term>
                     <listitem>
                         <para>
                             Finds recursively all Python source files in
@@ -345,7 +367,7 @@
                 </varlistentry>
 
                 <varlistentry>
-                    <term>pyrequires_eq()</term>
+                    <term role="rpm.macro">pyrequires_eq()</term>
                     <listitem>
                         <para>
                             Creates dependency on specified package with main version



Więcej informacji o liście dyskusyjnej pld-doc