mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Add new parameter for gen_pyi.py to make it more configureable. (#161772)
This is a reposting of PR #128519. This change is important to how we maintain PyTorch at Google. From the previous PR: " This will make the script more flexible for the directory where it is executed. ... We plan to use the deprecated_yaml from a blaze genrule that invokes pyi.py. As the input to the pyi.py, genrule requires the input file to be explicitly listed out. When we feed the value of tools/autograd/deprecated.yaml to genrule, it failed to resolve since tools/autograd is a package from blaze perspective. Any file under a blaze package will a proper blaze target to be access. " Pull Request resolved: https://github.com/pytorch/pytorch/pull/161772 Approved by: https://github.com/albanD Co-authored-by: Haifeng Jin <haifeng-jin@users.noreply.github.com>
This commit is contained in:
@ -12,3 +12,9 @@ def define_targets(rules):
|
||||
"//torchgen",
|
||||
],
|
||||
)
|
||||
|
||||
rules.filegroup(
|
||||
name = "deprecated_yaml",
|
||||
srcs = ["deprecated.yaml"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
)
|
||||
|
@ -1885,8 +1885,15 @@ def main() -> None:
|
||||
default=".",
|
||||
help="path to output directory",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--template-dir",
|
||||
default=".",
|
||||
help="path to template directory",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
fm = FileManager(install_dir=args.out, template_dir=".", dry_run=False)
|
||||
fm = FileManager(
|
||||
install_dir=args.out, template_dir=args.template_dir, dry_run=False
|
||||
)
|
||||
gen_pyi(
|
||||
args.native_functions_path,
|
||||
args.tags_path,
|
||||
|
Reference in New Issue
Block a user