Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
brahma19 authored Jan 1, 2025
2 parents d06aaed + d9d7b0f commit f384a8c
Show file tree
Hide file tree
Showing 35 changed files with 412 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [pypy3, 3.5.x, 3.6.x, 3.7.x, 3.8.x, 3.9.x, 3.10.x, 3.11.x]
python-version: [3.8.x, 3.9.x, 3.10.x, 3.11.x, 3.12.x]

steps:
- uses: actions/checkout@v2
Expand Down
20 changes: 20 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
Release 5.33 (release date: 2024-12-10)
======================================
Bug Fixes
------------------
- Corrected python-requires as <3.13 (#1827)

Other Changes
------------------

Release 5.32 (release date: 2024-12-04)
======================================
New Features
------------------
- Added explicit support for Python 3.12

Other Changes
------------------
- Dropped Support for Python 3.5, 3.6 and 3.7.
- Pinned pyOpenSSL to a maximum version of 24.2.1 (#1822).

Release 5.31 (release date: 2024-10-10)
======================================
Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion CHECKSUM
Original file line number Diff line number Diff line change
@@ -1 +1 @@
047a02622fbb528fb2e5c13201a33dc2
c1441eab7ca94a134090e58f578e2e80
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.31
5.33
4 changes: 2 additions & 2 deletions gslib/commands/perfdiag.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import six
from six.moves import cStringIO
from six.moves import http_client
from six.moves import xrange
from six.moves import range
from six.moves import range

import gslib
Expand Down Expand Up @@ -1222,7 +1222,7 @@ def _RunListTests(self):
[random.choice(string.ascii_lowercase) for _ in range(10)])
list_prefix = 'gsutil-perfdiag-list-' + random_id + '-'

for _ in xrange(self.num_objects):
for _ in range(self.num_objects):
fpath = self._MakeTempFile(0,
mem_data=True,
mem_metadata=True,
Expand Down
5 changes: 3 additions & 2 deletions gslib/commands/signurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import copy
from datetime import datetime
from datetime import timedelta
from datetime import timezone
import getpass
import json
import re
Expand Down Expand Up @@ -214,7 +215,7 @@

def _NowUTC():
"""Returns the current utc time as a datetime object."""
return datetime.utcnow()
return datetime.now(tz=timezone.utc).replace(tzinfo=None)


def _DurationToTimeDelta(duration):
Expand Down Expand Up @@ -697,7 +698,7 @@ def RunCommand(self):
billing_project=billing_project,
string_to_sign_debug=True)

expiration = calendar.timegm((datetime.utcnow() + delta).utctimetuple())
expiration = calendar.timegm((datetime.now(tz=timezone.utc).replace(tzinfo=None) + delta).utctimetuple())
expiration_dt = datetime.fromtimestamp(expiration)

time_str = expiration_dt.strftime('%Y-%m-%d %H:%M:%S')
Expand Down
4 changes: 2 additions & 2 deletions gslib/tests/test_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from __future__ import division
from __future__ import unicode_literals

from six.moves import xrange
from six.moves import range
from six.moves import range

from gslib.commands.compose import MAX_COMPOSE_ARITY
Expand All @@ -45,7 +45,7 @@ def check_n_ary_compose(self, num_components):
bucket_uri = self.CreateBucket()

data_list = [
('data-%d,' % i).encode('ascii') for i in xrange(num_components)
('data-%d,' % i).encode('ascii') for i in range(num_components)
]
components = [
self.CreateObject(bucket_uri=bucket_uri, contents=data).uri
Expand Down
4 changes: 2 additions & 2 deletions gslib/tests/test_cp.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
import six
from six.moves import http_client
from six.moves import range
from six.moves import xrange
from six.moves import range

if six.PY3:
long = int # pylint: disable=redefined-builtin,invalid-name
Expand Down Expand Up @@ -3829,7 +3829,7 @@ def test_cp_resumable_download_gzip(self):
object_uri = self.CreateObject()
random.seed(0)
contents = str([
random.choice(string.ascii_letters) for _ in xrange(self.halt_size)
random.choice(string.ascii_letters) for _ in range(self.halt_size)
]).encode('ascii')
random.seed() # Reset the seed for any other tests.
fpath1 = self.CreateTempFile(file_name='unzipped.txt', contents=contents)
Expand Down
2 changes: 1 addition & 1 deletion gslib/tests/test_retention.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def test_get_retention_unlocked(self):
['retention', 'get', suri(bucket_uri)], return_stdout=True)
if self._use_gcloud_storage:
# Sometimes the field is absent if isLocked is false.
self.assertNotRegexpMatches(stdout, r'isLocked \: true')
self.assertNotRegex(stdout, r'isLocked \: true')
self.assertRegex(stdout, r'retentionPeriod\: \'86400\'')
self.assertRegex(stdout, r'effectiveTime\: \'.*\'')
else:
Expand Down
2 changes: 1 addition & 1 deletion gslib/tests/test_rsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2929,7 +2929,7 @@ def _test_dir_to_bucket_regex_negative_lookahead(self, flag, includes):
'b.txt'), ('data3', 'data4', 'c.txt')
])
self.RunGsUtil(
['rsync', '-r', flag, '^(?!.*\.txt$).*', tmpdir,
['rsync', '-r', flag, r'^(?!.*\.txt$).*', tmpdir,
suri(bucket_uri)],
return_stderr=True)
listing = TailSet(tmpdir, self.FlatListDir(tmpdir))
Expand Down
2 changes: 1 addition & 1 deletion gslib/tests/test_shim_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ def test_gets_format_flag_newline_on_non_windows(self):

def test_gets_format_flag_escaped_newline_on_windows(self):
with mock.patch.object(system_util, 'IS_WINDOWS', new=True):
self.assertEqual(shim_util.get_format_flag_newline(), '^\^n')
self.assertEqual(shim_util.get_format_flag_newline(), r'^\^n')


class TestBotoTranslation(testcase.GsUtilUnitTestCase):
Expand Down
8 changes: 4 additions & 4 deletions gslib/utils/copy_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import traceback

import six
from six.moves import xrange
from six.moves import range
from six.moves import range

from apitools.base.protorpclite import protojson
Expand Down Expand Up @@ -4138,13 +4138,13 @@ def Initialize(self, source_url, destination_url):
# Always use the source_url as the key for the item. This is unique.
self.Set(source_url, 'source_uri', source_url)
self.Set(source_url, 'destination_uri', destination_url)
self.Set(source_url, 'start_time', datetime.datetime.utcnow())
self.Set(source_url, 'start_time', datetime.datetime.now(tz=datetime.timezone.utc).replace(tzinfo=None))

def SetResult(self, source_url, bytes_transferred, result, description=''):
self.Set(source_url, 'bytes', bytes_transferred)
self.Set(source_url, 'result', result)
self.Set(source_url, 'description', description)
self.Set(source_url, 'end_time', datetime.datetime.utcnow())
self.Set(source_url, 'end_time', datetime.datetime.now(tz=datetime.timezone.utc).replace(tzinfo=None))
self._WriteRowToManifestFile(source_url)
self._RemoveItemFromManifest(source_url)

Expand Down Expand Up @@ -4270,7 +4270,7 @@ def ResolveWildcardsInPathBeforeFinalDir(src_url_path_sans_final_dir,
wildcarded_src_obj_path = StorageUrlFromString(
src_url_path_sans_final_dir).object_name.split('/')
expanded_src_obj_path = exp_src_url.object_name.split('/')
for path_segment_index in xrange(len(wildcarded_src_obj_path)):
for path_segment_index in range(len(wildcarded_src_obj_path)):
if ContainsWildcard(wildcarded_src_obj_path[path_segment_index]):
# The expanded path is guaranteed to be have at least as many path
# segments as the wildcarded path.
Expand Down
3 changes: 2 additions & 1 deletion gslib/utils/signurl_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import base64
from datetime import datetime
from datetime import timezone
import hashlib

from gslib.utils.constants import UTF8
Expand All @@ -33,7 +34,7 @@


def _NowUTC():
return datetime.utcnow()
return datetime.now(tz=timezone.utc).replace(tzinfo=None)


def CreatePayload(client_id,
Expand Down
2 changes: 1 addition & 1 deletion gslib/vendored/boto
Submodule boto updated 78 files
+3 −3 bin/cwutil
+1 −1 boto/__init__.py
+2 −2 boto/auth.py
+1 −1 boto/cloudfront/distribution.py
+1 −1 boto/cloudsearchdomain/layer1.py
+6 −6 boto/connection.py
+2 −1 boto/ec2/connection.py
+1 −1 boto/gs/resumable_upload_handler.py
+1 −1 boto/https_connection.py
+1 −1 boto/manage/task.py
+1 −1 boto/mturk/connection.py
+1 −1 boto/opsworks/layer1.py
+2 −1 boto/provider.py
+1 −1 boto/pyami/config.py
+3 −3 boto/redshift/layer1.py
+2 −2 boto/sdb/db/manager/sdbmanager.py
+2 −2 boto/sdb/db/property.py
+1 −1 boto/sts/connection.py
+1 −1 boto/sts/credentials.py
+2 −1 docs/source/cloudsearch_tut.rst
+1 −1 docs/source/cloudwatch_tut.rst
+6 −6 tests/db/test_password.py
+2 −2 tests/integration/cloudformation/test_connection.py
+10 −10 tests/integration/ec2/cloudwatch/test_connection.py
+11 −11 tests/integration/gs/test_basic.py
+26 −26 tests/integration/gs/test_generation_conditionals.py
+1 −1 tests/integration/gs/test_resumable_downloads.py
+14 −14 tests/integration/gs/test_storage_uri.py
+2 −2 tests/integration/gs/test_versioning.py
+24 −24 tests/integration/route53/test_health_check.py
+18 −18 tests/integration/route53/test_zone.py
+7 −7 tests/integration/s3/test_connect_to_region.py
+1 −1 tests/mturk/create_free_text_question_regex.doctest
+1 −1 tests/mturk/create_hit.doctest
+1 −1 tests/mturk/create_hit_binary.doctest
+1 −1 tests/mturk/create_hit_from_hit_type.doctest
+1 −1 tests/unit/cloudformation/test_connection.py
+2 −2 tests/unit/cloudsearch/test_exceptions.py
+1 −1 tests/unit/cloudsearch/test_search.py
+1 −1 tests/unit/cloudsearch2/test_document.py
+2 −2 tests/unit/cloudsearch2/test_exceptions.py
+1 −1 tests/unit/cloudsearch2/test_search.py
+25 −25 tests/unit/ec2/test_connection.py
+1 −1 tests/unit/ec2/test_networkinterface.py
+4 −4 tests/unit/ec2/test_reservedinstance.py
+1 −1 tests/unit/ec2/test_volume.py
+3 −3 tests/unit/emr/test_emr_responses.py
+4 −4 tests/unit/emr/test_instance_group_args.py
+7 −7 tests/unit/glacier/test_layer2.py
+1 −1 tests/unit/glacier/test_response.py
+3 −3 tests/unit/glacier/test_writer.py
+3 −3 tests/unit/iam/test_connection.py
+2 −2 tests/unit/mturk/test_connection.py
+2 −2 tests/unit/mturk/test_locale_qualification_in.py
+2 −2 tests/unit/mturk/test_locale_qualification_notin.py
+1 −1 tests/unit/mturk/test_qualification_doesnotexist.py
+1 −1 tests/unit/mturk/test_qualification_exists.py
+1 −1 tests/unit/mturk/test_qualification_qualtypewithscore_in.py
+2 −2 tests/unit/provider/test_provider.py
+2 −2 tests/unit/rds/test_connection.py
+5 −5 tests/unit/s3/test_lifecycle.py
+2 −2 tests/unit/sqs/test_connection.py
+10 −10 tests/unit/sqs/test_message.py
+1 −1 tests/unit/swf/test_layer1_decisions.py
+4 −4 tests/unit/swf/test_layer2_base.py
+14 −14 tests/unit/swf/test_layer2_domain.py
+3 −3 tests/unit/swf/test_layer2_types.py
+2 −2 tests/unit/test_endpoints.py
+16 −16 tests/unit/utils/test_utils.py
+7 −7 tests/unit/vpc/test_customergateway.py
+12 −12 tests/unit/vpc/test_dhcpoptions.py
+4 −4 tests/unit/vpc/test_internetgateway.py
+53 −53 tests/unit/vpc/test_routetable.py
+8 −8 tests/unit/vpc/test_subnet.py
+8 −8 tests/unit/vpc/test_vpc.py
+4 −4 tests/unit/vpc/test_vpc_peering_connection.py
+6 −6 tests/unit/vpc/test_vpnconnection.py
+3 −3 tests/unit/vpc/test_vpngateway.py
8 changes: 4 additions & 4 deletions gsutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
# TODO: gsutil-beta: Distribute a pylint rc file.

ver = sys.version_info
if (ver.major == 2 and ver.minor < 7) or (ver.major == 3 and (ver.minor < 5 or ver.minor > 11)):
if ver.major != 3 or ver.minor < 8 or ver.minor > 12:
sys.exit(
"Error: gsutil requires Python version 2.7 or 3.5-3.11, but a different version is installed.\n"
"Error: gsutil requires Python version 3.8-3.12, but a different version is installed.\n"
"You are currently running Python {}.{}\n"
"Follow the steps below to resolve this issue:\n"
"\t1. Switch to Python 3.5-3.11 using your Python version manager or install an appropriate version.\n"
"\t1. Switch to Python 3.8-3.12 using your Python version manager or install an appropriate version.\n"
"\t2. If you are unsure how to manage Python versions, visit [https://cloud.google.com/storage/docs/gsutil_install#specifications] for detailed instructions.".format(ver.major, ver.minor)
)

Expand Down Expand Up @@ -116,7 +116,7 @@ def _fix_google_module():
('chardet', ''), # requests dependency
('certifi', ''), # requests dependency
('idna', ''), # requests dependency
('requests', ''), # google auth dependency
('requests', 'src'), # google auth dependency
('google-auth-library-python', ''),
('google-auth-library-python-httplib2', ''), #Package name: google-auth-httplib2
]
Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"""

requires = [
'argcomplete>=1.9.4',
'argcomplete>=3.5.1',
'crcmod>=1.7',
'fasteners>=0.14.1',
'gcs-oauth2-boto-plugin>=3.2',
Expand All @@ -47,7 +47,7 @@
# 3.0.5 is the last version that supports Python 3.3 or lower.
'mock>=2.0.0, <=3.0.5; python_version < "3.3"',
'monotonic>=1.4',
'pyOpenSSL>=0.13',
'pyOpenSSL>=0.13, <=24.2.1',
'retry_decorator>=1.0.0',
'six>=1.16.0',
# aiohttp is the extra dependency that contains requests lib.
Expand Down Expand Up @@ -126,16 +126,16 @@ def make_release_tree(self, base_dir, files):
'Natural Language :: English',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: System :: Filesystems',
'Topic :: Utilities',
],
# Gsutil supports Python 3.5+
python_requires='!=2.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4',
# Gsutil supports Python 3.8 to 3.12
python_requires='>=3.8, <3.13',
platforms='any',
packages=find_packages(
exclude=[
Expand Down
61 changes: 61 additions & 0 deletions test/ci/kokoro/linux/py312_json.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Format: //devtools/kokoro/config/proto/build.proto
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

build_file: "/src/gsutil/test/ci/kokoro/run_integ_tests.sh"
timeout_mins: 60

# Get access keys from Keystore
# go/kokoro-keystore
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 74008
keyname: "gsutil_kokoro_service_key"
}
keystore_resource {
keystore_config_id: 74008
keyname: "mtls_test_account_refresh_token"
}
keystore_resource {
keystore_config_id: 74008
keyname: "mtls_test_account_client_id"
}
keystore_resource {
keystore_config_id: 74008
keyname: "mtls_test_account_client_secret"
}
keystore_resource {
keystore_config_id: 74008
keyname: "mtls_test_cert"
}
}
}

# Environment variables to specify interpreter version.
# go/kokoro-env-vars
env_vars {
key: "PYMAJOR"
value: "3"
}

env_vars {
key: "PYMINOR"
value: "12"
}

env_vars {
key: "API"
value: "json"
}
45 changes: 45 additions & 0 deletions test/ci/kokoro/linux/py312_xml.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Format: //devtools/kokoro/config/proto/build.proto
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

build_file: "/src/gsutil/test/ci/kokoro/run_integ_tests.sh"
timeout_mins: 60

# Get access keys from Keystore
# go/kokoro-keystore
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 74008
keyname: "gsutil_kokoro_service_key"
}
}
}

# Environment variables to specify interpreter version.
# go/kokoro-env-vars
env_vars {
key: "PYMAJOR"
value: "3"
}

env_vars {
key: "PYMINOR"
value: "12"
}

env_vars {
key: "API"
value: "xml"
}
Loading

0 comments on commit f384a8c

Please sign in to comment.