Mercurial > hg > orthanc-python
annotate Resources/SyncOrthancFolder.py @ 188:87e546600cbe java-code-model
added Sources/Autogenerated/orthanc.pyi
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 02 Jul 2024 17:03:08 +0200 |
parents | d08d75fc6d6a |
children | 0c5da632f34d |
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 | |
175
c012edac593e
patching the Orthanc SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
145
diff
changeset
|
11 import subprocess |
132 | 12 import urllib.request |
0 | 13 |
14 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') | |
187
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
15 ORTHANC_JAVA_VERSION = '1.0' |
107
461dfb859ac7
upgrade to Orthanc SDK 1.10.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
16 PLUGIN_SDK_VERSION = '1.10.0' |
187
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
17 ORTHANC_CORE_REPOSITORY = 'https://orthanc.uclouvain.be/hg/orthanc/raw-file' |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
18 ORTHANC_JAVA_REPOSITORY = 'https://orthanc.uclouvain.be/hg/orthanc-java/raw-file' |
0 | 19 |
20 FILES = [ | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
21 ('OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
22 ('OrthancFramework/Resources/CMake/Compiler.cmake', 'CMake'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
23 ('OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake', 'CMake'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
24 ('OrthancFramework/Resources/CMake/DownloadPackage.cmake', 'CMake'), |
145 | 25 ('OrthancFramework/Resources/CMake/GoogleTestConfiguration.cmake', 'CMake'), |
26 ('OrthancFramework/Resources/EmbedResources.py', 'CMake'), | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
27 ('OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake', 'Toolchains'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
28 ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain32.cmake', 'Toolchains'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
29 ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain64.cmake', 'Toolchains'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
30 ('OrthancFramework/Resources/Toolchains/MinGWToolchain.cmake', 'Toolchains'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
31 ('OrthancServer/Plugins/Samples/Common/ExportedSymbolsPlugins.list', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
32 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
33 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
34 ('OrthancServer/Plugins/Samples/Common/OrthancPluginException.h', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
35 ('OrthancServer/Plugins/Samples/Common/OrthancPluginsExports.cmake', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
36 ('OrthancServer/Plugins/Samples/Common/VersionScriptPlugins.map', 'Plugins'), |
0 | 37 ] |
38 | |
39 | |
40 def Download(x): | |
187
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
41 repository = x[0] |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
42 branch = x[1] |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
43 source = x[2] |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
44 target = os.path.join(TARGET, x[3]) |
132 | 45 print(target) |
0 | 46 |
47 try: | |
48 os.makedirs(os.path.dirname(target)) | |
49 except: | |
50 pass | |
51 | |
187
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
52 url = '%s/%s/%s' % (repository, branch, source) |
0 | 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: | |
187
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
65 commands.append([ |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
66 ORTHANC_CORE_REPOSITORY, |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
67 'default', |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
68 f[0], |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
69 os.path.join(f[1], os.path.basename(f[0])) |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
70 ]) |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
71 |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
72 |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
73 commands.append([ |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
74 ORTHANC_JAVA_REPOSITORY, |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
75 'OrthancJava-%s' % ORTHANC_JAVA_VERSION, |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
76 'Resources/Orthanc/Sdk-%s/orthanc/OrthancCPlugin.h' % PLUGIN_SDK_VERSION, |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
77 'Sdk-%s/orthanc/OrthancCPlugin.h' % PLUGIN_SDK_VERSION, |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
78 ]) |
0 | 79 |
187
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
80 |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
81 commands.append([ |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
82 ORTHANC_JAVA_REPOSITORY, |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
83 'OrthancJava-%s' % ORTHANC_JAVA_VERSION, |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
84 'CodeGeneration/CodeModel.json', |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
85 'Sdk-%s/CodeModel.json' % PLUGIN_SDK_VERSION, |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
86 ]) |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
87 |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
88 |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
89 commands.append([ |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
90 ORTHANC_JAVA_REPOSITORY, |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
91 'OrthancJava-%s' % ORTHANC_JAVA_VERSION, |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
92 'CodeGeneration/CodeModel.json.license', |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
93 'Sdk-%s/CodeModel.json.license' % PLUGIN_SDK_VERSION, |
d08d75fc6d6a
synchronization of the code model with orthanc-java project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
175
diff
changeset
|
94 ]) |
0 | 95 |
96 | |
97 pool = multiprocessing.Pool(10) # simultaneous downloads | |
98 pool.map(Download, commands) |