-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Use standard Python tool to build snowboy #326
Comments
I already fork snowboy to https://github.com/fossasia/snowboy and working there. With the setup.py like this import os
import sys
from setuptools import setup, find_packages, Extension
from distutils.command.build import build
py_dir = 'Python' if sys.version_info[0] < 3 else 'Python3'
class SnowboyBuild(build):
# Reorder build commands such that swig generated files are also copied.
sub_commands = [('build_ext', build.has_ext_modules),
('build_py', build.has_pure_modules),
('build_clib', build.has_c_libraries),
('build_scripts', build.has_scripts)]
ext = Extension(
'_snowboydetect',
['swig/Python3/snowboy-detect-swig.i'],
swig_opts=['-c++'],
include_dirs=['.'],
)
setup(
name='snowboy',
version='1.3.0',
description='Snowboy is a customizable hotword detection engine',
maintainer='KITT.AI',
maintainer_email='snowboy@kitt.ai',
license='Apache-2.0',
url='https://snowboy.kitt.ai',
ext_modules=[ext],
packages=find_packages(os.path.join('examples', py_dir)),
package_dir={'snowboy': os.path.join('examples', py_dir)},
py_modules=['snowboy.snowboydecoder', 'snowboy.snowboydetect'],
# include_package_data=True,
package_data={'snowboy': ['resources/*']},
zip_safe=False,
long_description="",
classifiers=[],
install_requires=[
'PyAudio',
],
cmdclass={
'build': SnowboyBuild
}
) I can make setuptools build the C++ source code, without calling |
Found the cause: The project layout is like this (listing only Python files and resources folder):
And with the setup() written like this: setup(
packages=find_packages(os.path.join('examples', py_dir)),
package_dir={'snowboy': os.path.join('examples', py_dir)},
py_modules=['snowboy.snowboydecoder', 'snowboy.snowboydetect'],
package_data={'snowboy': ['resources/*']},
) the My discovery is that, the path passed to
|
Working in this branch: https://github.com/fossasia/snowboy/tree/feature/standard-Python-build Can produce *.so file and include resources files now, but the *.so file is not not linked enough libraries yet. |
This is the output of
This is output of our current setup.py:
To produce correct *.so file, our script must produce compiler command with the same parameter as Currently, the content of files generated by |
Successfully fix the setup.py and build wheel files for armv7, x86_64 (uploaded to https://repo.fury.io/fossasia/). Waiting for friend to test on Mac OSX before making a pull request to upstream. |
Made Pull Request to upstream here: Kitt-AI/snowboy#493 |
I don't know when the Kiit-AI will review and accept the PR. But because it has been done and the wheel packages have been built, I'm closing this issue now. |
This issue is to track what I'm doing to improve snowboy's setup.py.
Motivation:
The text was updated successfully, but these errors were encountered: