Update pyoxidizer.bzl

For compatibility with the latest version of Pyoxidizer. Unfortunately,
Pyoxidizer is unable to produce a working executable for the latest
version of Black, because Black recently started using multiprocessing
to format multiple files in parallel, and Pyoxidizer doesn't currently
work with code that uses multiprocessing:
https://github.com/indygreg/PyOxidizer/issues/111

Change-Id: I6cdf729486efb4d367afa57efe068de534ea356b
2 files changed
tree: 568f63315507ec984d7e930e55bcc3a783d3318b
  1. .gitignore
  2. cipd-linux.yaml
  3. cipd-mac.yaml
  4. CONTRIBUTING.md
  5. LICENSE
  6. PATENTS
  7. pyoxidizer.bzl
  8. README.md
README.md

Black package

This contains configuration useful in updating the black package in CIPD.

Build and upload a new version

We want this to run in the following environments:

  • On our GCE Swarming bots.
  • Developer Linux machines.
  • Developer MacOS machines.

At time of writing, binaries built on gLinux did not work on our GCE Swarming bots. In order to work on both GCE and gLinux workstations, I found that the following procedure works when run from a GCE VM that is using the same image as our swarming bots. You can ask the foundation infra team how to create a VM for this if you don't know how.

In order to produce a binary that works on MacOS, I ran these commands on MacOS.

  1. (one time) Install Rust: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. (one time) Install PyOxidizer: cargo install pyoxidizer
  3. Build and upload latest version
BLACK_VERSION=$(pip3 install black== 2>&1 | grep versions: | sed -E 's/.*, ([a-z0-9\.]+)\)/\1/')
# We have to specify a back-up to make this work on both Linux and MacOS:
# https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux
sed -E -e "s/black==[^\"]+\"/black==${BLACK_VERSION?}\"/" -i.bak ./pyoxidizer.bzl
rm ./pyoxidizer.bzl.bak
pyoxidizer build install
OS=$(if [[ $(uname) == 'Darwin' ]]; then echo 'mac'; else echo 'linux'; fi)
cipd create -tag version:${BLACK_VERSION?} -pkg-def ./cipd-${OS?}.yaml