This quiets the following deprecation warning:
./Scripts/reverse_integration_check.py:56: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
tag for tag in unmerged_tags if LooseVersion(tag) > LooseVersion(epoch_tag)
[`distutils.LooseVersion` will be removed in Python 3.12][0], and there
doesn't seem to be an equivalent in the standard library. I implemented
a simple `Version` class to replicate this functionality.
(I also looked into other solutions, such as rewriting the script in
Swift, but this seems like the right solution for now.)
[0]: https://peps.python.org/pep-0632/
This adds `5.23.0.22-beta` to our list of ignored tags, to avoid this error when running the script:
RuntimeError: 💥 Found unmerged tags: ['5.23.0.22-beta']
We saw this error when deploying 5.25.
genstrings warns on non-constant strings being passed to
NSLocalizedString, but that happens precisely when we define
OWSLocalizedString. Skip the two files where we define it (one for
each language).
While here:
- Use find's -exec feature rather than a separate xargs invocation.
- Make the script shellcheck-clean.
In Python 2, `subprocess.check_output` returns a string. In Python 3, it
returns a byte string unless you provide `text=True`.
This makes sure all calls have that option for compatibility.
Also, my editor was auto-formatting these with [Black][0], which I
didn't prevent, so now these files are formatted a little better.
[0]: https://github.com/psf/black
On my machine, the `./precommit.py --all` took 344.15 seconds (more than
5 minutes). This change speeds it up so that it takes less than 10
seconds.
It primarily achieves this by running `swiftlint` twice instead of twice
per file. There are some other smaller changes, too:
- Use a `set` for common operations
- Avoid a needless call to `text.split`
- Use built-in `pathlib.Path().parts` instead of a home-rolled solution
Tested this by running `./precommit.py` with all flags.
Python 3 removed the [`cmp` function][0] which this script relied on.
Calling it was unnecessary, so I removed it (and cleaned up some of the
surrounding code).
Tested this with the `--all`, `--path`, and `--ref` flags.
[0]: https://docs.python.org/2.7/library/functions.html#cmp
Every single message updates a TSThread model, but only a change in a
member's profile name or phone number, or a change to a group's model,
can update the indexing information. Turn 'shouldBeIndexedForFTS' into
a tri-state 'FTSIndexMode' with options 'never', 'manualUpdates', and
'always', and use 'manualUpdates' for TSThreads. Then explicitly
reindex on any of the changes listed above.
- The Pods/ directory always exists even before submodules have been
initialized; check for Pods/.git instead, which may be a file or
a folder depending on how the submodule was set up.
- When cloning for the first time, make sure the remote is called
'private' so that later updates will reference it correctly. Also
run `git submodule absorbgitdirs` so that git stores the submodule
state inside the top-level .git directory.
- For an existing directory, simplify the check for the presence of
a proper 'private' remote.
- Check that we're running from the repository root so we don't get
weird errors or do random clones.
- Make the script Shellcheck-clean.
ASC will assign its own build numbers to our builds independent of what
our plist requests. Right now, we're in a situation where a failed build
has forced our local and ASC variants out-of-sync. This change allows
the version flag to specify a fix to re-sync.
- Any errors that are hit are propogated out to stdout
- Notifies via stdout if a new emoji needs a component definition
- Uses Character instead of UnicodeScalar when appropriate
- Explicitly declares the RemoteModel that's in use
- Enhancements to file writing to simplify indentation