mcshader-lsp/setup.py

33 lines
No EOL
1.1 KiB
Python

import urllib.request
import zipfile
from io import BytesIO
import shutil
import os as o
os = {
0: 'win',
1: 'linux',
2: 'osx'
}
url = {
0: 'https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Release.zip',
1: 'https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Release.zip',
2: 'https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-osx-Release.zip'
}
def main():
os_choice = int(input('Choose your OS:\n - 0: Windows\n - 1: Linux\n - 2: OSX\n> '))
if os_choice not in os:
print('Invalid OS. Please only choose a value between 0 and 2')
with urllib.request.urlopen(url[os_choice]) as respone:
with BytesIO(respone.read()) as zipped:
with zipfile.ZipFile(zipped) as zip_file:
zip_file.extract('bin/glslangValidator')
o.rename('bin/glslangValidator', 'glslangValidator')
o.rmdir('bin')
print('glslangValidator downloaded. Set mclglsl')
return
print('There was an error :(')
main()