setup.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env python3
  2. PROJ_NAME = 'you-get'
  3. PACKAGE_NAME = 'you_get'
  4. PROJ_METADATA = '%s.json' % PROJ_NAME
  5. import importlib.util
  6. import importlib.machinery
  7. def load_source(modname, filename):
  8. loader = importlib.machinery.SourceFileLoader(modname, filename)
  9. spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
  10. module = importlib.util.module_from_spec(spec)
  11. # The module is always executed and not cached in sys.modules.
  12. # Uncomment the following line to cache the module.
  13. # sys.modules[module.__name__] = module
  14. loader.exec_module(module)
  15. return module
  16. import os, json
  17. here = os.path.abspath(os.path.dirname(__file__))
  18. proj_info = json.loads(open(os.path.join(here, PROJ_METADATA), encoding='utf-8').read())
  19. try:
  20. README = open(os.path.join(here, 'README.rst'), encoding='utf-8').read()
  21. except:
  22. README = ""
  23. CHANGELOG = open(os.path.join(here, 'CHANGELOG.rst'), encoding='utf-8').read()
  24. VERSION = load_source('version', os.path.join(here, 'src/%s/version.py' % PACKAGE_NAME)).__version__
  25. from setuptools import setup, find_packages
  26. setup(
  27. name = proj_info['name'],
  28. version = VERSION,
  29. author = proj_info['author'],
  30. author_email = proj_info['author_email'],
  31. url = proj_info['url'],
  32. license = proj_info['license'],
  33. description = proj_info['description'],
  34. keywords = proj_info['keywords'],
  35. long_description = README,
  36. packages = find_packages('src'),
  37. package_dir = {'' : 'src'},
  38. test_suite = 'tests',
  39. platforms = 'any',
  40. zip_safe = True,
  41. include_package_data = True,
  42. classifiers = proj_info['classifiers'],
  43. entry_points = {'console_scripts': proj_info['console_scripts']},
  44. install_requires = ['dukpy'],
  45. extras_require = {
  46. 'socks': ['PySocks'],
  47. }
  48. )