mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add compile_grammar command to setup.py (ref: #2765)
This commit is contained in:
parent
05caa0f037
commit
dbac9aa8ec
31
setup.py
31
setup.py
@ -4,9 +4,9 @@ from setuptools import setup, find_packages
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from distutils import log
|
from distutils import log
|
||||||
|
from distutils.cmd import Command
|
||||||
|
|
||||||
import sphinx
|
import sphinx
|
||||||
from sphinx.pycode.pgen2.driver import compile_grammar
|
|
||||||
|
|
||||||
long_desc = '''
|
long_desc = '''
|
||||||
Sphinx is a tool that makes it easy to create intelligent and beautiful
|
Sphinx is a tool that makes it easy to create intelligent and beautiful
|
||||||
@ -73,10 +73,6 @@ extras_require = {
|
|||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
requires.append('colorama>=0.3.5')
|
requires.append('colorama>=0.3.5')
|
||||||
|
|
||||||
# Compile grammars before packaging
|
|
||||||
compile_grammar('sphinx/pycode/Grammar-py2.txt')
|
|
||||||
compile_grammar('sphinx/pycode/Grammar-py3.txt')
|
|
||||||
|
|
||||||
# Provide a "compile_catalog" command that also creates the translated
|
# Provide a "compile_catalog" command that also creates the translated
|
||||||
# JavaScript files if Babel is available.
|
# JavaScript files if Babel is available.
|
||||||
|
|
||||||
@ -173,6 +169,31 @@ else:
|
|||||||
cmdclass['compile_catalog'] = compile_catalog_plusjs
|
cmdclass['compile_catalog'] = compile_catalog_plusjs
|
||||||
|
|
||||||
|
|
||||||
|
class CompileGrammarCommand(Command):
|
||||||
|
description = 'Compile python grammar file for pycode'
|
||||||
|
user_options = []
|
||||||
|
|
||||||
|
def initialize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
from sphinx.pycode.pgen2.driver import compile_grammar
|
||||||
|
|
||||||
|
compile_grammar('sphinx/pycode/Grammar-py2.txt')
|
||||||
|
print('sphinx/pycode/Grammar-py2.txt ... done')
|
||||||
|
|
||||||
|
compile_grammar('sphinx/pycode/Grammar-py3.txt')
|
||||||
|
print('sphinx/pycode/Grammar-py3.txt ... done')
|
||||||
|
|
||||||
|
def sub_commands(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
cmdclass['compile_grammar'] = CompileGrammarCommand
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='Sphinx',
|
name='Sphinx',
|
||||||
version=sphinx.__version__,
|
version=sphinx.__version__,
|
||||||
|
@ -9,6 +9,7 @@ Release checklist
|
|||||||
* Update release date in CHANGES
|
* Update release date in CHANGES
|
||||||
* `git commit -am 'Bump to x.y.z final'`
|
* `git commit -am 'Bump to x.y.z final'`
|
||||||
* `make clean`
|
* `make clean`
|
||||||
|
* `python setup.py compile_grammar`
|
||||||
* `python setup.py release bdist_wheel sdist upload --identity=[your key]`
|
* `python setup.py release bdist_wheel sdist upload --identity=[your key]`
|
||||||
* Check PyPI release page for obvious errors
|
* Check PyPI release page for obvious errors
|
||||||
* `git tag` with version number
|
* `git tag` with version number
|
||||||
|
Loading…
Reference in New Issue
Block a user