diff Resources/SyncOrthancFolder.py @ 309:a8a2471ece25

sync orthanc folder
author Alain Mazy <am@osimis.io>
date Mon, 13 Nov 2023 21:19:57 +0100
parents 52b56343d268
children 68f7a794e686
line wrap: on
line diff
--- a/Resources/SyncOrthancFolder.py	Thu Feb 24 12:24:40 2022 +0100
+++ b/Resources/SyncOrthancFolder.py	Mon Nov 13 21:19:57 2023 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 #
 # This maintenance script updates the content of the "Orthanc" folder
@@ -8,11 +8,11 @@
 import multiprocessing
 import os
 import stat
-import urllib2
+import urllib.request
 
 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc')
 PLUGIN_SDK_VERSION = '0.9.5'
-REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file'
+REPOSITORY = 'https://orthanc.uclouvain.be/hg/orthanc/raw-file'
 
 FILES = [
     ('OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'),
@@ -42,7 +42,7 @@
     branch = x[0]
     source = x[1]
     target = os.path.join(TARGET, x[2])
-    print target
+    print(target)
 
     try:
         os.makedirs(os.path.dirname(target))
@@ -51,8 +51,12 @@
 
     url = '%s/%s/%s' % (REPOSITORY, branch, source)
 
-    with open(target, 'w') as f:
-        f.write(urllib2.urlopen(url).read())
+    with open(target, 'wb') as f:
+        try:
+            f.write(urllib.request.urlopen(url).read())
+        except:
+            print('ERROR %s' % url)
+            raise
 
 
 commands = []
@@ -65,7 +69,7 @@
 for f in SDK:
     commands.append([
         'Orthanc-%s' % PLUGIN_SDK_VERSION, 
-        'Plugins/Include/%s' % f,
+        'OrthancServer/Plugins/Include/%s' % f,
         'Sdk-%s/%s' % (PLUGIN_SDK_VERSION, f) 
     ])