Skip to content

Commit

Permalink
Move some files out then put them back in
Browse files Browse the repository at this point in the history
  • Loading branch information
KenCorma committed Oct 28, 2024
1 parent cb516aa commit 18ab5a2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
17 changes: 8 additions & 9 deletions scripts/signPython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ find . -name '*.tar.gz' -delete
wait
ls
echo Sign Libs and Bins
cd python2/python/
filelist=("lib/libpython3.12.dylib" "lib/python3.12/lib-dynload/_crypt.cpython-312-darwin.so" "bin/uv" "bin/uvx" "bin/python3.12")
for file in ${filelist[@]}; do codesign --sign 48F7750D708A9F1506A3DD335ADE537ED2FEA768 --force --timestamp --options runtime --entitlements ../../../builderStaticFiles/entitlements.mac.plist "$file"; done
echo Rezip
cd ../..
mv python python3
mv python2/python python
tar -czf python.tgz python/
mkdir output
rm -rf python2
rm -rf python3
rm -rf python
rm python.tgz
ls
cd python
filelist=("lib/libpython3.12.dylib" "lib/python3.12/lib-dynload/_crypt.cpython-312-darwin.so" "bin/uv" "bin/uvx" "bin/python3.12")
for file in ${filelist[@]}; do mkdir -p `dirname ../output/$file` && mv "$file" ../output/; done
cd ..
echo Rezip
tar -czf python.tgz python/
rm -rf python
13 changes: 13 additions & 0 deletions src/pythonEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class PythonEnvironment {
*/
readonly requirementsCompiledPath: string;

readonly macExtraFiles: Array<string>;

constructor(
public pythonInstallPath: string,
public appResourcesPath: string,
Expand All @@ -45,6 +47,7 @@ export class PythonEnvironment {
this.pythonTarPath = path.join(appResourcesPath, 'python.tgz');
this.wheelsPath = path.join(this.pythonRootPath, 'wheels');
this.requirementsCompiledPath = path.join(this.pythonRootPath, 'requirements.compiled');
this.macExtraFiles = ["lib/libpython3.12.dylib", "lib/python3.12/lib-dynload/_crypt.cpython-312-darwin.so","bin/uv","bin/uvx","bin/python3.12"];
}

async isInstalled(): Promise<boolean> {
Expand Down Expand Up @@ -91,6 +94,16 @@ export class PythonEnvironment {
strict: true,
});

if (process.platform === 'darwin') {
this.macExtraFiles.forEach(async (fileName) => {
await fsPromises.cp(
path.join(this.appResourcesPath, 'output', fileName),
path.join(this.pythonRootPath, fileName)
);
});
await fsPromises.rm(path.join(this.appResourcesPath, 'output'));
}

const exitCode = await this.installRequirements();

if (exitCode === 0) {
Expand Down
6 changes: 5 additions & 1 deletion todesktop.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@
"appPath": ".",
"appFiles": ["src/**", "scripts/**", "assets/**", "dist/**", ".vite/**", ".yarnrc.yml", ".yarn/**"],
"extraResources": [{ "from": "./assets" }],
"filesForDistribution": ["!assets/**","!dist/**" , "!.yarn/**", "!.yarnrc.yml"]
"filesForDistribution": ["!assets/**","!dist/**" , "!.yarn/**", "!.yarnrc.yml"],
"mac" :
{
"additionalBinariesToSign" : ["./assets/output/lib/libpython3.12.dylib" , "./assets/output/lib/python3.12/lib-dynload/_crypt.cpython-312-darwin.so" , "./assets/output/bin/uv" ,"./assets/output/bin/uvx","./assets/output/bin/python3.12"]
}
}

0 comments on commit 18ab5a2

Please sign in to comment.