Mercurial > hg > orthanc-postgresql
view Resources/SyncOrthancFolder.py @ 71:ce0aee24667b
improvement to sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 09 Oct 2015 18:18:24 +0200 |
parents | d02887df2380 |
children | 7479f1549b43 |
line wrap: on
line source
#!/usr/bin/python # # This maintenance script updates the content of the "Orthanc" folder # to match the latest version of the Orthanc source code. # import os import urllib2 import multiprocessing TARGET = os.path.join(os.path.dirname(__file__), '..', 'Orthanc') BRANCH = 'default' PLUGIN_SDK_VERSION = '0.9.4' FILES = [ 'Plugins/Samples/Common/ExportedSymbols.list', 'Plugins/Samples/Common/VersionScript.map', 'Resources/CMake/AutoGeneratedCode.cmake', 'Resources/CMake/BoostConfiguration.cmake', 'Resources/CMake/Compiler.cmake', 'Resources/CMake/DownloadPackage.cmake', 'Resources/CMake/GoogleTestConfiguration.cmake', 'Resources/CMake/JsonCppConfiguration.cmake', 'Resources/EmbedResources.py', 'Resources/MinGW-W64-Toolchain32.cmake', 'Resources/MinGW-W64-Toolchain64.cmake', 'Resources/MinGWToolchain.cmake', 'Resources/ThirdParty/VisualStudio/stdint.h', 'Resources/WindowsResources.py', 'Resources/WindowsResources.rc', ] SDK = [ 'orthanc/OrthancCPlugin.h', 'orthanc/OrthancCDatabasePlugin.h', 'orthanc/OrthancCppDatabasePlugin.h', ] def Download(x): branch = x[0] source = x[1] target = os.path.join(TARGET, source) print target try: os.makedirs(os.path.dirname(target)) except: pass url = 'https://bitbucket.org/sjodogne/orthanc/raw/%s/%s' % (branch, source) with open(target, 'w') as f: f.write(urllib2.urlopen(url).read()) commands = [] for f in FILES: commands.append([ BRANCH, f ]) for f in SDK: commands.append([ 'Orthanc-%s' % PLUGIN_SDK_VERSION, 'Plugins/Include/%s' % f ]) pool = multiprocessing.Pool(10) # simultaneous downloads pool.map(Download, commands)