Commit Graph

38 Commits

Author SHA1 Message Date
Sergii Tkachenko de6ed9ba9f
[Python] Migrate from yapf to black (#33138)
- Switched  from yapf to black
- Reconfigure isort for black
- Resolve black/pylint idiosyncrasies 

Note: I used `--experimental-string-processing` because black was
producing "implicit string concatenation", similar to what described
here: https://github.com/psf/black/issues/1837. While currently this
feature is experimental, it will be enabled by default:
https://github.com/psf/black/issues/2188. After running black with the
new string processing so that the generated code merges these `"hello" "
world"` strings concatenations, then I removed
`--experimental-string-processing` for stability, and regenerated the
code again.

To the reviewer: don't even try to open "Files Changed" tab 😄 It's
better to review commit-by-commit, and ignore `run black and isort`.
2023-06-09 15:08:55 -07:00
Craig Tiller f1bba530a5
[infra] Make tools/buildgen/generate_projects.py non-executable (#33042)
This file does not contain a shebang, and whenever I try and run it it
wedges my console into some weird state.
There's a .sh file with the same name that should be run instead. Remove
the executable bit of the thing we shouldn't run directly so we, like,
don't.

<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-05-08 17:01:20 -07:00
Cheng-Yu Chung 384982ba2b
[bugfixes] Fix vulnerability for PyYAML (#32007)
* Fix vulnerability for PyYAML

* Fix

* Revert "Fix"

This reverts commit 5522d226c4.

* Fix

* Fix format
2023-01-04 12:33:29 +08:00
Lidi Zheng ec5b3b22c3
Remove var type annotations in extract_metadata_from_bazel_xml (#29463)
* Remove var type annotations in extract_metadata_from_bazel_xml

* Use plain-old Python class to store data

* No more f-string

* Remove version check in generate_projects.py
2022-04-21 12:53:20 -07:00
Lidi Zheng b3ded99cd4
Add a raise for generate_projects if Python is too old (#29432)
* Add a raise for generate_projects if Python is too old

* Update the comment

* Resolve the YAPF difference between local 0.30 and kokoro's 0.30

* YAPF
2022-04-18 15:24:48 -07:00
Lidi Zheng 2231c2ba77
Introduce Python import sorting to our sanity test suite (#26768)
* Add isort_code.sh to sanity tests

* Run tools/distrib/isort_code.sh

* Fine tune the import order for relative imports

* Make pylint and project generation happy

* Fix a few corner cases

* Use --check instead of --diff

* The import order impacts test result somehow

* Make isort print diff and check output at the same time

* Let tools/run_tests/python_utils be firstparty library

* Run isort against latest HEAD
2021-07-26 12:31:21 -07:00
Lidi Zheng e7d9cccf9a
Fix build abseil/boringssl/protobuf at head (#25638)
* Update PyYAML install steps

* F-string is 3.6+

* Regenerate project
2021-03-05 14:00:32 -08:00
Lidi Zheng 39cc797025
[xDS Proto] Modernize buildgen scripts (#25512)
* [xDS Proto] Modernize buildgen scripts

* This PR only covers some buildgen scripts that will be used by xDS
proto
* This PR also improves the debuggability of some scripts
* Merge with master

* Adopt reviewer's advices
2021-03-02 11:25:01 -08:00
AJ Heller b2d3d157e3 Make generate_projects.sh fail earlier on job errors 2020-11-10 17:25:43 -08:00
capstan 7267c8fcd9 Python3-ize tools/buildgen.
* Ran `2to3` on `tools/buildgen` and the `gen_build_yaml.py` files.
* Updated the invocations of python to be explicitly Python 3.
* Changed the loader in `mako_renderer.py` to allow pickle to find the module for pickling `external_version.Version`
* Added a few open-as-binary to placate readers/writers expecting bytes.
* Hand tweaked the templates to remove `iteritems` and fiddle with encodings.

Partially addresses #24359.
2020-11-04 01:18:57 +01:00
Jan Tattermusch 41ac287f7b generate build metadata from bazel BUILD 2020-02-26 19:56:49 -05:00
Esun Kim 7be821ac47 Yapf all target python sources 2020-01-03 09:25:10 -08:00
Lidi Zheng 1b230752e4 Use Python to execute Python 2019-12-10 15:25:42 -08:00
Thomas Bechtold 08b626a704 Don't hardcode python2.7 in generate_projects.py script
Instead, use the same python interpreter for calling the mako renderer
that is currently use (which is sys.executable).

This is useful when trying to run generate_projects.py in a python3
only environment (which is still broken but this is a first step).
2018-05-20 08:34:21 +02:00
ncteisen 26d70b1653 yapf tools/buildgen 2017-12-11 16:40:56 -08:00
Nicolas "Pixel" Noble 72b36736ce The input files also need to follow the base argument... 2017-09-13 00:05:29 +02:00
Nicolas "Pixel" Noble 40c346ced9 Adding --base to generate_projects.py 2017-09-12 22:39:30 +02:00
Jan Tattermusch 7897ae9308 auto-fix most of licenses 2017-06-08 11:22:41 +02:00
Jan Tattermusch 5c79a3199c cleanup tools/run_tests directory 2016-12-22 10:47:52 +01:00
Craig Tiller 3ab2fe0094 Rollup of changes from the latest import 2016-04-11 20:11:18 -07:00
Craig Tiller 6169d5f7b0 Update copyrights 2016-03-31 07:46:18 -07:00
Craig Tiller 560c9017c4 Faster code generation 2016-02-24 16:34:38 -08:00
Craig Tiller 1297170048 Ensure sanity generate projects doesnt eat all available cpu 2016-01-21 13:38:35 -08:00
Craig Tiller 32d0f14c35 Update copyrights 2016-01-19 13:50:59 -08:00
Craig Tiller 590105ac53 Eliminate jobset timeouts in some circumstances
There are cases where we truly don't care how long something takes, and
some external timeout will kill truly stuck processes, so let's
eliminate timeouts in those cases
2016-01-19 13:03:46 -08:00
Craig Tiller 0fe5ee7be3 BoringSSL integration: non-vsprojects changes 2015-12-22 12:50:36 -08:00
Nicolas Noble 075821f726 Merge pull request #3614 from dgquintas/port_server_python_version
Small changes to tools/ Python scripts
2015-10-05 13:59:03 -07:00
David Garcia Quintas 985f22e42b Limited number of parallel jobs for generate_projects 2015-10-04 23:14:37 -07:00
David Garcia Quintas 9a170333d5 Idem for generate_projects.py 2015-10-04 15:44:07 -07:00
Nicolas "Pixel" Noble 9baaeade7c Get sanity to output more interesting information if it fails. 2015-10-03 02:25:02 +02:00
Craig Tiller 259e627b61 Fix sanity 2015-08-31 16:58:18 -07:00
Nicolas "Pixel" Noble 5876ad1757 Merge branch 'master' of github.com:grpc/grpc into win32-is-an-os-too
Conflicts:
	tools/buildgen/generate_projects.py
2015-08-05 01:20:12 +02:00
Nicolas "Pixel" Noble 4d811daf52 generate_projects.py should make directories.
That's necessary for generating Visual Studio project files that are in separate empty directories otherwise.
2015-07-14 19:07:08 +02:00
Nicolas "Pixel" Noble 587b7592b5 Calling python to spawn a python subprocess.
This will enable the script to work under Windows, which doesn't understand hashbangs interpreters.
Also built on top of #2395.
2015-07-11 22:43:24 +02:00
Nicolas "Pixel" Noble 22232ae298 Swapping tabs for spaces in generate_projects.py 2015-07-11 22:42:41 +02:00
Nicolas "Pixel" Noble 368524c7c8 Swapping tabs for spaces in generate_projects.py 2015-07-11 22:41:42 +02:00
Craig Tiller 5cdc81d709 Fix test mode 2015-07-06 16:36:15 -07:00
Craig Tiller 1a71811678 Add parallel execution for generate_projects 2015-07-03 12:07:06 -07:00