|
@@ -21,8 +21,18 @@ def getSuitePath():
|
|
|
os.makedirs(installDir)
|
|
|
return installDir
|
|
|
|
|
|
+def buildGITURL(server,project,path,branch='master'):
|
|
|
+ projectURL='%2f'.join(project)
|
|
|
+ pathURL='%2f'.join(path)
|
|
|
+ return server+'/api/v4/projects/'+projectURL+'/repository/files/'+pathURL+'?ref='+branch
|
|
|
+
|
|
|
+
|
|
|
def getResources():
|
|
|
- remoteSourcesURL="http://wiscigt.powertheword.com/api/v4/projects/labkey%2fnixsuite/repository/files/remoteResources%2fresources.json?ref=master"
|
|
|
+ server='http://wiscigt.powertheword.com'
|
|
|
+ project=['labkey','nixsuite']
|
|
|
+ path=['remoteResources','resources.json']
|
|
|
+
|
|
|
+ remoteSourcesURL=buildGITURL(server,project,path)
|
|
|
http = urllib3.PoolManager()
|
|
|
r = http.request('GET', remoteSourcesURL)
|
|
|
#returns a JSON
|
|
@@ -37,7 +47,7 @@ def getResources():
|
|
|
|
|
|
def loadModule(slicer,qt,name,moduleName):
|
|
|
loadLibrary(name)
|
|
|
- modulePath=os.path.join(getSuitePath(),name,'slicerModule',moduleName+'.py')
|
|
|
+ modulePath=os.path.join(getSuitePath(),name,'slicerModules',moduleName+'.py')
|
|
|
factoryManager = slicer.app.moduleManager().factoryManager()
|
|
|
|
|
|
factoryManager.registerModule(qt.QFileInfo(modulePath))
|
|
@@ -60,7 +70,9 @@ def loadLibrary(name):
|
|
|
tempFile=os.path.join(tempDir,name+'.zip')
|
|
|
|
|
|
http = urllib3.PoolManager()
|
|
|
- r = http.request('GET', remoteSources[name], preload_content=False)
|
|
|
+
|
|
|
+ rsource=remoteSources[name]
|
|
|
+ r = http.request('GET', rsource['url'], preload_content=False)
|
|
|
chunk_size=65536
|
|
|
with open(tempFile, 'wb') as out:
|
|
|
while True:
|
|
@@ -88,7 +100,7 @@ def loadLibrary(name):
|
|
|
|
|
|
#rename
|
|
|
#this is the best guess of the relation between zip directory and name
|
|
|
- zipName=name.lower()+'-master'
|
|
|
+ zipName=name.lower()+'-'+rsource['branch']
|
|
|
os.rename(os.path.join(installDir,zipName),finalName)
|
|
|
|
|
|
sys.path.append(finalName)
|