changeset 512:fe0671a4c145

update SyncOrthancFolder.py to use Python 3
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 06 Dec 2021 12:59:24 +0100 (2021-12-06)
parents f478b78e58f3
children c76d81c6fee8 87b0e7e4d8d5
files Resources/Orthanc/CMake/AutoGeneratedCode.cmake Resources/Orthanc/CMake/Compiler.cmake Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Resources/Orthanc/CMake/DownloadPackage.cmake Resources/Orthanc/CMake/EmbedResources.py Resources/Orthanc/CMake/GoogleTestConfiguration.cmake Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Resources/Orthanc/Plugins/OrthancPluginException.h Resources/Orthanc/Plugins/OrthancPluginsExports.cmake Resources/Orthanc/Toolchains/LinuxStandardBaseToolchain.cmake Resources/Orthanc/Toolchains/MinGW-W64-Toolchain32.cmake Resources/Orthanc/Toolchains/MinGW-W64-Toolchain64.cmake Resources/Orthanc/Toolchains/MinGWToolchain.cmake Resources/SyncOrthancFolder.py
diffstat 14 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/Orthanc/CMake/AutoGeneratedCode.cmake	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/Orthanc/CMake/AutoGeneratedCode.cmake	Mon Dec 06 12:59:24 2021 +0100
@@ -2,6 +2,7 @@
 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 # Department, University Hospital of Liege, Belgium
 # Copyright (C) 2017-2021 Osimis S.A., Belgium
+# Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
 #
 # This program is free software: you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public License
--- a/Resources/Orthanc/CMake/Compiler.cmake	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/Orthanc/CMake/Compiler.cmake	Mon Dec 06 12:59:24 2021 +0100
@@ -2,6 +2,7 @@
 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 # Department, University Hospital of Liege, Belgium
 # Copyright (C) 2017-2021 Osimis S.A., Belgium
+# Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
 #
 # This program is free software: you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public License
--- a/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake	Mon Dec 06 12:59:24 2021 +0100
@@ -2,6 +2,7 @@
 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 # Department, University Hospital of Liege, Belgium
 # Copyright (C) 2017-2021 Osimis S.A., Belgium
+# Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
 #
 # This program is free software: you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public License
--- a/Resources/Orthanc/CMake/DownloadPackage.cmake	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/Orthanc/CMake/DownloadPackage.cmake	Mon Dec 06 12:59:24 2021 +0100
@@ -2,6 +2,7 @@
 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 # Department, University Hospital of Liege, Belgium
 # Copyright (C) 2017-2021 Osimis S.A., Belgium
+# Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
 #
 # This program is free software: you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public License
--- a/Resources/Orthanc/CMake/EmbedResources.py	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/Orthanc/CMake/EmbedResources.py	Mon Dec 06 12:59:24 2021 +0100
@@ -4,6 +4,7 @@
 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 # Department, University Hospital of Liege, Belgium
 # Copyright (C) 2017-2021 Osimis S.A., Belgium
+# Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
 #
 # This program is free software: you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public License
--- a/Resources/Orthanc/CMake/GoogleTestConfiguration.cmake	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/Orthanc/CMake/GoogleTestConfiguration.cmake	Mon Dec 06 12:59:24 2021 +0100
@@ -2,6 +2,7 @@
 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 # Department, University Hospital of Liege, Belgium
 # Copyright (C) 2017-2021 Osimis S.A., Belgium
+# Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
 #
 # This program is free software: you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public License
--- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h	Mon Dec 06 12:59:24 2021 +0100
@@ -3,6 +3,7 @@
  * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  * Copyright (C) 2017-2021 Osimis S.A., Belgium
+ * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
  *
  * This program is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
--- a/Resources/Orthanc/Plugins/OrthancPluginException.h	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/Orthanc/Plugins/OrthancPluginException.h	Mon Dec 06 12:59:24 2021 +0100
@@ -3,6 +3,7 @@
  * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  * Copyright (C) 2017-2021 Osimis S.A., Belgium
+ * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
  *
  * This program is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
--- a/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake	Mon Dec 06 12:59:24 2021 +0100
@@ -2,6 +2,7 @@
 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 # Department, University Hospital of Liege, Belgium
 # Copyright (C) 2017-2021 Osimis S.A., Belgium
+# Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
 #
 # This program is free software: you can redistribute it and/or
 # modify it under the terms of the GNU General Public License as
--- a/Resources/Orthanc/Toolchains/LinuxStandardBaseToolchain.cmake	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/Orthanc/Toolchains/LinuxStandardBaseToolchain.cmake	Mon Dec 06 12:59:24 2021 +0100
@@ -2,6 +2,7 @@
 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 # Department, University Hospital of Liege, Belgium
 # Copyright (C) 2017-2021 Osimis S.A., Belgium
+# Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
 #
 # This program is free software: you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public License
--- a/Resources/Orthanc/Toolchains/MinGW-W64-Toolchain32.cmake	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/Orthanc/Toolchains/MinGW-W64-Toolchain32.cmake	Mon Dec 06 12:59:24 2021 +0100
@@ -2,6 +2,7 @@
 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 # Department, University Hospital of Liege, Belgium
 # Copyright (C) 2017-2021 Osimis S.A., Belgium
+# Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
 #
 # This program is free software: you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public License
--- a/Resources/Orthanc/Toolchains/MinGW-W64-Toolchain64.cmake	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/Orthanc/Toolchains/MinGW-W64-Toolchain64.cmake	Mon Dec 06 12:59:24 2021 +0100
@@ -2,6 +2,7 @@
 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 # Department, University Hospital of Liege, Belgium
 # Copyright (C) 2017-2021 Osimis S.A., Belgium
+# Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
 #
 # This program is free software: you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public License
--- a/Resources/Orthanc/Toolchains/MinGWToolchain.cmake	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/Orthanc/Toolchains/MinGWToolchain.cmake	Mon Dec 06 12:59:24 2021 +0100
@@ -2,6 +2,7 @@
 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 # Department, University Hospital of Liege, Belgium
 # Copyright (C) 2017-2021 Osimis S.A., Belgium
+# Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
 #
 # This program is free software: you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public License
--- a/Resources/SyncOrthancFolder.py	Thu Dec 02 13:03:45 2021 +0100
+++ b/Resources/SyncOrthancFolder.py	Mon Dec 06 12:59:24 2021 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 #
 # This maintenance script updates the content of the "Orthanc" folder
@@ -8,7 +8,7 @@
 import multiprocessing
 import os
 import stat
-import urllib2
+import urllib.request
 
 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc')
 PLUGIN_SDK_VERSION = '1.7.0'
@@ -45,7 +45,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))
@@ -54,9 +54,9 @@
 
     url = '%s/%s/%s' % (REPOSITORY, branch, source)
 
-    with open(target, 'w') as f:
+    with open(target, 'wb') as f:
         try:
-            f.write(urllib2.urlopen(url).read())
+            f.write(urllib.request.urlopen(url).read())
         except:
             print('ERROR %s' % url)
             raise