Mercurial > hg > orthanc-gcp
comparison Resources/SyncOrthancFolder.py @ 49:c71a008fc1e3
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 22 Nov 2023 07:59:30 +0100 |
parents | 92b93845d84b |
children |
comparison
equal
deleted
inserted
replaced
48:2e6c0fe4bdee | 49:c71a008fc1e3 |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python3 |
2 | 2 |
3 # | 3 # |
4 # This maintenance script updates the content of the "Orthanc" folder | 4 # This maintenance script updates the content of the "Orthanc" folder |
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 multiprocessing | 8 import multiprocessing |
9 import os | 9 import os |
10 import stat | 10 import stat |
11 import urllib2 | 11 import urllib.request |
12 | 12 |
13 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') | 13 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') |
14 PLUGIN_SDK_VERSION = '1.0.0' | 14 PLUGIN_SDK_VERSION = '1.0.0' |
15 REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file' | 15 REPOSITORY = 'https://orthanc.uclouvain.be/hg/orthanc/raw-file' |
16 | 16 |
17 FILES = [ | 17 FILES = [ |
18 ('OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'), | 18 ('OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'), |
19 ('OrthancFramework/Resources/CMake/Compiler.cmake', 'CMake'), | 19 ('OrthancFramework/Resources/CMake/Compiler.cmake', 'CMake'), |
20 ('OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake', 'CMake'), | 20 ('OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake', 'CMake'), |
45 except: | 45 except: |
46 pass | 46 pass |
47 | 47 |
48 url = '%s/%s/%s' % (REPOSITORY, branch, source) | 48 url = '%s/%s/%s' % (REPOSITORY, branch, source) |
49 | 49 |
50 with open(target, 'w') as f: | 50 with open(target, 'wb') as f: |
51 f.write(urllib2.urlopen(url).read()) | 51 try: |
52 f.write(urllib.request.urlopen(url).read()) | |
53 except: | |
54 print('ERROR: %s' % url) | |
55 raise | |
52 | 56 |
53 | 57 |
54 commands = [] | 58 commands = [] |
55 | 59 |
56 for f in FILES: | 60 for f in FILES: |