Mercurial > hg > orthanc-python
annotate Resources/SyncOrthancFolder.py @ 50:70abe3ebbbfc
New Python function: "orthanc.RegisterIncomingHttpRequestFilter()"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 08 Dec 2020 19:02:30 +0100 |
parents | 9e466631660a |
children | 627b8a19fb9f |
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 import subprocess | |
13 | |
14 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') | |
49
9e466631660a
ugrade to Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
15 PLUGIN_SDK_VERSION = '1.8.1' |
0 | 16 REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file' |
17 | |
18 FILES = [ | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
19 ('OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
20 ('OrthancFramework/Resources/CMake/Compiler.cmake', 'CMake'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
21 ('OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake', 'CMake'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
22 ('OrthancFramework/Resources/CMake/DownloadPackage.cmake', 'CMake'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
23 |
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 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
29 ('OrthancServer/Plugins/Samples/Common/ExportedSymbolsPlugins.list', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
30 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
31 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
32 ('OrthancServer/Plugins/Samples/Common/OrthancPluginException.h', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
33 ('OrthancServer/Plugins/Samples/Common/OrthancPluginsExports.cmake', 'Plugins'), |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
34 ('OrthancServer/Plugins/Samples/Common/VersionScriptPlugins.map', 'Plugins'), |
0 | 35 ] |
36 | |
37 SDK = [ | |
38 'orthanc/OrthancCPlugin.h', | |
39 ] | |
40 | |
41 | |
42 def Download(x): | |
43 branch = x[0] | |
44 source = x[1] | |
45 target = os.path.join(TARGET, x[2]) | |
46 print target | |
47 | |
48 try: | |
49 os.makedirs(os.path.dirname(target)) | |
50 except: | |
51 pass | |
52 | |
53 url = '%s/%s/%s' % (REPOSITORY, branch, source) | |
54 | |
55 with open(target, 'w') as f: | |
56 f.write(urllib2.urlopen(url).read()) | |
57 | |
58 | |
59 commands = [] | |
60 | |
61 for f in FILES: | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
62 commands.append([ 'default', |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
63 f[0], |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
64 os.path.join(f[1], os.path.basename(f[0])) ]) |
0 | 65 |
66 for f in SDK: | |
67 commands.append([ | |
68 'Orthanc-%s' % PLUGIN_SDK_VERSION, | |
41
393d2da0722a
upgrade to Orthanc SDK 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
36
diff
changeset
|
69 'OrthancServer/Plugins/Include/%s' % f, |
0 | 70 'Sdk-%s/%s' % (PLUGIN_SDK_VERSION, f) |
71 ]) | |
72 | |
73 | |
74 pool = multiprocessing.Pool(10) # simultaneous downloads | |
75 pool.map(Download, commands) | |
76 | |
77 | |
41
393d2da0722a
upgrade to Orthanc SDK 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
36
diff
changeset
|
78 if False: |
393d2da0722a
upgrade to Orthanc SDK 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
36
diff
changeset
|
79 # Patch the SDK |
393d2da0722a
upgrade to Orthanc SDK 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
36
diff
changeset
|
80 subprocess.check_call([ 'patch', '-p0', '-i', os.path.join |
393d2da0722a
upgrade to Orthanc SDK 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
36
diff
changeset
|
81 (os.path.abspath(os.path.dirname(__file__)), |
393d2da0722a
upgrade to Orthanc SDK 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
36
diff
changeset
|
82 'OrthancCPlugin-%s.patch' % PLUGIN_SDK_VERSION) ], |
393d2da0722a
upgrade to Orthanc SDK 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
36
diff
changeset
|
83 cwd = os.path.join(os.path.dirname(__file__), |
393d2da0722a
upgrade to Orthanc SDK 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
36
diff
changeset
|
84 'Orthanc', |
393d2da0722a
upgrade to Orthanc SDK 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
36
diff
changeset
|
85 'Sdk-%s' % PLUGIN_SDK_VERSION, 'orthanc')) |