Mercurial > hg > orthanc-stone
view OrthancStone/Resources/SyncOrthancFolder.py @ 1566:a80363b15235
rollback wrongly committed test code
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 17 Sep 2020 15:23:06 +0200 |
parents | a48ae10857b1 |
children | 8c5f9864545f |
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 multiprocessing import os import stat import urllib2 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file' FILES = [ ('OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'), ('OrthancFramework/Resources/CMake/Compiler.cmake', 'CMake'), ('OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake', 'CMake'), ('OrthancFramework/Resources/CMake/DownloadPackage.cmake', 'CMake'), ('OrthancFramework/Resources/CMake/EmscriptenParameters.cmake', 'CMake'), ('OrthancFramework/Resources/CMake/GoogleTestConfiguration.cmake', 'CMake'), ('OrthancFramework/Resources/EmbedResources.py', 'CMake'), ('OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake', 'Toolchains'), ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain32.cmake', 'Toolchains'), ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain64.cmake', 'Toolchains'), ('OrthancFramework/Resources/Toolchains/MinGWToolchain.cmake', 'Toolchains'), ] def Download(x): branch = x[0] source = x[1] target = os.path.join(TARGET, x[2]) print target try: os.makedirs(os.path.dirname(target)) except: pass url = '%s/%s/%s' % (REPOSITORY, branch, source) with open(target, 'w') as f: f.write(urllib2.urlopen(url).read()) commands = [] for f in FILES: commands.append([ 'default', f[0], os.path.join(f[1], os.path.basename(f[0])) ]) pool = multiprocessing.Pool(10) # simultaneous downloads pool.map(Download, commands)