Mercurial > hg > orthanc-stone
annotate Resources/SyncOrthancFolder.py @ 47:28956ed68280
agpl license
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 27 Apr 2017 11:00:15 +0200 |
parents | 981f0257e080 |
children | d20e25cfcf3a |
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', |
0 | 67 'Resources/CMake/AutoGeneratedCode.cmake', |
68 'Resources/CMake/BoostConfiguration.cmake', | |
69 'Resources/CMake/Compiler.cmake', | |
70 'Resources/CMake/DownloadPackage.cmake', | |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
16
diff
changeset
|
71 'Resources/CMake/GoogleTestConfiguration.cmake', |
0 | 72 'Resources/CMake/JsonCppConfiguration.cmake', |
73 'Resources/CMake/LibCurlConfiguration.cmake', | |
74 'Resources/CMake/LibIconvConfiguration.cmake', | |
75 'Resources/CMake/LibJpegConfiguration.cmake', | |
76 'Resources/CMake/LibPngConfiguration.cmake', | |
77 'Resources/CMake/OpenSslConfiguration.cmake', | |
78 'Resources/CMake/ZlibConfiguration.cmake', | |
79 'Resources/EmbedResources.py', | |
80 'Resources/MinGW-W64-Toolchain32.cmake', | |
81 'Resources/MinGW-W64-Toolchain64.cmake', | |
82 'Resources/MinGWToolchain.cmake', | |
83 'Resources/ThirdParty/VisualStudio/stdint.h', | |
84 'Resources/ThirdParty/base64/base64.cpp', | |
85 'Resources/ThirdParty/base64/base64.h', | |
86 'Resources/ThirdParty/patch/msys-1.0.dll', | |
87 'Resources/ThirdParty/patch/patch.exe', | |
88 'Resources/ThirdParty/patch/patch.exe.manifest', | |
89 'Resources/WindowsResources.py', | |
90 'Resources/WindowsResources.rc', | |
91 ] | |
92 | |
93 EXE = [ | |
94 'Resources/WindowsResources.py', | |
95 ] | |
96 | |
97 | |
98 def Download(x): | |
99 branch = x[0] | |
100 source = x[1] | |
101 target = os.path.join(TARGET, x[2]) | |
102 print target | |
103 | |
104 try: | |
105 os.makedirs(os.path.dirname(target)) | |
106 except: | |
107 pass | |
108 | |
23 | 109 url = '%s/%s/%s' % (REPOSITORY, branch, source) |
0 | 110 |
111 with open(target, 'w') as f: | |
112 f.write(urllib2.urlopen(url).read()) | |
113 | |
114 | |
115 commands = [] | |
116 | |
117 for f in FILES: | |
118 commands.append([ 'default', f, f ]) | |
119 | |
120 | |
121 if sys.platform == 'win32': | |
122 # Sequential execution | |
123 for c in commands: | |
124 Download(c) | |
125 else: | |
126 # Concurrent downloads | |
127 pool = multiprocessing.Pool(10) | |
128 pool.map(Download, commands) | |
129 | |
130 | |
131 for exe in EXE: | |
132 path = os.path.join(TARGET, exe) | |
133 st = os.stat(path) | |
134 os.chmod(path, st.st_mode | stat.S_IEXEC) | |
135 |