diff options
| author | Theron Luhn <theron@luhn.com> | 2019-03-30 15:02:43 -0700 |
|---|---|---|
| committer | Theron Luhn <theron@luhn.com> | 2019-03-30 15:02:43 -0700 |
| commit | b05b66e77b9851ff2ed912b6b8bfa0d5068febd1 (patch) | |
| tree | d2cb66fc602f430522c6459923e88a303086f513 | |
| parent | 9f267dd842c5e93336f0392f2809da75a716039a (diff) | |
| parent | 01618a1399f547fb1f89cf8b56600325b4f8d04b (diff) | |
| download | pyramid-b05b66e77b9851ff2ed912b6b8bfa0d5068febd1.tar.gz pyramid-b05b66e77b9851ff2ed912b6b8bfa0d5068febd1.tar.bz2 pyramid-b05b66e77b9851ff2ed912b6b8bfa0d5068febd1.zip | |
Merge branch 'master' into security-policy
| -rw-r--r-- | CHANGES.rst | 3 | ||||
| -rw-r--r-- | CONTRIBUTORS.txt | 4 | ||||
| -rw-r--r-- | docs/conf.py | 38 | ||||
| -rw-r--r-- | docs/index.rst | 8 | ||||
| -rw-r--r-- | setup.py | 2 | ||||
| -rw-r--r-- | src/pyramid/scripts/pserve.py | 24 | ||||
| -rw-r--r-- | tests/test_scripts/test_pserve.py | 32 |
7 files changed, 79 insertions, 32 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index d8a4f45a6..afac078b0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -93,3 +93,6 @@ Documentation Changes - Restore build of PDF on Read The Docs. See https://github.com/Pylons/pyramid/issues/3290 + +- Fix docs build for Sphinx 2.0. + See https://github.com/Pylons/pyramid/pull/3480 diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 019c66c9a..33218cbbd 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -337,6 +337,8 @@ Contributors - Alexandre Yukio Harano, 2018/10/05 +- Eric Atkin, 2019/02/15 + - Arijit Basu, 2019/02/19 -- Theron Luhn, 2019/03/30
\ No newline at end of file +- Theron Luhn, 2019/03/30 diff --git a/docs/conf.py b/docs/conf.py index a6d37a176..8fdebf53d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -28,6 +28,7 @@ from sphinx.writers.latex import LaTeXTranslator from docutils import nodes from docutils import utils +from docutils.parsers.rst import Directive def raw(*arg): @@ -326,7 +327,6 @@ _PREAMBLE = r""" latex_elements = { 'preamble': _PREAMBLE, - 'date': '', 'releasename': 'Version', 'title': r'The Pyramid Web Framework', # 'pointsize':'12pt', # uncomment for 12pt version @@ -345,25 +345,25 @@ latex_elements = { #subparagraph 5 -def frontmatter(name, arguments, options, content, lineno, - content_offset, block_text, state, state_machine): - return [nodes.raw( - '', - format='latex')] +class FrontMatter(Directive): + def run(self): + return [nodes.raw( + '', + format='latex')] -def mainmatter(name, arguments, options, content, lineno, - content_offset, block_text, state, state_machine): - return [nodes.raw( - '', - format='latex')] +class MainMatter(Directive): + def run(self): + return [nodes.raw( + '', + format='latex')] -def backmatter(name, arguments, options, content, lineno, - content_offset, block_text, state, state_machine): - return [nodes.raw( - '', - format='latex')] +class BackMatter(Directive): + def run(self): + return [nodes.raw( + '', + format='latex')] def app_role(role, rawtext, text, lineno, inliner, options={}, content=[]): @@ -378,9 +378,9 @@ def app_role(role, rawtext, text, lineno, inliner, options={}, content=[]): def setup(app): app.add_role('app', app_role) - app.add_directive('frontmatter', frontmatter, 1, (0, 0, 0)) - app.add_directive('mainmatter', mainmatter, 1, (0, 0, 0)) - app.add_directive('backmatter', backmatter, 1, (0, 0, 0)) + app.add_directive('frontmatter', FrontMatter, 1, (0, 0, 0)) + app.add_directive('mainmatter', MainMatter, 1, (0, 0, 0)) + app.add_directive('backmatter', BackMatter, 1, (0, 0, 0)) app.connect('autodoc-process-signature', resig) diff --git a/docs/index.rst b/docs/index.rst index a1a81872c..4b413c16d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -152,11 +152,9 @@ Comprehensive reference material for every public API exposed by :app:`Pyramid`: .. toctree:: - :maxdepth: 1 - :glob: + :maxdepth: 2 api/index - api/* ``p*`` Scripts Documentation @@ -165,11 +163,9 @@ Comprehensive reference material for every public API exposed by ``p*`` scripts included with :app:`Pyramid`. .. toctree:: - :maxdepth: 1 - :glob: + :maxdepth: 2 pscripts/index - pscripts/* Change History @@ -26,7 +26,7 @@ CHANGES = readfile('CHANGES.rst') VERSION = '2.0.dev0' install_requires = [ - 'hupper', + 'hupper >= 1.5', # ignore_files support 'plaster', 'plaster_pastedeploy', 'setuptools', diff --git a/src/pyramid/scripts/pserve.py b/src/pyramid/scripts/pserve.py index bf5662a19..350ab4d6d 100644 --- a/src/pyramid/scripts/pserve.py +++ b/src/pyramid/scripts/pserve.py @@ -25,8 +25,10 @@ from pyramid.path import AssetResolver from pyramid.settings import aslist -def main(argv=sys.argv, quiet=False): - command = PServeCommand(argv, quiet=quiet) +def main(argv=sys.argv, quiet=False, original_ignore_files=None): + command = PServeCommand( + argv, quiet=quiet, original_ignore_files=original_ignore_files + ) return command.run() @@ -131,13 +133,15 @@ class PServeCommand(object): _scheme_re = re.compile(r'^[a-z][a-z]+:', re.I) - def __init__(self, argv, quiet=False): + def __init__(self, argv, quiet=False, original_ignore_files=None): self.args = self.parser.parse_args(argv[1:]) if quiet: self.args.verbose = 0 if self.args.reload: self.worker_kwargs = {'argv': argv, "quiet": quiet} self.watch_files = set() + self.ignore_files = set() + self.original_ignore_files = original_ignore_files def out(self, msg): # pragma: no cover if self.args.verbose > 0: @@ -151,6 +155,9 @@ class PServeCommand(object): config_path = self.get_config_path(loader) here = os.path.dirname(config_path) watch_files = aslist(settings.get('watch_files', ''), flatten=False) + self.ignore_files = set( + aslist(settings.get('ignore_files', ''), flatten=False) + ) # track file paths relative to the ini file resolver = AssetResolver(package=None) @@ -232,11 +239,13 @@ class PServeCommand(object): if self.args.reload and not hupper.is_active(): if self.args.verbose > 1: self.out('Running reloading file monitor') + self.worker_kwargs['original_ignore_files'] = self.ignore_files hupper.start_reloader( 'pyramid.scripts.pserve.main', reload_interval=int(self.args.reload_interval), verbose=self.args.verbose, worker_kwargs=self.worker_kwargs, + ignore_files=self.ignore_files, ) return 0 @@ -250,6 +259,15 @@ class PServeCommand(object): reloader = hupper.get_reloader() reloader.watch_files(list(self.watch_files)) + if ( + self.original_ignore_files is not None + and self.original_ignore_files != self.ignore_files + ): + self.out( + 'A change to "ignore_files" was detected but it will not take' + ' effect until pserve is restarted.' + ) + server = server_loader.get_wsgi_server(server_name, config_vars) app = loader.get_wsgi_app(app_name, config_vars) diff --git a/tests/test_scripts/test_pserve.py b/tests/test_scripts/test_pserve.py index a573f2e5b..f19ba81df 100644 --- a/tests/test_scripts/test_pserve.py +++ b/tests/test_scripts/test_pserve.py @@ -19,10 +19,10 @@ class TestPServeCommand(unittest.TestCase): return PServeCommand - def _makeOne(self, *args): + def _makeOne(self, *args, **kwargs): effargs = ['pserve'] effargs.extend(args) - cmd = self._getTargetClass()(effargs) + cmd = self._getTargetClass()(effargs, **kwargs) cmd.out = self.out self.loader = dummy.DummyLoader() cmd._get_config_loader = self.loader @@ -49,6 +49,32 @@ class TestPServeCommand(unittest.TestCase): inst.run() self.assertEqual(app.global_conf, {'a': '1', 'b': '2'}) + def test_original_ignore_files(self): + msg = 'A change to "ignore_files" was detected' + + def get_app(name, global_conf): + app.name = name + app.global_conf = global_conf + return app + + inst = self._makeOne('development.ini') + app = dummy.DummyApp() + self.loader.get_wsgi_app = get_app + self.loader.server = lambda x: x + self.loader.settings = {'pserve': {'ignore_files': '*.txt'}} + inst.run() + self.assertNotIn(msg, self.out_.getvalue()) + + inst = self._makeOne( + 'development.ini', original_ignore_files={'*.txt'} + ) + app = dummy.DummyApp() + self.loader.get_wsgi_app = get_app + self.loader.server = lambda x: x + self.loader.settings = {'pserve': {'ignore_files': 'foo/*.txt'}} + inst.run() + self.assertIn(msg, self.out_.getvalue()) + def test_parse_vars_bad(self): inst = self._makeOne('development.ini', 'a') self.assertRaises(ValueError, inst.run) @@ -122,7 +148,9 @@ class TestPServeCommand(unittest.TestCase): 'worker_kwargs': { 'argv': ['pserve', '--reload', 'development.ini'], 'quiet': False, + 'original_ignore_files': set(), }, + 'ignore_files': set(), }, ) |
