Mercurial > hg > orthanc-python
annotate Resources/SyncOrthancFolder.py @ 145:8b310d571e5b
sync orthanc folder
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 13 Nov 2023 21:12:54 +0100 |
parents | cc0765aae484 |
children | c012edac593e |
rev | line source |
---|---|
132 | 1 #!/usr/bin/python3 |
0 | 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 | |
132 | 11 import urllib.request |
0 | 12 |
13 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') | |
107
461dfb859ac7
upgrade to Orthanc SDK 1.10.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
14 PLUGIN_SDK_VERSION = '1.10.0' |
145 | 15 REPOSITORY = 'https://orthanc.uclouvain.be/hg/orthanc/raw-file' |
0 | 16 |
17 FILES = [ | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
18 ('OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
19 ('OrthancFramework/Resources/CMake/Compiler.cmake', 'CMake'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
20 ('OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake', 'CMake'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
21 ('OrthancFramework/Resources/CMake/DownloadPackage.cmake', 'CMake'), |
145 | 22 ('OrthancFramework/Resources/CMake/GoogleTestConfiguration.cmake', 'CMake'), |
23 ('OrthancFramework/Resources/EmbedResources.py', 'CMake'), | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
24 ('OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake', 'Toolchains'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
25 ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain32.cmake', 'Toolchains'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
26 ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain64.cmake', 'Toolchains'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
27 ('OrthancFramework/Resources/Toolchains/MinGWToolchain.cmake', 'Toolchains'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
28 ('OrthancServer/Plugins/Samples/Common/ExportedSymbolsPlugins.list', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
29 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
30 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
31 ('OrthancServer/Plugins/Samples/Common/OrthancPluginException.h', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
32 ('OrthancServer/Plugins/Samples/Common/OrthancPluginsExports.cmake', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
33 ('OrthancServer/Plugins/Samples/Common/VersionScriptPlugins.map', 'Plugins'), |
0 | 34 ] |
35 | |
36 SDK = [ | |
37 'orthanc/OrthancCPlugin.h', | |
38 ] | |
39 | |
40 | |
41 def Download(x): | |
42 branch = x[0] | |
43 source = x[1] | |
44 target = os.path.join(TARGET, x[2]) | |
132 | 45 print(target) |
0 | 46 |
47 try: | |
48 os.makedirs(os.path.dirname(target)) | |
49 except: | |
50 pass | |
51 | |
52 url = '%s/%s/%s' % (REPOSITORY, branch, source) | |
53 | |
132 | 54 with open(target, 'wb') as f: |
55 try: | |
56 f.write(urllib.request.urlopen(url).read()) | |
57 except: | |
58 print('ERROR %s' % url) | |
59 raise | |
0 | 60 |
61 | |
62 commands = [] | |
63 | |
64 for f in FILES: | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
65 commands.append([ 'default', |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
66 f[0], |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
67 os.path.join(f[1], os.path.basename(f[0])) ]) |
0 | 68 |
69 for f in SDK: | |
70 commands.append([ | |
71 'Orthanc-%s' % PLUGIN_SDK_VERSION, | |
41
393d2da0722a
upgrade to Orthanc SDK 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
36
diff
changeset
|
72 'OrthancServer/Plugins/Include/%s' % f, |
0 | 73 'Sdk-%s/%s' % (PLUGIN_SDK_VERSION, f) |
74 ]) | |
75 | |
76 | |
77 pool = multiprocessing.Pool(10) # simultaneous downloads | |
78 pool.map(Download, commands) |