buildframework/helium/builder/tools/sphinx/site.py
author Ross Qin <ross.qin@nokia.com>
Tue, 30 Nov 2010 14:05:41 +0800
changeset 713 7b7f0409fc00
parent 587 85df38eb4012
permissions -rw-r--r--
merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     1
# Duplicating setuptools' site.py...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     2
def __boot():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     3
    PYTHONPATH = []    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     4
    if sys.platform=='win32':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     5
        PYTHONPATH.append(os.path.join(sys.prefix, 'lib'))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     6
    if not (os.environ.get('PYTHONPATH') is None or (sys.platform=='win32' and not os.environ.get('PYTHONPATH'))):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     7
        PYTHONPATH.extend(os.environ.get('PYTHONPATH').split(os.pathsep))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     8
    pic = getattr(sys,'path_importer_cache',{})
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     9
    stdpath = sys.path[len(PYTHONPATH):]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    10
    mydir = os.path.dirname(__file__)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    11
    known_paths = dict([(makepath(item)[1],1) for item in sys.path]) # 2.2 comp
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    12
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    13
    oldpos = getattr(sys,'__egginsert',0)   # save old insertion position
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    14
    sys.__egginsert = 0                     # and reset the current one
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    15
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    16
    for item in PYTHONPATH:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    17
        addsitedir(item)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    18
        item_site_packages = os.path.join(item, 'site-packages')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    19
        if os.path.exists(item_site_packages):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    20
            addsitedir(item_site_packages)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    21
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    22
    sys.__egginsert += oldpos           # restore effective old position
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    23
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    24
    d,nd = makepath(stdpath[0])
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
    insert_at = None
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    26
    new_path = []
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    27
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    28
    for item in sys.path:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    29
        p,np = makepath(item)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    30
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
        if np==nd and insert_at is None:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    32
            # We've hit the first 'system' path entry, so added entries go here
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    33
            insert_at = len(new_path)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    34
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    35
        if np in known_paths or insert_at is None:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    36
            new_path.append(item)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    37
        else:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    38
            # new path after the insert point, back-insert it
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    39
            new_path.insert(insert_at, item)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    40
            insert_at += 1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    41
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    42
    sys.path[:] = new_path
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    43
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    44
import sys
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    45
import os
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    46
import __builtin__
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    47
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    48
def makepath(*paths):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    49
    dir = os.path.abspath(os.path.join(*paths))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    50
    return dir, os.path.normcase(dir)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    52
