1
0

setup.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import json
  2. import os
  3. import setuptools
  4. import ssl
  5. import subprocess
  6. from python_appimage.utils.deps import ensure_excludelist
  7. from python_appimage.utils.url import urlopen
  8. CLASSIFIERS = '''\
  9. Development Status :: 4 - Beta
  10. Intended Audience :: Developers
  11. License :: OSI Approved :: GNU General Public License v3 (GPLv3)
  12. Programming Language :: Python
  13. Topic :: Software Development
  14. Operating System :: POSIX :: Linux
  15. '''
  16. with open('README.md') as f:
  17. long_description = f.read()
  18. def get_version():
  19. '''Get the next version number from PyPI
  20. '''
  21. with open('VERSION') as f:
  22. version = f.read().strip()
  23. p = subprocess.Popen(
  24. 'git describe --match=NeVeRmAtCh --always --dirty 2> /dev/null || '
  25. 'echo unknown',
  26. shell=True, stdout=subprocess.PIPE,
  27. stderr=subprocess.STDOUT)
  28. stdout, _ = p.communicate()
  29. try:
  30. stdout = stdout.decode()
  31. except AttributeError:
  32. stdout = str(stdout)
  33. git_revision = stdout.strip()
  34. with open('python_appimage/version.py', 'w+') as f:
  35. f.write('''\
  36. # This file was generated by setup.py
  37. version = '{version:}'
  38. git_revision = '{git_revision:}'
  39. '''.format(version=version, git_revision=git_revision))
  40. return version
  41. def get_package_data():
  42. '''Get the list of package data
  43. '''
  44. ensure_excludelist()
  45. prefix = os.path.dirname(__file__) or '.'
  46. return ['data/' + file_
  47. for file_ in os.listdir(prefix + '/python_appimage/data')]
  48. setuptools.setup(
  49. name = 'python_appimage',
  50. version = get_version(),
  51. author = 'Valentin Niess',
  52. author_email = 'valentin.niess@gmail.com',
  53. description = 'Appimage releases of Python',
  54. long_description = long_description,
  55. long_description_content_type = 'text/markdown',
  56. url = 'https://github.com/niess/python-appimage',
  57. download_url = 'https://pypi.python.org/pypi/python-appimage',
  58. project_urls = {
  59. 'Bug Tracker' : 'https://github.com/niess/python-appimage/issues',
  60. 'Source Code' : 'https://github.com/niess/python-appimage',
  61. },
  62. packages = setuptools.find_packages(),
  63. classifiers = [s for s in CLASSIFIERS.split(os.linesep) if s.strip()],
  64. license = 'GPLv3',
  65. platforms = ['Linux'],
  66. python_requires = '>=2.7',
  67. include_package_data = True,
  68. package_data = {'': get_package_data()},
  69. entry_points = {
  70. 'console_scripts' : (
  71. 'python-appimage = python_appimage.__main__:main',)
  72. }
  73. )