Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: third_party/gsutil/gslib/commands/version.py

Issue 1380943003: Roll version of gsutil to 4.15. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/gsutil/gslib/commands/stat.py ('k') | third_party/gsutil/gslib/commands/web.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # Copyright 2011 Google Inc. All Rights Reserved. 2 # Copyright 2011 Google Inc. All Rights Reserved.
3 # 3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License. 5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at 6 # You may obtain a copy of the License at
7 # 7 #
8 # http://www.apache.org/licenses/LICENSE-2.0 8 # http://www.apache.org/licenses/LICENSE-2.0
9 # 9 #
10 # Unless required by applicable law or agreed to in writing, software 10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, 11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and 13 # See the License for the specific language governing permissions and
14 # limitations under the License. 14 # limitations under the License.
15 """Implementation of gsutil version command.""" 15 """Implementation of gsutil version command."""
16 16
17 from __future__ import absolute_import 17 from __future__ import absolute_import
18 18
19 from hashlib import md5 19 from hashlib import md5
20 import os 20 import os
21 import platform 21 import platform
22 import re 22 import re
23 import sys 23 import sys
24 24
25 import boto 25 import boto
26 import crcmod 26 import crcmod
27 import gslib 27 import gslib
28 from gslib.command import Command 28 from gslib.command import Command
29 from gslib.util import CheckMultiprocessingAvailableAndInit
29 from gslib.util import GetConfigFilePath 30 from gslib.util import GetConfigFilePath
30 from gslib.util import MultiprocessingIsAvailable
31 from gslib.util import UsingCrcmodExtension 31 from gslib.util import UsingCrcmodExtension
32 32
33 33
34 _SYNOPSIS = """ 34 _SYNOPSIS = """
35 gsutil version 35 gsutil version
36 """ 36 """
37 37
38 _DETAILED_HELP_TEXT = (""" 38 _DETAILED_HELP_TEXT = ("""
39 <B>SYNOPSIS</B> 39 <B>SYNOPSIS</B>
40 """ + _SYNOPSIS + """ 40 """ + _SYNOPSIS + """
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 'installed via package manager: {is_package_install}\n' 113 'installed via package manager: {is_package_install}\n'
114 'editable install: {is_editable_install}\n' 114 'editable install: {is_editable_install}\n'
115 ) 115 )
116 116
117 sys.stdout.write(long_form_output.format( 117 sys.stdout.write(long_form_output.format(
118 checksum=cur_checksum, 118 checksum=cur_checksum,
119 checksum_ok=checksum_ok_str, 119 checksum_ok=checksum_ok_str,
120 boto_version=boto.__version__, 120 boto_version=boto.__version__,
121 python_version=sys.version.replace('\n', ''), 121 python_version=sys.version.replace('\n', ''),
122 os_version='%s %s' % (platform.system(), platform.release()), 122 os_version='%s %s' % (platform.system(), platform.release()),
123 multiprocessing_available=MultiprocessingIsAvailable()[0], 123 multiprocessing_available=(
124 CheckMultiprocessingAvailableAndInit().is_available),
124 cloud_sdk=(os.environ.get('CLOUDSDK_WRAPPER') == '1'), 125 cloud_sdk=(os.environ.get('CLOUDSDK_WRAPPER') == '1'),
125 config_path=config_path, 126 config_path=config_path,
126 gsutil_path=gslib.GSUTIL_PATH, 127 gsutil_path=gslib.GSUTIL_PATH,
127 compiled_crcmod=UsingCrcmodExtension(crcmod), 128 compiled_crcmod=UsingCrcmodExtension(crcmod),
128 is_package_install=gslib.IS_PACKAGE_INSTALL, 129 is_package_install=gslib.IS_PACKAGE_INSTALL,
129 is_editable_install=gslib.IS_EDITABLE_INSTALL, 130 is_editable_install=gslib.IS_EDITABLE_INSTALL,
130 )) 131 ))
131 132
132 return 0 133 return 0
133 134
(...skipping 19 matching lines...) Expand all
153 files_to_checksum.append(os.path.join(root, filepath)) 154 files_to_checksum.append(os.path.join(root, filepath))
154 # Sort to ensure consistent checksum build, no matter how os.walk 155 # Sort to ensure consistent checksum build, no matter how os.walk
155 # orders the list. 156 # orders the list.
156 for filepath in sorted(files_to_checksum): 157 for filepath in sorted(files_to_checksum):
157 f = open(filepath, 'r') 158 f = open(filepath, 'r')
158 content = f.read() 159 content = f.read()
159 content = re.sub(r'(\r\n|\r|\n)', '\n', content) 160 content = re.sub(r'(\r\n|\r|\n)', '\n', content)
160 m.update(content) 161 m.update(content)
161 f.close() 162 f.close()
162 return m.hexdigest() 163 return m.hexdigest()
OLDNEW
« no previous file with comments | « third_party/gsutil/gslib/commands/stat.py ('k') | third_party/gsutil/gslib/commands/web.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698