Mercurial > hg > orthanc-transfers
annotate Resources/SyncOrthancFolder.py @ 27:8f3137dc55c1
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 06 Jul 2020 21:33:11 +0200 |
parents | 065bc476bcdc |
children | 1256194e1c08 |
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') | |
14 PLUGIN_SDK_VERSION = [ '1.4.2' ] | |
20 | 15 REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file' |
0 | 16 |
17 FILES = [ | |
24
065bc476bcdc
use of OrthancPluginsExports.cmake, link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
18 ('OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'), |
065bc476bcdc
use of OrthancPluginsExports.cmake, link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
19 ('OrthancFramework/Resources/CMake/Compiler.cmake', 'CMake'), |
065bc476bcdc
use of OrthancPluginsExports.cmake, link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
20 ('OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake', 'CMake'), |
065bc476bcdc
use of OrthancPluginsExports.cmake, link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
21 ('OrthancFramework/Resources/CMake/DownloadPackage.cmake', 'CMake'), |
065bc476bcdc
use of OrthancPluginsExports.cmake, link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
22 ('OrthancFramework/Resources/CMake/GoogleTestConfiguration.cmake', 'CMake'), |
065bc476bcdc
use of OrthancPluginsExports.cmake, link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
23 ('OrthancFramework/Resources/EmbedResources.py', 'CMake'), |
065bc476bcdc
use of OrthancPluginsExports.cmake, link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
24 |
22 | 25 ('OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake', '.'), |
26 ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain32.cmake', '.'), | |
27 ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain64.cmake', '.'), | |
28 ('OrthancFramework/Resources/Toolchains/MinGWToolchain.cmake', '.'), | |
29 | |
24
065bc476bcdc
use of OrthancPluginsExports.cmake, link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
30 ('OrthancServer/Plugins/Samples/Common/ExportedSymbolsPlugins.list', 'Plugins'), |
22 | 31 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp', 'Plugins'), |
32 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h', 'Plugins'), | |
33 ('OrthancServer/Plugins/Samples/Common/OrthancPluginException.h', 'Plugins'), | |
24
065bc476bcdc
use of OrthancPluginsExports.cmake, link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
34 ('OrthancServer/Plugins/Samples/Common/OrthancPluginsExports.cmake', 'Plugins'), |
065bc476bcdc
use of OrthancPluginsExports.cmake, link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
35 ('OrthancServer/Plugins/Samples/Common/VersionScriptPlugins.map', 'Plugins'), |
0 | 36 ] |
37 | |
38 SDK = [ | |
39 'orthanc/OrthancCPlugin.h', | |
40 ] | |
41 | |
42 | |
43 def Download(x): | |
44 branch = x[0] | |
45 source = x[1] | |
46 target = os.path.join(TARGET, x[2]) | |
47 print target | |
48 | |
49 try: | |
50 os.makedirs(os.path.dirname(target)) | |
51 except: | |
52 pass | |
53 | |
54 url = '%s/%s/%s' % (REPOSITORY, branch, source) | |
55 | |
56 with open(target, 'w') as f: | |
57 f.write(urllib2.urlopen(url).read()) | |
58 | |
59 | |
60 commands = [] | |
61 | |
62 for f in FILES: | |
63 commands.append([ 'default', | |
22 | 64 f[0], |
65 os.path.join(f[1], os.path.basename(f[0])) ]) | |
0 | 66 |
7
151e29acbb13
use orthanc sdk 1.4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
67 for version in PLUGIN_SDK_VERSION: |
151e29acbb13
use orthanc sdk 1.4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
68 for f in SDK: |
151e29acbb13
use orthanc sdk 1.4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
69 commands.append([ |
151e29acbb13
use orthanc sdk 1.4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
70 'Orthanc-%s' % version, |
151e29acbb13
use orthanc sdk 1.4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
71 'Plugins/Include/%s' % f, |
151e29acbb13
use orthanc sdk 1.4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
72 'Sdk-%s/%s' % (version, f) |
151e29acbb13
use orthanc sdk 1.4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
73 ]) |
0 | 74 |
75 | |
76 pool = multiprocessing.Pool(10) # simultaneous downloads | |
77 pool.map(Download, commands) |