Move routes stubs to @python2 directory (#5637)

* Move routes stubs to @python2 directory

* Ignore Python-2-only stubs for stubtest

* Use standard idiom for re-exporting items

Co-authored-by: Akuli <akuviljanen17@gmail.com>
This commit is contained in:
Sebastian Rittau
2021-06-18 16:05:23 +02:00
committed by GitHub
parent 5a256a0c70
commit bc2ec748f6
8 changed files with 9 additions and 12 deletions

View File

@@ -8,6 +8,7 @@ import sys
import tempfile
import toml
import venv
from glob import glob
from pathlib import Path
@@ -37,7 +38,7 @@ def run_stubtest(dist: Path) -> None:
metadata = dict(toml.loads(f.read()))
# Ignore stubs that don't support Python 2
if not bool(metadata.get("python3", True)):
if not bool(metadata.get("python3", True)) or not has_py3_stubs(dist):
return
with tempfile.TemporaryDirectory() as tmp:
@@ -105,6 +106,10 @@ def run_stubtest(dist: Path) -> None:
print(f"stubtest succeeded for {dist.name}", file=sys.stderr)
def has_py3_stubs(dist: Path) -> bool:
return len(glob(f"{dist}/*.pyi")) > 0 or len(glob(f"{dist}/[!@]*/__init__.pyi")) > 0
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--num-shards", type=int, default=1)