mercurial/__init__.py
changeset 27223 a40c84defd76
parent 27220 4374d819ccd5
child 27224 d308a9ca9ed7
equal deleted inserted replaced
27222:511a4384b033 27223:a40c84defd76
    20 #    py - only load pure Python modules
    20 #    py - only load pure Python modules
    21 modulepolicy = '@MODULELOADPOLICY@'
    21 modulepolicy = '@MODULELOADPOLICY@'
    22 
    22 
    23 # By default, require the C extensions for performance reasons.
    23 # By default, require the C extensions for performance reasons.
    24 if modulepolicy == '@' 'MODULELOADPOLICY' '@':
    24 if modulepolicy == '@' 'MODULELOADPOLICY' '@':
    25     # TODO change to 'c' once installer is changed.
    25     modulepolicy = 'c'
    26     modulepolicy = 'allow'
       
    27 
    26 
    28 # Environment variable can always force settings.
    27 # Environment variable can always force settings.
    29 modulepolicy = os.environ.get('HGMODULEPOLICY', modulepolicy)
    28 modulepolicy = os.environ.get('HGMODULEPOLICY', modulepolicy)
    30 
    29 
    31 # Modules that have both Python and C implementations. See also the
    30 # Modules that have both Python and C implementations. See also the
    77             # Mercurial version, potentially leading to incompatibility. Either
    76             # Mercurial version, potentially leading to incompatibility. Either
    78             # scenario is bad. So we verify that modules loaded from
    77             # scenario is bad. So we verify that modules loaded from
    79             # mercurial/* are C extensions. If the current policy allows the
    78             # mercurial/* are C extensions. If the current policy allows the
    80             # loading of .py modules, the module will be re-imported from
    79             # loading of .py modules, the module will be re-imported from
    81             # mercurial/pure/* below.
    80             # mercurial/pure/* below.
    82             # TODO uncomment once setup.py is updated to actually install
    81             if modinfo[2][2] != imp.C_EXTENSION:
    83             # into mercurial/pure.
    82                 raise ImportError('.py version of %s found where C '
    84             #if modinfo[2][2] != imp.C_EXTENSION:
    83                                   'version should exist' % name)
    85             #    raise ImportError('.py version of %s found where C '
       
    86             #                      'version should exist' % name)
       
    87 
    84 
    88         except ImportError:
    85         except ImportError:
    89             if modulepolicy == 'c':
    86             if modulepolicy == 'c':
    90                 raise
    87                 raise
    91 
    88