Changeset 10433:510c2b571117 in orange


Ignore:
Timestamp:
03/05/12 10:16:49 (2 years ago)
Author:
anzeh <anze.staric@…>
Branch:
default
Message:

Fixed a bug when setup.py crashed if .hg was missing.
(fix inspired by numpy)

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Orange/__init__.py

    r10391 r10433  
    11from __future__ import absolute_import 
     2 
    23__version__ = "2.5a4" 
    34 
    4 from . import orange 
     5try: 
     6    __ORANGE_SETUP__ 
     7except NameError: 
     8    __ORANGE_SETUP__ = False 
    59 
    6 # Definitely ugly, but I see no other workaround. 
    7 # When, e.g. data.io executes "from orange import ExampleTable" 
    8 # orange gets imported again since it is not in sys.modules 
    9 # before this entire file is executed 
    10 import sys 
    11 sys.modules["orange"] = orange 
    1210 
    13 import warnings 
     11if __ORANGE_SETUP__: 
     12    import sys as _sys 
     13    _sys.stderr.write('Running from orange source directory.\n') 
     14    del _sys 
     15else: 
     16    from . import orange 
    1417 
    15 alreadyWarned = False 
    16 disabledMsg = "Some features will be disabled due to failing modules\n" 
    17 def _import(name): 
    18     global alreadyWarned 
    19     try: 
    20         __import__(name, globals(), locals(), [], -1) 
    21     except Exception as err: 
    22         warnings.warn("%sImporting '%s' failed: %s" %  
    23             (disabledMsg if not alreadyWarned else "", name, err), 
    24             UserWarning, 2) 
    25         alreadyWarned = True 
     18    # Definitely ugly, but I see no other workaround. 
     19    # When, e.g. data.io executes "from orange import ExampleTable" 
     20    # orange gets imported again since it is not in sys.modules 
     21    # before this entire file is executed 
     22    import sys 
     23    sys.modules["orange"] = orange 
    2624 
    27 _import("misc") 
    28 _import("data") 
    29 _import("data.io") 
    30 _import("data.sample") 
    31 _import("data.outliers") 
    32 _import("data.utils") 
    33 _import("data.discretization") 
    34 _import("data.continuization") 
    35 _import("data.filter") 
    36 _import("data.imputation") 
     25    import warnings 
    3726 
    38 _import("feature") 
    39 _import("feature.construction") 
    40 _import("feature.construction.functionDecomposition") 
    41 _import("feature.construction.univariate") 
    42 _import("feature.discretization") 
    43 _import("feature.imputation") 
    44 _import("feature.scoring") 
    45 _import("feature.selection") 
     27    alreadyWarned = False 
     28    disabledMsg = "Some features will be disabled due to failing modules\n" 
     29    def _import(name): 
     30        global alreadyWarned 
     31        try: 
     32            __import__(name, globals(), locals(), [], -1) 
     33        except Exception as err: 
     34            warnings.warn("%sImporting '%s' failed: %s" % 
     35                (disabledMsg if not alreadyWarned else "", name, err), 
     36                UserWarning, 2) 
     37            alreadyWarned = True 
    4638 
    47 _import("network") 
     39    _import("misc") 
     40    _import("data") 
     41    _import("data.io") 
     42    _import("data.sample") 
     43    _import("data.outliers") 
     44    _import("data.utils") 
     45    _import("data.discretization") 
     46    _import("data.continuization") 
     47    _import("data.filter") 
     48    _import("data.imputation") 
    4849 
    49 _import("stat") 
     50    _import("feature") 
     51    _import("feature.construction") 
     52    _import("feature.construction.functionDecomposition") 
     53    _import("feature.construction.univariate") 
     54    _import("feature.discretization") 
     55    _import("feature.imputation") 
     56    _import("feature.scoring") 
     57    _import("feature.selection") 
    5058 
    51 _import("statistics") 
    52 _import("statistics.estimate") 
    53 _import("statistics.contingency") 
    54 _import("statistics.distribution") 
    55 _import("statistics.basic") 
    56 _import("statistics.evd") 
     59    _import("network") 
    5760 
    58 _import("classification") 
    59 _import("classification.tree") 
     61    _import("stat") 
    6062 
    61 _import("classification.rules") 
     63    _import("statistics") 
     64    _import("statistics.estimate") 
     65    _import("statistics.contingency") 
     66    _import("statistics.distribution") 
     67    _import("statistics.basic") 
     68    _import("statistics.evd") 
    6269 
    63 _import("classification.lookup") 
    64 _import("classification.bayes") 
    65 _import("classification.svm") 
    66 _import("classification.logreg") 
    67 _import("classification.knn") 
    68 _import("classification.majority") 
     70    _import("classification") 
     71    _import("classification.tree") 
    6972 
    70 _import("optimization") 
     73    _import("classification.rules") 
    7174 
    72 _import("projection") 
    73 _import("projection.linear") 
    74 _import("projection.mds") 
    75 _import("projection.som") 
    76 _import("projection.pca") 
     75    _import("classification.lookup") 
     76    _import("classification.bayes") 
     77    _import("classification.svm") 
     78    _import("classification.logreg") 
     79    _import("classification.knn") 
     80    _import("classification.majority") 
    7781 
    78 _import("ensemble") 
    79 _import("ensemble.bagging") 
    80 _import("ensemble.boosting") 
    81 _import("ensemble.forest") 
     82    _import("optimization") 
    8283 
    83 _import("regression") 
    84 _import("regression.base") 
    85 _import("regression.earth") 
    86 _import("regression.lasso") 
    87 _import("regression.linear") 
    88 _import("regression.mean") 
    89 _import("regression.pls") 
    90 _import("regression.tree") 
     84    _import("projection") 
     85    _import("projection.linear") 
     86    _import("projection.mds") 
     87    _import("projection.som") 
     88    _import("projection.pca") 
    9189 
    92 _import("multitarget") 
    93 _import("multitarget.tree") 
     90    _import("ensemble") 
     91    _import("ensemble.bagging") 
     92    _import("ensemble.boosting") 
     93    _import("ensemble.forest") 
    9494 
    95 _import("multilabel") 
    96 _import("multilabel.multibase") 
    97 _import("multilabel.br") 
    98 _import("multilabel.lp") 
    99 _import("multilabel.mlknn") 
    100 _import("multilabel.brknn") 
    101 _import("multilabel.mulan") 
     95    _import("regression") 
     96    _import("regression.base") 
     97    _import("regression.earth") 
     98    _import("regression.lasso") 
     99    _import("regression.linear") 
     100    _import("regression.mean") 
     101    _import("regression.pls") 
     102    _import("regression.tree") 
    102103 
    103 _import("associate") 
     104    _import("multitarget") 
     105    _import("multitarget.tree") 
    104106 
    105 _import("preprocess") 
    106 _import("preprocess.scaling") 
     107    _import("multilabel") 
     108    _import("multilabel.multibase") 
     109    _import("multilabel.br") 
     110    _import("multilabel.lp") 
     111    _import("multilabel.mlknn") 
     112    _import("multilabel.brknn") 
     113    _import("multilabel.mulan") 
    107114 
    108 _import("distance") 
     115    _import("associate") 
    109116 
    110 _import("wrappers") 
     117    _import("preprocess") 
     118    _import("preprocess.scaling") 
    111119 
    112 _import("featureConstruction") 
    113 _import("featureConstruction.univariate") 
    114 _import("featureConstruction.functionDecomposition") 
     120    _import("distance") 
    115121 
    116 _import("evaluation") 
    117 _import("evaluation.scoring") 
    118 _import("evaluation.testing") 
    119 _import("evaluation.reliability") 
     122    _import("wrappers") 
    120123 
    121 _import("clustering") 
    122 _import("clustering.kmeans") 
    123 _import("clustering.hierarchical") 
    124 _import("clustering.consensus") 
     124    _import("featureConstruction") 
     125    _import("featureConstruction.univariate") 
     126    _import("featureConstruction.functionDecomposition") 
    125127 
    126 _import("misc") 
    127 _import("misc.environ") 
    128 _import("misc.counters") 
    129 _import("misc.addons") 
    130 _import("misc.render") 
    131 _import("misc.selection") 
    132 _import("misc.serverfiles") 
    133 #_import("misc.r") 
     128    _import("evaluation") 
     129    _import("evaluation.scoring") 
     130    _import("evaluation.testing") 
     131    _import("evaluation.reliability") 
    134132 
     133    _import("clustering") 
     134    _import("clustering.kmeans") 
     135    _import("clustering.hierarchical") 
     136    _import("clustering.consensus") 
     137 
     138    _import("misc") 
     139    _import("misc.environ") 
     140    _import("misc.counters") 
     141    _import("misc.addons") 
     142    _import("misc.render") 
     143    _import("misc.selection") 
     144    _import("misc.serverfiles") 
     145    #_import("misc.r") 
     146 
  • setup.py

    r10424 r10433  
    592592                      libraries=libraries 
    593593                      ) 
    594      
     594 
     595 
     596import __builtin__ as builtins 
     597 
     598# We are setting a global variable so that the main Orange __init__ can detect 
     599# if it is being loaded by the setup routine, to avoid attempting to 
     600# load components that aren't built yet. 
     601builtins.__ORANGE_SETUP__ = True 
    595602 
    596603def get_packages(): 
Note: See TracChangeset for help on using the changeset viewer.