Commit Graph

69 Commits

Author SHA1 Message Date
Steve Howell ec416a315f provision: Extract need_to_run_inline_email_css.
This extraction also prevents an unnecessary
call to `glob.glob` when `is_force` is `True`.
2020-04-17 09:45:59 -07:00
Steve Howell 66234850ba provision: Extract need_to_run_build_pygments_data.
This is more encapsulated and more efficient.

In the cases where `is_force` is `True` or
`pygments_data.json` is missing, we now avoid
the unnecessary step of importing `pygments`, at
least up front.

(Of course, we probably import that once we generate
the artifacts.)
2020-04-17 09:45:59 -07:00
Steve Howell 796351ed9e provision: Detect missing language_name_map.json.
If somebody is having issues with provision, it's
plausible they'll do something like `git clean -fX`
to clean up old artifacts of earlier provision runs,
as part of debugging things.

We defend against this by detecting the most obvious
symptom as cheaply as possible.
2020-04-17 09:45:59 -07:00
Steve Howell 765d40b34c provision: Extract need_to_run_compilemessages.
This is slightly more than a code move, as we
now skip some unnecessary file I/O when
`is_force` is `True`.
2020-04-17 09:45:59 -07:00
Steve Howell 067196c508 provision: Simplify `is_force` codepaths.
I remove `is_force` from `file_or_package_hash_updated`
and modernize its mypy annotations.

If `is_force` is `True`, we just now run the thing
we want to force-run without having to call
`file_or_package_hash_updated` to expensively
and riskily return `True`.

Another nice outcome of this change is that if
`file_or_package_hash_updated` returns `True`,
you can know that the file or package has
indeed been updated.

For the case of `build_pygments_data` we also
skip an `os.path.exists` check when `is_force`
is `True`.

We will short-circuit more logic in the next
few commits, as well as cleaning up some of
the long/wrapper lines in the `if` statements.
2020-04-17 09:45:59 -07:00
Steve Howell 478b50dde3 provision: Improve message for configure-rabbitmq.
We change the message for skipping RabbitMQ
configuration to match nearby messages:

    No need to run `tools/setup/build_pygments_data`.
    No need to run `scripts/setup/inline_email_css.py`.
    No need to run `scripts/setup/configure-rabbitmq.
    No need to regenerate the dev DB.
    No need to regenerate the test DB.
    No need to run `manage.py compilemessages`.
2020-04-17 09:45:59 -07:00
Tim Abbott 59937ec9fa scripts: Rename inline-email-css to inline_email_css.py.
This is a preparatory step for making it a module that we can import
and call from other code.
2020-04-10 15:29:47 -07:00
Anders Kaseorg c734bbd95d python: Modernize legacy Python 2 syntax with pyupgrade.
Generated by `pyupgrade --py3-plus --keep-percent-format` on all our
Python code except `zthumbor` and `zulip-ec2-configure-interfaces`,
followed by manual indentation fixes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-09 16:43:22 -07:00
Vishnu KS 449f7e2d4b team: Generate team page data using cron job.
This eliminates the contributors data as a possible source of
flakiness when installing Zulip from Git.

Fixes #14351.
2020-04-08 12:52:31 -07:00
Vishnu KS 8415a1472a tools: Rename update-authors-json to fetch-contributor-data. 2020-04-08 12:40:00 -07:00
Tim Abbott aaee506fb2 provision: Always build pygments_data.json if missing.
While it's a bit of extra complexity to do this check, which I'm not
excited about, we've had multiple folks spend significant time being
confused rebasing past d7d8632525 into
deleting `pygments_data.json`, with provision not rebuilding it, so
this seems worth merging as a transitional fix even if we decide to
remove it in 2 months.
2020-02-20 10:25:11 -08:00
Hashir Sarwar eb23c6fa6c test_fixtures: Clean up interface for `template_database_status()`.
1) Created a new class `DatabaseType` and access its objects inside
`template_database_status()` instead of sending five arguments with
default values.

2) Made `check_files` and `setting_name` local variables instead of
function parameters since they had same value(None) for every call.

Fixes #13845.
2020-02-12 11:07:10 -08:00
Tim Abbott 4e421ebe12 scripts: Move inline-email-css from tools to scripts.
We'll be soon documenting a production workflow that involves using
it, and that means it needs to live under scripts/ (since tools/ isn't
present in release tarballs).
2019-11-15 17:39:42 -08:00
Ray Kraesig 1180299fe4 provisioning: fix up bash profile creation
The base Ubuntu image includes no `.bash_profile`. Creating one will
prevent the existing support scripts in `~/.profile` from loading.

Instead, append our setup code to [whichever script Bash will load
first][bash-startup].

[bash-startup]: https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html#Bash-Startup-Files
2019-10-08 17:17:55 -07:00
Anders Kaseorg 349f22524e provision: Don’t rely on uid == gid assumption when invoking chown.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-17 12:59:09 -07:00
Anders Kaseorg 88793e80ea provision: Skip some rm, mkdir, chown commands if possible.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-17 12:59:09 -07:00
Tim Abbott c2bdccbaa8 provision: Use a shorter threshold for clean-unused-caches.
We've had a few reports of folks running out of disk when we're making
rapid changes to dependencies, and this should help prevent that.
2019-07-24 13:35:00 -07:00
Anders Kaseorg e80b57a18a provision_inner: Remove unused lsb_release run.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-19 16:36:11 -07:00
Anders Kaseorg c5a4b0501b provision: Start a new Python process after activating the virtualenv.
Mismatching imports from outside and inside the virtualenv in the same
process was causing segfaults after apparently benign changes to the
script!

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-19 12:16:55 -07:00