@azure-tools/typespec-python 0.61.1 → 0.61.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/{scripts/eng → eng/scripts/ci}/format.d.ts.map +1 -1
- package/dist/eng/scripts/ci/format.js +140 -0
- package/dist/eng/scripts/ci/format.js.map +1 -0
- package/dist/eng/scripts/ci/lint.d.ts +2 -0
- package/dist/eng/scripts/ci/lint.d.ts.map +1 -0
- package/dist/eng/scripts/ci/lint.js +96 -0
- package/dist/eng/scripts/ci/lint.js.map +1 -0
- package/dist/eng/scripts/ci/run-tests.d.ts.map +1 -0
- package/dist/eng/scripts/ci/run-tests.js +226 -0
- package/dist/eng/scripts/ci/run-tests.js.map +1 -0
- package/dist/{scripts/eng → eng/scripts}/regenerate-common.d.ts +1 -0
- package/dist/eng/scripts/regenerate-common.d.ts.map +1 -0
- package/dist/{scripts/eng → eng/scripts}/regenerate-common.js +15 -14
- package/dist/{scripts/eng → eng/scripts}/regenerate-common.js.map +1 -1
- package/dist/eng/scripts/regenerate.d.ts +8 -0
- package/dist/eng/scripts/regenerate.d.ts.map +1 -0
- package/dist/eng/scripts/regenerate.js +288 -0
- package/dist/eng/scripts/regenerate.js.map +1 -0
- package/dist/eng/scripts/setup/run-python3.d.ts.map +1 -0
- package/dist/eng/scripts/setup/run-python3.js.map +1 -0
- package/dist/eng/scripts/setup/system-requirements.d.ts.map +1 -0
- package/dist/{scripts → eng/scripts/setup}/system-requirements.js +6 -2
- package/dist/eng/scripts/setup/system-requirements.js.map +1 -0
- package/{scripts → eng/scripts/setup}/__pycache__/package_manager.cpython-310.pyc +0 -0
- package/{scripts → eng/scripts/setup}/__pycache__/venvtools.cpython-310.pyc +0 -0
- package/{scripts → eng/scripts/setup}/prepare.py +1 -1
- package/{scripts → eng/scripts/setup}/run_tsp.py +7 -7
- package/{scripts → eng/scripts/setup}/system-requirements.ts +6 -2
- package/package.json +52 -49
- package/dist/scripts/eng/format.js +0 -4
- package/dist/scripts/eng/format.js.map +0 -1
- package/dist/scripts/eng/lint.d.ts +0 -5
- package/dist/scripts/eng/lint.d.ts.map +0 -1
- package/dist/scripts/eng/lint.js +0 -95
- package/dist/scripts/eng/lint.js.map +0 -1
- package/dist/scripts/eng/regenerate-common.d.ts.map +0 -1
- package/dist/scripts/eng/regenerate.d.ts +0 -2
- package/dist/scripts/eng/regenerate.d.ts.map +0 -1
- package/dist/scripts/eng/regenerate.js +0 -123
- package/dist/scripts/eng/regenerate.js.map +0 -1
- package/dist/scripts/eng/run-tests.d.ts.map +0 -1
- package/dist/scripts/eng/run-tests.js +0 -91
- package/dist/scripts/eng/run-tests.js.map +0 -1
- package/dist/scripts/eng/utils.d.ts +0 -3
- package/dist/scripts/eng/utils.d.ts.map +0 -1
- package/dist/scripts/eng/utils.js +0 -39
- package/dist/scripts/eng/utils.js.map +0 -1
- package/dist/scripts/run-python3.d.ts.map +0 -1
- package/dist/scripts/run-python3.js.map +0 -1
- package/dist/scripts/system-requirements.d.ts.map +0 -1
- package/dist/scripts/system-requirements.js.map +0 -1
- package/scripts/eng/format.ts +0 -5
- package/scripts/eng/lint.ts +0 -102
- package/scripts/eng/mypy.ini +0 -40
- package/scripts/eng/pylintrc +0 -59
- package/scripts/eng/pyrightconfig.json +0 -7
- package/scripts/eng/regenerate-common.ts +0 -449
- package/scripts/eng/regenerate.ts +0 -159
- package/scripts/eng/run-tests.ts +0 -101
- package/scripts/eng/utils.ts +0 -38
- /package/dist/{scripts/eng → eng/scripts/ci}/format.d.ts +0 -0
- /package/dist/{scripts/eng → eng/scripts/ci}/run-tests.d.ts +0 -0
- /package/dist/{scripts → eng/scripts/setup}/run-python3.d.ts +0 -0
- /package/dist/{scripts → eng/scripts/setup}/run-python3.js +0 -0
- /package/dist/{scripts → eng/scripts/setup}/system-requirements.d.ts +0 -0
- /package/{scripts → eng/scripts/setup}/install.py +0 -0
- /package/{scripts → eng/scripts/setup}/package_manager.py +0 -0
- /package/{scripts → eng/scripts/setup}/run-python3.ts +0 -0
- /package/{scripts → eng/scripts/setup}/venvtools.py +0 -0
package/scripts/eng/run-tests.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import { execSync } from "child_process";
|
|
3
|
-
import { readFileSync } from "fs";
|
|
4
|
-
import { join } from "path";
|
|
5
|
-
import yargs from "yargs";
|
|
6
|
-
import { hideBin } from "yargs/helpers";
|
|
7
|
-
import { fileURLToPath } from "url";
|
|
8
|
-
|
|
9
|
-
interface Arguments {
|
|
10
|
-
validFolders: string[];
|
|
11
|
-
folder?: string;
|
|
12
|
-
command?: string;
|
|
13
|
-
name?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const validCommands = ["ci", "lint", "mypy", "pyright", "apiview"];
|
|
17
|
-
|
|
18
|
-
// Parse command-line arguments using yargs
|
|
19
|
-
const argv = yargs(hideBin(process.argv))
|
|
20
|
-
.option("validFolders", {
|
|
21
|
-
alias: "vf",
|
|
22
|
-
describe: "Specify the valid folders",
|
|
23
|
-
type: "array",
|
|
24
|
-
default: ["azure", "unbranded"],
|
|
25
|
-
})
|
|
26
|
-
.option("folder", {
|
|
27
|
-
alias: "f",
|
|
28
|
-
describe: "Specify the folder to use",
|
|
29
|
-
type: "string",
|
|
30
|
-
})
|
|
31
|
-
.option("command", {
|
|
32
|
-
alias: "c",
|
|
33
|
-
describe: "Specify the command to run",
|
|
34
|
-
choices: validCommands,
|
|
35
|
-
type: "string",
|
|
36
|
-
})
|
|
37
|
-
.option("name", {
|
|
38
|
-
alias: "n",
|
|
39
|
-
describe: "Specify the name of the test",
|
|
40
|
-
type: "string",
|
|
41
|
-
}).argv as Arguments;
|
|
42
|
-
|
|
43
|
-
const foldersToProcess = argv.folder ? [argv.folder] : argv.validFolders;
|
|
44
|
-
|
|
45
|
-
const commandToRun = argv.command || "all";
|
|
46
|
-
|
|
47
|
-
function getCommand(command: string, folder: string, name?: string): string {
|
|
48
|
-
if (!validCommands.includes(command)) throw new Error(`Unknown command '${command}'.`);
|
|
49
|
-
// Check if running on Windows
|
|
50
|
-
const isWindows = process.platform === "win32";
|
|
51
|
-
const baseCommand = `tox -c ./test/${folder}/tox.ini -e ${command}`;
|
|
52
|
-
|
|
53
|
-
let retval: string;
|
|
54
|
-
if (isWindows) {
|
|
55
|
-
// Windows command format: set FOLDER=value && command
|
|
56
|
-
retval = `set FOLDER=${folder} && ${baseCommand}`;
|
|
57
|
-
} else {
|
|
58
|
-
// Unix/Linux/macOS format: FOLDER=value command
|
|
59
|
-
retval = `FOLDER=${folder} ${baseCommand}`;
|
|
60
|
-
}
|
|
61
|
-
if (name) {
|
|
62
|
-
return `${retval} -- -f ${name}`;
|
|
63
|
-
}
|
|
64
|
-
return retval;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function sectionExistsInToxIni(command: string, folder: string): boolean {
|
|
68
|
-
const toxIniPath = join(fileURLToPath(import.meta.url), `../../../test/${folder}/tox.ini`);
|
|
69
|
-
const toxIniContent = readFileSync(toxIniPath, "utf-8");
|
|
70
|
-
const sectionHeader = `[testenv:${command}]`;
|
|
71
|
-
return toxIniContent.includes(sectionHeader);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function myExecSync(command: string, folder: string, name?: string): void {
|
|
75
|
-
if (!sectionExistsInToxIni(command, folder)) {
|
|
76
|
-
console.log(`No section for ${command} in tox.ini for folder ${folder}. Skipping...`);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
execSync(getCommand(command, folder, name), { stdio: "inherit" });
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
foldersToProcess.forEach((folder) => {
|
|
83
|
-
try {
|
|
84
|
-
if (commandToRun === "all") {
|
|
85
|
-
for (const key of validCommands) {
|
|
86
|
-
console.log(`Running ${key} for folder ${folder}...`);
|
|
87
|
-
myExecSync(key, folder, argv.name);
|
|
88
|
-
}
|
|
89
|
-
} else if (getCommand(commandToRun, folder, argv.name)) {
|
|
90
|
-
console.log(`Running ${commandToRun} for folder ${folder}...`);
|
|
91
|
-
myExecSync(commandToRun, folder, argv.name);
|
|
92
|
-
} else {
|
|
93
|
-
console.error(`Error: Unknown command '${commandToRun}'.`);
|
|
94
|
-
process.exit(1);
|
|
95
|
-
}
|
|
96
|
-
} catch (error) {
|
|
97
|
-
console.error((error as Error).message);
|
|
98
|
-
console.error(`Error executing command for folder ${folder}: ${(error as Error).message}`);
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
});
|
package/scripts/eng/utils.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import { exec } from "child_process";
|
|
3
|
-
import process from "process";
|
|
4
|
-
import { existsSync } from "fs";
|
|
5
|
-
import { dirname, join } from "path";
|
|
6
|
-
import { fileURLToPath } from "url";
|
|
7
|
-
import chalk from "chalk";
|
|
8
|
-
|
|
9
|
-
// execute the command
|
|
10
|
-
export function executeCommand(command: string, prettyName: string) {
|
|
11
|
-
exec(command, (error, stdout, stderr) => {
|
|
12
|
-
if (error) {
|
|
13
|
-
console.error(chalk.red(`Error executing ${command}(stdout): ${stdout}`));
|
|
14
|
-
console.error(chalk.red(`Error executing ${command}{stderr}: ${stderr}`));
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
if (stderr) {
|
|
18
|
-
// Process stderr output
|
|
19
|
-
console.log(chalk.yellow(`${command}:\n${stderr}`));
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
console.log(chalk.green(`${prettyName} passed`));
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Function to run a command and log the output
|
|
27
|
-
export function runCommand(command: string, prettyName: string) {
|
|
28
|
-
let pythonPath = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "venv/");
|
|
29
|
-
if (existsSync(join(pythonPath, "bin"))) {
|
|
30
|
-
pythonPath = join(pythonPath, "bin", "python");
|
|
31
|
-
} else if (existsSync(join(pythonPath, "Scripts"))) {
|
|
32
|
-
pythonPath = join(pythonPath, "Scripts", "python");
|
|
33
|
-
} else {
|
|
34
|
-
throw new Error(pythonPath);
|
|
35
|
-
}
|
|
36
|
-
command = `${pythonPath} -m ${command}`;
|
|
37
|
-
executeCommand(command, prettyName);
|
|
38
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|