Skip to content

Commit

Permalink
set default platform to "All"
Browse files Browse the repository at this point in the history
  • Loading branch information
KotlinIsland committed Feb 19, 2024
1 parent 83b3e1c commit 254922f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
9 changes: 4 additions & 5 deletions packages/pyright-internal/src/common/configOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,8 @@ export class ConfigOptions {
if (configObj.pythonPlatform !== undefined) {
if (typeof configObj.pythonPlatform !== 'string') {
errors.push(`Config "pythonPlatform" field must contain a string.`);
} else if (!['Linux', 'Windows', 'Darwin', 'All'].includes(configObj.pythonPlatform)) {
`'${configObj.pythonPlatform}' is not a supported Python platform; specify All, Darwin, Linux, or Windows.`;
} else {
this.defaultPythonPlatform = configObj.pythonPlatform;
}
Expand Down Expand Up @@ -1515,15 +1517,12 @@ export class ConfigOptions {

ensureDefaultPythonPlatform(host: Host, console: ConsoleInterface) {
// If no default python platform was specified, assume that the
// user wants to use the current platform.
// user wants to use all mode
if (this.defaultPythonPlatform !== undefined) {
return;
}

this.defaultPythonPlatform = host.getPythonPlatform();
if (this.defaultPythonPlatform !== undefined) {
console.log(`Assuming Python platform ${this.defaultPythonPlatform}`);
}
this.defaultPythonPlatform = 'All';
}

ensureDefaultPythonVersion(host: Host, console: ConsoleInterface) {
Expand Down
4 changes: 2 additions & 2 deletions packages/pyright-internal/src/pyright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,11 @@ async function processArgs(): Promise<ExitStatus> {
}

if (args.pythonplatform) {
if (args.pythonplatform === 'Darwin' || args.pythonplatform === 'Linux' || args.pythonplatform === 'Windows') {
if (!['All', 'Darwin', 'Linux', 'Windows'].includes(args.pythonplatform)) {
options.pythonPlatform = args.pythonplatform;
} else {
console.error(
`'${args.pythonplatform}' is not a supported Python platform; specify Darwin, Linux, or Windows`
`'${args.pythonplatform}' is not a supported Python platform; specify All, Darwin, Linux, or Windows`
);
return ExitStatus.ParameterError;
}
Expand Down
6 changes: 6 additions & 0 deletions pdm_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@
from subprocess import run # noqa: S404
else:
from nodejs.npm import run
import os

from nodejs import node


class PackageJson(TypedDict):
bin: dict[str, str]


# ah yes, the classic "wrong path" moment!
os.environ["PATH"] = os.pathsep.join([str(Path(node.__file__).parent), os.environ["PATH"]])

if not Path("node_modules").exists():
_ = run(["ci"], check=True)
_ = run(["run", "build:cli:dev"], check=True)
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ max-line-length = 200
[tool.basedpyright]
ignore = ["pw", "basedpyright/dist", "packages"]
pythonVersion = "3.8"
pythonPlatform = "All"
include = ["basedpyright", "get_version.py", "pdm_build.py"]
exclude = ["pw", "basedpyright/dist", "packages"]
typeCheckingMode = "all"
Expand Down

0 comments on commit 254922f

Please sign in to comment.