Skip to content

Commit

Permalink
Add option for setup tools to build the docs
Browse files Browse the repository at this point in the history
Updated internal link in `setup.rst`
  • Loading branch information
marksweb committed Feb 26, 2020
1 parent e882c26 commit 1c644ba
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
8 changes: 2 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import os
import sys

from django_bleach import VERSION

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -51,9 +47,9 @@
# built documents.
#
# The short X.Y version.
version = '.'.join(VERSION[:2])
# version = '0.6'
# The full version, including alpha/beta/rc tags.
release = '.'.join(VERSION)
# release = '0.6.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion docs/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Setup

3. Configure ``django_bleach``. It comes with some sensible defaults, but you
will probably want to tweak the settings for your application. See the
:role:`settings` page for more information
:ref:`settings` page for more information

3. Add a ``django_bleach.models.BleachField`` to a model, a
``django_bleach.forms.BleachField`` to a form, or use the ``bleach``
Expand Down
22 changes: 19 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from setuptools import setup, find_packages
from setuptools.command.test import test as test_command
from sphinx.setup_command import BuildDoc


class Tox(test_command):
Expand Down Expand Up @@ -46,7 +47,9 @@ def find_variable(variable, *parts):
raise RuntimeError("Unable to find version string.")


version = find_variable('__version__', 'django_bleach', '__init__.py')
name = 'django-bleach'
release = find_variable('__version__', 'django_bleach', '__init__.py')
version = release.rstrip('.')

if sys.argv[-1] == 'build':
os.system('python setup.py sdist bdist_wheel')
Expand All @@ -61,7 +64,7 @@ def find_variable(variable, *parts):


setup(
name='django-bleach',
name=name,
version=version,
description='Easily use bleach with Django models and templates',
long_description=read('README.rst'),
Expand All @@ -77,9 +80,22 @@ def find_variable(variable, *parts):
tests_require=[
'bleach>=1.5.0',
'mock',
'sphinx',
'tox'
],
cmdclass={'test': Tox},
cmdclass={
'build_sphinx': BuildDoc,
'test': Tox
},
command_options={
'build_sphinx': {
'project': ('setup.py', name),
'version': ('setup.py', version),
'release': ('setup.py', release),
'source_dir': ('setup.py', 'docs'),
'build_dir': ('setup.py', './docs/_build')
}
},
package_data={},
classifiers=[
'Environment :: Web Environment',
Expand Down

0 comments on commit 1c644ba

Please sign in to comment.