mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-25 11:04:02 +03:00
eb3d078a2c
* Set version number for 3.7.0 release * Rename release notes section Moved issue links to top for easier access. (Can move back later) * Add release note for #5273 * Add release note for #5440 * Add release note for #5265 Strict JSON handling * Add release note for #5250 * Add release notes for #5170 * Add release notes for #5443 * Add release notes for #5448 * Add release notes for #5452 * Add release not for #5342 * Add release notes for 5454 * Add release notes for #5058 & #5457 Remove Django 1.8 & 1.9 from README and setup.py * Release notes for merged 3.6.5 milestone tickets Tickets migrated to 3.7.0 milestone. * Add release notes for #5469 * Add release notes from AM 2ndOct * Add final changes to the release notes. * Add date and milestone link Move issue links back to bottom. * Update translations from transifex * Begin releae anouncement * Add release note for #5482 * 3.7 release announcement & related docs.
115 lines
3.5 KiB
Python
Executable File
115 lines
3.5 KiB
Python
Executable File
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
import os
|
|
import re
|
|
import shutil
|
|
import sys
|
|
from io import open
|
|
|
|
from setuptools import setup
|
|
|
|
try:
|
|
from pypandoc import convert
|
|
|
|
def read_md(f):
|
|
return convert(f, 'rst')
|
|
except ImportError:
|
|
print("warning: pypandoc module not found, could not convert Markdown to RST")
|
|
|
|
def read_md(f):
|
|
return open(f, 'r', encoding='utf-8').read()
|
|
|
|
|
|
def get_version(package):
|
|
"""
|
|
Return package version as listed in `__version__` in `init.py`.
|
|
"""
|
|
init_py = open(os.path.join(package, '__init__.py')).read()
|
|
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
|
|
|
|
|
|
def get_packages(package):
|
|
"""
|
|
Return root package and all sub-packages.
|
|
"""
|
|
return [dirpath
|
|
for dirpath, dirnames, filenames in os.walk(package)
|
|
if os.path.exists(os.path.join(dirpath, '__init__.py'))]
|
|
|
|
|
|
def get_package_data(package):
|
|
"""
|
|
Return all files under the root package, that are not in a
|
|
package themselves.
|
|
"""
|
|
walk = [(dirpath.replace(package + os.sep, '', 1), filenames)
|
|
for dirpath, dirnames, filenames in os.walk(package)
|
|
if not os.path.exists(os.path.join(dirpath, '__init__.py'))]
|
|
|
|
filepaths = []
|
|
for base, filenames in walk:
|
|
filepaths.extend([os.path.join(base, filename)
|
|
for filename in filenames])
|
|
return {package: filepaths}
|
|
|
|
|
|
version = get_version('rest_framework')
|
|
|
|
|
|
if sys.argv[-1] == 'publish':
|
|
try:
|
|
import pypandoc
|
|
except ImportError:
|
|
print("pypandoc not installed.\nUse `pip install pypandoc`.\nExiting.")
|
|
if os.system("pip freeze | grep twine"):
|
|
print("twine not installed.\nUse `pip install twine`.\nExiting.")
|
|
sys.exit()
|
|
os.system("python setup.py sdist bdist_wheel")
|
|
os.system("twine upload dist/*")
|
|
print("You probably want to also tag the version now:")
|
|
print(" git tag -a %s -m 'version %s'" % (version, version))
|
|
print(" git push --tags")
|
|
shutil.rmtree('dist')
|
|
shutil.rmtree('build')
|
|
shutil.rmtree('djangorestframework.egg-info')
|
|
sys.exit()
|
|
|
|
|
|
setup(
|
|
name='djangorestframework',
|
|
version=version,
|
|
url='http://www.django-rest-framework.org',
|
|
license='BSD',
|
|
description='Web APIs for Django, made easy.',
|
|
long_description=read_md('README.md'),
|
|
author='Tom Christie',
|
|
author_email='tom@tomchristie.com', # SEE NOTE BELOW (*)
|
|
packages=get_packages('rest_framework'),
|
|
package_data=get_package_data('rest_framework'),
|
|
install_requires=[],
|
|
zip_safe=False,
|
|
classifiers=[
|
|
'Development Status :: 5 - Production/Stable',
|
|
'Environment :: Web Environment',
|
|
'Framework :: Django',
|
|
'Framework :: Django :: 1.10',
|
|
'Framework :: Django :: 1.11',
|
|
'Intended Audience :: Developers',
|
|
'License :: OSI Approved :: BSD License',
|
|
'Operating System :: OS Independent',
|
|
'Programming Language :: Python',
|
|
'Programming Language :: Python :: 2',
|
|
'Programming Language :: Python :: 2.7',
|
|
'Programming Language :: Python :: 3',
|
|
'Programming Language :: Python :: 3.4',
|
|
'Programming Language :: Python :: 3.5',
|
|
'Topic :: Internet :: WWW/HTTP',
|
|
]
|
|
)
|
|
|
|
# (*) Please direct queries to the discussion group, rather than to me directly
|
|
# Doing so helps ensure your question is helpful to other users.
|
|
# Queries directly to my email are likely to receive a canned response.
|
|
#
|
|
# Many thanks for your understanding.
|