Mercurial > hg > orthanc-stone
comparison OrthancStone/Resources/SyncOrthancFolder.py @ 1512:244ad1e4e76a
reorganization of folders
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 07 Jul 2020 16:21:02 +0200 |
parents | Resources/SyncOrthancFolder.py@dd1d1cc0575d |
children | b750b6eab453 |
comparison
equal
deleted
inserted
replaced
1511:9dfeee74c1e6 | 1512:244ad1e4e76a |
---|---|
1 #!/usr/bin/python | |
2 | |
3 # | |
4 # This maintenance script updates the content of the "Orthanc" folder | |
5 # to match the latest version of the Orthanc source code. | |
6 # | |
7 | |
8 import multiprocessing | |
9 import os | |
10 import stat | |
11 import urllib2 | |
12 | |
13 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') | |
14 PLUGIN_SDK_VERSION = '1.0.0' | |
15 REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file' | |
16 | |
17 FILES = [ | |
18 ('OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'), | |
19 ('OrthancFramework/Resources/CMake/Compiler.cmake', 'CMake'), | |
20 ('OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake', 'CMake'), | |
21 ('OrthancFramework/Resources/CMake/DownloadPackage.cmake', 'CMake'), | |
22 ('OrthancFramework/Resources/CMake/GoogleTestConfiguration.cmake', 'CMake'), | |
23 ('OrthancFramework/Resources/EmbedResources.py', 'CMake'), | |
24 | |
25 ('OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake', 'Toolchains'), | |
26 ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain32.cmake', 'Toolchains'), | |
27 ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain64.cmake', 'Toolchains'), | |
28 ('OrthancFramework/Resources/Toolchains/MinGWToolchain.cmake', 'Toolchains'), | |
29 | |
30 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h', | |
31 '../../StoneWebViewer/Resources/Orthanc/Plugins'), | |
32 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp', | |
33 '../../StoneWebViewer/Resources/Orthanc/Plugins'), | |
34 ('OrthancServer/Plugins/Samples/Common/OrthancPluginException.h', | |
35 '../../StoneWebViewer/Resources/Orthanc/Plugins'), | |
36 ('OrthancServer/Plugins/Samples/Common/ExportedSymbolsPlugins.list', | |
37 '../../StoneWebViewer/Resources/Orthanc/Plugins'), | |
38 ('OrthancServer/Plugins/Samples/Common/OrthancPluginsExports.cmake', | |
39 '../../StoneWebViewer/Resources/Orthanc/Plugins'), | |
40 ('OrthancServer/Plugins/Samples/Common/VersionScriptPlugins.map', | |
41 '../../StoneWebViewer/Resources/Orthanc/Plugins'), | |
42 ] | |
43 | |
44 SDK = [ | |
45 'orthanc/OrthancCPlugin.h', | |
46 ] | |
47 | |
48 | |
49 def Download(x): | |
50 branch = x[0] | |
51 source = x[1] | |
52 target = os.path.join(TARGET, x[2]) | |
53 print target | |
54 | |
55 try: | |
56 os.makedirs(os.path.dirname(target)) | |
57 except: | |
58 pass | |
59 | |
60 url = '%s/%s/%s' % (REPOSITORY, branch, source) | |
61 | |
62 with open(target, 'w') as f: | |
63 f.write(urllib2.urlopen(url).read()) | |
64 | |
65 | |
66 commands = [] | |
67 | |
68 for f in FILES: | |
69 commands.append([ 'default', | |
70 f[0], | |
71 os.path.join(f[1], os.path.basename(f[0])) ]) | |
72 | |
73 for f in SDK: | |
74 commands.append([ | |
75 'Orthanc-%s' % PLUGIN_SDK_VERSION, | |
76 'Plugins/Include/%s' % f, | |
77 '../../StoneWebViewer/Resources/OrthancSdk-%s/%s' % (PLUGIN_SDK_VERSION, f) | |
78 ]) | |
79 | |
80 pool = multiprocessing.Pool(10) # simultaneous downloads | |
81 pool.map(Download, commands) |