Mercurial > hg > orthanc-wsi
comparison Resources/SyncOrthancFolder.py @ 140:a0f9a3df1110
resort to Orthanc framework
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 17 Apr 2018 15:47:47 +0200 |
parents | 90b392cb1aba |
children | f80631f632ad |
comparison
equal
deleted
inserted
replaced
139:f2f58f288172 | 140:a0f9a3df1110 |
---|---|
8 import multiprocessing | 8 import multiprocessing |
9 import os | 9 import os |
10 import stat | 10 import stat |
11 import urllib2 | 11 import urllib2 |
12 | 12 |
13 TARGET = os.path.join(os.path.dirname(__file__), '..', 'Resources', 'Orthanc') | 13 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') |
14 PLUGIN_SDK_VERSION = '1.0.0' | 14 PLUGIN_SDK_VERSION = '1.0.0' |
15 REPOSITORY = 'http://bitbucket.org/sjodogne/orthanc/raw' | 15 REPOSITORY = 'https://bitbucket.org/sjodogne/orthanc/raw' |
16 | 16 |
17 FILES = [ | 17 FILES = [ |
18 'NEWS', | 18 'DownloadOrthancFramework.cmake', |
19 'Core/Cache/LeastRecentlyUsedIndex.h', | 19 'LinuxStandardBaseToolchain.cmake', |
20 'Core/ChunkedBuffer.cpp', | 20 'MinGW-W64-Toolchain32.cmake', |
21 'Core/ChunkedBuffer.h', | 21 'MinGW-W64-Toolchain64.cmake', |
22 'Core/DicomFormat/DicomArray.cpp', | 22 'MinGWToolchain.cmake', |
23 'Core/DicomFormat/DicomArray.h', | |
24 'Core/DicomFormat/DicomElement.h', | |
25 'Core/DicomFormat/DicomMap.cpp', | |
26 'Core/DicomFormat/DicomMap.h', | |
27 'Core/DicomFormat/DicomTag.cpp', | |
28 'Core/DicomFormat/DicomTag.h', | |
29 'Core/DicomFormat/DicomValue.cpp', | |
30 'Core/DicomFormat/DicomValue.h', | |
31 'Core/DicomParsing/ITagVisitor.h', | |
32 'Core/DicomParsing/FromDcmtkBridge.cpp', | |
33 'Core/DicomParsing/FromDcmtkBridge.h', | |
34 'Core/DicomParsing/ToDcmtkBridge.cpp', | |
35 'Core/DicomParsing/ToDcmtkBridge.h', | |
36 'Core/Endianness.h', | |
37 'Core/EnumerationDictionary.h', | |
38 'Core/Enumerations.cpp', | |
39 'Core/Enumerations.h', | |
40 'Core/HttpClient.cpp', | |
41 'Core/HttpClient.h', | |
42 'Core/ICommand.h', | |
43 'Core/IDynamicObject.h', | |
44 'Core/Images/IImageWriter.cpp', | |
45 'Core/Images/IImageWriter.h', | |
46 'Core/Images/Image.cpp', | |
47 'Core/Images/Image.h', | |
48 'Core/Images/ImageAccessor.cpp', | |
49 'Core/Images/ImageAccessor.h', | |
50 'Core/Images/ImageBuffer.cpp', | |
51 'Core/Images/ImageBuffer.h', | |
52 'Core/Images/ImageProcessing.cpp', | |
53 'Core/Images/ImageProcessing.h', | |
54 'Core/Images/JpegErrorManager.cpp', | |
55 'Core/Images/JpegErrorManager.h', | |
56 'Core/Images/JpegReader.cpp', | |
57 'Core/Images/JpegReader.h', | |
58 'Core/Images/JpegWriter.cpp', | |
59 'Core/Images/JpegWriter.h', | |
60 'Core/Images/PixelTraits.h', | |
61 'Core/Images/PngReader.cpp', | |
62 'Core/Images/PngReader.h', | |
63 'Core/Images/PngWriter.cpp', | |
64 'Core/Images/PngWriter.h', | |
65 'Core/Logging.cpp', | |
66 'Core/Logging.h', | |
67 'Core/MultiThreading/BagOfTasks.h', | |
68 'Core/MultiThreading/BagOfTasksProcessor.cpp', | |
69 'Core/MultiThreading/BagOfTasksProcessor.h', | |
70 'Core/MultiThreading/Semaphore.cpp', | |
71 'Core/MultiThreading/Semaphore.h', | |
72 'Core/MultiThreading/SharedMessageQueue.cpp', | |
73 'Core/MultiThreading/SharedMessageQueue.h', | |
74 'Core/OrthancException.h', | |
75 'Core/PrecompiledHeaders.cpp', | |
76 'Core/PrecompiledHeaders.h', | |
77 'Core/SharedLibrary.cpp', | |
78 'Core/SharedLibrary.h', | |
79 'Core/SystemToolbox.cpp', | |
80 'Core/SystemToolbox.h', | |
81 'Core/TemporaryFile.cpp', | |
82 'Core/TemporaryFile.h', | |
83 'Core/Toolbox.cpp', | |
84 'Core/Toolbox.h', | |
85 'Core/WebServiceParameters.cpp', | |
86 'Core/WebServiceParameters.h', | |
87 'Plugins/Samples/Common/DicomDatasetReader.cpp', | |
88 'Plugins/Samples/Common/DicomDatasetReader.h', | |
89 'Plugins/Samples/Common/DicomPath.cpp', | |
90 'Plugins/Samples/Common/DicomPath.h', | |
91 'Plugins/Samples/Common/DicomTag.cpp', | |
92 'Plugins/Samples/Common/DicomTag.h', | |
93 'Plugins/Samples/Common/ExportedSymbols.list', | |
94 'Plugins/Samples/Common/FullOrthancDataset.cpp', | |
95 'Plugins/Samples/Common/FullOrthancDataset.h', | |
96 'Plugins/Samples/Common/IDicomDataset.h', | |
97 'Plugins/Samples/Common/IOrthancConnection.cpp', | |
98 'Plugins/Samples/Common/IOrthancConnection.h', | |
99 'Plugins/Samples/Common/OrthancHttpConnection.cpp', | |
100 'Plugins/Samples/Common/OrthancHttpConnection.h', | |
101 'Plugins/Samples/Common/OrthancPluginConnection.cpp', | |
102 'Plugins/Samples/Common/OrthancPluginConnection.h', | |
103 'Plugins/Samples/Common/OrthancPluginCppWrapper.cpp', | |
104 'Plugins/Samples/Common/OrthancPluginCppWrapper.h', | |
105 'Plugins/Samples/Common/OrthancPluginException.h', | |
106 'Plugins/Samples/Common/SimplifiedOrthancDataset.cpp', | |
107 'Plugins/Samples/Common/SimplifiedOrthancDataset.h', | |
108 'Plugins/Samples/Common/VersionScript.map', | |
109 'Resources/CMake/AutoGeneratedCode.cmake', | |
110 'Resources/CMake/BoostConfiguration.cmake', | |
111 'Resources/CMake/Compiler.cmake', | |
112 'Resources/CMake/DcmtkConfiguration.cmake', | |
113 'Resources/CMake/DownloadPackage.cmake', | |
114 'Resources/CMake/JsonCppConfiguration.cmake', | |
115 'Resources/CMake/LibCurlConfiguration.cmake', | |
116 'Resources/CMake/LibIconvConfiguration.cmake', | |
117 'Resources/CMake/LibJpegConfiguration.cmake', | |
118 'Resources/CMake/LibPngConfiguration.cmake', | |
119 'Resources/CMake/OpenSslConfiguration.cmake', | |
120 'Resources/CMake/UuidConfiguration.cmake', | |
121 'Resources/CMake/VisualStudioPrecompiledHeaders.cmake', | |
122 'Resources/CMake/ZlibConfiguration.cmake', | |
123 'Resources/EmbedResources.py', | |
124 'Resources/LinuxStandardBaseToolchain.cmake', | |
125 'Resources/MinGW-W64-Toolchain32.cmake', | |
126 'Resources/MinGW-W64-Toolchain64.cmake', | |
127 'Resources/MinGWToolchain.cmake', | |
128 'Resources/Patches/boost-1.66.0-linux-standard-base.patch', | |
129 'Resources/Patches/curl-7.57.0-cmake.patch', | |
130 'Resources/Patches/dcmtk-3.6.0-dulparse-vulnerability.patch', | |
131 'Resources/Patches/dcmtk-3.6.0-mingw64.patch', | |
132 'Resources/Patches/dcmtk-3.6.0-speed.patch', | |
133 'Resources/Patches/dcmtk-3.6.2-linux-standard-base.patch', | |
134 'Resources/Patches/dcmtk-3.6.2-cmath.patch', | |
135 'Resources/ThirdParty/VisualStudio/stdint.h', | |
136 'Resources/ThirdParty/base64/base64.cpp', | |
137 'Resources/ThirdParty/base64/base64.h', | |
138 'Resources/ThirdParty/patch/NOTES.txt', | |
139 'Resources/ThirdParty/patch/msys-1.0.dll', | |
140 'Resources/ThirdParty/patch/patch.exe', | |
141 'Resources/ThirdParty/patch/patch.exe.manifest', | |
142 'Resources/WindowsResources.py', | |
143 'Resources/WindowsResources.rc', | |
144 ] | 23 ] |
145 | 24 |
146 SDK = [ | 25 SDK = [ |
147 'orthanc/OrthancCPlugin.h', | 26 'orthanc/OrthancCPlugin.h', |
148 ] | |
149 | |
150 EXE = [ | |
151 'Resources/EmbedResources.py', | |
152 'Resources/WindowsResources.py', | |
153 ] | 27 ] |
154 | 28 |
155 | 29 |
156 def Download(x): | 30 def Download(x): |
157 branch = x[0] | 31 branch = x[0] |
164 except: | 38 except: |
165 pass | 39 pass |
166 | 40 |
167 url = '%s/%s/%s' % (REPOSITORY, branch, source) | 41 url = '%s/%s/%s' % (REPOSITORY, branch, source) |
168 | 42 |
169 try: | 43 with open(target, 'w') as f: |
170 with open(target, 'w') as f: | 44 f.write(urllib2.urlopen(url).read()) |
171 f.write(urllib2.urlopen(url).read()) | |
172 except: | |
173 print('Cannot download file %s' % url) | |
174 raise | |
175 | 45 |
176 | 46 |
177 commands = [] | 47 commands = [] |
178 | 48 |
179 for f in FILES: | 49 for f in FILES: |
180 commands.append([ 'default', f, f ]) | 50 commands.append([ 'default', |
51 os.path.join('Resources', f), | |
52 f ]) | |
181 | 53 |
182 for f in SDK: | 54 for f in SDK: |
183 commands.append([ | 55 commands.append([ |
184 'Orthanc-%s' % PLUGIN_SDK_VERSION, | 56 'Orthanc-%s' % PLUGIN_SDK_VERSION, |
185 'Plugins/Include/%s' % f, | 57 'Plugins/Include/%s' % f, |
186 'Sdk-%s/%s' % (PLUGIN_SDK_VERSION, f) | 58 'Sdk-%s/%s' % (PLUGIN_SDK_VERSION, f) |
187 ]) | 59 ]) |
188 | 60 |
189 | 61 |
190 pool = multiprocessing.Pool(10) # simultaneous downloads | 62 pool = multiprocessing.Pool(10) # simultaneous downloads |
191 pool.map(Download, commands) | 63 pool.map(Download, commands) |
192 | |
193 | |
194 for exe in EXE: | |
195 path = os.path.join(TARGET, exe) | |
196 st = os.stat(path) | |
197 os.chmod(path, st.st_mode | stat.S_IEXEC) | |
198 |