changeset 101:71bca28a4645

remove the dependency upon installing Orthanc to generate the default configuration file
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 02 Feb 2017 15:56:34 +0100
parents 2af6c0fb850d
children 9671578fd4d3
files GenerateConfigurationForTests.py
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/GenerateConfigurationForTests.py	Wed Jan 04 16:40:03 2017 +0100
+++ b/GenerateConfigurationForTests.py	Thu Feb 02 15:56:34 2017 +0100
@@ -26,6 +26,8 @@
 import subprocess
 import sys
 import json
+import urllib
+
 
 ##
 ## Parse the command-line arguments
@@ -76,7 +78,16 @@
 # Retrieve the IP address of the localhost
 ip = socket.gethostbyname(socket.gethostname())
 
-subprocess.check_call([ 'Orthanc', '--config=%s' % args.target ])
+
+# Download the content of the default configuration file
+with open(args.target, 'w') as f:
+    url = 'https://bitbucket.org/sjodogne/orthanc/raw/Orthanc-1.2.0/Resources/Configuration.json'
+    http = urllib.urlopen(url)
+    if http.getcode() != 200:
+        raise Exception('Cannot download: %s' % url)
+    
+    f.write(http.read())
+    
 
 with open(args.target, 'r') as f:
     # Remove the C++-style comments