diff --git a/.github/run-tests/action.yml b/.github/run-tests/action.yml index 32ca9ceb3..28f6d46f8 100644 --- a/.github/run-tests/action.yml +++ b/.github/run-tests/action.yml @@ -10,135 +10,6 @@ runs: - run: pip3 install -r installer/requirements.txt 2>&1 shell: bash - # download launchers - - run: mkdir installer/3rdParty - shell: bash - # https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/tree/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/Alternative%20EXEs - - run: >- - curl -Lo installer/3rdParty/KentieDeusExe.exe - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/Alternative%20EXEs/Kentie's%20DeusExe.exe" - shell: bash - - run: >- - curl -Lo installer/3rdParty/DeusExe.u - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/DeusExe.u" - shell: bash - - - run: >- - curl -Lo installer/3rdParty/Launch.exe - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/Alternative%20EXEs/Launch.exe" - shell: bash - - # download D3D9 - - run: >- - curl -Lo installer/3rdParty/D3D9Drv.dll - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/D3D9Drv.dll" - shell: bash - #- run: >- - # curl -Lo installer/3rdParty/D3D9Drv.hut - # "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/D3D9Drv.hut" - # shell: bash - #- run: >- - # curl -Lo installer/3rdParty/D3D9Drv.int - # "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/D3D9Drv.int" - # shell: bash - - # download and extract OpenGL 2.0 https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/tree/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/CommunityUpdateFileArchiveDXPC/OpenGL - - run: >- - curl -Lo dxglr21.zip - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/CommunityUpdateFileArchiveDXPC/OpenGL/dxglr21.zip" - shell: bash - - run: unzip dxglr21.zip - shell: bash - - run: cp OpenGLDrv.dll installer/3rdParty/OpenGLDrv.dll - shell: bash - - # download D3D10 stuff - - run: mkdir installer/3rdParty/d3d10drv - shell: bash - - - run: >- - curl -Lo installer/3rdParty/D3D10Drv.int - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/D3D10Drv.int" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv.dll - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv.dll" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/common.fxh - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/common.fxh" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/complexsurface.fx - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/complexsurface.fx" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/finalpass.fx - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/finalpass.fx" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/firstpass.fx - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/firstpass.fx" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/fogsurface.fx - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/fogsurface.fx" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/gouraudpolygon.fx - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/gouraudpolygon.fx" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/hdr.original.fx - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/hdr%20(original).fx" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/hdr.fx - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/hdr.fx" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/polyflags.fxh - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/polyflags.fxh" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/postprocessing.fxh - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/postprocessing.fxh" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/states.fxh - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/states.fxh" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/tile.fx - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/tile.fx" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/unreal_pom.fx - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/unreal_pom.fx" - shell: bash - - run: >- - curl -Lo installer/3rdParty/d3d10drv/unrealpool.fxh - "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/unrealpool.fxh" - shell: bash - - # LDDP minimal install - - run: >- - curl -Lo installer/3rdParty/FemJC.u - "https://github.com/LayDDentonProject/Lay-D-Denton-Project/releases/download/v1.1/FemJC.u" - shell: bash - - # download DXVK 32bit, the extracted folder has the version number in it like dxvk-2.3 - - run: >- - curl -Lo dxvk.tar.gz - "https://github.com/doitsujin/dxvk/releases/download/v2.3/dxvk-2.3.tar.gz" - shell: bash - - run: tar -xf dxvk.tar.gz - shell: bash - - run: mkdir installer/3rdParty/dxvk/ - shell: bash - - run: cp dxvk-*/x32/* installer/3rdParty/dxvk/ - shell: bash - # check syntax and run tests - run: python3 -m compileall -q . 2>&1 shell: bash @@ -146,42 +17,24 @@ runs: shell: bash - name: Build - run: pyinstaller --clean installer/installer.spec + run: python3 installer/build.py shell: bash - run: du -ha dist shell: bash - - run: cat build/installer/warn-installer.txt + - run: cat installer/build/installer/warn-installer.txt shell: bash # small test, use timeouts because on windows the GUI can catch errors and a dialog box will freeze the program - - run: timeout 30 ./dist/DXRandoInstaller --version --verbose 2>&1 + - run: timeout 30 ./installer/dist/DXRandoInstaller --version --verbose 2>&1 shell: bash - - run: timeout 30 ./dist/BingoViewer --version 2>&1 + - run: timeout 30 ./installer/dist/BingoViewer --version 2>&1 shell: bash - # zip it up - # - if: runner.os == 'Windows' - # run: Compress-Archive -Path ./* -Destination DXRando.zip - # working-directory: ./dist/DXRando/ - # shell: pwsh - # - if: runner.os == 'Windows' - # run: Compress-Archive -Path ./* -Destination BingoViewer.zip - # working-directory: ./dist/BingoViewer/ - # shell: pwsh - # - if: runner.os != 'Windows' - # run: zip -r9 DXRando.zip . - # working-directory: ./dist/DXRando - # shell: bash - # - if: runner.os != 'Windows' - # run: zip -r9 BingoViewer.zip . - # working-directory: ./dist/BingoViewer - # shell: bash - # make sure we got everything - run: find installer/3rdParty/ shell: bash - - run: find dist/ + - run: find installer/dist/ shell: bash - - run: ls -lah dist/ + - run: ls -lah installer/dist/ shell: bash diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index b6094142e..7f193aa7e 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -8,27 +8,27 @@ jobs: runs-on: windows-latest steps: - name: Check out repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: ./.github/run-tests - name: Upload Installer - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: DXRando - path: dist/DXRandoInstaller.exe + path: installer/dist/DXRandoInstaller.exe - name: Upload installer warnings - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: installerwarnings.txt - path: build/installer/warn-installer.txt + path: installer/build/installer/warn-installer.txt - name: Upload Bingo Viewer - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: BingoViewer - path: dist/BingoViewer.exe + path: installer/dist/BingoViewer.exe linux: runs-on: ubuntu-latest @@ -37,7 +37,7 @@ jobs: shell: bash steps: - name: Check out repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: sudo apt-get update -y - run: sudo apt-get install -y python3-tk idle3 binutils @@ -45,19 +45,19 @@ jobs: - uses: ./.github/run-tests - name: Upload Installer - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: DXRando-linux - path: dist/DXRandoInstaller + path: installer/dist/DXRandoInstaller - name: Upload installer warnings - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: installerwarningslinux.txt - path: build/installer/warn-installer.txt + path: installer/build/installer/warn-installer.txt - name: Upload Bingo Viewer - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: BingoViewer-linux - path: dist/BingoViewer + path: installer/dist/BingoViewer diff --git a/.github/workflows/release-installer.yml b/.github/workflows/release-installer.yml index 01f693855..a429bd7e9 100644 --- a/.github/workflows/release-installer.yml +++ b/.github/workflows/release-installer.yml @@ -9,7 +9,7 @@ jobs: runs-on: windows-latest steps: - name: Check out repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: ./.github/run-tests @@ -18,7 +18,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: dist/DXRandoInstaller.exe + file: installer/dist/DXRandoInstaller.exe asset_name: DXRandoInstaller.exe tag: ${{ github.ref }} @@ -27,7 +27,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: dist/BingoViewer.exe + file: installer/dist/BingoViewer.exe asset_name: BingoViewer.exe tag: ${{ github.ref }} @@ -38,7 +38,7 @@ jobs: shell: bash steps: - name: Check out repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: sudo apt-get update -y - run: sudo apt-get install -y python3-tk idle3 binutils @@ -50,7 +50,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: dist/DXRandoInstaller + file: installer/dist/DXRandoInstaller asset_name: DXRandoInstaller-Linux tag: ${{ github.ref }} @@ -59,6 +59,6 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: dist/BingoViewer + file: installer/dist/BingoViewer asset_name: BingoViewer-Linux tag: ${{ github.ref }} diff --git a/installer/Install/__init__.py b/installer/Install/__init__.py index 088955372..edb48ce09 100644 --- a/installer/Install/__init__.py +++ b/installer/Install/__init__.py @@ -349,7 +349,7 @@ def MD5(bytes:bytes) -> str: return ret -def DownloadFile(url, dest, callback): +def DownloadFile(url, dest, callback=None): # still do this on dryrun because it writes to temp? sslcontext = ssl.create_default_context(cafile=certifi.where()) old_func = ssl._create_default_https_context diff --git a/installer/build.py b/installer/build.py new file mode 100644 index 000000000..6bfab9ca7 --- /dev/null +++ b/installer/build.py @@ -0,0 +1,96 @@ +# -*- mode: python ; coding: utf-8 -*- +from pathlib import Path +import re +import os +from Install import DownloadFile, WriteBytes +from zipfile import ZipFile +import tarfile +import PyInstaller.__main__ + +Community_Update_url = "https://github.com/Defaultplayer001/Deus-Ex-Universe-Community-Update-/raw/a662f6ed177dba52ad3a0d8141fa2ac72f8af034/%5B1.0%5D%20Deus%20Ex%20-%20Windows-Linux-macOS-Android/" +downloads = { + # Launchers + "DXCU%20Installer%20Source/Mods/Community%20Update/System/Alternative%20EXEs/Kentie's%20DeusExe.exe": "KentieDeusExe.exe", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/DeusExe.u": "DeusExe.u", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/Alternative%20EXEs/Launch.exe": "Launch.exe", + + # Renderers + "DXCU%20Installer%20Source/Mods/Community%20Update/System/D3D9Drv.dll": "D3D9Drv.dll", + # "DXCU%20Installer%20Source/Mods/Community%20Update/System/D3D9Drv.hut": "D3D9Drv.hut", + # "DXCU%20Installer%20Source/Mods/Community%20Update/System/D3D9Drv.int": "D3D9Drv.int", + + "CommunityUpdateFileArchiveDXPC/OpenGL/dxglr21.zip": "dxglr21.zip", + + # D3D10 + "DXCU%20Installer%20Source/Mods/Community%20Update/System/D3D10Drv.int": "D3D10Drv.int", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv.dll": "d3d10drv.dll", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/common.fxh": "d3d10drv/common.fxh", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/complexsurface.fx": "d3d10drv/complexsurface.fx", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/finalpass.fx": "d3d10drv/finalpass.fx", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/firstpass.fx": "d3d10drv/firstpass.fx", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/fogsurface.fx": "d3d10drv/fogsurface.fx", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/gouraudpolygon.fx": "d3d10drv/gouraudpolygon.fx", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/hdr%20(original).fx": "d3d10drv/hdr.original.fx", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/hdr.fx": "d3d10drv/hdr.fx", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/polyflags.fxh": "d3d10drv/polyflags.fxh", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/postprocessing.fxh": "d3d10drv/postprocessing.fxh", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/states.fxh": "d3d10drv/states.fxh", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/tile.fx": "d3d10drv/tile.fx", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/unreal_pom.fx": "d3d10drv/unreal_pom.fx", + "DXCU%20Installer%20Source/Mods/Community%20Update/System/d3d10drv/unrealpool.fxh": "d3d10drv/unrealpool.fxh", +} + +basedest = '' +base = Path() + +if Path('installer/add_lib_path.py').exists(): + base = Path('installer') + basedest = 'installer/3rdParty/' +elif Path('add_lib_path.py').exists(): + basedest = '3rdParty/' +else: + raise RuntimeError("Can't find root folder for installer") + +basedest = base / '3rdParty' + +basedest.mkdir(exist_ok=True) +(basedest/'d3d10drv').mkdir(exist_ok=True) +(basedest/'dxvk').mkdir(exist_ok=True) + +for (url, dest) in downloads.items(): + p = basedest/dest + if not p.exists(): + DownloadFile(Community_Update_url + url, basedest/dest) + +# TODO: unzip dxglr21.zip +zip = ZipFile(basedest/'dxglr21.zip', 'r') +zip.extractall(basedest) +zip.close() +(basedest/'dxglr21.zip').unlink() + + +# # LDDP minimal install +if not (basedest/'FemJC.u').exists(): + DownloadFile('https://github.com/LayDDentonProject/Lay-D-Denton-Project/releases/download/v1.1/FemJC.u', basedest/'FemJC.u') + +# DXVK 32bit +if not (basedest/'dxvk.tar.gz').exists(): + DownloadFile('https://github.com/doitsujin/dxvk/releases/download/v2.3/dxvk-2.3.tar.gz', basedest/'dxvk.tar.gz') +tar = tarfile.open(basedest/'dxvk.tar.gz') +for f in tar.getmembers(): + if '/x32/' in f.path and f.isfile(): + p = Path(f.name).name + p = basedest/'dxvk'/p + data = tar.extractfile(f).read() + WriteBytes(p, data) +tar.close() +(basedest/'dxvk.tar.gz').unlink() + +spec = base/'installer.spec' +print("building spec file:", spec) +PyInstaller.__main__.run([ + #'--clean', + '--distpath=' + str(base/'dist'), + '--workpath=' + str(base/'build'), + str(spec), +])