Commit Graph

98 Commits

Author SHA1 Message Date
Aditya Bansal ec1297c1e8 schedulemessages: Add delivery system for scheduled message. 2018-01-10 09:18:02 -05:00
Greg Price 137c0e65bb tools: Revert to Python 2 typing syntax for now.
This reverts commit 66261f1cc.  See parent commit for reason; here,
provision worked but `tools/run-dev.py` would give errors.

We need to figure out a test that reproduces these issues, then make a
version of these changes that keeps that test working, before we
re-merge them.
2017-12-13 10:38:15 -08:00
Greg Price d5fd2a1d72 tools: Fix run-dev.py, which had an `if False:` on a needed import. 2017-12-12 20:50:00 -08:00
rht 66261f1cc3 tools: Use Python 3 syntax for typing in many files. 2017-12-12 17:42:57 -08:00
Greg Price c32b16715d tornado: Use spiffy new `call_later` rather than `add_timeout`.
This method was new in Tornado 4.0.  It saves us from having to get
the time ourselves and do the arithmetic -- which not only makes the
code a bit shorter, but also easier to get right.  Tornado docs (see
http://www.tornadoweb.org/en/stable/ioloop.html) say we should have
been getting the time from `ioloop.time()` rather than hardcoding
`time.time()`, because the loop could e.g. be running on the
`time.monotonic()` clock.
2017-11-29 16:56:29 -08:00
rht 9c7d5812ce refactor: Remove six.moves.urllib.parse import. 2017-11-07 10:51:44 -08:00
neiljp (Neil Pilgrim) 737408f741 mypy: Add explicit flexible type parameters for Callable in run-dev.py. 2017-11-04 19:47:44 -07:00
rht c4fcff7178 refactor: Replace super(.*self) with Python 3-specific super().
We change all the instances except for the `test_helpers.py`
TimeTrackingCursor monkey-patching, which actually needs to specify
the base class.
2017-10-30 14:30:25 -07:00
rht 45f30c7f54 tools: Remove unused imports. 2017-10-02 10:13:48 -07:00
rht e9d35be2bd run-dev: Replace optparse with argparse.
Tweaked by tabbott to preserve the usage information correctly and
remove some duplication.
2017-09-30 09:40:19 -07:00
rht f15bdce90e tools: Remove print_function.
Tweaked by tabbott to exclude the linter libraries.
2017-09-29 15:44:56 -07:00
rht bf4eda7374 tools: Remove absolute_import in most tools.
Tweaked by tabbott to not remove it from lister.py, linter_lib, and
friends, since those are intended to support both Python 2 and 3
(we're planning to extract them from the repository).
2017-09-29 12:28:43 -07:00
Greg Price a099e698e2 py3: Switch almost all shebang lines to use `python3`.
This causes `upgrade-zulip-from-git`, as well as a no-option run of
`tools/build-release-tarball`, to produce a Zulip install running
Python 3, rather than Python 2.  In particular this means that the
virtualenv we create, in which all application code runs, is Python 3.

One shebang line, on `zulip-ec2-configure-interfaces`, explicitly
keeps Python 2, and at least one external ops script, `wal-e`, also
still runs on Python 2.  See discussion on the respective previous
commits that made those explicit.  There may also be some other
third-party scripts we use, outside of this source tree and running
outside our virtualenv, that still run on Python 2.
2017-08-16 17:54:43 -07:00
Tim Abbott 37eb6a9863 run-dev: Remove now-unnecessary checks for Google/GitHub auth. 2017-08-16 10:05:19 -07:00
Vaida Plankyte 902d2715a5 run-dev.py: Fix typo in GitHub auth warning message. 2017-08-14 14:35:15 -07:00
Vaida Plankyte 02d8f62bb2 run-dev.py: Add Google auth test message & link to docs. 2017-07-27 17:35:14 -07:00
Pweaver (Paul Weaver) d3ffc81726 Enable Hot Module Replacement in webpack.
This allow the webbpack dev server to properly reload JavaScript modules
while running in dev without restarting the server. We need to connect
to webpack-dev-server directly because SockJS doesn't support more than
one connection on the same host/port.
2017-07-18 11:02:05 -07:00
Tim Abbott 0970fb1a8f run-dev: Remove old node_modules/.bin/handlebars deletion hack.
This hack saved a lot of time debugging weird issues back in 2016, but
it's no longer needed.

Anyone rebasing a branch from 2016 will need to provision afterwards
regardless, which will fix this issue automatically, and more
importantly, these changes were made obsolete when we moved to the
cached `node_modules` model.
2017-07-17 17:57:38 -07:00
Aditya Bansal 44edab1cff pep8: Add compliance with rule E261 tools/run-dev.py. 2017-07-11 11:53:33 -07:00
Pweaver (Paul Weaver) 28874cf26f webpack: Add --minify option to run-dev.py for to test minification. 2017-06-13 12:45:40 -07:00
Pweaver (Paul Weaver) 2efecd4809 webpack: Fix webpack-dev-server to not inline serve bad sockjs url.
Fixes #5118.
2017-05-31 09:31:29 -07:00
Eklavya Sharma 7636972a6c mypy: Wrap return value in Optional. 2017-05-23 21:56:50 -07:00
Umair Khan c1049f5bd9 github: Warn if GitHub settings are not filled. 2017-04-04 18:03:33 -07:00
Tim Abbott ecea8c2d43 run-dev: Fix missing type annotation. 2017-03-17 21:03:35 -07:00
Tim Abbott 25488b550f casper: Fix issues with server autoreloading on save.
This fixes an issue where if you saved a Python file (even just
changing whitespace) while casper tests were running, the Tornado
server being used would restart, triggering a confusing error like
this:

ReferenceError: Can't find variable: $
Traceback:
  undefined:2
  :4
Suite explicitly interrupted without any message given.
2017-03-17 20:45:07 -07:00
sinwar 6f0564e9f4 python: Fix remaining bare excepts in codebase.
Fixes #2862.
2017-03-05 16:17:04 -08:00
Raghav Jajodia a3a03bd6a5 mypy: Added Dict, List and Set imports.
Fixed mypy errors associated with the upgrade.
2017-03-04 14:33:44 -08:00
Rishi Gupta 28d3af0965 Fix several new errors caught by mypy 0.501.
Clear out a bunch of easy to review errors, so we can focus on the more
complicated ones.
2017-03-03 14:12:52 -08:00
Tim Abbott 3ccbc7c114 run-dev: Use a different path for casper test PID file.
This fixes an issue where running the casper tests while a development
server was running would effectively corrupt the PID file.
2017-02-17 16:31:28 -08:00
Umair Khan ef0d2a4bb5 logging: Use django.server to filter 200 and 304.
Previously, we were monkey patching the runserver command
in zerver/management/commands/rundjango.py for this.
2017-02-10 15:55:17 -08:00
sinwar eab355b0cd tools: Create more consistent checks for venv.
This helps make the Zulip development environment somewhat more robust
to new contributors, since it will give them a nice warning if they
try running any of our development tools outside the Zulip virtualenv.

Fixes #3468.
2017-02-06 21:50:32 -08:00
K.Kanakhin cb1d61cae0 run-dev: Add pid file to development server.
- Add pid file of development processes group, which allows to
  manage development processes group with os utils. Also it allows to
  kill subprocesses  when parent process was closed incorrectly.
- Add tool 'stop_dev_server' to stop development server by pid file.

Fixes #1547
2017-02-02 21:07:03 -08:00
Rishi Gupta 52c18e9c9d run-dev: Change provisioning error messages to not reference tests.
Previously, we got the following as a part of the output when running
`tools/run-dev.py` without provisioning:

    It looks like you checked out a branch that has added
    dependencies beyond what you last provisioned.  Your tests
    are likely to fail until you add dependencies by provisioning.

which is a bit confusing.
2016-12-29 16:13:49 -08:00
K.Kanakhin e122dcab5c dev-proxy-logging: Add client ip transference to proxy server.
- Add rewriting 'X-REAL-IP' header for each request through dev
  proxy server.
- Change webpack configuration ip to 0.0.0.0 to fix socket.io build
  for launching remote dev server.
2016-12-21 17:18:02 +06:00
K.Kanakhin 4750d30341 dev-proxy-logging: Disable dev proxy logging by default.
- Add parameter to proxy launchig script, which enables logging
  for dev proxy server (disabled by default).
2016-12-21 17:18:02 +06:00
Rafid Aslam c5316b4002 lint: Fix E127 pep8 violations.
Fix pep8: E127 continuation line over-indented for visual indent
style issue.
2016-12-01 10:23:55 -08:00
Tommy Ip 46b7d54b3e pep8: Fix E701 violations. 2016-11-30 20:45:09 +00:00
Tim Abbott 92d1b6d6da run-dev: Fix regression ignoring --interface argument.
When we migrated run-dev.py from Twisted to Tornado a few weeks ago,
the --interface argument wasn't properly ported and thus was ignored.

This restores the original functionality of defaulting to only
listening on localhost.

Ideally, we'd replace the vagrant/zulipdev user check with something
that just checks whether a special file that is created by the
Vagrant/remote-dev-vm creation process exists; that would be more
robust.
2016-11-26 17:23:31 -08:00
Anders Kaseorg 207cf6302b Always start python via shebang lines.
This is preparation for supporting using Python 3 in production.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2016-11-26 14:46:37 -08:00
Anders Kaseorg 1ea8abe493 Replace python -u with PYTHONUNBUFFERED=1
(Why is -u needed at all?  I’m not sure, but test-run-dev spins forever
“Polling run-dev...” without it.)

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2016-11-26 13:20:22 -08:00
Pweaver (Paul Weaver) 8f05ea877d lint: Fix pep8 linter error regressions.
Since `lint-all --pep8` wasn't running in CI, a few errors have leaked
in.
2016-11-17 00:09:21 -08:00
Shashank 702d3cf103 Check provision version in run-dev.py.
Don't start run-dev.py if the provisioning version is
incorrect.
2016-11-09 16:06:16 -08:00
Tim Abbott a93530e413 Remove unused route for development tornado proxy server.
This was a duplicate of the other sockjs line.
2016-11-03 10:46:18 -07:00
K.Kanakhin 870de03ede run-dev: Add websockets support to tornado dev proxy server.
Fixes #1036.
2016-11-01 20:35:31 -07:00
K.Kanakhin 09e17fbe17 run-dev: Use tornado for dev proxy server for HTTP requests.
- Use tornado as proxy server for development environment,
  replacing twisted (this doesn't support websockets).
- Upgrade tornado version to 4.4.1 (needs to be coupled to the
  above since neither change works without the other)
2016-11-01 20:35:31 -07:00
Tim Abbott 6a8f8c2abf run-dev: Fix minor whitespace issues. 2016-11-01 20:27:44 -07:00
Tim Abbott 9b7a3f040c Remove now-unused /json/get_events endpoint. 2016-10-27 21:34:58 -07:00
K.Kanakhin 06e70e1fbd run-dev-proxy: Fix twisted py3 compatibility.
- All necessary strings was converted to bytestring
 - Added twisted as py3 dependency
 - Change type annotation for method getchild of class Resource
 - Remove activating python2 env section from run-dev.py script

Fixes #1256
2016-10-06 20:21:25 -07:00
Tim Abbott 82764d0215 run-dev: Display the port 9991 warning in colored text. 2016-10-05 22:07:46 -07:00
Feorlen e09c27f1ae run-dev.py: Log what service is being started on which port.
The new messages make it more obvious which services are started
from run-dev.py, and explicitly call out where to access the web
proxy to reach the Zulip web UI. This is a common confusion for
new administrators/developers. Messages are output before the
processes are launched, as run-dev.py does not currently have a
way to know if they started successfully.

Example output:

Starting Zulip services on ports:  web proxy: 9991, Django: 9992, Tornado: 9993, webpack: 9994
Note: only port 9991 is exposed to the host in a Vagrant environment.

Alternate behavior for automated testing:

If run-dev.py is invoked with --test, don't include the webpack
port as it isn't used.

Tested on Ubuntu 14.04, by running run-dev.py at a shell prompt and
via the test-all script.

Fixes #1861
2016-10-05 22:07:46 -07:00