Skip to content

Commit

Permalink
Fix problems with pip distribution model and inclusion of resources
Browse files Browse the repository at this point in the history
  • Loading branch information
leosampaio committed Jun 7, 2017
1 parent 5bb5596 commit d2c64d9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
7 changes: 5 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
recursive-include examples/Python *
recursive-include include *
recursive-include lib *
recursive-include swig/Python *
recursive-include resources *
include README.md

exclude *.txt
exclude *.pyc
exclude *.pyc
global-exclude .DS_Store _snowboydetect.so
prune resources/alexa
prune lib/ios
prune lib/android
28 changes: 13 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
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 distutils.dir_util import copy_tree
from subprocess import call
from multiprocessing import cpu_count


class SnowboyBuild(build):
Expand All @@ -16,22 +14,29 @@ def run(self):
def compile():
call(cmd, cwd='swig/Python')

self.execute(compile, [], 'Compiling snowboy')
self.execute(compile, [], 'Compiling snowboy...')

# copy generated .so to build folder
self.mkpath(self.build_lib)
self.mkpath(os.path.join(self.build_lib, 'snowboy'))
snowboy_build_lib = os.path.join(self.build_lib, 'snowboy')
self.mkpath(snowboy_build_lib)
target_file = 'swig/Python/_snowboydetect.so'
if not self.dry_run:
self.copy_file(target_file,
os.path.join(self.build_lib, 'snowboy'))
snowboy_build_lib)

# copy resources too since it is a symlink
resources_dir = 'resources'
resources_dir_on_build = os.path.join(snowboy_build_lib,
'resources')
copy_tree(resources_dir, resources_dir_on_build)

build.run(self)


setup(
name='snowboy',
version='1.2.0',
version='1.2.0b1',
description='Snowboy is a customizable hotword detection engine',
maintainer='KITT.AI',
maintainer_email='snowboy@kitt.ai',
Expand All @@ -40,14 +45,7 @@ def compile():
packages=find_packages('examples/Python/'),
package_dir={'snowboy': 'examples/Python/'},
py_modules=['snowboy.snowboydecoder', 'snowboy.snowboydetect'],
package_data={'': ['README.md', 'snowboy/resources/common.res']},
data_files=[('.', ['README.md']),
('snowboy/resources', ['resources/common.res',
'resources/ding.wav',
'resources/dong.wav',
'resources/snowboy.wav',
'resources/snowboy.umdl'])],
include_package_data=True,
package_data={'snowboy': ['resources/*']},
zip_safe=False,
long_description="",
classifiers=[],
Expand Down

0 comments on commit d2c64d9

Please sign in to comment.