mirror of
https://github.com/drewcassidy/quicktex.git
synced 2024-09-13 06:37:34 +00:00
use pybind11-stubgen instead
This commit is contained in:
parent
190bb58367
commit
25cd3bba24
1
setup.py
1
setup.py
@ -123,6 +123,7 @@ setup(
|
|||||||
extras_require={
|
extras_require={
|
||||||
"tests": ["nose", "parameterized"],
|
"tests": ["nose", "parameterized"],
|
||||||
"docs": ["sphinx", "myst-parser", "sphinx-rtd-theme"],
|
"docs": ["sphinx", "myst-parser", "sphinx-rtd-theme"],
|
||||||
|
"stubs": ["pybind11-stubgen"],
|
||||||
},
|
},
|
||||||
entry_points='''
|
entry_points='''
|
||||||
[console_scripts]
|
[console_scripts]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import inspect
|
import inspect
|
||||||
import os.path
|
import os.path
|
||||||
import tempfile
|
import tempfile
|
||||||
import mypy.stubgen as sg
|
import pybind11_stubgen as sg
|
||||||
|
|
||||||
package = 'quicktex'
|
package = 'quicktex'
|
||||||
prefix = '_'
|
prefix = '_'
|
||||||
@ -20,10 +20,15 @@ def find_submodules(pkg):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
find_submodules(__import__(prefix + package))
|
find_submodules(__import__(prefix + package))
|
||||||
|
|
||||||
|
pkgdir = os.path.abspath(os.curdir)
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory() as out:
|
with tempfile.TemporaryDirectory() as out:
|
||||||
|
|
||||||
# generate stubs using mypy Stubgen
|
# generate stubs using mypy Stubgen
|
||||||
sg.generate_stubs(sg.parse_options(['-o', out, '-p', prefix + package]))
|
sg.main(['-o', out, '--root-module-suffix', "", prefix + package])
|
||||||
|
|
||||||
|
os.curdir = pkgdir
|
||||||
|
|
||||||
# walk resulting stubs and move them to their new location
|
# walk resulting stubs and move them to their new location
|
||||||
for root, dirs, files in os.walk(out):
|
for root, dirs, files in os.walk(out):
|
||||||
@ -31,6 +36,9 @@ if __name__ == "__main__":
|
|||||||
# location of the extension module's stub file
|
# location of the extension module's stub file
|
||||||
ext_module = os.path.relpath(root, out)
|
ext_module = os.path.relpath(root, out)
|
||||||
|
|
||||||
|
if stub_name.split('.')[-1] != 'pyi':
|
||||||
|
continue
|
||||||
|
|
||||||
if stub_name != '__init__.pyi':
|
if stub_name != '__init__.pyi':
|
||||||
ext_module = os.path.join(ext_module, os.path.splitext(stub_name)[0])
|
ext_module = os.path.join(ext_module, os.path.splitext(stub_name)[0])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user