def abs__file__():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
    """Set all module' __file__ attribute to an absolute path"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    54
    for m in sys.modules.values():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    55
        try:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    56
            m.__file__ = os.path.abspath(m.__file__)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    57
        except AttributeError:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    58
            continue
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    59
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    60
try:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    61
    set
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    62
except NameError:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    63
    class set:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    64
        def __init__(self, args=()):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    65
            self.d = {}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    66
            for v in args:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    67
                self.d[v] = None
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    68
        def __contains__(self, key):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    69
            return key in self.d
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    70
        def add(self, key):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    71
            self.d[key] = None
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    72
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    73
def removeduppaths():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    74
    """ Remove duplicate entries from sys.path along with making them
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    75
    absolute"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    76
    # This ensures that the initial path provided by the interpreter contains
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    77
    # only absolute pathnames, even if we're running from the build directory.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    78
    L = []
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    79
    known_paths = set()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    80
    for dir in sys.path:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    81
        # Filter out duplicate paths (on case-insensitive file systems also
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    82
        # if they only differ in case); turn relative paths into absolute
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    83
        # paths.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    84
        dir, dircase = makepath(dir)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    85
        if not dircase in known_paths:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    86
            L.append(dir)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    87
            known_paths.add(dircase)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    88
    sys.path[:] = L
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    89
    return known_paths
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    90
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    91
def _init_pathinfo():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    92
    """Return a set containing all existing directory entries from sys.path"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    93
    d = set()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    94
    for dir in sys.path:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    95
        try:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    96
            if os.path.isdir(dir):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    97
                dir, dircase = makepath(dir)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    98
                d.add(dircase)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    99
        except TypeError:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   100
            continue
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   101
    return d
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   102
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   103
def addpackage(sitedir, name, known_paths, exclude_packages=()):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   104
    """Add a new path to known_paths by combining sitedir and 'name' or execute
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   105
    sitedir if it starts with 'import'"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   106
    import fnmatch
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   107
    if known_paths is None:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   108
        _init_pathinfo()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   109
        reset = 1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   110
    else:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   111
        reset = 0
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   112
    fullname = os.path.join(sitedir, name)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   113
    try:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   114
        f = open(fullname, "rU")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   115
    except IOError:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   116
        return
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   117
    try:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   118
        for line in f:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   119
            if line.startswith("#"):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   120
                continue
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   121
            found_exclude = False
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   122
            for exclude in exclude_packages:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   123
                if exclude(line):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   124
                    found_exclude = True
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   125
                    break
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   126
            if found_exclude:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   127
                continue
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   128
            if line.startswith("import"):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   129
                exec line
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   130
                continue
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   131
            line = line.rstrip()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   132
            dir, dircase = makepath(sitedir, line)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   133
            if not dircase in known_paths and os.path.exists(dir):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   134
                sys.path.append(dir)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   135
                known_paths.add(dircase)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   136
    finally:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   137
        f.close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   138
    if reset:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   139
        known_paths = None
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   140
    return known_paths
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   141
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   142
def addsitedir(sitedir, known_paths=None, exclude_packages=()):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   143
    """Add 'sitedir' argument to sys.path if missing and handle .pth files in
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   144
    'sitedir'"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   145
    if known_paths is None:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   146
        known_paths = _init_pathinfo()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   147
        reset = 1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   148
    else:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   149
        reset = 0
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   150
    sitedir, sitedircase = makepath(sitedir)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   151
    if not sitedircase in known_paths:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   152
        sys.path.append(sitedir)        # Add path component
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   153
    try:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   154
        names = os.listdir(sitedir)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   155
    except os.error:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   156
        return
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   157
    names.sort()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   158
    for name in names:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   159
        if name.endswith(os.extsep + "pth"):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   160
            addpackage(sitedir, name, known_paths,
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   161
                       exclude_packages=exclude_packages)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   162
    if reset:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   163
        known_paths = None
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   164
    return known_paths
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   165
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   166
def addsitepackages(known_paths):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   167
    """Add site-packages (and possibly site-python) to sys.path"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   168
    prefixes = [os.path.join(sys.prefix, "local"), sys.prefix]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   169
    if sys.exec_prefix != sys.prefix:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   170
        prefixes.append(os.path.join(sys.exec_prefix, "local"))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   171
    for prefix in prefixes:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   172
        if prefix:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   173
            if sys.platform in ('os2emx', 'riscos'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   174
                sitedirs = [os.path.join(prefix, "Lib", "site-packages")]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   175
            elif os.sep == '/':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   176
                sitedirs = [os.path.join(prefix,
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   177
                                         "lib",
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   178
                                         "python" + sys.version[:3],
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   179
                                         "site-packages"),
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   180
                            os.path.join(prefix, "lib", "site-python")]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   181
                try:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   182
                    # sys.getobjects only available in --with-pydebug build
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   183
                    # pylint: disable-msg=E1101
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   184
                    sys.getobjects
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   185
                    sitedirs.insert(0, os.path.join(sitedirs[0], 'debug'))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   186
                except AttributeError:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   187
                    pass
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   188
            else:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   189
                sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   190
            if sys.platform == 'darwin':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   191
                sitedirs.append( os.path.join('/opt/local', 'lib', 'python' + sys.version[:3], 'site-packages') )
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   192
                # for framework builds *only* we add the standard Apple
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   193
                # locations. Currently only per-user, but /Library and
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   194
                # /Network/Library could be added too
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   195
                if 'Python.framework' in prefix:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   196
                    home = os.environ.get('HOME')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   197
                    if home:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   198
                        sitedirs.append(
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   199
                            os.path.join(home,
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   200
                                         'Library',
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   201
                                         'Python',
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   202
                                         sys.version[:3],
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   203
                                         'site-packages'))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   204
            for sitedir in sitedirs:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   205
                if os.path.isdir(sitedir):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   206
                    addsitedir(sitedir, known_paths,
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   207
                               exclude_packages=[lambda line: 'setuptools' in line])
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   208
    return None
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   209
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   210
def setquit():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   211
    """Define new built-ins 'quit' and 'exit'.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   212
    These are simply strings that display a hint on how to exit.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   213
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   214
    """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   215
    if os.sep == ':':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   216
        exit = 'Use Cmd-Q to quit.'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   217
    elif os.sep == '\\':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   218
        exit = 'Use Ctrl-Z plus Return to exit.'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   219
    else:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   220
        exit = 'Use Ctrl-D (i.e. EOF) to exit.'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   221
    __builtin__.quit = __builtin__.exit = exit
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   222
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   223
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   224
class _Printer(object):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   225
    """interactive prompt objects for printing the license text, a list of
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   226
    contributors and the copyright notice."""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   227
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   228
    MAXLINES = 23
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   229
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   230
    def __init__(self, name, data, files=(), dirs=()):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   231
        self.__name = name
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   232
        self.__data = data
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   233
        self.__files = files
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   234
        self.__dirs = dirs
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   235
        self.__lines = None
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   236
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   237
    def __setup(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   238
        if self.__lines:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   239
            return
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   240
        data = None
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   241
        for dir in self.__dirs:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   242
            for filename in self.__files:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   243
                filename = os.path.join(dir, filename)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   244
                try:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   245
                    fp = file(filename, "rU")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   246
                    data = fp.read()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   247
                    fp.close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   248
                    break
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   249
                except IOError:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   250
                    pass
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   251
            if data:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   252
                break
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   253
        if not data:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   254
            data = self.__data
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   255
        self.__lines = data.split('\n')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   256
        self.__linecnt = len(self.__lines)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   257
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   258
    def __repr__(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   259
        self.__setup()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   260
        if len(self.__lines) <= self.MAXLINES:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   261
            return "\n".join(self.__lines)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   262
        else:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   263
            return "Type %s() to see the full %s text" % ((self.__name,)*2)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   264
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   265
    def __call__(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   266
        self.__setup()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   267
        prompt = 'Hit Return for more, or q (and Return) to quit: '
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   268
        lineno = 0
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   269
        while 1:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   270
            try:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   271
                for i in range(lineno, lineno + self.MAXLINES):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   272
                    print self.__lines[i]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   273
            except IndexError:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   274
                break
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   275
            else:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   276
                lineno += self.MAXLINES
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   277
                key = None
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   278
                while key is None:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   279
                    key = raw_input(prompt)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   280
                    if key not in ('', 'q'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   281
                        key = None
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   282
                if key == 'q':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   283
                    break
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   284
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   285
def setcopyright():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   286
    """Set 'copyright' and 'credits' in __builtin__"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   287
    __builtin__.copyright = _Printer("copyright", sys.copyright)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   288
    if sys.platform[:4] == 'java':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   289
        __builtin__.credits = _Printer(
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   290
            "credits",
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   291
            "Jython is maintained by the Jython developers (www.jython.org).")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   292
    else:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   293
        __builtin__.credits = _Printer("credits", """\
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   294
    Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   295
    for supporting Python development.  See www.python.org for more information.""")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   296
    here = os.path.dirname(os.__file__)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   297
    __builtin__.license = _Printer(
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   298
        "license", "See http://www.python.org/%.3s/license.html" % sys.version,
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   299
        ["LICENSE.txt", "LICENSE"],
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   300
        [os.path.join(here, os.pardir), here, os.curdir])
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   301
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   302
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   303
class _Helper(object):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   304
    """Define the built-in 'help'.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   305
    This is a wrapper around pydoc.help (with a twist).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   306
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   307
    """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   308
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   309
    def __repr__(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   310
        return "Type help() for interactive help, " \
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   311
               "or help(object) for help about object."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   312
    def __call__(self, *args, **kwds):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   313
        import pydoc
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   314
        return pydoc.help(*args, **kwds)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   315
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   316
def sethelper():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   317
    __builtin__.help = _Helper()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   318
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   319
def aliasmbcs():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   320
    """On Windows, some default encodings are not provided by Python,
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   321
    while they are always available as "mbcs" in each locale. Make
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   322
    them usable by aliasing to "mbcs" in such a case."""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   323
    if sys.platform == 'win32':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   324
        import locale, codecs
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   325
        enc = locale.getdefaultlocale()[1]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   326
        if enc.startswith('cp'):            # "cp***" ?
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   327
            try:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   328
                codecs.lookup(enc)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   329
            except LookupError:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   330
                import encodings
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   331
                encodings._cache[enc] = encodings._unknown
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   332
                encodings.aliases.aliases[enc] = 'mbcs'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   333
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   334
def setencoding():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   335
    """Set the string encoding used by the Unicode implementation.  The
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   336
    default is 'ascii', but if you're willing to experiment, you can
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   337
    change this."""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   338
    encoding = "ascii" # Default value set by _PyUnicode_Init()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   339
    if 0:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   340
        # Enable to support locale aware default string encodings.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   341
        import locale
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   342
        loc = locale.getdefaultlocale()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   343
        if loc[1]:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   344
            encoding = loc[1]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   345
    if 0:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   346
        # Enable to switch off string to Unicode coercion and implicit
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   347
        # Unicode to string conversion.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   348
        encoding = "undefined"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   349
    if encoding != "ascii":
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   350
        # On Non-Unicode builds this will raise an AttributeError...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   351
        sys.setdefaultencoding(encoding) # Needs Python Unicode build !
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   352
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   353
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   354
def execsitecustomize():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   355
    """Run custom site specific code, if available."""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   356
    try:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   357
        import sitecustomize
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   358
    except ImportError:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   359
        pass
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   360
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   361
def fixup_setuptools():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   362
    """Make sure our setuptools monkeypatch is in place"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   363
    for i in range(len(sys.path)):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   364
        if sys.path[i].find('setuptools') != -1:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   365
            path = sys.path[i]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   366
            del sys.path[i]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   367
            sys.path.append(path)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   368
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   369
def main():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   370
    abs__file__()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   371
    paths_in_sys = removeduppaths()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   372
    if include_site_packages:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   373
        paths_in_sys = addsitepackages(paths_in_sys)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   374
    setquit()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   375
    setcopyright()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   376
    sethelper()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   377
    aliasmbcs()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   378
    setencoding()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   379
    execsitecustomize()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   380
    # Remove sys.setdefaultencoding() so that users cannot change the
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   381
    # encoding after initialization.  The test for presence is needed when
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   382
    # this module is run as a script, because this code is executed twice.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   383
    if hasattr(sys, "setdefaultencoding"):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   384
        del sys.setdefaultencoding
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   385
    __boot()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   386
    fixup_setuptools()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   387
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   388
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   389
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   390
include_site_packages = False
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   391
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   392
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   393
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   394
main()