Codebase list python-livereload / 6cd66a9
New upstream version 2.6.0 Pierre-Elliott Bécue 5 years ago
7 changed file(s) with 40 addition(s) and 33 deletion(s). Raw diff Collapse all Expand all
11 =========
22
33 The full list of changes between each Python LiveReload release.
4
5 Version 2.6.0
6 -------------
7
8 Released on Nov 21, 2018
9
10 1. Changed logic of liveport.
11 2. Fixed bugs
412
513 Version 2.5.2
614 -------------
22
33 This is a brand new LiveReload in version 2.0.0.
44
5 .. image:: https://img.shields.io/pypi/dm/livereload.svg
6 :target: https://pypi.python.org/pypi/livereload
7 :alt: Downloads
8 .. image:: https://img.shields.io/pypi/v/livereload.svg
9 :target: https://pypi.python.org/pypi/livereload
10 :alt: Version
11
5 `Download on PyPi <https://pypi.python.org/pypi/livereload>`_
126
137 Installation
148 ------------
129123 server.serve(port=8080, host='localhost')
130124
131125 # open the web browser on startup, based on $BROWSER environment variable
132 server.serve(open_url=True, debug=False)
126 server.serve(open_url_delay=5, debug=False)
133127
134128
135129 shell
77 :license: BSD, see LICENSE for more details.
88 """
99
10 __version__ = '2.5.2'
10 __version__ = '2.6.0'
1111 __author__ = 'Hsiaoming Yang <me@lepture.com>'
1212 __homepage__ = 'https://github.com/lepture/python-livereload'
1313
102102 }
103103
104104 cls._last_reload_time = time.time()
105 for waiter in cls.waiters:
105 for waiter in cls.waiters.copy():
106106 try:
107107 waiter.write_message(msg)
108108 except:
131131
132132 if status_code != 304:
133133 if "content-type" not in header_set:
134 headers.append(("Content-Type", "application/octet-stream; charset=UTF-8"))
134 headers.append((
135 "Content-Type",
136 "application/octet-stream; charset=UTF-8"
137 ))
135138 if "content-length" not in header_set:
136139 headers.append(("Content-Length", str(len(body))))
137140
206209
207210 self.watcher.watch(filepath, func, delay, ignore=ignore)
208211
209 def application(self, port, host, liveport=None, debug=None, live_css=True):
212 def application(self, port, host, liveport=None, debug=None,
213 live_css=True):
210214 LiveReloadHandler.watcher = self.watcher
211215 LiveReloadHandler.live_css = live_css
212 if liveport is None:
213 liveport = port
214216 if debug is None and self.app:
215217 debug = True
216218
223225 # The livereload.js snippet.
224226 # Uses JavaScript to dynamically inject the client's hostname.
225227 # This allows for serving on 0.0.0.0.
226 live_reload_path = ":{port}/livereload.js?port={port}".format(port=liveport)
227 if liveport == 80 or liveport == 443:
228 live_reload_path = "/livereload.js?port={port}".format(port=liveport)
229
230 live_script = escape.utf8((
231 '<script type="text/javascript">'
232 'document.write("<script src=''//"'
233 ' + window.location.hostname + "{path}''>'
234 ' </"+"script>");'
235 '</script>'
236 ).format(path=live_reload_path))
228 live_script = (
229 '<script type="text/javascript">(function(){'
230 'var s=document.createElement("script");'
231 'var port=%s;'
232 's.src="//"+window.location.hostname+":"+port'
233 '+ "/livereload.js?port=" + port;'
234 'document.head.appendChild(s);'
235 '})();</script>'
236 )
237 if liveport:
238 live_script = escape.utf8(live_script % liveport)
239 else:
240 live_script = escape.utf8(live_script % 'window.location.port')
237241
238242 web_handlers = self.get_web_handlers(live_script)
239243
240244 class ConfiguredTransform(LiveScriptInjector):
241245 script = live_script
242246
243 if liveport == port:
247 if not liveport:
244248 handlers = live_handlers + web_handlers
245249 app = web.Application(
246250 handlers=handlers,
270274 ]
271275
272276 def serve(self, port=5500, liveport=None, host=None, root=None, debug=None,
273 open_url=False, restart_delay=2, open_url_delay=None, live_css=True):
277 open_url=False, restart_delay=2, open_url_delay=None,
278 live_css=True):
274279 """Start serve the server with the given port.
275280
276281 :param port: serve on this port, default is 5500
281286 via Tornado (and causes polling). Defaults to True when
282287 ``self.app`` is set, otherwise False.
283288 :param open_url_delay: open webbrowser after the delay seconds
284 :param live_css: whether to use live css or force reload on css. Defaults to True
289 :param live_css: whether to use live css or force reload on css.
290 Defaults to True
285291 """
286292 host = host or '127.0.0.1'
287293 if root is not None:
290296 self._setup_logging()
291297 logger.info('Serving on http://%s:%s' % (host, port))
292298
293 self.application(port, host, liveport=liveport, debug=debug, live_css=live_css)
299 self.application(
300 port, host, liveport=liveport, debug=debug, live_css=live_css)
294301
295302 # Async open web browser after 5 sec timeout
296303 if open_url or open_url_delay:
33
44 server = Server()
55 server.watch('docs/*.rst', shell('make html'))
6 server.serve(root='docs/_build/html', open_url_delay=5)
6 server.serve(root='docs/_build/html')
4747 'Operating System :: POSIX :: Linux',
4848 'Programming Language :: Python',
4949 'Programming Language :: Python :: 2',
50 'Programming Language :: Python :: 2.6',
5150 'Programming Language :: Python :: 2.7',
5251 'Programming Language :: Python :: 3',
53 'Programming Language :: Python :: 3.3',
54 'Programming Language :: Python :: 3.4',
5552 'Programming Language :: Python :: 3.5',
5653 'Programming Language :: Python :: 3.6',
54 'Programming Language :: Python :: 3.7',
5755 'Programming Language :: Python :: Implementation :: CPython',
5856 'Programming Language :: Python :: Implementation :: PyPy',
5957 'Topic :: Software Development :: Build Tools',