From 779c2af3160948dc1b0e467f247de95c8ac7d836 Mon Sep 17 00:00:00 2001 From: "instance.id" <dan@instance.id> Date: Sat, 23 Mar 2024 17:22:42 -0500 Subject: [PATCH] Build script update to fix missing .pyc bytecode --- build.ps1 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 1891aee..c911a94 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,4 +1,4 @@ -#!/usr/bin/env pwsh +#!/usr/bin/env -S pwsh -noProfile -nologo # .\build.ps1 -Zip -Version v0.1.0 Param ( @@ -76,6 +76,19 @@ if ($Version) { Move-Item -Path $destination1\python3.10libs -Destination $folderVer\$searcher\python3.10libs Move-Item -Path $destination1\toolbar -Destination $folderVer\$searcher\toolbar + # --| Move and rename compiled runtime files ----- + $searcherLibs = [System.IO.Path]::Combine($folderVer, $searcher, "python3.10libs", "searcher") + $cachePath = [System.IO.Path]::Combine($searcherLibs, "__pycache__") + $compiledFiles = Get-ChildItem -Path $cachePath -Recurse -Include "*.pyc", "*.pyo" + + # --| Remove 'cpython-310' from the file names --- + foreach ($file in $compiledFiles) { + $newName = $file.Name.Replace('.cpython-310', '') + $newPath = [System.IO.Path]::Combine($file.DirectoryName, $newName) + Rename-Item -Path $file.FullName -NewName $newName + Move-Item -Path $newPath -Destination $searcherLibs + } + $listfiles = Get-ChildItem $folderVer -Recurse -File -Include '*.md', '*.txt' $old = '{#version}' foreach ($file in $listfiles) {