fix stubgen and add pyi files to package

This commit is contained in:
Andrew Cassidy 2021-04-03 22:03:50 -07:00
parent 6e30ba871c
commit 190bb58367
3 changed files with 7 additions and 1 deletions

0
quicktex/py.typed Normal file
View File

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
import sys import sys
import glob
import subprocess import subprocess
from setuptools import setup, Extension, find_packages from setuptools import setup, Extension, find_packages
@ -99,6 +100,9 @@ class CMakeBuild(build_ext):
) )
# Find stub files
stubs = [path.replace('quicktex/', '') for path in glob.glob('quicktex/**/*.pyi', recursive=True)]
# The information here can also be placed in setup.cfg - better separation of # The information here can also be placed in setup.cfg - better separation of
# logic and declaration, and simpler if you include description/version in a file. # logic and declaration, and simpler if you include description/version in a file.
setup( setup(
@ -113,6 +117,8 @@ setup(
cmdclass={"build_ext": CMakeBuild}, cmdclass={"build_ext": CMakeBuild},
packages=find_packages('.'), packages=find_packages('.'),
package_dir={'': '.'}, package_dir={'': '.'},
package_data={'': ['py.typed'] + stubs},
include_package_data=True,
install_requires=["Pillow", "click"], install_requires=["Pillow", "click"],
extras_require={ extras_require={
"tests": ["nose", "parameterized"], "tests": ["nose", "parameterized"],

View File

@ -40,7 +40,7 @@ if __name__ == "__main__":
for mod in modules: for mod in modules:
new_mod = mod.replace(prefix, '') new_mod = mod.replace(prefix, '')
contents.replace(mod, new_mod) contents = contents.replace(mod, new_mod)
# write out to the new location # write out to the new location
py_module = ext_module.replace(prefix, '') py_module = ext_module.replace(prefix, '')