Fix packaging (#5624)

* Packaging should use manifest

* Add schema.js template to MANIFEST
This commit is contained in:
Ryan P Kilby 2017-11-27 05:28:25 -05:00 committed by Carlton Gibson
parent fc94fbd4e8
commit abef84fb60
2 changed files with 4 additions and 29 deletions

View File

@ -1,6 +1,6 @@
include README.md include README.md
include LICENSE.md include LICENSE.md
recursive-include rest_framework/static *.js *.css *.png *.eot *.svg *.ttf *.woff recursive-include rest_framework/static *.js *.css *.png *.eot *.svg *.ttf *.woff
recursive-include rest_framework/templates *.html recursive-include rest_framework/templates *.html schema.js
global-exclude __pycache__ global-exclude __pycache__
global-exclude *.py[co] global-exclude *.py[co]

View File

@ -6,7 +6,7 @@ import shutil
import sys import sys
from io import open from io import open
from setuptools import setup from setuptools import setup, find_packages
try: try:
from pypandoc import convert from pypandoc import convert
@ -28,31 +28,6 @@ def get_version(package):
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) 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') version = get_version('rest_framework')
@ -84,8 +59,8 @@ setup(
long_description=read_md('README.md'), long_description=read_md('README.md'),
author='Tom Christie', author='Tom Christie',
author_email='tom@tomchristie.com', # SEE NOTE BELOW (*) author_email='tom@tomchristie.com', # SEE NOTE BELOW (*)
packages=get_packages('rest_framework'), packages=find_packages(exclude=['tests*']),
package_data=get_package_data('rest_framework'), include_package_data=True,
install_requires=[], install_requires=[],
zip_safe=False, zip_safe=False,
classifiers=[ classifiers=[