midi: move python src to server folder to be as consistent as possible with the build result

This commit is contained in:
jean-emmanuel 2025-09-12 11:45:21 +02:00
parent 18568d40c6
commit 34de7420e2
11 changed files with 9 additions and 7 deletions

4
.gitignore vendored
View file

@ -2,5 +2,5 @@ node_modules/
dist/
/app/
*.pyc
src/python/build
src/python/__pycache__
src/server/python/build
src/server/python/__pycache__

View file

@ -55,7 +55,7 @@ module.exports = {
targets: [
{src: 'src/app/index.js', dest: 'app/'},
{src: 'src/server/index.js', dest: 'app/server/'},
{src: 'src/python/*', dest: 'app/server/python/'},
{src: 'src/server/python/*', dest: 'app/server/python/'},
{src: 'node_modules/fsevents/fsevents.node', dest: 'app/server/'},
{src: 'LICENSE', dest: 'app/'},
{src: 'package.json', dest: 'app/'},

View file

@ -4,7 +4,9 @@ import path from 'path'
import * as settings from './settings'
var scriptPath = path.resolve(__dirname, '../python')
var scriptPath = __dirname.includes('server/node') ?
path.resolve(__dirname, '../python') : // src folder structure
path.resolve(__dirname, './python') // app folder structure with rollup chunking
var midiBinaries = {
x64: {
@ -17,7 +19,7 @@ var midiBinaries = {
}
}
var expectMidiBinaries = fs.existsSync(path.resoluve(scriptPath, '/.expect-midi-bin')),
var expectMidiBinaries = fs.existsSync(path.resolve(scriptPath, './.expect-midi-bin')),
expectMidiBinariesError = false
var pythonPathOverride
@ -36,7 +38,7 @@ class MidiConverter {
if (expectMidiBinariesError) MidiConverter.midiBinariesError()
this.py = new PythonShell('python/midi.py', Object.assign({
this.py = new PythonShell('midi.py', Object.assign({
args: [
'--params',
settings.read('debug') ? 'debug' : '',
@ -124,7 +126,7 @@ class MidiConverter {
if (expectMidiBinariesError) MidiConverter.midiBinariesError()
PythonShell.run('python/midi.py', Object.assign({pythonPath: MidiConverter.getPythonPath(), args: ['--params', 'list-only']}, {scriptPath, mode:'text'}), function(e, results) {
PythonShell.run('midi.py', Object.assign({pythonPath: MidiConverter.getPythonPath(), args: ['--params', 'list-only']}, {scriptPath, mode:'text'}), function(e, results) {
if (e) {
if (e.code === 'ENOENT') {
console.error(`(ERROR, MIDI) Could not find python binary: ${e.message.replace(/spawn (.*) ENOENT/, '$1')}`)