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.
Implemented setup.py that compiles python wrapper using Makefile
- Loading branch information
1 parent
8d750d2
commit 130ea12
Showing
3 changed files
with
60 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,3 +45,6 @@ Snowboy.pm | |
/node_modules | ||
/lib/node/binding | ||
/lib/node/index.js | ||
|
||
/dist | ||
**/snowboy.egg-info |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
recursive-include examples/Python * | ||
recursive-include include * | ||
recursive-include lib * | ||
recursive-include swig/Python * | ||
include README.md | ||
|
||
exclude *.txt |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import os | ||
from sys import platform | ||
from setuptools import setup, find_packages | ||
from setuptools.command.install import install | ||
from distutils.command.build import build | ||
from subprocess import call | ||
from multiprocessing import cpu_count | ||
|
||
|
||
class SnowboyBuild(build): | ||
|
||
def run(self): | ||
|
||
cmd = ['make'] | ||
|
||
def compile(): | ||
call(cmd, cwd='swig/Python') | ||
|
||
self.execute(compile, [], 'Compiling snowboy') | ||
|
||
# copy generated .so to build folder | ||
self.mkpath(self.build_lib) | ||
target_file = os.path.join('swig/Python/_snowboydetect.so') | ||
if not self.dry_run: | ||
self.copy_file(target_file, self.build_lib) | ||
|
||
build.run(self) | ||
|
||
|
||
setup( | ||
name='snowboy', | ||
version='0.1', | ||
description='', | ||
maintainer='', | ||
maintainer_email='', | ||
license='', | ||
url='', | ||
packages=find_packages('examples/Python/'), | ||
package_dir={'snowboy': 'examples/Python/'}, | ||
py_modules=['snowboy.snowboydecoder', 'snowboy.snowboydetect'], | ||
include_package_data=True, | ||
long_description="", | ||
classifiers=[], | ||
install_requires=[ | ||
'PyAudio', | ||
], | ||
cmdclass={ | ||
'build': SnowboyBuild | ||
} | ||
) |