=======l=========================================================================
$Id: 5-Python_FAQ.txt 13 2005-05-07 12:24:50Z cray $
--------------------------------------------------------------------------------
   :

        ,     
    .
    
    Q1:      Policy?
    
    A1:   /usr/share/doc/rpm-build-python   
         .   "www.neural.ru":http://www.neural.ru/Products/Python
         ,           ,
           .
        
    Q2:     Policy?
    
    A2:   ,  python@neural.ru.     . 
            -   
        devel@altlinux.ru.      
         ;
        
    Q3:   Policy  ?    ?
    
    A3:  - .     2003-  (cray,
        doc, ldv  ),      ,  
           -  -  ,  
           .    
        ,    ,   ,
            .
    
          ,  ,   python & Zope. 
           () -  .  ? 
             python.   
        python - ,      .  ? 
            -       ;),  
           ,  :
        
            a)     ;
        
            b)      : 
                  ,   -
                  ( ,        );
                
        -      , , 
            LDV, , , 
          -  LDV,      .
        
    Q4:     -  -,   
        ""  .    ?
        
    A4:   ,   .  ,   ,   
          ,  
           ,   -   ,  .  
            ,    
        (    .QA2).
        
    Q5:         Distutils ?

    A5:   Distutils -    
             
          (  rpm)    . 
            "" . 
         rpm-build-python    Distutils 
        bdist_altrpm,   , 
         ,       -
        (, -  ).  ,  Distutils 
               ,
              ,  
        setup.py    ,    (
         -  ) .
        
    Q9:   ,  python-doc - .
    
    A9:   .     python-doc 
               ,    
           python-doc
        -    python23    python23-info. ,
            python -   python23-info
          python-doc.
        
    Q10:          
        py, pyo, pyc,          
        ? , ,   ?
        
    A10:    ,      
         ,        
          .       
           (,  ,    
                  ):
        
            1.       py, pyc  pyo, 
                    ,  ,  .
                
                   pyc & pyo:
                
                    -      py, pyc -    
                         -O (   
                        )    , 
                           ;
                        
                    -      py (), pyo - 
                           -O     pyo
                         ,   
                        py   ,    
                            ,   ,
                            -O  
                        ;
                        
                    -     pyc -    -O
                        () ;
                        
                    -     py -   
                             ;

                       
                pyc, : Zope,  ,   : 
                       -O.
                
                , ,    : "    ",
                  (python23), ,   
                ,  Zope,     
                ,  .   
                 (Live CD ),  .

            2.   py, pyc, pyo   ,    
                ,       , 
                   py (  /usr/share/doc,
                /usr/src,  -)  :   .
                
            3.  ,     python-<MODULE> &
                python-<MODULE>-src,   python-<MODULE>  
                pyo  () pyc,  ...-src -  py.
                
            4.      pyc  pyo,   
                :
            
                    -   (   
                    -  );
                    
                    -        
                        (  ,   
                        ,   ,   
                        );
                        
                    -      
                        %_install_langs (    ,   
                          ,    
                            ,   
                           python,   rpm;
                        
            5.        .. 
                python-<MODULE>,     
                   ,   ""
                 ( -src,    , 
                 ,   ,   
                ,    );
                
            6.     *py c  .
                                
              ,    
          .
        
    Q11:   python24    ?
    
    A11:    -   .     ;),  
                  .
                
    Q12:   Zope27?
    
    A12: Offtopic! offtopic!  ,   .

    Q13:     Zope?
    
    A13:   Zope -    Zope.    python 
          .     Zope,
        ,  ,  Plone,     
           ,  ,        
          .
        
    Q14:   /  python = 2.3,   
           python23,   , 
          ?
        
               ,  
          ?

    A14:       
        ,    -  "" 
               : 
               ,
                 ,
           python = 2.3      : 
               ,
           ,   -  .
        
          ,    python  
        .
        
          ,     ,   
           - python-*-X.Y -    python-*-X.Y+1
        ( -   ,    ) 
             .    
          notes/Names.txt.
        
        ,    :  ,    ,
         .
        
    
    Q15:
    > The following packages have unmet dependencies:
    >   solfege: Depends: python2.3(gnome) but it is not installable
    >            Depends: python2.3(gobject) but it is not installable
    >            Depends: python2.3(gtk) but it is not installable
    >            Depends: python2.3(mpd) but it is not installable
    >            Depends: python2.3(pango) but it is not installable
    >            Depends: python2.3(soundcard) but it is not installable
    >            Depends: python2.3(src) but it is not installable
    
    A15:

            ,     
            .   :
             , 
              - ,   
        MAC-.
        
             :
        
        1.   ,    
        ().
        
            :   
        
        2.    .
        
            :      
            (python-module-SOMETHAT-test)     AutoReqProv:
            nopython.   - .
        
        3.    :
        
        
              :
        
                if EXPR : import MACOSMODULE
                
                  (  
            ,   ),     - 
            :  ,    ,   
                :
            
                %add_python_req_skip <_>
        
        4. ,       . 
        
                   
             :
        
                %add_python_req_skip <_>
        
                Provide: python%__python_version( <_> )
        
             ,      rpm-build-python 
                .

        5.   "  ".
        
             , ,  ,  
                "":  
            :

                AutoReqProv: yes, nopython 
                
                Requires: python-strict
                
              python-strict  " 
            python",     . ,  
                   
              ( ,     ,  
             ,      Provides, 
                 ,    
            -   ( MySQL-python ->
            python-module-MySQLdb))).

             ,    ,   
             . , ..,     ,
                      
            ,  .   ,   
              python-strict -     
               .
           

    Q16:    python-base-2.3.3-alt9 
        python-relaxed-2.3.3.alt9, python.prov.py  :
        rpm-build-python   python2.3(__future__);
    
    A16:    ,   . 
    
          ,     ,  ,
           .
    
            1.      rpm-build-python  
                  python -  Require: python2.3(__future__)
                   .  ,   
                    .
                
            2.      rpm-build-python  
                python  - ..     
                        
                   .      , 
                  ,     
                     , 
                     -       ,  
                 .
            
        ,  ,    ,     
           ,    tcl    
        .        .
        
             :
        
            1.    -    ,
                 python-devel;
            
            2.    -  python,  
                ,    rpm-build-python 
                ,    .
                
              
        -2.   ,    -  
           ,     .
                    
        ,     -   
           rpm-build-python   python-devel 
        python-base (  python-devel),    
        rpm-build-python    ,
            SUCCESS.

    Q17:           python  AutoReqProv? 
           nopython,      
        ,       python 
          ?        ,
          -          
        ?
        
    A17:      -   .    
        python-policy,    ,    
        ____   . ,   
        python. ,  python  
        -  ,    .     
        ,   . ..    :
        
            1.     ,  
                   ,   . 
                    ,  
                .
                
            2.        .
                 ,      , 
                  ,       
                   ,     
                ,    
                .
                
                , ,     
                -    python-strict.  -
                 ,     ;
                
           ,    -    
          ,     , 
        .
        
          ,     .  
          ,   ,    
              
        ,      
          .
        
    Q18:          ?
    
    A18:     .  ,    
           ,     
        -       .   ,  
            perl,   ,  
        .        , , 
          .
        
           ,   ,  perl,    
         ,     ,    
         .    

    Q19:         python-devel = 2.3,   
        python-devel ?
    
    A19:        python-devel = 2.3, ..  
           , ..     
                -   
        .
        
           ,     , -   
        apt  -  ,   ,    
         , ,   ,  
          (,    ,
                ,
         ,   ,   
         ).      
          ,    
        (,   python2.3(some) 
        python2.2(some),    -     
        ),    unmets   
         ,    .
        
           ,      
              ,  
        ,  :   ,  
               -
           python.   - None, 
            2.3 (  ),
           Zope    , 
          .     API
           .  ,     ,  
          -  .       
          .
        
         ,        
            ,    
          .      
        ,      .
        
         ,     
           ,     . 
             (  , 
            ,    
         , ,  -  ,  
            -  ).
        
    Q20:       python-devel,  python-devel 
            python-dev?    
           python-devel,    python-dev?
        
    A20:        
        ,  python-devel = 2.3.     
        python-devel,     Provides: python-devel = 2.3 
        python-devel = 2.3.4.   rpm   
        ,     apt   Requires: python-devel =
        2.3   .  python-devel  
         ,      - .
             python-dev -  .  
               
         apt        . ,
        python-build   .
        
        (      ,     
         apt,    rpm, ,     ).
        
        ,  python-dev      
        :   ,   python-dev = 2.3  ,
            python-dev = 2.3.4    -
          .
       
    
    Q21:       ,      
        karamba (kiki, etc),       !   ,
          !
        
    A21:   ,     .   ,      
            ,    ,   
          ,  ,  builtin -  (. Q22).
        
               -   ,
        :
        
            %add_python_req_skip < >,
            
        :
        
            %add_python_req_skip karamba                    
        
             ,  . 
              ,   
                 .
        
    Q22:      builtin ?       ?
    
    A22:    Builtin -  ,    ,  
              .  ,   
                 
               .  
             -   %add_python_req_skip  
             .  ,   
          ,  add_python_req_skip   ,  
          . 
        
             embedded ,    
         .        (not tested):
        
            import sys
            
            print sys.builtin_module_names
            
              , 
         ,      
           stdout        .
        
        ,       stdout -  
        .
    
    Q24:          ,    
           ,      
        ,     ,   
        !
        
    A24:          ,  ?   - 
        .    ,  .
        
             ,   , 
           %_findreq_topdir,   ,
           %_findreq_skiplist.   
          set_findreq_topdir, set_findreq_skiplist,
        add_findreq_skiplist,      rpm.  
           ,  ,    
        python-policy.
        
    Q26:          /usr/lib/mypackage, 
           .      
             ,       
         (   python-path),  -  
        unmets.  ?
        
    A26:     ,   , .   ,  
          %add_python_lib_path,     
        .     ,      
              .  ,
          ,     .   
         -    add_python_req_skip.  ,
            .    ,  
        :
        
            find <  > | /usr/lib/rpm/python.req.py | sort | uniq

            ,    
        ,  :
        
            RPM_PYTHON_LIB_PATH=<      >

            (    )
            
            export RPM_PYTHON_LIB_PATH
            
            
            find <  > | /usr/lib/rpm/python.prov.py | sort | uniq

           .    .
        
    Q27:         ,   ?        
        
    Q28:          ,    
          __init__.py,   Provides    
          (   __init__.py).  ?
        
    A28:       python_module_declare <PATH>, 
        <PATH> -      __init__.py :
        
            python_module_declare /usr/lib/python2.3/email/
            
          Provides     ,  
           <PATH>  __init__.py,   , 
             
          ,   <PATH>;
        
        (    python_module_declare   )
        
    Q29:       ?                    
    
    A29:      -    , 
          .     :
        
            "python" <N> "." <M> "(" <NAME> [ "." <NAME> ] * ")"
            
             :
        
        
            "import" " " <NAME> [ "." <NAME> ]*
            
          "  NAME (2)   NAME (1)".
        
    Q30:     from <MODULE> import <NAME>  
         ?
        
    A30:         <NAME>  
          - ..  (),  
          ,    MODULE. 
         Python       
            (  ,    
              ).

            ,   .
        


 python faq,   .   ,      
,     ,  ,  .     
      ,    ,  
      ,     FAQ.   
     .   -    
 ,      ,      .

:

site-packages/a
site-packages/a/b
site-packages/a/b/test.py ( import b)
site-packages/a/b/__init__.py
site-packages/a/__init__.py ( import b)

     a   (.. python -c "import a"   ),
    (   )  test.py,  ____ , 
   (  ),   ,  b.      .

         ....       ,    
 FAQ. 

  ,  %add_python_req_skip  - ,   %py_provides -     ,  ,
 .

================================================================================
