Mercurial > hg > orthanc-wsi
changeset 241:5ed8d1cee52d
update SyncOrthancFolder.py to use Python 3
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 06 Dec 2021 13:24:33 +0100 |
parents | 24e5f64263a0 |
children | 49f647ed1b4c |
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/LinuxStandardBaseToolchain.cmake Resources/Orthanc/MinGW-W64-Toolchain32.cmake Resources/Orthanc/MinGW-W64-Toolchain64.cmake Resources/Orthanc/MinGWToolchain.cmake Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Resources/Orthanc/Plugins/OrthancPluginException.h Resources/Orthanc/Plugins/OrthancPluginsExports.cmake Resources/SyncOrthancFolder.py |
diffstat | 14 files changed, 58 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Resources/Orthanc/CMake/AutoGeneratedCode.cmake Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/Orthanc/CMake/AutoGeneratedCode.cmake Mon Dec 06 13:24:33 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 Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/Orthanc/CMake/Compiler.cmake Mon Dec 06 13:24:33 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 Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Mon Dec 06 13:24:33 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 @@ -130,6 +131,14 @@ set(ORTHANC_FRAMEWORK_MD5 "3ea66c09f64aca990016683b6375734e") elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.3") set(ORTHANC_FRAMEWORK_MD5 "9b86e6f00e03278293cd15643cc0233f") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.4") + set(ORTHANC_FRAMEWORK_MD5 "6d5ca4a73ac7d42445041ca79de1624d") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.5") + set(ORTHANC_FRAMEWORK_MD5 "10fc64de1254a095e5d3ed3931f0cfbb") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.6") + set(ORTHANC_FRAMEWORK_MD5 "4b5d05683d747c29b2860ad79d11e62e") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.7") + set(ORTHANC_FRAMEWORK_MD5 "c912bbb860d640d3ae3003b5c9698205") # Below this point are development snapshots that were used to # release some plugin, before an official release of the Orthanc
--- a/Resources/Orthanc/CMake/DownloadPackage.cmake Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/Orthanc/CMake/DownloadPackage.cmake Mon Dec 06 13:24:33 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 Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/Orthanc/CMake/EmbedResources.py Mon Dec 06 13:24:33 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/LinuxStandardBaseToolchain.cmake Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/Orthanc/LinuxStandardBaseToolchain.cmake Mon Dec 06 13:24:33 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/MinGW-W64-Toolchain32.cmake Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/Orthanc/MinGW-W64-Toolchain32.cmake Mon Dec 06 13:24:33 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/MinGW-W64-Toolchain64.cmake Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/Orthanc/MinGW-W64-Toolchain64.cmake Mon Dec 06 13:24:33 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/MinGWToolchain.cmake Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/Orthanc/MinGWToolchain.cmake Mon Dec 06 13:24:33 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.cpp Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Mon Dec 06 13:24:33 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 @@ -539,6 +540,13 @@ const std::string& password) { Clear(); + + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + return CheckHttp(OrthancPluginHttpPost(GetGlobalContext(), &buffer_, url.c_str(), body.c_str(), body.size(), username.empty() ? NULL : username.c_str(), @@ -552,6 +560,13 @@ const std::string& password) { Clear(); + + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + return CheckHttp(OrthancPluginHttpPut(GetGlobalContext(), &buffer_, url.c_str(), body.empty() ? NULL : body.c_str(), body.size(), @@ -1892,6 +1907,12 @@ ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + OrthancPlugins::MemoryBuffer answer; uint16_t status; OrthancPluginErrorCode code = OrthancPluginCallPeerApi @@ -1920,6 +1941,12 @@ ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + OrthancPlugins::MemoryBuffer answer; uint16_t status; OrthancPluginErrorCode code = OrthancPluginCallPeerApi @@ -2883,6 +2910,12 @@ MemoryBuffer answerBodyBuffer, answerHeadersBuffer; + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + OrthancPluginErrorCode error = OrthancPluginHttpClient( GetGlobalContext(), *answerBodyBuffer,
--- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Mon Dec 06 13:24:33 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 Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginException.h Mon Dec 06 13:24:33 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 Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake Mon Dec 06 13:24:33 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/SyncOrthancFolder.py Wed Jun 23 09:12:29 2021 +0200 +++ b/Resources/SyncOrthancFolder.py Mon Dec 06 13:24:33 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.0.0' @@ -54,7 +54,7 @@ branch = x[1] source = x[2] target = os.path.join(TARGET, x[3]) - print target + print(target) try: os.makedirs(os.path.dirname(target)) @@ -63,9 +63,9 @@ url = '%s/%s/%s' % (REPOSITORY % 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