@bjia56/portable-python
Advanced tools
Comparing version 0.1.113 to 0.1.114
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const os_1 = require("os"); | ||
const fs_1 = require("fs"); | ||
const promises_1 = require("fs/promises"); | ||
@@ -40,2 +41,8 @@ const path_1 = require("path"); | ||
})(); | ||
const COSMO_EXES = [ | ||
"python.com", | ||
"python.x86_64.elf", | ||
"python.x86_64.macho", | ||
"python.aarch64.elf" | ||
]; | ||
class CPythonInstaller { | ||
@@ -47,4 +54,26 @@ parent; | ||
get relativeExecutablePath() { | ||
return (0, path_1.join)(this.pythonDistributionName, "bin", "python" + (this.parent.distribution === "cosmo" ? ".com" : | ||
((0, os_1.platform)() === "win32" ? ".exe" : ""))); | ||
if (this.parent.distribution === "cosmo") { | ||
let exe = "python.com"; | ||
if ((0, os_1.platform)() == "darwin") { | ||
if ((0, os_1.arch)() == "x64") { | ||
exe = "python.x86_64.macho"; | ||
} | ||
} | ||
else if ((0, os_1.platform)() != "win32") { | ||
if ((0, os_1.arch)() == "x64") { | ||
exe = "python.x86_64.elf"; | ||
} | ||
else if ((0, os_1.arch)() == "arm64") { | ||
exe = "python.aarch64.elf"; | ||
} | ||
} | ||
try { | ||
(0, fs_1.accessSync)((0, path_1.join)(this.parent.extractPath, "bin", exe)); | ||
} | ||
catch { | ||
exe = "python.com"; | ||
} | ||
return (0, path_1.join)(this.pythonDistributionName, "bin", exe); | ||
} | ||
return (0, path_1.join)(this.pythonDistributionName, "bin", "python" + ((0, os_1.platform)() === "win32" ? ".exe" : "")); | ||
} | ||
@@ -94,2 +123,15 @@ get relativePipPath() { | ||
} | ||
if (this.parent.distribution === "cosmo" && (0, os_1.platform)() != "win32") { | ||
for (const exe of COSMO_EXES) { | ||
try { | ||
await (0, promises_1.chmod)((0, path_1.join)(this.parent.extractPath, "bin", exe), 0o777); | ||
} | ||
catch (e) { | ||
// ignore | ||
} | ||
} | ||
// ensure the pip script is executable | ||
await (0, promises_1.chmod)(this.parent.pipPath, 0o777); | ||
await (0, promises_1.chmod)(`${this.parent.pipPath}.${this.parent.minor}`, 0o777); | ||
} | ||
} | ||
@@ -96,0 +138,0 @@ } |
@@ -32,2 +32,6 @@ import { IPortablePython, IPortablePythonOptions } from "./types"; | ||
/** | ||
* Contains the micro version number. | ||
*/ | ||
get micro(): string; | ||
/** | ||
* Contains the patch version number. | ||
@@ -34,0 +38,0 @@ */ |
@@ -104,6 +104,12 @@ "use strict"; | ||
/** | ||
* Contains the micro version number. | ||
*/ | ||
get micro() { | ||
return this.version.split(".")[2]; | ||
} | ||
/** | ||
* Contains the patch version number. | ||
*/ | ||
get patch() { | ||
return this.version.split(".")[2]; | ||
return this.micro; | ||
} | ||
@@ -110,0 +116,0 @@ /** |
@@ -15,2 +15,3 @@ export interface IInstallerProps { | ||
patch: string; | ||
micro: string; | ||
releaseTag: string; | ||
@@ -17,0 +18,0 @@ implementation: string; |
{ | ||
"name": "@bjia56/portable-python", | ||
"version": "0.1.113", | ||
"version": "0.1.114", | ||
"description": "Portable Python", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
48063
661
6