mirror of
https://github.com/LinoSchmidt/StickExporterTX.git
synced 2026-03-21 01:51:15 +01:00
Fixed script installs unused blender versions
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"install:win32": "python ./scripts/download-blender.py",
|
"install:win32": "python ./scripts/download-blender.py",
|
||||||
"install:linux": "python3 ./scripts/download-blender.py",
|
"install:linux": "python3 ./scripts/download-blender.py",
|
||||||
|
"install:darwin": "python3 ./scripts/download-blender.py",
|
||||||
"install": "run-script-os",
|
"install": "run-script-os",
|
||||||
"build:main": "cross-env NODE_ENV=production webpack --config configs/webpack.main.prod.config.babel.js",
|
"build:main": "cross-env NODE_ENV=production webpack --config configs/webpack.main.prod.config.babel.js",
|
||||||
"build:renderer": "cross-env NODE_ENV=production webpack --config configs/webpack.renderer.prod.config.babel.js",
|
"build:renderer": "cross-env NODE_ENV=production webpack --config configs/webpack.renderer.prod.config.babel.js",
|
||||||
|
|||||||
@@ -1,44 +1,60 @@
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
import platform
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
import tarfile
|
import tarfile
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import time
|
|
||||||
|
|
||||||
windowsURL = 'https://ftp.halifax.rwth-aachen.de/blender/release/Blender3.2/blender-3.2.0-windows-x64.zip'
|
windowsURL = 'https://ftp.halifax.rwth-aachen.de/blender/release/Blender3.2/blender-3.2.0-windows-x64.zip'
|
||||||
linuxURL = 'https://ftp.halifax.rwth-aachen.de/blender/release/Blender3.2/blender-3.2.0-linux-x64.tar.xz'
|
linuxURL = 'https://ftp.halifax.rwth-aachen.de/blender/release/Blender3.2/blender-3.2.0-linux-x64.tar.xz'
|
||||||
|
|
||||||
# Windows
|
if(platform.system() == 'Windows'):
|
||||||
if(os.path.exists('./dependencies/windows')):
|
if(os.path.exists('./dependencies/windows')):
|
||||||
print("Removing old windows folder")
|
print("Removing old windows folder")
|
||||||
shutil.rmtree('./dependencies/windows')
|
shutil.rmtree('./dependencies/windows')
|
||||||
|
|
||||||
print("Downloading windows version")
|
print("Downloading windows version")
|
||||||
with urllib.request.urlopen(windowsURL) as zipresp:
|
with urllib.request.urlopen(windowsURL) as zipresp:
|
||||||
with ZipFile(BytesIO(zipresp.read())) as zfile:
|
with ZipFile(BytesIO(zipresp.read())) as zfile:
|
||||||
zfile.extractall('./dependencies/windows')
|
zfile.extractall('./dependencies/windows')
|
||||||
|
|
||||||
print("Adjust windows version")
|
print("Adjust windows version")
|
||||||
oldWindowsName = windowsURL.split('/')[-1].replace('.zip', '')
|
oldWindowsName = windowsURL.split('/')[-1].replace('.zip', '')
|
||||||
os.rename('./dependencies/windows/' + oldWindowsName, './dependencies/windows/blender')
|
os.rename('./dependencies/windows/' + oldWindowsName, './dependencies/windows/blender')
|
||||||
|
|
||||||
# Linux
|
if(platform.system() == 'Linux'):
|
||||||
if(os.path.exists('./dependencies/linux')):
|
if(os.path.exists('./dependencies/linux')):
|
||||||
print("Removing old linux folder")
|
print("Removing old linux folder")
|
||||||
shutil.rmtree('./dependencies/linux')
|
shutil.rmtree('./dependencies/linux')
|
||||||
|
|
||||||
print("Downloading linux version")
|
print("Downloading linux version")
|
||||||
os.mkdir('./dependencies/linux')
|
os.mkdir('./dependencies/linux')
|
||||||
|
|
||||||
urllib.request.urlretrieve(linuxURL, './dependencies/linux/blender.tar.xz')
|
urllib.request.urlretrieve(linuxURL, './dependencies/linux/blender.tar.xz')
|
||||||
print("Extracting linux version")
|
print("Extracting linux version")
|
||||||
with tarfile.open('./dependencies/linux/blender.tar.xz') as tfile:
|
with tarfile.open('./dependencies/linux/blender.tar.xz') as tfile:
|
||||||
tfile.extractall('./dependencies/linux')
|
tfile.extractall('./dependencies/linux')
|
||||||
|
|
||||||
print("Adjust linux version")
|
print("Adjust linux version")
|
||||||
oldLinuxName = linuxURL.split('/')[-1].replace('.tar.xz', '')
|
oldLinuxName = linuxURL.split('/')[-1].replace('.tar.xz', '')
|
||||||
os.rename('./dependencies/linux/' + oldLinuxName, './dependencies/linux/blender')
|
os.rename('./dependencies/linux/' + oldLinuxName, './dependencies/linux/blender')
|
||||||
|
|
||||||
print("Clean up linux folder")
|
print("Clean up linux folder")
|
||||||
os.remove('./dependencies/linux/blender.tar.xz')
|
os.remove('./dependencies/linux/blender.tar.xz')
|
||||||
|
|
||||||
|
if(platform.system() == 'Darwin'):
|
||||||
|
if(os.path.exists('./dependencies/darwin')):
|
||||||
|
print("Removing old darwin folder")
|
||||||
|
shutil.rmtree('./dependencies/darwin')
|
||||||
|
|
||||||
|
print("Darwin is not supported yet!")
|
||||||
|
|
||||||
|
# TODO: Add darwin support as following:
|
||||||
|
# - look for blender
|
||||||
|
# -- if blender not found, ask user to install blender or let the script do it
|
||||||
|
# --- if user wants the script to install blender, download the installer
|
||||||
|
# --- ask the user to follow the installer
|
||||||
|
# - try copy the blender files into the dependencies blender folder
|
||||||
|
# -- if it doesn't work, ask the user for admin rights and try to copy again
|
||||||
|
# remove the "Darwin is not supported yet!" comment
|
||||||
Reference in New Issue
Block a user