Skip to content

Commit

Permalink
Remove unused files
Browse files Browse the repository at this point in the history
  • Loading branch information
tpeulen committed Jan 29, 2025
1 parent 2805c4f commit 288c729
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 20 deletions.
50 changes: 33 additions & 17 deletions build_tools/win/build-setup.bat
Original file line number Diff line number Diff line change
@@ -1,46 +1,62 @@
@echo off
set "DIST_PATH=..\..\dist"
set "DIST_PATH=%CD%\..\..\dist"
set "SCRIPT_PATH=%~dp0"
set "APP_PATH=..\..\dist\win"
set "SOURCE_PATH=..\.."
set "CONDA_RECIPE_FOLDER=..\..\conda-recipe"
set "APP_PATH=%CD%\..\..\dist\win"
set "SOURCE_PATH=%CD%\..\.."
set "CONDA_RECIPE_FOLDER=%CD%\..\..\conda-recipe"

rem Default behavior: Do not build conda package
:: Normalize paths to absolute paths
for %%I in ("%DIST_PATH%") do set "DIST_PATH=%%~fI"
for %%I in ("%APP_PATH%") do set "APP_PATH=%%~fI"
for %%I in ("%SOURCE_PATH%") do set "SOURCE_PATH=%%~fI"
for %%I in ("%CONDA_RECIPE_FOLDER%") do set "CONDA_RECIPE_FOLDER=%%~fI"

:: Default behavior: Do not build conda package
set "BUILD_CONDA_PACKAGE=0"

rem Check for command-line arguments
:: Check for command-line arguments
if /I "%1"=="/build" (
set "BUILD_CONDA_PACKAGE=1"
)

rem If /build flag is passed, build the Conda package
:: If /build flag is passed, build the Conda package
if %BUILD_CONDA_PACKAGE%==1 (
echo Building Conda package...
call conda mambabuild %CONDA_RECIPE_FOLDER%
) else (
echo Skipping Conda package build...
)

rem Create necessary directories
:: Create necessary directories
md %DIST_PATH%
md %APP_PATH%

rem Create the conda environment
:: Create the conda environment
call mamba create -y --prefix %APP_PATH% chisurf -c local -c tpeulen --force

rem Generate Inno Setup script
python make_inno_setup.py
:: Compile all Python source files into .pyc
python -m compileall -q %APP_PATH%

:: Remove unused files/directories
rmdir /s /q %APP_PATH%\include
rmdir /s /q %APP_PATH%\Library\share\doc
rmdir /s /q %APP_PATH%\Library\share\IMP
rmdir /s /q %APP_PATH%\Library\include
rmdir /s /q %APP_PATH%\etc\conda\test-files

rem Optionally deactivate conda environment
rem call conda deactivate
rem call conda activate base
:: Delete all .lib files from the Conda environment
echo Deleting all .lib files in %APP_PATH%...
for /r "%APP_PATH%\Library\lib" %%F in (*.lib) do del "%%F"

:: Generate Inno Setup script
python make_inno_setup.py

rem Create an installer with Inno Setup
:: Create an installer with Inno Setup
"C:\Program Files (x86)\Inno Setup 6\Compil32.exe" /cc setup.iss

rem Cleaning step: Purge the APP_PATH folder
:: Cleaning step: Purge the APP_PATH folder
:: echo Cleaning up APP_PATH: %APP_PATH%...
rmdir /s /q %APP_PATH%
:: rmdir /s /q %APP_PATH%

echo Script finished.

5 changes: 2 additions & 3 deletions build_tools/win/setup_template.iss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Compression=lzma2/ultra64
;Compression=lzma2/fast
;Compression=none
SolidCompression=yes
CompressionThreads=8
CompressionThreads=auto
UninstallLogMode=overwrite
DirExistsWarning=yes
UninstallDisplayIcon="{app}\{{ AppName }}"
Expand All @@ -37,8 +37,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
; Icon files must be explicitely included
Source: ".\icons\*.ico"; DestDir: "{app}\icons"
;Source: "chisurf.exe"; DestDir: "{app}"
Source: "{{ SourceDir }}\dist\win\**"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "Library\share\doc\*"

Source: "{{ SourceDir }}\dist\win\**"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
;uncomment below to add VC Runtimes
;Source: "{{ vc_runtime_path }}\*"; DestDir: {tmp}; Flags: deleteafterinstall
Source: "fix_shebangs.py"; DestDir: "{app}";
Expand Down

0 comments on commit 288c729

Please sign in to comment.