Skip to content

Commit

Permalink
Implemented setup.py that compiles python wrapper using Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
leosampaio committed May 13, 2017
1 parent 8d750d2 commit 130ea12
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ Snowboy.pm
/node_modules
/lib/node/binding
/lib/node/index.js

/dist
**/snowboy.egg-info
7 changes: 7 additions & 0 deletions MANIFEST.in
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
50 changes: 50 additions & 0 deletions setup.py
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
}
)

0 comments on commit 130ea12

Please sign in to comment.