|
1 | 1 | import os |
2 | | -import requests |
3 | | -import zipfile |
4 | 2 |
|
5 | 3 | import psutil |
6 | 4 |
|
7 | 5 | from conda_git_deployment import utils |
| 6 | +import environment_setup |
8 | 7 |
|
9 | 8 |
|
10 | | -def download_file(url, path): |
11 | | - r = requests.get(url, stream=True) |
12 | | - with open(path, 'wb') as f: |
13 | | - for chunk in r.iter_content(chunk_size=1024): |
14 | | - if chunk: |
15 | | - f.write(chunk) |
16 | | - if os.path.exists(path): |
17 | | - return True |
18 | | - else: |
19 | | - return False |
| 9 | +def main(): |
| 10 | + environment = {} |
20 | 11 |
|
| 12 | + # PATH |
| 13 | + environment["PATH"] = [ |
| 14 | + os.path.abspath( |
| 15 | + os.path.join( |
| 16 | + __file__, "..", "applications", "djv-1.1.0-Windows-64", "bin" |
| 17 | + ) |
| 18 | + ) |
| 19 | + ] |
21 | 20 |
|
22 | | -# Install DJV |
23 | | -root = os.path.dirname(__file__) |
24 | | -applications_path = os.path.join(root, "applications") |
25 | | -application_path = os.path.join(applications_path, "djv-1.1.0-Windows-64") |
| 21 | + # PYTHONPATH |
| 22 | + environment["PYTHONPATH"] = [ |
| 23 | + os.path.join( |
| 24 | + os.environ["CONDA_GIT_REPOSITORY"], |
| 25 | + "pyblish-maya", |
| 26 | + "pyblish_maya", |
| 27 | + "pythonpath" |
| 28 | + ), |
| 29 | + os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "pyblish-nukestudio"), |
| 30 | + os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "Tapp"), |
| 31 | + os.path.join( |
| 32 | + os.environ["CONDA_GIT_REPOSITORY"], |
| 33 | + "Tapp", |
| 34 | + "environment", |
| 35 | + "PYTHONPATH" |
| 36 | + ), |
| 37 | + os.path.join(os.environ["CONDA_GIT_REPOSITORY"]), |
| 38 | + os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "maya-capture"), |
| 39 | + os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "maya-capture-gui"), |
| 40 | + os.path.join( |
| 41 | + os.environ["CONDA_GIT_REPOSITORY"], "maya-alembic-export" |
| 42 | + ), |
| 43 | + os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "ftrack-hooks"), |
| 44 | + os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "filelink"), |
| 45 | + os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "pyblish-bumpybox"), |
| 46 | + os.path.join(os.path.dirname(__file__), "environment", "PYTHONPATH"), |
| 47 | + ] |
| 48 | + |
| 49 | + # LUCIDITY_TEMPLATE_PATH |
| 50 | + environment["LUCIDITY_TEMPLATE_PATH"] = [ |
| 51 | + os.path.join( |
| 52 | + os.path.dirname(__file__), "environment", "LUCIDITY_TEMPLATE_PATH" |
| 53 | + ), |
| 54 | + ] |
26 | 55 |
|
27 | | -if not os.path.exists(applications_path): |
28 | | - os.makedirs(applications_path) |
| 56 | + # HIERO_PLUGIN_PATH |
| 57 | + environment["HIERO_PLUGIN_PATH"] = [ |
| 58 | + os.path.join( |
| 59 | + os.environ["CONDA_GIT_REPOSITORY"], |
| 60 | + "pyblish-nukestudio", |
| 61 | + "pyblish_nukestudio", |
| 62 | + "hiero_plugin_path", |
| 63 | + ), |
| 64 | + os.path.join( |
| 65 | + os.environ["CONDA_GIT_REPOSITORY"], |
| 66 | + "pyblish-grill-environment", |
| 67 | + "environment", |
| 68 | + "HIERO_PLUGIN_PATH" |
| 69 | + ), |
| 70 | + os.path.join( |
| 71 | + os.path.dirname(__file__), "environment", "HIERO_PLUGIN_PATH" |
| 72 | + ), |
| 73 | + ] |
29 | 74 |
|
30 | | -path = os.path.join(applications_path, "djv.zip") |
| 75 | + # NUKE_PATH |
| 76 | + environment["NUKE_PATH"] = [ |
| 77 | + os.path.join( |
| 78 | + os.environ["CONDA_GIT_REPOSITORY"], |
| 79 | + "pyblish-nuke", |
| 80 | + "pyblish_nuke", |
| 81 | + "nuke_path" |
| 82 | + ), |
| 83 | + os.path.join( |
| 84 | + os.environ["CONDA_GIT_REPOSITORY"], |
| 85 | + "pyblish-bumpybox", |
| 86 | + "pyblish_bumpybox", |
| 87 | + "environment_variables", |
| 88 | + "nuke_path" |
| 89 | + ) |
| 90 | + ] |
31 | 91 |
|
32 | | -if not os.path.exists(application_path) and not os.path.exists(path): |
33 | | - print "Installing DJV..." |
34 | | - url = "https://downloads.sourceforge.net/project/djv/djv-stable/1.1.0/" |
35 | | - url += "djv-1.1.0-Windows-64.zip" |
36 | | - download_file(url, path) |
| 92 | + # MAYA_PLUG_IN_PATH |
| 93 | + environment["MAYA_PLUG_IN_PATH"] = [ |
| 94 | + os.path.join( |
| 95 | + os.environ["CONDA_GIT_REPOSITORY"], |
| 96 | + "Tapp", |
| 97 | + "environment", |
| 98 | + "MAYA_PLUG_IN_PATH" |
| 99 | + ), |
| 100 | + os.path.join( |
| 101 | + os.path.dirname(__file__), "environment", "MAYA_PLUG_IN_PATH" |
| 102 | + ) |
| 103 | + ] |
37 | 104 |
|
38 | | - zip_ref = zipfile.ZipFile(path, "r") |
39 | | - zip_ref.extractall(applications_path) |
40 | | - zip_ref.close() |
| 105 | + # XBMLANGPATH |
| 106 | + environment["XBMLANGPATH"] = [ |
| 107 | + os.path.join(os.path.dirname(__file__), "environment", "XBMLANGPATH") |
| 108 | + ] |
41 | 109 |
|
42 | | - os.remove(path) |
| 110 | + # MAYA_MODULE_PATH |
| 111 | + environment["MAYA_MODULE_PATH"] = [ |
| 112 | + os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "cvshapeinverter"), |
| 113 | + ] |
43 | 114 |
|
44 | | -# Setup environment |
45 | | -environment = {} |
| 115 | + # FTRACK_CONNECT_PLUGIN_PATH |
| 116 | + environment["FTRACK_CONNECT_PLUGIN_PATH"] = [ |
| 117 | + os.path.join( |
| 118 | + os.environ["CONDA_GIT_REPOSITORY"], "ftrack-hooks", "djv_plugin" |
| 119 | + ), |
| 120 | + os.path.join( |
| 121 | + os.environ["CONDA_GIT_REPOSITORY"], |
| 122 | + "ftrack-hooks", |
| 123 | + "create_structure" |
| 124 | + ), |
| 125 | + os.path.join( |
| 126 | + os.path.dirname(__file__), |
| 127 | + "environment", |
| 128 | + "FTRACK_CONNECT_PLUGIN_PATH" |
| 129 | + ) |
| 130 | + ] |
46 | 131 |
|
47 | | -# PATH |
48 | | -environment["PATH"] = [ |
49 | | - os.path.abspath( |
| 132 | + # FTRACK_EVENT_PLUGIN_PATH |
| 133 | + environment["FTRACK_EVENT_PLUGIN_PATH"] = [ |
50 | 134 | os.path.join( |
51 | | - __file__, "..", "applications", "djv-1.1.0-Windows-64", "bin" |
| 135 | + os.path.dirname(__file__), |
| 136 | + "environment", |
| 137 | + "FTRACK_EVENT_PLUGIN_PATH" |
52 | 138 | ) |
53 | | - ) |
54 | | -] |
55 | | - |
56 | | -# PYTHONPATH |
57 | | -environment["PYTHONPATH"] = [ |
58 | | - os.path.join( |
59 | | - os.environ["CONDA_GIT_REPOSITORY"], |
60 | | - "pyblish-maya", |
61 | | - "pyblish_maya", |
62 | | - "pythonpath" |
63 | | - ), |
64 | | - os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "pyblish-nukestudio"), |
65 | | - os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "Tapp"), |
66 | | - os.path.join( |
67 | | - os.environ["CONDA_GIT_REPOSITORY"], |
68 | | - "Tapp", |
69 | | - "environment", |
70 | | - "PYTHONPATH" |
71 | | - ), |
72 | | - os.path.join(os.environ["CONDA_GIT_REPOSITORY"]), |
73 | | - os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "maya-capture"), |
74 | | - os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "maya-capture-gui"), |
75 | | - os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "maya-alembic-export"), |
76 | | - os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "ftrack-hooks"), |
77 | | - os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "filelink"), |
78 | | - os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "pyblish-bumpybox"), |
79 | | - os.path.join(os.path.dirname(__file__), "environment", "PYTHONPATH"), |
80 | | -] |
81 | | - |
82 | | -# LUCIDITY_TEMPLATE_PATH |
83 | | -environment["LUCIDITY_TEMPLATE_PATH"] = [ |
84 | | - os.path.join( |
85 | | - os.path.dirname(__file__), "environment", "LUCIDITY_TEMPLATE_PATH" |
86 | | - ), |
87 | | -] |
88 | | - |
89 | | -# HIERO_PLUGIN_PATH |
90 | | -environment["HIERO_PLUGIN_PATH"] = [ |
91 | | - os.path.join( |
92 | | - os.environ["CONDA_GIT_REPOSITORY"], |
93 | | - "pyblish-nukestudio", |
94 | | - "pyblish_nukestudio", |
95 | | - "hiero_plugin_path", |
96 | | - ), |
97 | | - os.path.join( |
98 | | - os.environ["CONDA_GIT_REPOSITORY"], |
99 | | - "pyblish-grill-environment", |
100 | | - "environment", |
101 | | - "HIERO_PLUGIN_PATH" |
102 | | - ), |
103 | | - os.path.join( |
104 | | - os.path.dirname(__file__), "environment", "HIERO_PLUGIN_PATH" |
105 | | - ), |
106 | | -] |
107 | | - |
108 | | -# NUKE_PATH |
109 | | -environment["NUKE_PATH"] = [ |
110 | | - os.path.join( |
111 | | - os.environ["CONDA_GIT_REPOSITORY"], |
112 | | - "pyblish-nuke", |
113 | | - "pyblish_nuke", |
114 | | - "nuke_path" |
115 | | - ), |
116 | | - os.path.join( |
117 | | - os.environ["CONDA_GIT_REPOSITORY"], |
118 | | - "pyblish-bumpybox", |
119 | | - "pyblish_bumpybox", |
120 | | - "environment_variables", |
121 | | - "nuke_path" |
122 | | - ) |
123 | | -] |
124 | | - |
125 | | -# MAYA_PLUG_IN_PATH |
126 | | -environment["MAYA_PLUG_IN_PATH"] = [ |
127 | | - os.path.join( |
128 | | - os.environ["CONDA_GIT_REPOSITORY"], |
129 | | - "Tapp", |
130 | | - "environment", |
131 | | - "MAYA_PLUG_IN_PATH" |
132 | | - ), |
133 | | - os.path.join(os.path.dirname(__file__), "environment", "MAYA_PLUG_IN_PATH") |
134 | | -] |
135 | | - |
136 | | -# XBMLANGPATH |
137 | | -environment["XBMLANGPATH"] = [ |
138 | | - os.path.join(os.path.dirname(__file__), "environment", "XBMLANGPATH") |
139 | | -] |
140 | | - |
141 | | -# MAYA_MODULE_PATH |
142 | | -environment["MAYA_MODULE_PATH"] = [ |
143 | | - os.path.join(os.environ["CONDA_GIT_REPOSITORY"], "cvshapeinverter"), |
144 | | -] |
145 | | - |
146 | | -# FTRACK_CONNECT_PLUGIN_PATH |
147 | | -environment["FTRACK_CONNECT_PLUGIN_PATH"] = [ |
148 | | - os.path.join( |
149 | | - os.environ["CONDA_GIT_REPOSITORY"], "ftrack-hooks", "djv_plugin" |
150 | | - ), |
151 | | - os.path.join( |
152 | | - os.environ["CONDA_GIT_REPOSITORY"], "ftrack-hooks", "create_structure" |
153 | | - ), |
154 | | - os.path.join( |
155 | | - os.path.dirname(__file__), "environment", "FTRACK_CONNECT_PLUGIN_PATH" |
156 | | - ) |
157 | | -] |
158 | | - |
159 | | -# FTRACK_EVENT_PLUGIN_PATH |
160 | | -environment["FTRACK_EVENT_PLUGIN_PATH"] = [ |
161 | | - os.path.join( |
162 | | - os.path.dirname(__file__), "environment", "FTRACK_EVENT_PLUGIN_PATH" |
163 | | - ) |
164 | | -] |
165 | | - |
166 | | -# PYBLISH_HOTKEY |
167 | | -environment["PYBLISH_HOTKEY"] = ["Ctrl+Alt+P"] |
168 | | - |
169 | | -# PYBLISH_QML_MODAL |
170 | | -environment["PYBLISH_QML_MODAL"] = ["True"] |
171 | | - |
172 | | -# PYBLISH_ALLOW_DUPLICATE_PLUGIN_NAMES |
173 | | -environment["PYBLISH_ALLOW_DUPLICATE_PLUGIN_NAMES"] = ["True"] |
174 | | - |
175 | | -# Kill existing ftrack_connects |
176 | | -for proc in psutil.process_iter(): |
177 | | - try: |
178 | | - if "ftrack_connect" in proc.cmdline(): |
179 | | - proc.kill() |
180 | | - except psutil.AccessDenied: |
181 | | - # Some process does not allow you to get "cmdline()" |
182 | | - pass |
183 | | - |
184 | | -utils.write_environment(environment) |
| 139 | + ] |
| 140 | + |
| 141 | + # PYBLISH_HOTKEY |
| 142 | + environment["PYBLISH_HOTKEY"] = ["Ctrl+Alt+P"] |
| 143 | + |
| 144 | + # PYBLISH_QML_MODAL |
| 145 | + environment["PYBLISH_QML_MODAL"] = ["True"] |
| 146 | + |
| 147 | + # PYBLISH_ALLOW_DUPLICATE_PLUGIN_NAMES |
| 148 | + environment["PYBLISH_ALLOW_DUPLICATE_PLUGIN_NAMES"] = ["True"] |
| 149 | + |
| 150 | + # Kill existing ftrack_connects |
| 151 | + for proc in psutil.process_iter(): |
| 152 | + try: |
| 153 | + if "ftrack_connect" in proc.cmdline(): |
| 154 | + proc.kill() |
| 155 | + except psutil.AccessDenied: |
| 156 | + # Some process does not allow you to get "cmdline()" |
| 157 | + pass |
| 158 | + |
| 159 | + utils.write_environment(environment) |
| 160 | + |
| 161 | + |
| 162 | +if __name__ == "__main__": |
| 163 | + environment_setup.install_djv() |
| 164 | + main() |
0 commit comments