setup.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Copyright 2012 Matt Martz
  4. # All Rights Reserved.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  7. # not use this file except in compliance with the License. You may obtain
  8. # a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. # License for the specific language governing permissions and limitations
  16. # under the License.
  17. import os
  18. import re
  19. import codecs
  20. from setuptools import setup
  21. here = os.path.abspath(os.path.dirname(__file__))
  22. # Read the version number from a source file.
  23. # Why read it, and not import?
  24. # see https://groups.google.com/d/topic/pypa-dev/0PkjVpcxTzQ/discussion
  25. def find_version(*file_paths):
  26. # Open in Latin-1 so that we avoid encoding errors.
  27. # Use codecs.open for Python 2 compatibility
  28. try:
  29. f = codecs.open(os.path.join(here, *file_paths), 'r', 'latin1')
  30. version_file = f.read()
  31. f.close()
  32. except:
  33. raise RuntimeError("Unable to find version string.")
  34. # The version line must have the form
  35. # __version__ = 'ver'
  36. version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
  37. version_file, re.M)
  38. if version_match:
  39. return version_match.group(1)
  40. raise RuntimeError("Unable to find version string.")
  41. # Get the long description from the relevant file
  42. try:
  43. f = codecs.open('README.rst', encoding='utf-8')
  44. long_description = f.read()
  45. f.close()
  46. except:
  47. long_description = ''
  48. setup(
  49. name='speedtest-cli',
  50. version=find_version('speedtest.py'),
  51. description=('Command line interface for testing internet bandwidth using '
  52. 'speedtest.net'),
  53. long_description=long_description,
  54. keywords='speedtest speedtest.net',
  55. author='Matt Martz',
  56. author_email='matt@sivel.net',
  57. url='https://github.com/sivel/speedtest-cli',
  58. license='Apache License, Version 2.0',
  59. py_modules=['speedtest'],
  60. entry_points={
  61. 'console_scripts': [
  62. 'speedtest=speedtest:main',
  63. 'speedtest-cli=speedtest:main'
  64. ]
  65. },
  66. classifiers=[
  67. 'Development Status :: 5 - Production/Stable',
  68. 'Programming Language :: Python',
  69. 'Environment :: Console',
  70. 'License :: OSI Approved :: Apache Software License',
  71. 'Operating System :: OS Independent',
  72. 'Programming Language :: Python :: 2',
  73. 'Programming Language :: Python :: 2.4',
  74. 'Programming Language :: Python :: 2.5',
  75. 'Programming Language :: Python :: 2.6',
  76. 'Programming Language :: Python :: 2.7',
  77. 'Programming Language :: Python :: 3',
  78. 'Programming Language :: Python :: 3.1',
  79. 'Programming Language :: Python :: 3.2',
  80. 'Programming Language :: Python :: 3.3',
  81. 'Programming Language :: Python :: 3.4',
  82. 'Programming Language :: Python :: 3.5',
  83. 'Programming Language :: Python :: 3.6',
  84. 'Programming Language :: Python :: 3.7',
  85. 'Programming Language :: Python :: 3.8',
  86. 'Programming Language :: Python :: 3.9',
  87. 'Programming Language :: Python :: 3.10',
  88. ]
  89. )