|
36 | 36 | from .connect import _get_metric_tracker
|
37 | 37 | from . import visualization
|
38 | 38 |
|
39 |
| -from .data_structures.sgraph import Vertex, Edge |
40 |
| -from .data_structures.sgraph import SGraph |
41 |
| -from .data_structures.sframe import SFrame |
42 |
| -from .data_structures.sarray import SArray |
43 |
| -from .data_structures.sketch import Sketch |
44 |
| -from .data_structures.image import Image |
45 |
| -from .data_structures.sarray_builder import SArrayBuilder |
46 |
| -from .data_structures.sframe_builder import SFrameBuilder |
| 39 | +import os as _os |
| 40 | +import sys as _sys |
| 41 | +if _sys.platform != 'win32' or \ |
| 42 | + (_os.path.exists(_os.path.join(_os.path.dirname(__file__), 'cython', 'libstdc++-6.dll')) and \ |
| 43 | + _os.path.exists(_os.path.join(_os.path.dirname(__file__), 'cython', 'libgcc_s_seh-1.dll'))): |
| 44 | + from .data_structures.sgraph import Vertex, Edge |
| 45 | + from .data_structures.sgraph import SGraph |
| 46 | + from .data_structures.sframe import SFrame |
| 47 | + from .data_structures.sarray import SArray |
| 48 | + from .data_structures.sketch import Sketch |
| 49 | + from .data_structures.image import Image |
| 50 | + from .data_structures.sarray_builder import SArrayBuilder |
| 51 | + from .data_structures.sframe_builder import SFrameBuilder |
47 | 52 |
|
48 |
| -from .data_structures.sgraph import load_sgraph, load_graph |
| 53 | + from .data_structures.sgraph import load_sgraph, load_graph |
49 | 54 |
|
50 |
| -from .toolkits._model import Model, CustomModel, load_model |
| 55 | + from .toolkits._model import Model, CustomModel, load_model |
51 | 56 |
|
52 |
| -from . import aggregate |
53 |
| -from . import toolkits |
| 57 | + from . import aggregate |
| 58 | + from . import toolkits |
54 | 59 |
|
55 |
| -from .toolkits.image_analysis import image_analysis |
| 60 | + from .toolkits.image_analysis import image_analysis |
56 | 61 |
|
57 |
| -from .data_structures.sframe import load_sframe, get_spark_integration_jar_path |
58 |
| -from .data_structures.DBConnection import connect_odbc, get_libodbc_path, set_libodbc_path |
| 62 | + from .data_structures.sframe import load_sframe, get_spark_integration_jar_path |
| 63 | + from .data_structures.DBConnection import connect_odbc, get_libodbc_path, set_libodbc_path |
59 | 64 |
|
60 |
| -# internal util |
61 |
| -from .connect.main import launch as _launch |
62 |
| -from .connect.main import stop as _stop |
63 |
| -from .connect import main as glconnect |
| 65 | + # internal util |
| 66 | + from .connect.main import launch as _launch |
| 67 | + from .connect.main import stop as _stop |
| 68 | + from .connect import main as glconnect |
64 | 69 |
|
65 | 70 |
|
66 |
| -from .util import get_environment_config |
67 |
| -from .util import get_graphlab_object_type |
68 |
| -from .util import get_log_location, get_client_log_location, get_server_log_location |
| 71 | + from .util import get_environment_config |
| 72 | + from .util import get_graphlab_object_type |
| 73 | + from .util import get_log_location, get_client_log_location, get_server_log_location |
69 | 74 |
|
70 |
| -from .version_info import version |
71 |
| -from .version_info import __VERSION__ |
| 75 | + from .version_info import version |
| 76 | + from .version_info import __VERSION__ |
72 | 77 |
|
73 | 78 |
|
74 |
| -class DeprecationHelper(object): |
75 |
| - def __init__(self, new_target): |
76 |
| - self.new_target = new_target |
| 79 | + class DeprecationHelper(object): |
| 80 | + def __init__(self, new_target): |
| 81 | + self.new_target = new_target |
77 | 82 |
|
78 |
| - def _warn(self): |
79 |
| - import warnings |
80 |
| - import logging |
81 |
| - warnings.warn("Graph has been renamed to SGraph. The Graph class will be removed in the next release.", PendingDeprecationWarning) |
82 |
| - logging.warning("Graph has been renamed to SGraph. The Graph class will be removed in the next release.") |
| 83 | + def _warn(self): |
| 84 | + import warnings |
| 85 | + import logging |
| 86 | + warnings.warn("Graph has been renamed to SGraph. The Graph class will be removed in the next release.", PendingDeprecationWarning) |
| 87 | + logging.warning("Graph has been renamed to SGraph. The Graph class will be removed in the next release.") |
83 | 88 |
|
84 |
| - def __call__(self, *args, **kwargs): |
85 |
| - self._warn() |
86 |
| - return self.new_target(*args, **kwargs) |
| 89 | + def __call__(self, *args, **kwargs): |
| 90 | + self._warn() |
| 91 | + return self.new_target(*args, **kwargs) |
87 | 92 |
|
88 |
| - def __getattr__(self, attr): |
89 |
| - self._warn() |
90 |
| - return getattr(self.new_target, attr) |
| 93 | + def __getattr__(self, attr): |
| 94 | + self._warn() |
| 95 | + return getattr(self.new_target, attr) |
91 | 96 |
|
92 |
| -Graph = DeprecationHelper(SGraph) |
| 97 | + Graph = DeprecationHelper(SGraph) |
93 | 98 |
|
94 |
| -from .cython import cy_pylambda_workers |
95 |
| -################### Extension Importing ######################## |
96 |
| -from . import extensions |
97 |
| -from .extensions import ext_import |
| 99 | + from .cython import cy_pylambda_workers |
| 100 | + ################### Extension Importing ######################## |
| 101 | + from . import extensions |
| 102 | + from .extensions import ext_import |
98 | 103 |
|
99 |
| -extensions._add_meta_path() |
| 104 | + extensions._add_meta_path() |
100 | 105 |
|
101 |
| -# rewrite the extensions module |
102 |
| -class _extensions_wrapper(object): |
103 |
| - def __init__(self, wrapped): |
104 |
| - self._wrapped = wrapped |
105 |
| - self.__doc__ = wrapped.__doc__ |
| 106 | + # rewrite the extensions module |
| 107 | + class _extensions_wrapper(object): |
| 108 | + def __init__(self, wrapped): |
| 109 | + self._wrapped = wrapped |
| 110 | + self.__doc__ = wrapped.__doc__ |
106 | 111 |
|
107 |
| - def __getattr__(self, name): |
108 |
| - try: |
| 112 | + def __getattr__(self, name): |
| 113 | + try: |
| 114 | + return getattr(self._wrapped, name) |
| 115 | + except: |
| 116 | + pass |
| 117 | + from .connect.main import get_unity |
| 118 | + get_unity() |
109 | 119 | return getattr(self._wrapped, name)
|
110 |
| - except: |
111 |
| - pass |
112 |
| - from .connect.main import get_unity |
113 |
| - get_unity() |
114 |
| - return getattr(self._wrapped, name) |
115 | 120 |
|
116 |
| -import sys as _sys |
117 |
| -from . import _json as json # imports from _json.py in this directory |
| 121 | + from . import _json as json # imports from _json.py in this directory |
| 122 | + |
| 123 | + _sys.modules[__name__ + ".extensions"] = _extensions_wrapper(_sys.modules[__name__ + ".extensions"]) |
| 124 | + # rewrite the import |
| 125 | + extensions = _sys.modules[__name__ + ".extensions"] |
| 126 | +else: |
| 127 | + from dependencies import get_dependencies |
| 128 | + package_dir = _os.path.dirname(__file__) |
| 129 | + print(""" |
| 130 | +ACTION REQUIRED: Dependencies libstdc++-6.dll and libgcc_s_seh-1.dll not found. |
| 131 | +
|
| 132 | +1. Ensure user account has write permission to %s |
| 133 | +2. Run sframe.get_dependencies() to download and install them. |
| 134 | +3. Restart Python and import sframe again. |
| 135 | +
|
| 136 | +By running the above function, you agree to the following licenses. |
118 | 137 |
|
119 |
| -_sys.modules[__name__ + ".extensions"] = _extensions_wrapper(_sys.modules[__name__ + ".extensions"]) |
120 |
| -# rewrite the import |
121 |
| -extensions = _sys.modules[__name__ + ".extensions"] |
| 138 | +* libstdc++: https://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html |
| 139 | +* xz: http://git.tukaani.org/?p=xz.git;a=blob;f=COPYING |
| 140 | + """ % package_dir) |
0 commit comments