Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug: Python venv on Windows #233

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion allow-list.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ignore": [
{ "id": "CVE-2023-29827" },
{ "id": "CVE-2022-25883" }
{ "id": "CVE-2023-45857" }
]
}
6 changes: 4 additions & 2 deletions generators/python/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const Generator = require('yeoman-generator')
const { keyPair, getPythonBdkVersion }= require('../_lib/util')
const path = require('path')
const fs = require("fs")

const BOT_APP_FOLDER = 'bot-app' // source folder for bot resources
const RESOURCES_FOLDER = 'resources' // target resources folder
Expand All @@ -20,7 +21,8 @@ module.exports = class extends Generator {

install() {
this.spawnCommandSync('python3', [ '-m', 'venv', 'env' ])
this.spawnCommandSync(path.join(this.destinationPath(), 'env', 'bin', 'pip3'), [ 'install', '-r', 'requirements.txt' ])
this.binDir = fs.existsSync(path.join(this.destinationPath(), 'env', 'bin')) ? 'bin' : 'Scripts'
this.spawnCommandSync(path.join(this.destinationPath(), 'env', this.binDir, 'pip3'), [ 'install', '-r', 'requirements.txt' ])
}

end() {
Expand All @@ -36,7 +38,7 @@ module.exports = class extends Generator {

this.log(`Your Python project has been successfully generated !`.cyan)
this.log(`A virtual environment has been created in:`.cyan + ' ./env')
this.log(`You can now run your bot with: `.cyan + `env/bin/python3 -m ${PYTHON_FOLDER}`)
this.log(`You can now run your bot with: `.cyan + `env/${this.binDir}/python3 -m ${PYTHON_FOLDER}`)
}

_generateRsaKeys() {
Expand Down
18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@finos/generator-symphony",
"version": "2.9.0-SNAPSHOT",
"version": "2.10.0-SNAPSHOT",
"repository": {
"type": "git",
"url": "git+https://github.com/finos/generator-symphony.git"
Expand All @@ -16,24 +16,22 @@
"symphony-chat"
],
"dependencies": {
"axios": "^1.4.0",
"axios": "^1.5.1",
"colors": "1.4.0",
"mem-fs": "^2.2.1",
"mem-fs-editor": "^10.0.2",
"mkdirp": "^3.0.1",
"node-forge": "^1.3.1",
"upath": "^2.0.1",
"yeoman-environment": "^3.18.3",
"yeoman-generator": "^5.9.0"
"yeoman-environment": "^3.19.3",
"yeoman-generator": "^5.10.0"
},
"devDependencies": {
"decamelize": "^6.0.0",
"fs-extra": "^11.1.1",
"jest": "^29.5.0",
"jest-junit": "^15.0.0",
"jest-mock-axios": "^4.7.2",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"jest-mock-axios": "^4.7.3",
"yeoman-assert": "^3.1.1",
"yeoman-test": "^6.2.0"
"yeoman-test": "^6.3.0"
},
"bugs": {
"url": "https://github.com/finos/generator-symphony/issues"
Expand Down
Loading