tryin something here

master
BrOakes 2018-11-20 18:39:29 -05:00
parent a3ef494fd0
commit bcd56daebd
5 changed files with 43 additions and 15 deletions

15
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "portapy",
"version": "0.0.4",
"version": "0.0.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -64,6 +64,14 @@
"delayed-stream": "~1.0.0"
}
},
"copy-dir": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/copy-dir/-/copy-dir-0.4.0.tgz",
"integrity": "sha512-mIefrD97nE1XX2th570tR5UQvW6/92czEPGe+oTtrxPAJl+KOKLpzcRa+e38WEpmt/IUN1n65KvRMzPblR+fDQ==",
"requires": {
"mkdir-p": "~0.0.4"
}
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
@ -217,6 +225,11 @@
"resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
},
"mkdir-p": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/mkdir-p/-/mkdir-p-0.0.7.tgz",
"integrity": "sha1-JMXb4m2jqZ7xWKHu+aXC3Z3laDw="
},
"oauth-sign": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "portapy",
"version": "0.0.4",
"version": "0.0.7",
"description": "",
"main": "index.js",
"scripts": {
@ -22,6 +22,7 @@
"url": "https://github.com/marcus13345/portapy/issues"
},
"dependencies": {
"copy-dir": "^0.4.0",
"minimist": "^1.2.0",
"python": "0.0.4",
"request": "^2.88.0"

View File

@ -1,7 +1,7 @@
// pip install --target=lib numpy six pypng pyplatec
let {execSync} = require('child_process');
let pythonDownloader = require('./util/downloadpython.js')
let pythonDownloader = require('../util/downloadpython.js')
pythonDownloader.download();

View File

@ -3,8 +3,13 @@ const fs = require('fs');
let installerFilename = fs.readFileSync('.installerLocation').toString();
let pythonPath = path.resolve(__dirname, 'Python-Installer', installerFilename);
let pythonInstallerPath = path.resolve(__dirname, 'Python-Installer', installerFilename);
require('child_process').execSync(`${pythonPath} /passive /uninstall`, {
stdio: 'inherit'
});
let pythonPath = path.resolve(__dirname, 'Python');
fs.rmdirSync(pythonPath);
// require('child_process').execSync(`${pythonInstallerPath} /passive /uninstall`, {
// stdio: 'inherit'
// });

View File

@ -7,6 +7,7 @@ const fs = require('fs');
const os = require('os');
const {execSync} = require('child_process');
const path = require('path');
const copydir = require('copy-dir');
async function download() {
@ -20,6 +21,9 @@ async function download() {
try {
fs.mkdirSync('Python');
} catch(e) {'';}
try {
fs.mkdirSync('Temp-Python');
} catch(e) {'';}
try {
fs.writeFileSync('.installerLocation', filename);
} catch(e) {'';}
@ -45,26 +49,31 @@ async function download() {
case 'win32': {
try {
let installerPath = path.join(__dirname, '..', 'Python-Installer/', filename);
let tempPath = path.join(__dirname, '..', 'Temp-Python/');
let targetPath = path.join(__dirname, '..', 'Python/');
execSync(`${installerPath} /passive DefaultJustForMeTargetDir=${targetPath}`, {
execSync(`${installerPath} /passive DefaultJustForMeTargetDir=${tempPath}`, {
stdio: "inherit"
});
let files = fs.readdirSync(targetPath);
files.forEach(function (element) {
console.log(element);
});
console.log("Creating Portable Python Directory");
console.log("Python Installed!");
copydir.sync(tempPath, targetPath);
console.log("Portable Directory Created!");
console.log("Uninstalling Unnecessary Python Files");
execSync(`${installerPath} /passive /uninstall`, {
stdio: 'inherit'
});
fs.rmdirSync(tempPath);
console.log("PordaPy Installed!");
} catch (err) {
console.log(err);
}
break;
}[]
}
}
function getPythonDownloadLink() {