Skip to content

Commit

Permalink
remove boto3 dependency
Browse files Browse the repository at this point in the history
botocore dependency is simpler for the use case of rpm_s3_mirror rather
than using the boto3 wrapper. This makes it easier to use rpm_s3_mirror
along with other dependencies.
  • Loading branch information
lionbee committed Dec 5, 2022
1 parent 18c5aa9 commit 7f1338d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ build-dep-fed:
python3-defusedxml \
python3-requests \
python3-dateutil \
python3-boto3 \
python3-botocore \
python3-lxml

test: copyright lint unittest
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defusedxml
requests
python-dateutil
boto3
botocore
lxml
2 changes: 1 addition & 1 deletion rpm_s3_mirror.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BuildRequires: rpm-build
Requires: python3-defusedxml
Requires: python3-requests
Requires: python3-dateutil
Requires: python3-boto3
Requires: python3-botocore
Requires: python3-lxml
Requires: systemd
Requires: zchunk
Expand Down
5 changes: 3 additions & 2 deletions rpm_s3_mirror/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from typing import Collection, Union, BinaryIO, Dict, Iterable
from urllib.parse import urlparse

import boto3
import botocore.session
import botocore.exceptions
import time

Expand Down Expand Up @@ -220,7 +220,8 @@ def _client(self):
if self._s3 is None:
# The boto3 client call is not threadsafe, so only allow calling it from a singe thread at a time
with lock:
self._s3 = boto3.client(
botocore_session = botocore.session.get_session()
self._s3 = botocore_session.create_client(
"s3",
region_name=self.bucket_region,
aws_access_key_id=self.aws_access_key_id,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"defusedxml",
"requests",
"python-dateutil",
"boto3",
"botocore",
"lxml",
],
entry_points={
Expand Down

0 comments on commit 7f1338d

Please sign in to comment.