forked from Kitt-AI/snowboy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed setup.py so it works on Raspbian Stretch/Python3
- Loading branch information
Showing
2 changed files
with
9 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
import os | ||
import sys | ||
from setuptools import setup, find_packages | ||
from distutils.command.build import build | ||
from distutils.dir_util import copy_tree | ||
from subprocess import call | ||
|
||
|
||
py_dir = 'Python' if sys.version_info[0] < 3 else 'Python3' | ||
|
||
class SnowboyBuild(build): | ||
|
||
def run(self): | ||
|
||
cmd = ['make'] | ||
|
||
swig_dir = os.path.join('swig', py_dir) | ||
def compile(): | ||
call(cmd, cwd='swig/Python') | ||
call(cmd, cwd=swig_dir) | ||
|
||
self.execute(compile, [], 'Compiling snowboy...') | ||
|
||
# copy generated .so to build folder | ||
self.mkpath(self.build_lib) | ||
snowboy_build_lib = os.path.join(self.build_lib, 'snowboy') | ||
self.mkpath(snowboy_build_lib) | ||
target_file = 'swig/Python/_snowboydetect.so' | ||
target_file = os.path.join(swig_dir, '_snowboydetect.so') | ||
if not self.dry_run: | ||
self.copy_file(target_file, | ||
snowboy_build_lib) | ||
|
@@ -42,8 +45,8 @@ def compile(): | |
maintainer_email='[email protected]', | ||
license='Apache-2.0', | ||
url='https://snowboy.kitt.ai', | ||
packages=find_packages('examples/Python/'), | ||
package_dir={'snowboy': 'examples/Python/'}, | ||
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/*']}, | ||
zip_safe=False, | ||
|