Mercurial > hg > orthanc-stone
annotate Resources/SyncOrthancFolder.py @ 33:12987d11be33
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 19 Dec 2016 11:29:23 +0100 |
parents | 9aace933cb64 |
children | 981f0257e080 |
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 sys | |
9 import multiprocessing | |
10 import os | |
11 import stat | |
12 import urllib2 | |
13 | |
16 | 14 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') |
0 | 15 REPOSITORY = 'https://bitbucket.org/sjodogne/orthanc/raw' |
16 | |
17 FILES = [ | |
18 'Core/ChunkedBuffer.cpp', | |
19 'Core/ChunkedBuffer.h', | |
20 'Core/Compression/DeflateBaseCompressor.cpp', | |
21 'Core/Compression/DeflateBaseCompressor.h', | |
22 'Core/Compression/GzipCompressor.cpp', | |
23 'Core/Compression/GzipCompressor.h', | |
24 'Core/Compression/IBufferCompressor.h', | |
25 'Core/Enumerations.cpp', | |
26 'Core/Enumerations.h', | |
27 'Core/HttpClient.cpp', | |
28 'Core/HttpClient.h', | |
29 'Core/Images/Image.cpp', | |
30 'Core/Images/Image.h', | |
31 'Core/Images/ImageAccessor.cpp', | |
32 'Core/Images/ImageAccessor.h', | |
33 'Core/Images/ImageBuffer.cpp', | |
34 'Core/Images/ImageBuffer.h', | |
35 'Core/Images/ImageProcessing.cpp', | |
36 'Core/Images/ImageProcessing.h', | |
37 'Core/Images/JpegErrorManager.cpp', | |
38 'Core/Images/JpegErrorManager.h', | |
39 'Core/Images/JpegReader.cpp', | |
40 'Core/Images/JpegReader.h', | |
41 'Core/Images/PngReader.cpp', | |
42 'Core/Images/PngReader.h', | |
43 'Core/Logging.cpp', | |
44 'Core/Logging.h', | |
45 'Core/OrthancException.h', | |
46 'Core/PrecompiledHeaders.h', | |
15 | 47 'Core/SystemToolbox.cpp', |
48 'Core/SystemToolbox.h', | |
0 | 49 'Core/Toolbox.cpp', |
50 'Core/Toolbox.h', | |
51 'Core/WebServiceParameters.cpp', | |
52 'Core/WebServiceParameters.h', | |
31
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
53 'Plugins/Samples/Common/DicomDatasetReader.cpp', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
54 'Plugins/Samples/Common/DicomDatasetReader.h', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
55 'Plugins/Samples/Common/DicomPath.cpp', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
56 'Plugins/Samples/Common/DicomPath.h', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
57 'Plugins/Samples/Common/DicomTag.cpp', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
58 'Plugins/Samples/Common/DicomTag.h', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
59 'Plugins/Samples/Common/FullOrthancDataset.cpp', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
60 'Plugins/Samples/Common/FullOrthancDataset.h', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
61 'Plugins/Samples/Common/IDicomDataset.h', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
62 'Plugins/Samples/Common/IOrthancConnection.cpp', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
63 'Plugins/Samples/Common/IOrthancConnection.h', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
64 'Plugins/Samples/Common/OrthancHttpConnection.cpp', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
65 'Plugins/Samples/Common/OrthancHttpConnection.h', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
66 'Plugins/Samples/Common/OrthancPluginException.h', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
67 'Plugins/Samples/Common/SimplifiedOrthancDataset.cpp', |
9aace933cb64
sharing code with the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
68 'Plugins/Samples/Common/SimplifiedOrthancDataset.h', |
0 | 69 'Resources/CMake/AutoGeneratedCode.cmake', |
70 'Resources/CMake/BoostConfiguration.cmake', | |
71 'Resources/CMake/Compiler.cmake', | |
72 'Resources/CMake/DownloadPackage.cmake', | |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
16
diff
changeset
|
73 'Resources/CMake/GoogleTestConfiguration.cmake', |
0 | 74 'Resources/CMake/JsonCppConfiguration.cmake', |
75 'Resources/CMake/LibCurlConfiguration.cmake', | |
76 'Resources/CMake/LibIconvConfiguration.cmake', | |
77 'Resources/CMake/LibJpegConfiguration.cmake', | |
78 'Resources/CMake/LibPngConfiguration.cmake', | |
79 'Resources/CMake/OpenSslConfiguration.cmake', | |
80 'Resources/CMake/ZlibConfiguration.cmake', | |
81 'Resources/EmbedResources.py', | |
82 'Resources/MinGW-W64-Toolchain32.cmake', | |
83 'Resources/MinGW-W64-Toolchain64.cmake', | |
84 'Resources/MinGWToolchain.cmake', | |
85 'Resources/ThirdParty/VisualStudio/stdint.h', | |
86 'Resources/ThirdParty/base64/base64.cpp', | |
87 'Resources/ThirdParty/base64/base64.h', | |
88 'Resources/ThirdParty/patch/msys-1.0.dll', | |
89 'Resources/ThirdParty/patch/patch.exe', | |
90 'Resources/ThirdParty/patch/patch.exe.manifest', | |
91 'Resources/WindowsResources.py', | |
92 'Resources/WindowsResources.rc', | |
93 ] | |
94 | |
95 EXE = [ | |
96 'Resources/WindowsResources.py', | |
97 ] | |
98 | |
99 | |
100 def Download(x): | |
101 branch = x[0] | |
102 source = x[1] | |
103 target = os.path.join(TARGET, x[2]) | |
104 print target | |
105 | |
106 try: | |
107 os.makedirs(os.path.dirname(target)) | |
108 except: | |
109 pass | |
110 | |
23 | 111 url = '%s/%s/%s' % (REPOSITORY, branch, source) |
0 | 112 |
113 with open(target, 'w') as f: | |
114 f.write(urllib2.urlopen(url).read()) | |
115 | |
116 | |
117 commands = [] | |
118 | |
119 for f in FILES: | |
120 commands.append([ 'default', f, f ]) | |
121 | |
122 | |
123 if sys.platform == 'win32': | |
124 # Sequential execution | |
125 for c in commands: | |
126 Download(c) | |
127 else: | |
128 # Concurrent downloads | |
129 pool = multiprocessing.Pool(10) | |
130 pool.map(Download, commands) | |
131 | |
132 | |
133 for exe in EXE: | |
134 path = os.path.join(TARGET, exe) | |
135 st = os.stat(path) | |
136 os.chmod(path, st.st_mode | stat.S_IEXEC) | |
137 |