Skip to content

Commit 92ac9fc

Browse files
authored
Scripts cleanup: remove python six usage and get ruby from PATH (#11039)
1 parent 2617e60 commit 92ac9fc

File tree

7 files changed

+12
-14
lines changed

7 files changed

+12
-14
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- uses: actions/setup-python@v4
2525
with:
26-
python-version: 3.6
26+
python-version: 3.11
2727

2828
- name: Cache Mint packages
2929
uses: actions/cache@v3

.github/workflows/firestore.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373

7474
- uses: actions/setup-python@v4
7575
with:
76-
python-version: 3.6
76+
python-version: 3.11
7777

7878
- name: Setup check
7979
run: scripts/setup_check.sh

.github/workflows/update-cpp-sdk-on-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Setup python
2424
uses: actions/setup-python@v4
2525
with:
26-
python-version: 3.7
26+
python-version: 3.11
2727

2828
- name: Check out firebase-cpp-sdk
2929
uses: actions/checkout@v3

scripts/lib/checker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import math
1818
import multiprocessing.pool
19-
import six
2019
import sys
2120
import threading
2221

@@ -55,7 +54,9 @@ class Result(object):
5554

5655
def __init__(self, num_errors, output):
5756
self.errors = num_errors
58-
self.output = six.ensure_text(output)
57+
self.output = (output
58+
if isinstance(output, str)
59+
else output.decode('utf8', errors='replace'))
5960

6061
@staticmethod
6162
def from_list(errors):

scripts/lib/git.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
import os
16-
import six
1716
import subprocess
1817

1918
from lib import command_trace
@@ -105,7 +104,7 @@ def find_lines_matching(pattern, sources=None):
105104
proc.terminate()
106105
proc.wait()
107106

108-
return six.ensure_text(b''.join(result))
107+
return b''.join(result).decode('utf8', errors='replace')
109108

110109

111110
def make_patterns(dirs):
@@ -135,11 +134,11 @@ def is_within_repo():
135134
def get_repo_root():
136135
"""Returns the absolute path to the root of the current git repo."""
137136
command = ['git', 'rev-parse', '--show-toplevel']
138-
return six.ensure_text(subprocess.check_output(command).rstrip())
137+
return subprocess.check_output(command, text=True, errors='replace').rstrip()
139138

140139

141140
def _null_split_output(command):
142141
"""Runs the given command and splits its output on the null byte."""
143142
command_trace.log(command)
144-
result = six.ensure_text(subprocess.check_output(command))
143+
result = subprocess.check_output(command, text=True, errors='replace')
145144
return [name for name in result.rstrip().split('\0') if name]

scripts/make_release_notes.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import subprocess
2323
import string
2424

25-
import six
26-
2725
NO_HEADING = 'PRODUCT HAS NO HEADING'
2826

2927

@@ -78,8 +76,8 @@ def main():
7876

7977

8078
def find_local_repo():
81-
url = six.ensure_text(
82-
subprocess.check_output(['git', 'config', '--get', 'remote.origin.url']))
79+
url = subprocess.check_output(['git', 'config', '--get', 'remote.origin.url'],
80+
text=True, errors='replace')
8381

8482
# ssh or https style URL
8583
m = re.match(r'^(?:git@github\.com:|https://github\.com/)(.*)\.git$', url)

scripts/sync_project.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/ruby
1+
#!/usr/bin/env ruby
22

33
# Copyright 2018 Google
44
#

0 commit comments

Comments
 (0)