mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-24 04:41:30 +08:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user