Mercurial > hg > orthanc-wsi
comparison Resources/SyncOrthancFolder.py @ 196:b0bd22077cd8
sharing code with orthanc-stone
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 01 Jul 2020 17:57:38 +0200 |
parents | e57e6ca5303d |
children | e5964793a790 |
comparison
equal
deleted
inserted
replaced
195:fda17c92d784 | 196:b0bd22077cd8 |
---|---|
10 import stat | 10 import stat |
11 import urllib2 | 11 import urllib2 |
12 | 12 |
13 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') | 13 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') |
14 PLUGIN_SDK_VERSION = '1.0.0' | 14 PLUGIN_SDK_VERSION = '1.0.0' |
15 REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file' | 15 REPOSITORY = 'https://hg.orthanc-server.com/%s/raw-file' |
16 | 16 |
17 FILES = [ | 17 FILES = [ |
18 ('OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake', '.'), | 18 ('orthanc', 'OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake', '.'), |
19 ('OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake', '.'), | 19 ('orthanc', 'OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake', '.'), |
20 ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain32.cmake', '.'), | 20 ('orthanc', 'OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain32.cmake', '.'), |
21 ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain64.cmake', '.'), | 21 ('orthanc', 'OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain64.cmake', '.'), |
22 ('OrthancFramework/Resources/Toolchains/MinGWToolchain.cmake', '.'), | 22 ('orthanc', 'OrthancFramework/Resources/Toolchains/MinGWToolchain.cmake', '.'), |
23 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp', 'Plugins'), | 23 |
24 ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h', 'Plugins'), | 24 ('orthanc', 'OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp', 'Plugins'), |
25 ('OrthancServer/Plugins/Samples/Common/OrthancPluginException.h', 'Plugins'), | 25 ('orthanc', 'OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h', 'Plugins'), |
26 ('orthanc', 'OrthancServer/Plugins/Samples/Common/OrthancPluginException.h', 'Plugins'), | |
27 | |
28 ('orthanc-stone', 'Framework/Toolbox/OrthancDatasets/DicomDatasetReader.cpp', 'Stone'), | |
29 ('orthanc-stone', 'Framework/Toolbox/OrthancDatasets/DicomDatasetReader.h', 'Stone'), | |
30 ('orthanc-stone', 'Framework/Toolbox/OrthancDatasets/DicomPath.cpp', 'Stone'), | |
31 ('orthanc-stone', 'Framework/Toolbox/OrthancDatasets/DicomPath.h', 'Stone'), | |
32 ('orthanc-stone', 'Framework/Toolbox/OrthancDatasets/FullOrthancDataset.cpp', 'Stone'), | |
33 ('orthanc-stone', 'Framework/Toolbox/OrthancDatasets/FullOrthancDataset.h', 'Stone'), | |
34 ('orthanc-stone', 'Framework/Toolbox/OrthancDatasets/IDicomDataset.h', 'Stone'), | |
35 ('orthanc-stone', 'Framework/Toolbox/OrthancDatasets/IOrthancConnection.cpp', 'Stone'), | |
36 ('orthanc-stone', 'Framework/Toolbox/OrthancDatasets/IOrthancConnection.h', 'Stone'), | |
37 ('orthanc-stone', 'Framework/Toolbox/OrthancDatasets/OrthancHttpConnection.cpp', 'Stone'), | |
38 ('orthanc-stone', 'Framework/Toolbox/OrthancDatasets/OrthancHttpConnection.h', 'Stone'), | |
26 ] | 39 ] |
27 | 40 |
28 SDK = [ | 41 SDK = [ |
29 'orthanc/OrthancCPlugin.h', | 42 'orthanc/OrthancCPlugin.h', |
30 ] | 43 ] |
31 | 44 |
32 | 45 |
33 def Download(x): | 46 def Download(x): |
34 branch = x[0] | 47 repository = x[0] |
35 source = x[1] | 48 branch = x[1] |
36 target = os.path.join(TARGET, x[2]) | 49 source = x[2] |
50 target = os.path.join(TARGET, x[3]) | |
37 print target | 51 print target |
38 | 52 |
39 try: | 53 try: |
40 os.makedirs(os.path.dirname(target)) | 54 os.makedirs(os.path.dirname(target)) |
41 except: | 55 except: |
42 pass | 56 pass |
43 | 57 |
44 url = '%s/%s/%s' % (REPOSITORY, branch, source) | 58 url = '%s/%s/%s' % (REPOSITORY % repository, branch, source) |
45 | 59 |
46 with open(target, 'w') as f: | 60 with open(target, 'w') as f: |
47 f.write(urllib2.urlopen(url).read()) | 61 try: |
62 f.write(urllib2.urlopen(url).read()) | |
63 except: | |
64 print('ERROR: %s' % url) | |
65 raise | |
48 | 66 |
49 | 67 |
50 commands = [] | 68 commands = [] |
51 | 69 |
52 for f in FILES: | 70 for f in FILES: |
53 commands.append([ 'default', | 71 commands.append([ f[0], |
54 f[0], | 72 'default', |
55 os.path.join(f[1], os.path.basename(f[0])) ]) | 73 f[1], |
74 os.path.join(f[2], os.path.basename(f[1])) ]) | |
56 | 75 |
57 for f in SDK: | 76 for f in SDK: |
58 commands.append([ | 77 commands.append([ |
78 'orthanc', | |
59 'Orthanc-%s' % PLUGIN_SDK_VERSION, | 79 'Orthanc-%s' % PLUGIN_SDK_VERSION, |
60 'Plugins/Include/%s' % f, | 80 'Plugins/Include/%s' % f, |
61 'Sdk-%s/%s' % (PLUGIN_SDK_VERSION, f) | 81 'Sdk-%s/%s' % (PLUGIN_SDK_VERSION, f) |
62 ]) | 82 ]) |
63 | 83 |