setup.py 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/usr/bin/env python3
  2. import sys
  3. import os
  4. import stat
  5. from setuptools import setup
  6. from setuptools.command.install import install
  7. from distutils import log
  8. import speech_recognition
  9. if sys.version_info < (2, 6):
  10. print("THIS MODULE REQUIRES PYTHON 2.6, 2.7, OR 3.3+. YOU ARE CURRENTLY USING PYTHON {0}".format(sys.version))
  11. sys.exit(1)
  12. FILES_TO_MARK_EXECUTABLE = ["flac-linux-x86", "flac-linux-x86_64", "flac-mac", "flac-win32.exe"]
  13. class InstallWithExtraSteps(install):
  14. def run(self):
  15. install.run(self) # do the original install steps
  16. # mark the FLAC executables as executable by all users (this fixes occasional issues when file permissions get messed up)
  17. for output_path in self.get_outputs():
  18. if os.path.basename(output_path) in FILES_TO_MARK_EXECUTABLE:
  19. log.info("setting executable permissions on {}".format(output_path))
  20. stat_info = os.stat(output_path)
  21. os.chmod(
  22. output_path,
  23. stat_info.st_mode |
  24. stat.S_IRUSR | stat.S_IXUSR | # owner can read/execute
  25. stat.S_IRGRP | stat.S_IXGRP | # group can read/execute
  26. stat.S_IROTH | stat.S_IXOTH # everyone else can read/execute
  27. )
  28. setup(
  29. name="SpeechRecognition",
  30. version=speech_recognition.__version__,
  31. packages=["speech_recognition"],
  32. include_package_data=True,
  33. cmdclass={"install": InstallWithExtraSteps},
  34. # PyPI metadata
  35. author=speech_recognition.__author__,
  36. author_email="azhang9@gmail.com",
  37. description=speech_recognition.__doc__,
  38. long_description=open("README.rst").read(),
  39. license=speech_recognition.__license__,
  40. keywords="speech recognition voice sphinx google wit bing api houndify ibm",
  41. url="https://github.com/Uberi/speech_recognition#readme",
  42. classifiers=[
  43. "Development Status :: 5 - Production/Stable",
  44. "Intended Audience :: Developers",
  45. "Natural Language :: English",
  46. "License :: OSI Approved :: BSD License",
  47. "Operating System :: Microsoft :: Windows",
  48. "Operating System :: POSIX :: Linux",
  49. "Operating System :: MacOS :: MacOS X",
  50. "Operating System :: Other OS",
  51. "Programming Language :: Python",
  52. "Programming Language :: Python :: 2",
  53. "Programming Language :: Python :: 2.7",
  54. "Programming Language :: Python :: 3",
  55. "Programming Language :: Python :: 3.3",
  56. "Programming Language :: Python :: 3.4",
  57. "Programming Language :: Python :: 3.5",
  58. "Programming Language :: Python :: 3.6",
  59. "Topic :: Software Development :: Libraries :: Python Modules",
  60. "Topic :: Multimedia :: Sound/Audio :: Speech",
  61. ],
  62. )