mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-07-28 04:08:05 +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:
+5
-3
@@ -1,5 +1,5 @@
|
||||
// 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 mpyCrossCompileV6 } from '@pybricks/mpy-cross-v6';
|
||||
@@ -129,12 +129,14 @@ function* handleCompileMulti6(): Generator {
|
||||
}
|
||||
|
||||
const mainPy = yield* editorGetValue();
|
||||
const mainPyPath = metadata.path ?? '__main__.py';
|
||||
const mainPyName = mainPyPath.replace(/\.[^.]+$/, '');
|
||||
|
||||
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);
|
||||
|
||||
for (;;) {
|
||||
|
||||
Reference in New Issue
Block a user