|
@@ -22,9 +22,15 @@ def getSuitePath():
|
|
|
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
|
|
|
+ if server.find('wiscigt')>-1:
|
|
|
+ projectURL='%2f'.join(project)
|
|
|
+ pathURL='%2f'.join(path)
|
|
|
+ return server+'/api/v4/projects/'+projectURL+'/repository/files/'+pathURL+'?ref='+branch
|
|
|
+ if server.find('fmf.uni-lj.si')>-1:
|
|
|
+ projectURL='/'.join(project)#studen/nixSuite
|
|
|
+ pathURL='/'.join(path)
|
|
|
+ return '/'.join([server,projectURL,'raw',branch,pathURL])
|
|
|
+
|
|
|
|
|
|
|
|
|
def getResources():
|
|
@@ -32,14 +38,25 @@ def getResources():
|
|
|
project=['labkey','nixsuite']
|
|
|
path=['remoteResources','resources.json']
|
|
|
|
|
|
+ server='https://git0.fmf.uni-lj.si'
|
|
|
+ project=['studen','nixSuite']
|
|
|
+
|
|
|
remoteSourcesURL=buildGITURL(server,project,path)
|
|
|
+ print('remoteSourcesURL {}'.format(remoteSourcesURL))
|
|
|
http = urllib3.PoolManager()
|
|
|
r = http.request('GET', remoteSourcesURL)
|
|
|
#returns a JSON
|
|
|
encoding=chardet.detect(r.data)['encoding']
|
|
|
- jsonData=json.loads(r.data.decode(encoding))
|
|
|
+ dataDecoded=r.data.decode(encoding)
|
|
|
+ jsonData=json.loads(dataDecoded)
|
|
|
+ print(jsonData)
|
|
|
|
|
|
- #we are interested in content, do looped way of decoding it
|
|
|
+ #since gogs drops raw data, we already did the hard part
|
|
|
+ if server.find('fmf.uni-lj.si')>-1:
|
|
|
+ return jsonData
|
|
|
+
|
|
|
+ #on gitlab a further decoding step is required
|
|
|
+ #we are interested in content, do looped way of decoding it
|
|
|
b64_bytes=jsonData['content'].encode('ascii')
|
|
|
m_bytes=base64.b64decode(b64_bytes)
|
|
|
m=m_bytes.decode('ascii')
|
|
@@ -104,8 +121,13 @@ def loadLibrary(name):
|
|
|
zipName=name.lower()+'-'+rsource['branch']
|
|
|
os.rename(os.path.join(installDir,zipName),finalName)
|
|
|
except FileNotFoundError:
|
|
|
- zipName=name+'-'+rsource['branch']
|
|
|
- os.rename(os.path.join(installDir,zipName),finalName)
|
|
|
+ try:
|
|
|
+ zipName=name+'-'+rsource['branch']
|
|
|
+ os.rename(os.path.join(installDir,zipName),finalName)
|
|
|
+ except FileNotFoundError:
|
|
|
+ #git0/gogs
|
|
|
+ zipName=name.lower()
|
|
|
+ os.rename(os.path.join(installDir,zipName),finalName)
|
|
|
|
|
|
|
|
|
sys.path.append(finalName)
|