mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-10-26 22:11:35 +00:00
sagas/mpy: Use main module name instead of __main__.
This is separate from Python's __main__ mechanism, so we shouldn't be manually renaming things to __main__ here. This also makes file names show correctly on EV3. See https://github.com/pybricks/support/issues/2364
This commit is contained in:
1 parent
32f2ece4da
commit
a18d88dffd
1 file changed
+5
-3
+5
-3
@@ -1,5 +1,5 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// Copyright (c) 2020-2023 The Pybricks Authors
|
// Copyright (c) 2020-2026 The Pybricks Authors
|
||||||
|
|
||||||
import { compile as mpyCrossCompileV5 } from '@pybricks/mpy-cross-v5';
|
import { compile as mpyCrossCompileV5 } from '@pybricks/mpy-cross-v5';
|
||||||
import { compile as mpyCrossCompileV6 } from '@pybricks/mpy-cross-v6';
|
import { compile as mpyCrossCompileV6 } from '@pybricks/mpy-cross-v6';
|
||||||
@@ -129,12 +129,14 @@ function* handleCompileMulti6(): Generator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const mainPy = yield* editorGetValue();
|
const mainPy = yield* editorGetValue();
|
||||||
|
const mainPyPath = metadata.path ?? '__main__.py';
|
||||||
|
const mainPyName = mainPyPath.replace(/\.[^.]+$/, '');
|
||||||
|
|
||||||
const pyFiles = new Map<string, FileContents>([
|
const pyFiles = new Map<string, FileContents>([
|
||||||
['__main__', { path: metadata.path ?? '__main__.py', contents: mainPy }],
|
[mainPyName, { path: mainPyPath, contents: mainPy }],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const checkedModules = new Set<string>(['__main__']);
|
const checkedModules = new Set<string>([mainPyName]);
|
||||||
const uncheckedScripts = new Array<string>(mainPy);
|
const uncheckedScripts = new Array<string>(mainPy);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|||||||
Reference in new issue
Block a user