-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
85 changed files
with
575 additions
and
831 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
changeKind: internal | ||
packages: | ||
- "@azure-tools/typespec-python" | ||
--- | ||
|
||
Enable lint check in CI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
changeKind: internal | ||
packages: | ||
- "@autorest/python" | ||
--- | ||
|
||
update ci to use npm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ pytest==8.3.2 | |
tox==4.18.0 | ||
coverage==7.6.1 | ||
black==24.8.0 | ||
setuptools==69.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { copyFileSync, readdirSync } from "fs"; | ||
import { existsSync, removeSync, copySync } from "fs-extra"; | ||
import { join } from "path"; | ||
|
||
const force: boolean = process.argv[2] === "--force"; | ||
|
||
function copyAndCreateDir(sourceDir: string, destDir: string) { | ||
// Delete the destination directory if it exists | ||
if (existsSync(destDir)) { | ||
if (force) removeSync(destDir); | ||
else process.exit(0); | ||
} | ||
|
||
// Copy the source directory to the destination directory | ||
copySync(sourceDir, destDir); | ||
} | ||
|
||
const typespecModulePath: string = join(__dirname, "..", "node_modules", "@azure-tools", "typespec-python"); | ||
|
||
// Copy the generator directory | ||
copyAndCreateDir(join(typespecModulePath, "generator"), join(__dirname, "..", "generator")); | ||
|
||
// Copy the scripts directory | ||
copyAndCreateDir(join(typespecModulePath, "scripts", "eng"), join(__dirname, "..", "scripts", "eng")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// This script wraps logic in @azure-tools/extension to resolve | ||
// the path to Python 3 so that a Python script file can be run | ||
// from an npm script in package.json. It uses the same Python 3 | ||
// path resolution algorithm as AutoRest so that the behavior | ||
// is fully consistent (and also supports AUTOREST_PYTHON_EXE). | ||
// | ||
// Invoke it like so: "tsx run-python3.ts script.py" | ||
|
||
import cp from "child_process"; | ||
import { patchPythonPath } from "./system-requirements.js"; | ||
|
||
async function runPython3(...args: string[]) { | ||
const command = await patchPythonPath(["python", ...args], { | ||
version: ">=3.8", | ||
environmentVariable: "AUTOREST_PYTHON_EXE", | ||
}); | ||
cp.execSync(command.join(" "), { | ||
stdio: [0, 1, 2], | ||
}); | ||
} | ||
|
||
runPython3(...process.argv.slice(2)).catch((err) => { | ||
console.error(err.toString()); // eslint-disable-line no-console | ||
process.exit(1); | ||
}); |
Oops, something went wrong.