|
21 | 21 | from Cython.Build import cythonize
|
22 | 22 | from setuptools import setup, find_packages, Extension
|
23 | 23 | import os
|
24 |
| -import platform |
25 | 24 | import shutil
|
26 | 25 | import subprocess
|
27 | 26 |
|
|
34 | 33 | ]
|
35 | 34 |
|
36 | 35 | # Setup
|
37 |
| -if platform.python_implementation() != 'PyPy': |
38 |
| - print("Generating stub files ...") |
39 |
| - os.makedirs(stubs_dir, exist_ok=True) |
40 |
| - for filename in os.listdir(source_dir): |
41 |
| - if filename.endswith('.py'): |
42 |
| - source_path = os.path.join(source_dir, filename) |
43 |
| - subprocess.run(['stubgen', '-o', stubs_dir, source_path], check=True) |
44 |
| - for stub_file in os.listdir(os.path.join(stubs_dir, source_dir)): |
45 |
| - if stub_file.endswith('.pyi'): |
46 |
| - source_stub_path = os.path.join(stubs_dir, source_dir, stub_file) |
47 |
| - if os.path.exists(os.path.join(source_dir, stub_file)): |
48 |
| - print(f"Skipped moving {source_stub_path} because {os.path.join(source_dir, stub_file)} already exists!") |
49 |
| - else: |
50 |
| - shutil.move(source_stub_path, source_dir) |
51 |
| - print(f"Moved {source_stub_path} to {source_dir}!") |
52 |
| - shutil.rmtree(os.path.join(stubs_dir)) |
53 |
| - print("Stub files generated and moved successfully.") |
| 36 | +print("Generating stub files ...") |
| 37 | +os.makedirs(stubs_dir, exist_ok=True) |
| 38 | +for filename in os.listdir(source_dir): |
| 39 | + if filename.endswith('.py'): |
| 40 | + source_path = os.path.join(source_dir, filename) |
| 41 | + subprocess.run(['stubgen', '-o', stubs_dir, source_path], check=True) |
| 42 | +for stub_file in os.listdir(os.path.join(stubs_dir, source_dir)): |
| 43 | + if stub_file.endswith('.pyi'): |
| 44 | + source_stub_path = os.path.join(stubs_dir, source_dir, stub_file) |
| 45 | + if os.path.exists(os.path.join(source_dir, stub_file)): |
| 46 | + print(f"Skipped moving {source_stub_path} because {os.path.join(source_dir, stub_file)} already exists!") |
| 47 | + else: |
| 48 | + shutil.move(source_stub_path, source_dir) |
| 49 | + print(f"Moved {source_stub_path} to {source_dir}!") |
| 50 | +shutil.rmtree(os.path.join(stubs_dir)) |
| 51 | +print("Stub files generated and moved successfully.") |
54 | 52 |
|
55 | 53 | with open("README.md", "r") as fh:
|
56 | 54 | print("Using README.md content as `long_description` ...")
|
|
0 commit comments