Mercurial > hg > orthanc-databases
annotate Resources/SyncOrthancFolder.py @ 258:9856290c3cfd
todo
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 16 Apr 2021 17:45:11 +0200 |
parents | 23cf7def8e44 |
children | c7dc70a0a477 |
rev | line source |
---|---|
0 | 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') | |
123
121ab36c87bd
updating to Orthanc SDK 1.5.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
94
diff
changeset
|
14 PLUGIN_SDK_VERSION = [ '0.9.5', '1.4.0', '1.5.2', '1.5.4' ] |
149 | 15 REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file' |
0 | 16 |
17 FILES = [ | |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
18 ('OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'), |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
19 ('OrthancFramework/Resources/CMake/Compiler.cmake', 'CMake'), |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
20 ('OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake', 'CMake'), |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
21 ('OrthancFramework/Resources/CMake/DownloadPackage.cmake', 'CMake'), |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
22 ('OrthancFramework/Resources/CMake/GoogleTestConfiguration.cmake', 'CMake'), |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
23 ('OrthancFramework/Resources/EmbedResources.py', '.'), |
152 | 24 ('OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake', '.'), |
25 ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain32.cmake', '.'), | |
26 ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain64.cmake', '.'), | |
27 ('OrthancFramework/Resources/Toolchains/MinGWToolchain.cmake', '.'), | |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
28 ('OrthancServer/Plugins/Samples/Common/ExportedSymbolsPlugins.list', 'Plugins'), |
152 | 29 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp', 'Plugins'), |
30 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h', 'Plugins'), | |
31 ('OrthancServer/Plugins/Samples/Common/OrthancPluginException.h', 'Plugins'), | |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
32 ('OrthancServer/Plugins/Samples/Common/OrthancPluginsExports.cmake', 'Plugins'), |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
33 ('OrthancServer/Plugins/Samples/Common/VersionScriptPlugins.map', 'Plugins'), |
152 | 34 ('OrthancServer/Sources/Search/DatabaseConstraint.cpp', 'Databases'), |
35 ('OrthancServer/Sources/Search/DatabaseConstraint.h', 'Databases'), | |
36 ('OrthancServer/Sources/Search/ISqlLookupFormatter.cpp', 'Databases'), | |
37 ('OrthancServer/Sources/Search/ISqlLookupFormatter.h', 'Databases'), | |
0 | 38 ] |
39 | |
40 SDK = [ | |
41 'orthanc/OrthancCPlugin.h', | |
42 'orthanc/OrthancCDatabasePlugin.h', | |
43 ] | |
44 | |
45 | |
46 def Download(x): | |
47 branch = x[0] | |
48 source = x[1] | |
49 target = os.path.join(TARGET, x[2]) | |
50 print target | |
51 | |
52 try: | |
53 os.makedirs(os.path.dirname(target)) | |
54 except: | |
55 pass | |
56 | |
57 url = '%s/%s/%s' % (REPOSITORY, branch, source) | |
58 | |
59 with open(target, 'w') as f: | |
60 f.write(urllib2.urlopen(url).read()) | |
61 | |
62 | |
63 commands = [] | |
64 | |
65 for f in FILES: | |
66 commands.append([ 'default', | |
152 | 67 f[0], |
68 os.path.join(f[1], os.path.basename(f[0])) ]) | |
0 | 69 |
28
c0cb5d2cd696
checks depending on Orthanc version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
70 for version in PLUGIN_SDK_VERSION: |
c0cb5d2cd696
checks depending on Orthanc version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
71 for f in SDK: |
c0cb5d2cd696
checks depending on Orthanc version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
72 commands.append([ |
c0cb5d2cd696
checks depending on Orthanc version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
73 'Orthanc-%s' % version, |
c0cb5d2cd696
checks depending on Orthanc version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
74 'Plugins/Include/%s' % f, |
c0cb5d2cd696
checks depending on Orthanc version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
75 'Sdk-%s/%s' % (version, f) |
c0cb5d2cd696
checks depending on Orthanc version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
76 ]) |
0 | 77 |
78 | |
79 pool = multiprocessing.Pool(10) # simultaneous downloads | |
80 pool.map(Download, commands) |