From a0572460ca043b334e1f76f3074d8ecd02d4d7f8 Mon Sep 17 00:00:00 2001 From: BrOakes Date: Tue, 20 Nov 2018 19:28:11 -0500 Subject: [PATCH] can install to multiple projects --- package-lock.json | 2 +- package.json | 6 +++--- scripts/postinstall.js | 1 - scripts/uninstall.js | 4 ++-- util/downloadpython.js | 3 +-- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2c173b7..38ddae9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "portapy", - "version": "0.0.7", + "version": "0.0.11", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 93ba8fd..00dfa20 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "portapy", - "version": "0.0.7", + "version": "0.0.11", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "postinstall": "node postinstall.js", - "preuninstall": "node uninstall.js", + "postinstall": "node scripts/postinstall.js", + "preuninstall": "node scripts/uninstall.js", "clean": "node clean.js" }, "bin": { diff --git a/scripts/postinstall.js b/scripts/postinstall.js index b7d36e9..7a07713 100644 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -3,7 +3,6 @@ let {execSync} = require('child_process'); let pythonDownloader = require('../util/downloadpython.js') - pythonDownloader.download(); // execSync('"Python/Scripts/pip.exe" install --target=worldengine/lib numpy six pypng pyplatec', { // stdio: 'inherit' diff --git a/scripts/uninstall.js b/scripts/uninstall.js index 51ab9a5..090a10b 100644 --- a/scripts/uninstall.js +++ b/scripts/uninstall.js @@ -5,9 +5,9 @@ let installerFilename = fs.readFileSync('.installerLocation').toString(); let pythonInstallerPath = path.resolve(__dirname, 'Python-Installer', installerFilename); -let pythonPath = path.resolve(__dirname, 'Python'); +// let pythonPath = path.resolve(__dirname, 'Python'); -fs.rmdirSync(pythonPath); +// fs.rmdirSync(pythonPath); // require('child_process').execSync(`${pythonInstallerPath} /passive /uninstall`, { diff --git a/util/downloadpython.js b/util/downloadpython.js index 5cf6f87..eef4a13 100644 --- a/util/downloadpython.js +++ b/util/downloadpython.js @@ -14,7 +14,6 @@ async function download() { let url = await getPythonDownloadLink(); let filename = path.parse(url).base; - try { fs.mkdirSync('Python-Installer'); } catch(e) {'';} @@ -31,7 +30,6 @@ async function download() { let out_file = `Python-Installer/${filename}` - await new Promise(resolve => { request({ uri: url, @@ -65,6 +63,7 @@ async function download() { execSync(`${installerPath} /passive /uninstall`, { stdio: 'inherit' }); + fs.rmdirSync(tempPath); console.log("PordaPy Installed!");