comparison Resources/SyncOrthancFolder.py @ 51:7b4b8b82112e

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 Jul 2015 15:56:27 +0200
parents bd68285248b7
children 56930e8c30b7
comparison
equal deleted inserted replaced
50:2578545f8d87 51:7b4b8b82112e
5 # to match the latest version of the Orthanc source code. 5 # to match the latest version of the Orthanc source code.
6 # 6 #
7 7
8 import os 8 import os
9 import shutil 9 import shutil
10 import urllib2
11
12 PLUGIN_SDK_VERSION = '0.9.1'
10 13
11 SOURCE = '/home/jodogne/Subversion/Orthanc' 14 SOURCE = '/home/jodogne/Subversion/Orthanc'
12 TARGET = os.path.join(os.path.dirname(__file__), '..', 'Orthanc') 15 TARGET = os.path.join(os.path.dirname(__file__), '..', 'Orthanc')
16 REPOSITORY = 'https://bitbucket.org/sjodogne/orthanc/raw/Orthanc-%s/Plugins/Include' % PLUGIN_SDK_VERSION
13 17
14 FILES = [ 18 FILES = [
15 'Core/ChunkedBuffer.cpp', 19 'Core/ChunkedBuffer.cpp',
16 'Core/ChunkedBuffer.h', 20 'Core/ChunkedBuffer.h',
17 'Core/Enumerations.cpp', 21 'Core/Enumerations.cpp',
83 'Resources/ThirdParty/VisualStudio/stdint.h', 87 'Resources/ThirdParty/VisualStudio/stdint.h',
84 'Resources/WindowsResources.py', 88 'Resources/WindowsResources.py',
85 'Resources/WindowsResources.rc', 89 'Resources/WindowsResources.rc',
86 ] 90 ]
87 91
92 SDK = [
93 'orthanc/OrthancCPlugin.h',
94 ]
95
88 for f in FILES: 96 for f in FILES:
89 source = os.path.join(SOURCE, f) 97 source = os.path.join(SOURCE, f)
90 target = os.path.join(TARGET, f) 98 target = os.path.join(TARGET, f)
91 try: 99 try:
92 os.makedirs(os.path.dirname(target)) 100 os.makedirs(os.path.dirname(target))
93 except: 101 except:
94 pass 102 pass
95 103
96 shutil.copy(source, target) 104 shutil.copy(source, target)
105
106 for f in SDK:
107 source = '%s/%s' % (REPOSITORY, f)
108 target = os.path.join(TARGET, 'Sdk-%s' % PLUGIN_SDK_VERSION, f)
109 try:
110 os.makedirs(os.path.dirname(target))
111 except:
112 pass
113
114 with open(target, 'w') as g:
115 g.write(urllib2.urlopen(source).read())