setup.py 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import os
  2. import sys
  3. from setuptools import setup, find_packages
  4. from distutils.sysconfig import get_python_lib
  5. # Warn if we are installing over top of an existing installation. This can
  6. # cause issues where files that were deleted from a more recent Django are
  7. # still present in site-packages. See #18115.
  8. overlay_warning = False
  9. if "install" in sys.argv:
  10. lib_paths = [get_python_lib()]
  11. if lib_paths[0].startswith("/usr/lib/"):
  12. # We have to try also with an explicit prefix of /usr/local in order to
  13. # catch Debian's custom user site-packages directory.
  14. lib_paths.append(get_python_lib(prefix="/usr/local"))
  15. for lib_path in lib_paths:
  16. existing_path = os.path.abspath(os.path.join(lib_path, "django"))
  17. if os.path.exists(existing_path):
  18. # We note the need for the warning here, but present it after the
  19. # command is run, so it's more likely to be seen.
  20. overlay_warning = True
  21. break
  22. EXCLUDE_FROM_PACKAGES = ['django.conf.project_template',
  23. 'django.conf.app_template',
  24. 'django.bin']
  25. # Dynamically calculate the version based on django.VERSION.
  26. version = __import__('django').get_version()
  27. setup(
  28. name='Django',
  29. version=version,
  30. url='http://www.djangoproject.com/',
  31. author='Django Software Foundation',
  32. author_email='foundation@djangoproject.com',
  33. description=('A high-level Python Web framework that encourages '
  34. 'rapid development and clean, pragmatic design.'),
  35. license='BSD',
  36. packages=find_packages(exclude=EXCLUDE_FROM_PACKAGES),
  37. include_package_data=True,
  38. scripts=['django/bin/django-admin.py'],
  39. entry_points={'console_scripts': [
  40. 'django-admin = django.core.management:execute_from_command_line',
  41. ]},
  42. zip_safe=False,
  43. classifiers=[
  44. 'Development Status :: 3 - Alpha',
  45. 'Environment :: Web Environment',
  46. 'Framework :: Django',
  47. 'Intended Audience :: Developers',
  48. 'License :: OSI Approved :: BSD License',
  49. 'Operating System :: OS Independent',
  50. 'Programming Language :: Python',
  51. 'Programming Language :: Python :: 2',
  52. 'Programming Language :: Python :: 2.7',
  53. 'Programming Language :: Python :: 3',
  54. 'Programming Language :: Python :: 3.2',
  55. 'Programming Language :: Python :: 3.3',
  56. 'Topic :: Internet :: WWW/HTTP',
  57. 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
  58. 'Topic :: Internet :: WWW/HTTP :: WSGI',
  59. 'Topic :: Software Development :: Libraries :: Application Frameworks',
  60. 'Topic :: Software Development :: Libraries :: Python Modules',
  61. ],
  62. )
  63. if overlay_warning:
  64. sys.stderr.write("""
  65. ========
  66. WARNING!
  67. ========
  68. You have just installed Django over top of an existing
  69. installation, without removing it first. Because of this,
  70. your install may now include extraneous files from a
  71. previous version that have since been removed from
  72. Django. This is known to cause a variety of problems. You
  73. should manually remove the
  74. %(existing_path)s
  75. directory and re-install Django.
  76. """ % {"existing_path": existing_path})